Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
66349fbd80 | ||
|
c205ce0975 | ||
|
254db2b9a1 | ||
|
bb44a3233a | ||
|
8b5994e429 | ||
|
2304ce3f23 | ||
|
d7a4a4f63d |
@ -14,6 +14,11 @@
|
|||||||
<name>HSAdmin-Cli</name>
|
<name>HSAdmin-Cli</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.hsadmin</groupId>
|
||||||
|
<artifactId>framework</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
<artifactId>xmlrpc-client</artifactId>
|
<artifactId>xmlrpc-client</artifactId>
|
||||||
|
@ -11,7 +11,8 @@ import org.apache.xmlrpc.XmlRpcException;
|
|||||||
import org.apache.xmlrpc.client.XmlRpcClient;
|
import org.apache.xmlrpc.client.XmlRpcClient;
|
||||||
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
|
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
|
||||||
|
|
||||||
import de.hsadmin.jscli.conf.Config;
|
import de.hsadmin.common.config.Config;
|
||||||
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.jscli.exception.JSCliException;
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
public class RpcClient {
|
public class RpcClient {
|
||||||
@ -37,6 +38,8 @@ public class RpcClient {
|
|||||||
}
|
}
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
throw new JSCliException(e);
|
throw new JSCliException(e);
|
||||||
|
} catch (TechnicalException e) {
|
||||||
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@ import java.util.Properties;
|
|||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
|
import de.hsadmin.common.config.Config;
|
||||||
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.jscli.TicketProvider;
|
import de.hsadmin.jscli.TicketProvider;
|
||||||
import de.hsadmin.jscli.conf.Config;
|
|
||||||
import de.hsadmin.jscli.console.PasswordReader;
|
import de.hsadmin.jscli.console.PasswordReader;
|
||||||
import de.hsadmin.jscli.exception.JSCliException;
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
@ -81,11 +82,11 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
|
|
||||||
private String getGrantingTicket() throws JSCliException {
|
private String getGrantingTicket() throws JSCliException {
|
||||||
grantingTicket = null;
|
grantingTicket = null;
|
||||||
String password = Config.getInstance().getProperty(user + ".passWord");
|
|
||||||
if (password == null || password.length() <= 0) {
|
|
||||||
password = readPasswordFromConsole();
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
String password = Config.getInstance().getProperty(user + ".passWord");
|
||||||
|
if (password == null || password.length() <= 0) {
|
||||||
|
password = readPasswordFromConsole();
|
||||||
|
}
|
||||||
String encodedParams = URLEncoder.encode("username", "UTF-8")
|
String encodedParams = URLEncoder.encode("username", "UTF-8")
|
||||||
+ "=" + URLEncoder.encode(user, "UTF-8")
|
+ "=" + URLEncoder.encode(user, "UTF-8")
|
||||||
+ "&" + URLEncoder.encode("password", "UTF-8")
|
+ "&" + URLEncoder.encode("password", "UTF-8")
|
||||||
@ -95,6 +96,8 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
throw new JSCliException(e);
|
throw new JSCliException(e);
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
throw new JSCliException("cas server not available: " + loginURL);
|
throw new JSCliException("cas server not available: " + loginURL);
|
||||||
|
} catch (TechnicalException e) {
|
||||||
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
return grantingTicket;
|
return grantingTicket;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package de.hsadmin.jscli.cas;
|
package de.hsadmin.jscli.cas;
|
||||||
|
|
||||||
|
import de.hsadmin.common.config.Config;
|
||||||
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.jscli.TicketProvider;
|
import de.hsadmin.jscli.TicketProvider;
|
||||||
import de.hsadmin.jscli.conf.Config;
|
|
||||||
import de.hsadmin.jscli.console.PasswordReader;
|
import de.hsadmin.jscli.console.PasswordReader;
|
||||||
import de.hsadmin.jscli.exception.JSCliException;
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
@ -12,13 +13,18 @@ public class TicketProviderFactory {
|
|||||||
|
|
||||||
public static TicketProvider getInstance(final PasswordReader console, final String user, final String runAs) throws JSCliException
|
public static TicketProvider getInstance(final PasswordReader console, final String user, final String runAs) throws JSCliException
|
||||||
{
|
{
|
||||||
final Config config = Config.getInstance();
|
Config config;
|
||||||
final String backendURL = config.getProperty("backendURL", HOSTSHARING_BACKEND_URL);
|
try {
|
||||||
final String loginURL = config.getProperty("loginURL", HOSTSHARING_LOGIN_URL);
|
config = Config.getInstance();
|
||||||
if ("TestUmgebung".equalsIgnoreCase(loginURL)) {
|
final String backendURL = config.getProperty("backendURL", HOSTSHARING_BACKEND_URL);
|
||||||
return new TestTicketProvider(user, runAs);
|
final String loginURL = config.getProperty("loginURL", HOSTSHARING_LOGIN_URL);
|
||||||
} else {
|
if ("TestUmgebung".equalsIgnoreCase(loginURL)) {
|
||||||
return new CASTicketProvider(console, user, runAs, backendURL, loginURL);
|
return new TestTicketProvider(user, runAs);
|
||||||
|
} else {
|
||||||
|
return new CASTicketProvider(console, user, runAs, backendURL, loginURL);
|
||||||
|
}
|
||||||
|
} catch (TechnicalException e) {
|
||||||
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ import org.apache.commons.cli.Options;
|
|||||||
import org.apache.commons.cli.ParseException;
|
import org.apache.commons.cli.ParseException;
|
||||||
import org.apache.commons.cli.PosixParser;
|
import org.apache.commons.cli.PosixParser;
|
||||||
|
|
||||||
|
import de.hsadmin.common.config.Config;
|
||||||
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.jscli.exception.JSCliException;
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
public class CommandlineParser {
|
public class CommandlineParser {
|
||||||
@ -38,13 +40,13 @@ public class CommandlineParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUser() {
|
public String getUser() throws TechnicalException {
|
||||||
final String systemUser = System.getProperty("user.name");
|
final String systemUser = System.getProperty("user.name");
|
||||||
final String configUser = Config.getInstance().getProperty("userName", systemUser);
|
final String configUser = Config.getInstance().getProperty("userName", systemUser);
|
||||||
return cmd.getOptionValue("user", configUser);
|
return cmd.getOptionValue("user", configUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRunAs() {
|
public String getRunAs() throws TechnicalException {
|
||||||
return cmd.getOptionValue("runas", getUser());
|
return cmd.getOptionValue("runas", getUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
package de.hsadmin.jscli.conf;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class Config {
|
|
||||||
|
|
||||||
private static Config instance;
|
|
||||||
|
|
||||||
private Properties props;
|
|
||||||
|
|
||||||
private Config() {
|
|
||||||
props = new Properties();
|
|
||||||
File file = new File(System.getProperty("user.dir") + "/hsadmin.properties");
|
|
||||||
if (!file.canRead()) {
|
|
||||||
file = new File(System.getProperty("user.dir") + "/conf/hsadmin.properties");
|
|
||||||
}
|
|
||||||
if (!file.canRead()) {
|
|
||||||
file = new File(System.getProperty("user.home") + "/.hsadmin.properties");
|
|
||||||
}
|
|
||||||
if (!file.canRead()) {
|
|
||||||
file = new File("/etc/hsadmin.properties");
|
|
||||||
}
|
|
||||||
if (!file.canRead()) {
|
|
||||||
file = new File("/etc/hsadmin/hsadmin.properties");
|
|
||||||
}
|
|
||||||
if (file.canRead()) {
|
|
||||||
try {
|
|
||||||
props.load(new FileReader(file));
|
|
||||||
} catch (Exception e) {
|
|
||||||
// should not happen
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Config getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new Config();
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProperty(String propertyName) {
|
|
||||||
String property = props.getProperty(propertyName);
|
|
||||||
if (property == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return property.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProperty(String propertyName, String defaultValue) {
|
|
||||||
return props.getProperty(propertyName, defaultValue).trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -105,6 +105,7 @@
|
|||||||
<debug>false</debug>
|
<debug>false</debug>
|
||||||
<debugPort>8000</debugPort>
|
<debugPort>8000</debugPort>
|
||||||
<config>${project.basedir}/src/test/tomee/conf</config>
|
<config>${project.basedir}/src/test/tomee/conf</config>
|
||||||
|
<context>cust-webapp</context>
|
||||||
<libs>
|
<libs>
|
||||||
<lib>org.postgresql:postgresql:9.4.1212.jre7</lib>
|
<lib>org.postgresql:postgresql:9.4.1212.jre7</lib>
|
||||||
</libs>
|
</libs>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.hsadmin.bo.customer;
|
package de.hsadmin.bo.customer;
|
||||||
|
|
||||||
|
import static javax.persistence.CascadeType.ALL;
|
||||||
import static javax.persistence.FetchType.EAGER;
|
import static javax.persistence.FetchType.EAGER;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -9,12 +10,15 @@ import javax.persistence.CollectionTable;
|
|||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
@Entity(name = "Contact")
|
@Entity(name = "Contact")
|
||||||
@Table(name = "contact")
|
@Table(name = "contact")
|
||||||
@ -31,6 +35,12 @@ public class Contact implements Serializable {
|
|||||||
@ManyToOne(fetch = EAGER)
|
@ManyToOne(fetch = EAGER)
|
||||||
private Customer customer;
|
private Customer customer;
|
||||||
|
|
||||||
|
@Column(name = "login", columnDefinition = "character varying(40)")
|
||||||
|
private String login;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private String password;
|
||||||
|
|
||||||
@Column(name = "salut", columnDefinition = "character varying(30)")
|
@Column(name = "salut", columnDefinition = "character varying(30)")
|
||||||
private String salut;
|
private String salut;
|
||||||
|
|
||||||
@ -84,6 +94,9 @@ public class Contact implements Serializable {
|
|||||||
@Column(name="role")
|
@Column(name="role")
|
||||||
private List<String> roles;
|
private List<String> roles;
|
||||||
|
|
||||||
|
@OneToMany(fetch=FetchType.LAZY, cascade = ALL, mappedBy = "contact")
|
||||||
|
private List<PacAdministration> pacAdminList;
|
||||||
|
|
||||||
public Contact() {
|
public Contact() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +116,22 @@ public class Contact implements Serializable {
|
|||||||
this.customer = customer;
|
this.customer = customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLogin() {
|
||||||
|
return login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogin(String login) {
|
||||||
|
this.login = login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSalut() {
|
public String getSalut() {
|
||||||
return salut;
|
return salut;
|
||||||
}
|
}
|
||||||
@ -231,4 +260,12 @@ public class Contact implements Serializable {
|
|||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PacAdministration> getPacAdminList() {
|
||||||
|
return pacAdminList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPacAdminList(List<PacAdministration> pacAdminList) {
|
||||||
|
this.pacAdminList = pacAdminList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,60 @@
|
|||||||
|
package de.hsadmin.bo.customer;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import de.hsadmin.bo.pac.Pac;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="pac_administration")
|
||||||
|
public class PacAdministration {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "pac_administration_id", columnDefinition = "integer")
|
||||||
|
private long pacAdministrationId;
|
||||||
|
|
||||||
|
@ManyToOne(fetch=FetchType.EAGER)
|
||||||
|
@JoinColumn(name="contact_id")
|
||||||
|
private Contact contact;
|
||||||
|
|
||||||
|
@ManyToOne(fetch=FetchType.EAGER)
|
||||||
|
@JoinColumn(name="pac_id")
|
||||||
|
private Pac pac;
|
||||||
|
|
||||||
|
public PacAdministration() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getPacAdministrationId() {
|
||||||
|
return pacAdministrationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPacAdministrationId(long pacAdministrationId) {
|
||||||
|
this.pacAdministrationId = pacAdministrationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Contact getContact() {
|
||||||
|
return contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContact(Contact contact) {
|
||||||
|
this.contact = contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pac getPac() {
|
||||||
|
return pac;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPac(Pac pac) {
|
||||||
|
this.pac = pac;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,7 +12,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityListeners;
|
// import javax.persistence.EntityListeners;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
@ -26,11 +26,12 @@ import javax.persistence.Temporal;
|
|||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
import de.hsadmin.bo.customer.Customer;
|
import de.hsadmin.bo.customer.Customer;
|
||||||
|
import de.hsadmin.bo.customer.PacAdministration;
|
||||||
|
|
||||||
@Entity(name = "Pac")
|
@Entity(name = "Pac")
|
||||||
@Table(name = "packet")
|
@Table(name = "packet")
|
||||||
@SequenceGenerator(name = "PacsSeqGen", sequenceName = "packet_packet_id_seq")
|
@SequenceGenerator(name = "PacsSeqGen", sequenceName = "packet_packet_id_seq")
|
||||||
@EntityListeners({PacEntityListener.class})
|
// @EntityListeners({PacEntityListener.class})
|
||||||
public class Pac implements Serializable {
|
public class Pac implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -81,6 +82,9 @@ public class Pac implements Serializable {
|
|||||||
|
|
||||||
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
|
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
|
||||||
private Set<UnixUser> unixUser;
|
private Set<UnixUser> unixUser;
|
||||||
|
|
||||||
|
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
|
||||||
|
private Set<PacAdministration> pacAdministrations;
|
||||||
|
|
||||||
public void initPacComponents(final EntityManager em, final BasePac aBasepac, final boolean setDefaults) {
|
public void initPacComponents(final EntityManager em, final BasePac aBasepac, final boolean setDefaults) {
|
||||||
final Query qAttachedBasepac = em.createQuery("SELECT b FROM BasePac b WHERE b.valid = :valid AND b.name = :name");
|
final Query qAttachedBasepac = em.createQuery("SELECT b FROM BasePac b WHERE b.valid = :valid AND b.name = :name");
|
||||||
@ -205,6 +209,14 @@ public class Pac implements Serializable {
|
|||||||
this.unixUser = unixUser;
|
this.unixUser = unixUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<PacAdministration> getPacAdministrations() {
|
||||||
|
return pacAdministrations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPacAdministrations(Set<PacAdministration> pacAdministrations) {
|
||||||
|
this.pacAdministrations = pacAdministrations;
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + "{ name=" + name + " }";
|
return super.toString() + "{ name=" + name + " }";
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package de.hsadmin.service.customer;
|
package de.hsadmin.service.customer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.module.ValueObject;
|
import de.hsadmin.module.ValueObject;
|
||||||
import de.hsadmin.module.impl.AbstractVO;
|
import de.hsadmin.module.impl.AbstractVO;
|
||||||
|
import de.hsadmin.module.property.ElementsType;
|
||||||
import de.hsadmin.module.property.ReadWrite;
|
import de.hsadmin.module.property.ReadWrite;
|
||||||
import de.hsadmin.module.property.ReadWritePolicy;
|
import de.hsadmin.module.property.ReadWritePolicy;
|
||||||
import de.hsadmin.module.property.Required;
|
import de.hsadmin.module.property.Required;
|
||||||
@ -26,6 +29,11 @@ public class ContactVO extends AbstractVO implements ValueObject {
|
|||||||
@Search(SearchPolicy.EQUALS)
|
@Search(SearchPolicy.EQUALS)
|
||||||
private String customer;
|
private String customer;
|
||||||
|
|
||||||
|
@Pattern(regexp="[a-z0-9\\-]*")
|
||||||
|
@Size(min=0,max=40)
|
||||||
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
|
private String login;
|
||||||
|
|
||||||
@Pattern(regexp="[A-Za-z]*")
|
@Pattern(regexp="[A-Za-z]*")
|
||||||
@Size(min=0,max=16)
|
@Size(min=0,max=16)
|
||||||
@ReadWrite(ReadWritePolicy.READWRITE)
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
@ -103,6 +111,10 @@ public class ContactVO extends AbstractVO implements ValueObject {
|
|||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.READWRITE)
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
private final StringSet roles;
|
private final StringSet roles;
|
||||||
|
|
||||||
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
|
@ElementsType(PacAdministrationVO.class)
|
||||||
|
private List<PacAdministrationVO> pacAdminList;
|
||||||
|
|
||||||
public ContactVO() throws TechnicalException {
|
public ContactVO() throws TechnicalException {
|
||||||
super();
|
super();
|
||||||
@ -117,6 +129,14 @@ public class ContactVO extends AbstractVO implements ValueObject {
|
|||||||
this.customer = customer;
|
this.customer = customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLogin() {
|
||||||
|
return login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogin(String login) {
|
||||||
|
this.login = login;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSalut() {
|
public String getSalut() {
|
||||||
return salut;
|
return salut;
|
||||||
}
|
}
|
||||||
@ -245,4 +265,12 @@ public class ContactVO extends AbstractVO implements ValueObject {
|
|||||||
roles.setStrings(changedRoles);
|
roles.setStrings(changedRoles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PacAdministrationVO> getPacAdminList() {
|
||||||
|
return pacAdminList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPacAdminList(List<PacAdministrationVO> pacAdminList) {
|
||||||
|
this.pacAdminList = pacAdminList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
package de.hsadmin.service.customer;
|
||||||
|
|
||||||
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
|
import de.hsadmin.module.ValueObject;
|
||||||
|
import de.hsadmin.module.impl.AbstractVO;
|
||||||
|
import de.hsadmin.module.property.ReadWrite;
|
||||||
|
import de.hsadmin.module.property.ReadWritePolicy;
|
||||||
|
import de.hsadmin.module.property.mapping.DefaultStringParameterMapMapper;
|
||||||
|
import de.hsadmin.module.property.mapping.Mapping;
|
||||||
|
import de.hsadmin.module.property.mapping.ReferredStringPersistentObjectMapper;
|
||||||
|
|
||||||
|
public class PacAdministrationVO extends AbstractVO implements ValueObject {
|
||||||
|
|
||||||
|
@Mapping(
|
||||||
|
boMapping=ReferredStringPersistentObjectMapper.class,
|
||||||
|
rpcMapping=DefaultStringParameterMapMapper.class,
|
||||||
|
boMappingPath="contact.customer.name")
|
||||||
|
@ReadWrite(ReadWritePolicy.READ)
|
||||||
|
private String customer;
|
||||||
|
|
||||||
|
@Mapping(
|
||||||
|
boMapping=ReferredStringPersistentObjectMapper.class,
|
||||||
|
rpcMapping=DefaultStringParameterMapMapper.class,
|
||||||
|
boMappingPath="contact.login")
|
||||||
|
@ReadWrite(ReadWritePolicy.READ)
|
||||||
|
private String contactLogin;
|
||||||
|
|
||||||
|
@Mapping(
|
||||||
|
boMapping=ReferredStringPersistentObjectMapper.class,
|
||||||
|
rpcMapping=DefaultStringParameterMapMapper.class,
|
||||||
|
boMappingPath="pac.name")
|
||||||
|
@ReadWrite(ReadWritePolicy.READ)
|
||||||
|
private String packetName;
|
||||||
|
|
||||||
|
public PacAdministrationVO() throws TechnicalException {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomer() {
|
||||||
|
return customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomer(String customer) {
|
||||||
|
this.customer = customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContactLogin() {
|
||||||
|
return contactLogin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContactLogin(String contactLogin) {
|
||||||
|
this.contactLogin = contactLogin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPacketName() {
|
||||||
|
return packetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPacketName(String packetName) {
|
||||||
|
this.packetName = packetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -8,6 +8,7 @@
|
|||||||
<class>de.hsadmin.bo.customer.Contact</class>
|
<class>de.hsadmin.bo.customer.Contact</class>
|
||||||
<class>de.hsadmin.bo.customer.Customer</class>
|
<class>de.hsadmin.bo.customer.Customer</class>
|
||||||
<class>de.hsadmin.bo.customer.SEPADirectDebit</class>
|
<class>de.hsadmin.bo.customer.SEPADirectDebit</class>
|
||||||
|
<class>de.hsadmin.bo.customer.PacAdministration</class>
|
||||||
<class>de.hsadmin.bo.domain.Domain</class>
|
<class>de.hsadmin.bo.domain.Domain</class>
|
||||||
<class>de.hsadmin.bo.domain.DomainOption</class>
|
<class>de.hsadmin.bo.domain.DomainOption</class>
|
||||||
<class>de.hsadmin.bo.domain.EMailAddress</class>
|
<class>de.hsadmin.bo.domain.EMailAddress</class>
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
CREATE TABLE pac_administration (
|
||||||
|
pac_administration_id integer NOT NULL,
|
||||||
|
contact_id integer NOT NULL,
|
||||||
|
pac_id integer NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE SEQUENCE pac_administration_pac_administration_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
ALTER SEQUENCE pac_administration_pac_administration_id_seq OWNED BY pac_administration.pac_administration_id;
|
||||||
|
|
||||||
|
ALTER TABLE ONLY pac_administration
|
||||||
|
ALTER COLUMN pac_administration_id SET DEFAULT nextval('pac_administration_pac_administration_id_seq'::regclass);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY pac_administration
|
||||||
|
ADD CONSTRAINT pk_pac_administration PRIMARY KEY (pac_administration_id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY pac_administration
|
||||||
|
ADD CONSTRAINT pac_administration_contact_ref FOREIGN KEY (contact_id) REFERENCES contact(contact_id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY pac_administration
|
||||||
|
ADD CONSTRAINT pac_administration_pac_ref FOREIGN KEY (pac_id) REFERENCES packet(packet_id);
|
||||||
|
|
||||||
|
ALTER TABLE ONLY contact
|
||||||
|
ADD COLUMN login character varying(40);
|
@ -752,4 +752,33 @@
|
|||||||
</createTable>
|
</createTable>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet author="phormanns" id="ph-20170412-01">
|
||||||
|
<createTable tableName="pac_administration">
|
||||||
|
<column autoIncrement="true" name="pac_administration_id" type="SERIAL">
|
||||||
|
<constraints primaryKey="true" primaryKeyName="pk_pac_administration"/>
|
||||||
|
</column>
|
||||||
|
<column name="contact_id" type="INT">
|
||||||
|
<constraints
|
||||||
|
foreignKeyName="pac_administration_contact_ref"
|
||||||
|
referencedTableName="contact"
|
||||||
|
referencedColumnNames="contact_id"
|
||||||
|
nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="pac_id" type="INT">
|
||||||
|
<constraints
|
||||||
|
foreignKeyName="pac_administration_pac_ref"
|
||||||
|
referencedTableName="packet"
|
||||||
|
referencedColumnNames="packet_id"
|
||||||
|
nullable="false"/>
|
||||||
|
</column>
|
||||||
|
</createTable>
|
||||||
|
<addColumn tableName="contact">
|
||||||
|
<column name="login" type="VARCHAR(40)"/>
|
||||||
|
</addColumn>
|
||||||
|
<addUniqueConstraint
|
||||||
|
columnNames="login"
|
||||||
|
constraintName="unique_contact_login"
|
||||||
|
tableName="contact"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
changeLogFile=target/classes/liquibase/db.changelog.xml
|
changeLogFile=target/classes/liquibase/db.changelog.xml
|
||||||
driver=org.postgresql.Driver
|
driver=org.postgresql.Driver
|
||||||
url=jdbc:postgresql://localhost:5432/hsadmin_migdb
|
url=jdbc:postgresql://localhost:5432/hsadmin_db
|
||||||
username=hsadmin_dbuser
|
username=hsadmin_dbuser
|
||||||
password=SelfDefinedPassword
|
password=SelfDefinedPassword
|
||||||
verbose=true
|
verbose=true
|
||||||
dropFirst=false
|
dropFirst=false
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<tomee>
|
<tomee>
|
||||||
<Resource id="hsar-ds" type="javax.sql.DataSource">
|
<Resource id="hsar-ds" type="javax.sql.DataSource">
|
||||||
JdbcDriver = org.postgresql.Driver
|
JdbcDriver = org.postgresql.Driver
|
||||||
JdbcUrl = jdbc:postgresql://localhost:5432/hsadmin_migdb
|
JdbcUrl = jdbc:postgresql://localhost:5432/hsadmin_db
|
||||||
UserName = hsadmin_dbuser
|
UserName = hsadmin_dbuser
|
||||||
Password = SelfDefinedPassword
|
Password = SelfDefinedPassword
|
||||||
</Resource>
|
</Resource>
|
||||||
|
@ -86,7 +86,7 @@ public abstract class AbstractVO implements ValueObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPropertyField(final Field f) {
|
private boolean isPropertyField(final Field f) {
|
||||||
ReadWrite annotation = f.getAnnotation(ReadWrite.class);
|
final ReadWrite annotation = f.getAnnotation(ReadWrite.class);
|
||||||
return annotation != null;
|
return annotation != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,12 +102,15 @@ public abstract class AbstractVO implements ValueObject {
|
|||||||
final Class<?> type = Class.forName("de.hsadmin.module.property." + simplePropertyClassName + "Property");
|
final Class<?> type = Class.forName("de.hsadmin.module.property." + simplePropertyClassName + "Property");
|
||||||
final Constructor<?> constructor = type.getConstructor(ValueObject.class, String.class, ReadWritePolicy.class, SearchPolicy.class, boolean.class);
|
final Constructor<?> constructor = type.getConstructor(ValueObject.class, String.class, ReadWritePolicy.class, SearchPolicy.class, boolean.class);
|
||||||
final Property<?> newInstance = (Property<?>) constructor.newInstance(this, f.getName(), getReadWritePolicy(f), getSearchPolicy(f), isRequired(f));
|
final Property<?> newInstance = (Property<?>) constructor.newInstance(this, f.getName(), getReadWritePolicy(f), getSearchPolicy(f), isRequired(f));
|
||||||
set(f.getName(), newInstance);
|
final String propertyName = f.getName();
|
||||||
|
assert propertyName != null && propertyName.length() > 0;
|
||||||
|
assert newInstance != null;
|
||||||
|
propertiesMap.put(propertyName, newInstance);
|
||||||
if (ContainsElements.class.isAssignableFrom(type)) {
|
if (ContainsElements.class.isAssignableFrom(type)) {
|
||||||
ContainsElements container = (ContainsElements) newInstance;
|
ContainsElements container = (ContainsElements) newInstance;
|
||||||
container.setElementsType(getElementsType(f));
|
container.setElementsType(getElementsType(f));
|
||||||
}
|
}
|
||||||
Mapping mapping = f.getAnnotation(Mapping.class);
|
final Mapping mapping = f.getAnnotation(Mapping.class);
|
||||||
if (mapping != null && newInstance instanceof AbstractProperty<?>) {
|
if (mapping != null && newInstance instanceof AbstractProperty<?>) {
|
||||||
AbstractProperty<?> prop = (AbstractProperty<?>) newInstance;
|
AbstractProperty<?> prop = (AbstractProperty<?>) newInstance;
|
||||||
PersistentObjectMapper<?> persistentObjectMapper = mapping.boMapping().newInstance();
|
PersistentObjectMapper<?> persistentObjectMapper = mapping.boMapping().newInstance();
|
||||||
@ -119,17 +122,11 @@ public abstract class AbstractVO implements ValueObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException
|
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException | InvocationTargetException
|
||||||
| NoSuchMethodException | SecurityException | UserException | ClassNotFoundException e) {
|
| NoSuchMethodException | SecurityException | ClassNotFoundException e) {
|
||||||
throw new TechnicalException(e);
|
throw new TechnicalException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void set(final String propertyName, final Property<?> propertyInstance) throws UserException {
|
|
||||||
assert propertyName != null && propertyName.length() > 0;
|
|
||||||
assert propertyInstance != null;
|
|
||||||
propertiesMap.put(propertyName, propertyInstance);
|
|
||||||
}
|
|
||||||
|
|
||||||
private SearchPolicy getSearchPolicy(final Field f) {
|
private SearchPolicy getSearchPolicy(final Field f) {
|
||||||
final Search search = f.getAnnotation(Search.class);
|
final Search search = f.getAnnotation(Search.class);
|
||||||
SearchPolicy searchPolicy = SearchPolicy.NONE;
|
SearchPolicy searchPolicy = SearchPolicy.NONE;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package de.hsadmin.service.property;
|
package de.hsadmin.service.property;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -14,6 +13,7 @@ import javax.validation.constraints.Size;
|
|||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.common.error.UserException;
|
import de.hsadmin.common.error.UserException;
|
||||||
|
import de.hsadmin.common.util.ReflectionUtil;
|
||||||
import de.hsadmin.login.RequestContext;
|
import de.hsadmin.login.RequestContext;
|
||||||
import de.hsadmin.login.RequiredScope;
|
import de.hsadmin.login.RequiredScope;
|
||||||
import de.hsadmin.login.Role;
|
import de.hsadmin.login.Role;
|
||||||
@ -22,6 +22,7 @@ import de.hsadmin.module.ValueObject;
|
|||||||
import de.hsadmin.module.impl.AbstractModule;
|
import de.hsadmin.module.impl.AbstractModule;
|
||||||
import de.hsadmin.module.property.Display;
|
import de.hsadmin.module.property.Display;
|
||||||
import de.hsadmin.module.property.DisplayPolicy;
|
import de.hsadmin.module.property.DisplayPolicy;
|
||||||
|
import de.hsadmin.module.property.Property;
|
||||||
import de.hsadmin.module.property.ReadWrite;
|
import de.hsadmin.module.property.ReadWrite;
|
||||||
import de.hsadmin.module.property.ReadWritePolicy;
|
import de.hsadmin.module.property.ReadWritePolicy;
|
||||||
import de.hsadmin.module.property.Search;
|
import de.hsadmin.module.property.Search;
|
||||||
@ -31,6 +32,8 @@ import de.hsadmin.xmlrpc.AbstractRemote;
|
|||||||
@Stateless
|
@Stateless
|
||||||
public class PropertyService extends AbstractModule<PropertyVO> implements PropertyServiceLocal {
|
public class PropertyService extends AbstractModule<PropertyVO> implements PropertyServiceLocal {
|
||||||
|
|
||||||
|
public static final String DEFAULT_VALIDATION_REGEXP = "[a-zA-Z0-9\\_\\-\\.\\,\\ ]*";
|
||||||
|
|
||||||
@PersistenceContext(name="hsar")
|
@PersistenceContext(name="hsar")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@ -47,6 +50,7 @@ public class PropertyService extends AbstractModule<PropertyVO> implements Prope
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@RequiredScope({@ScopePolicy(Role.ANY)})
|
@RequiredScope({@ScopePolicy(Role.ANY)})
|
||||||
public List<PropertyVO> read(final RequestContext requestContext, final PropertyVO criteria)
|
public List<PropertyVO> read(final RequestContext requestContext, final PropertyVO criteria)
|
||||||
throws UserException, TechnicalException {
|
throws UserException, TechnicalException {
|
||||||
@ -55,56 +59,57 @@ public class PropertyService extends AbstractModule<PropertyVO> implements Prope
|
|||||||
final String requestedModuleName = criteria.getModule();
|
final String requestedModuleName = criteria.getModule();
|
||||||
try {
|
try {
|
||||||
remoteServicesProperties.load(getClass().getClassLoader().getResourceAsStream("org/apache/xmlrpc/webserver/XmlRpcServlet.properties"));
|
remoteServicesProperties.load(getClass().getClassLoader().getResourceAsStream("org/apache/xmlrpc/webserver/XmlRpcServlet.properties"));
|
||||||
final Enumeration<?> propertyNames = remoteServicesProperties.propertyNames();
|
final Enumeration<?> remoteModuleNames = remoteServicesProperties.propertyNames();
|
||||||
while (propertyNames.hasMoreElements()) {
|
while (remoteModuleNames.hasMoreElements()) {
|
||||||
final String properyName = (String) propertyNames.nextElement();
|
final String moduleName = (String) remoteModuleNames.nextElement();
|
||||||
if (requestedModuleName != null && !requestedModuleName.equals(properyName)) {
|
if (requestedModuleName != null && !requestedModuleName.equals(moduleName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final Class<?> serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(properyName));
|
final Class<?> serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(moduleName));
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.newInstance();
|
final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.newInstance();
|
||||||
final ValueObject valueObject = serviceRemote.createValueObject();
|
final ValueObject valueObject = serviceRemote.createValueObject();
|
||||||
final Field[] declaredFields = valueObject.getClass().getDeclaredFields();
|
final Class<? extends ValueObject> voClass = valueObject.getClass();
|
||||||
for (Field f : declaredFields) {
|
final List<Property<?>> propertiesList = valueObject.properties();
|
||||||
|
for (final Property<?> prop : propertiesList) {
|
||||||
final PropertyVO vo = buildVO();
|
final PropertyVO vo = buildVO();
|
||||||
vo.setModule(properyName);
|
final String propName = prop.getName();
|
||||||
vo.setName(f.getName());
|
setStringValue(vo, "module", moduleName);
|
||||||
final ReadWrite readWrite = f.getAnnotation(ReadWrite.class);
|
setStringValue(vo, "name", propName);
|
||||||
|
final ReadWrite readWrite = (ReadWrite) ReflectionUtil.getAnnotation(voClass, propName, ReadWrite.class);
|
||||||
if (readWrite == null) {
|
if (readWrite == null) {
|
||||||
vo.setReadwriteable(ReadWritePolicy.NONE.name().toLowerCase());
|
setStringValue(vo, "readwriteable", ReadWritePolicy.NONE.name().toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
vo.setReadwriteable(readWrite.value().name().toLowerCase());
|
setStringValue(vo, "readwriteable", readWrite.value().name().toLowerCase());
|
||||||
}
|
}
|
||||||
final Search search = f.getAnnotation(Search.class);
|
final Search search = (Search) ReflectionUtil.getAnnotation(voClass, propName, Search.class);
|
||||||
if (search == null) {
|
if (search == null) {
|
||||||
vo.setSearchable(SearchPolicy.NONE.name().toLowerCase());
|
setStringValue(vo, "searchable", SearchPolicy.NONE.name().toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
vo.setSearchable(search.value().name().toLowerCase());
|
setStringValue(vo, "searchable", search.value().name().toLowerCase());
|
||||||
}
|
}
|
||||||
final Display sequence = f.getAnnotation(Display.class);
|
final Display sequence = (Display) ReflectionUtil.getAnnotation(voClass, propName, Display.class);
|
||||||
if (sequence == null) {
|
if (sequence == null) {
|
||||||
vo.setDisplaySequence(Integer.valueOf(9999));
|
setIntValue(vo, "displaySequence", 9999);
|
||||||
vo.setDisplayVisible(DisplayPolicy.ALWAYS.name().toLowerCase());;
|
setStringValue(vo, "displayVisible", DisplayPolicy.ALWAYS.name().toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
vo.setDisplaySequence(sequence.sequence());
|
setIntValue(vo, "displaySequence", sequence.sequence());
|
||||||
vo.setDisplayVisible(sequence.visible().name().toLowerCase());;
|
setStringValue(vo, "displayVisible", sequence.visible().name().toLowerCase());
|
||||||
}
|
}
|
||||||
final Pattern pattern = f.getAnnotation(Pattern.class);
|
final Pattern pattern = (Pattern) ReflectionUtil.getAnnotation(voClass, propName, Pattern.class);
|
||||||
if (pattern == null) {
|
if (pattern == null) {
|
||||||
vo.setValidationRegexp("[a-zA-Z0-9\\_\\-\\.\\,\\ ]*");
|
setStringValue(vo, "validationRegexp", DEFAULT_VALIDATION_REGEXP);
|
||||||
} else {
|
} else {
|
||||||
vo.setValidationRegexp(pattern.regexp());
|
setStringValue(vo, "validationRegexp", pattern.regexp());
|
||||||
}
|
}
|
||||||
final Size size = f.getAnnotation(Size.class);
|
final Size size = (Size) ReflectionUtil.getAnnotation(voClass, propName, Size.class);
|
||||||
if (size == null) {
|
if (size == null) {
|
||||||
vo.setMinLength(Integer.valueOf(0));
|
setIntValue(vo, "minLength", 0);
|
||||||
vo.setMaxLength(Integer.valueOf(999));
|
setIntValue(vo, "maxLength", 999);
|
||||||
} else {
|
} else {
|
||||||
vo.setMinLength(size.min());
|
setIntValue(vo, "minLength", size.min());
|
||||||
vo.setMaxLength(size.max());
|
setIntValue(vo, "maxLength", size.max());
|
||||||
}
|
}
|
||||||
vo.setType(printableTypeName(valueObject.get(f.getName()).getValueType()));
|
setStringValue(vo, "type", printableTypeName(valueObject.get(propName).getValueType()));
|
||||||
emptyList.add(vo);
|
emptyList.add(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,6 +119,18 @@ public class PropertyService extends AbstractModule<PropertyVO> implements Prope
|
|||||||
return emptyList;
|
return emptyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setStringValue(final PropertyVO vo, final String propertyName, final String value) throws TechnicalException, UserException {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
final Property<String> property = (Property<String>) vo.get(propertyName);
|
||||||
|
property.setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setIntValue(final PropertyVO vo, final String propertyName, final int value) throws TechnicalException, UserException {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
final Property<Integer> property = (Property<Integer>) vo.get(propertyName);
|
||||||
|
property.setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
private String printableTypeName(Class<?> type) {
|
private String printableTypeName(Class<?> type) {
|
||||||
String name = type.getName().toLowerCase();
|
String name = type.getName().toLowerCase();
|
||||||
if (name.indexOf('.') >= 0) {
|
if (name.indexOf('.') >= 0) {
|
||||||
|
@ -21,6 +21,12 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.hsadmin</groupId>
|
||||||
|
<artifactId>framework</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
<artifactId>xmlrpc-client</artifactId>
|
<artifactId>xmlrpc-client</artifactId>
|
||||||
|
@ -10,6 +10,7 @@ import java.net.URLEncoder;
|
|||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
|
import de.hsadmin.common.config.Config;
|
||||||
import de.hsadmin.rpc.RpcException;
|
import de.hsadmin.rpc.RpcException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,18 +22,17 @@ import de.hsadmin.rpc.RpcException;
|
|||||||
*/
|
*/
|
||||||
public class TicketService implements Serializable {
|
public class TicketService implements Serializable {
|
||||||
|
|
||||||
public static final String SERVICE_URL = "https://config.hostsharing.net:443/hsar/backend";
|
|
||||||
public static final String CAS_URL = "https://login.hostsharing.net/cas/v1/tickets";
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public String getGrantingTicket(final String user, final String password) throws RpcException {
|
public String getGrantingTicket(final String user, final String password) throws RpcException {
|
||||||
String ticket = null;
|
String ticket = null;
|
||||||
try {
|
try {
|
||||||
String userParam = "username=" + URLEncoder.encode(user, "UTF-8");
|
final Config conf = Config.getInstance();
|
||||||
String passwordParam = "password=" + URLEncoder.encode(password, "UTF-8");
|
final String userParam = "username=" + URLEncoder.encode(user, "UTF-8");
|
||||||
String encodedData = userParam + "&" + passwordParam;
|
final String passwordParam = "password=" + URLEncoder.encode(password, "UTF-8");
|
||||||
URL url = new URL(CAS_URL);
|
final String encodedData = userParam + "&" + passwordParam;
|
||||||
|
final String casUrl = conf.getProperty("loginURL");
|
||||||
|
final URL url = new URL(casUrl);
|
||||||
|
|
||||||
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||||
connection.setRequestMethod("POST");
|
connection.setRequestMethod("POST");
|
||||||
@ -56,8 +56,10 @@ public class TicketService implements Serializable {
|
|||||||
public String getServiceTicket(String grantingTicket) throws RpcException {
|
public String getServiceTicket(String grantingTicket) throws RpcException {
|
||||||
String ticket = null;
|
String ticket = null;
|
||||||
try {
|
try {
|
||||||
String serviceParam = "service=" + URLEncoder.encode(SERVICE_URL, "UTF-8");
|
final Config conf = Config.getInstance();
|
||||||
URL url = new URL(grantingTicket);
|
final String backendURL = conf.getProperty("backendURL");
|
||||||
|
final String serviceParam = "service=" + URLEncoder.encode(backendURL, "UTF-8");
|
||||||
|
final URL url = new URL(grantingTicket);
|
||||||
|
|
||||||
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
|
||||||
connection.setRequestMethod("POST");
|
connection.setRequestMethod("POST");
|
||||||
|
@ -14,6 +14,8 @@ import com.vaadin.ui.HorizontalSplitPanel;
|
|||||||
import com.vaadin.ui.Panel;
|
import com.vaadin.ui.Panel;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
|
|
||||||
|
import de.hsadmin.common.config.Config;
|
||||||
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.model.TicketService;
|
import de.hsadmin.model.TicketService;
|
||||||
import de.hsadmin.rpc.HSAdminSession;
|
import de.hsadmin.rpc.HSAdminSession;
|
||||||
import de.hsadmin.rpc.ModulesManager;
|
import de.hsadmin.rpc.ModulesManager;
|
||||||
@ -26,11 +28,6 @@ public class MainWindow extends CustomComponent implements HSAdminSession {
|
|||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(MainWindow.class);
|
private static final Logger LOG = Logger.getLogger(MainWindow.class);
|
||||||
|
|
||||||
public static final String[] SERVICE_URLS = new String[] {
|
|
||||||
"https://config2.hostsharing.net:443/hsar/xmlrpc/hsadmin",
|
|
||||||
"https://config.hostsharing.net:443/hsar/xmlrpc/hsadmin"
|
|
||||||
};
|
|
||||||
|
|
||||||
final private TicketService ticketService;
|
final private TicketService ticketService;
|
||||||
final private String grantingTicket;
|
final private String grantingTicket;
|
||||||
final private String username;
|
final private String username;
|
||||||
@ -52,11 +49,13 @@ public class MainWindow extends CustomComponent implements HSAdminSession {
|
|||||||
mainPanel.setContent(vl);
|
mainPanel.setContent(vl);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
final Config conf = Config.getInstance();
|
||||||
|
final String[] rpcUrls = conf.getProperty("xmlrpcURL").split(",");
|
||||||
final MainToolbar mainToolbar = new MainToolbar(this);
|
final MainToolbar mainToolbar = new MainToolbar(this);
|
||||||
vl.addComponent(mainToolbar);
|
vl.addComponent(mainToolbar);
|
||||||
vl.setExpandRatio(mainToolbar, 0.0f);
|
vl.setExpandRatio(mainToolbar, 0.0f);
|
||||||
final ModulesManagerFactory modulesManagerFactory = new ModulesManagerFactory(grantingTicket, username);
|
final ModulesManagerFactory modulesManagerFactory = new ModulesManagerFactory(grantingTicket, username);
|
||||||
modulesManager = modulesManagerFactory.newModulesManager(SERVICE_URLS);
|
modulesManager = modulesManagerFactory.newModulesManager(rpcUrls);
|
||||||
content = new HorizontalSplitPanel();
|
content = new HorizontalSplitPanel();
|
||||||
content.setSizeFull();
|
content.setSizeFull();
|
||||||
vl.addComponent(content);
|
vl.addComponent(content);
|
||||||
@ -66,7 +65,7 @@ public class MainWindow extends CustomComponent implements HSAdminSession {
|
|||||||
content.setFirstComponent(entryPoints);
|
content.setFirstComponent(entryPoints);
|
||||||
content.setSecondComponent(new MainPanel());
|
content.setSecondComponent(new MainPanel());
|
||||||
content.setSplitPosition(26.6f);
|
content.setSplitPosition(26.6f);
|
||||||
} catch (RpcException e) {
|
} catch (RpcException | TechnicalException e) {
|
||||||
LOG.fatal(e.getLocalizedMessage(), e);
|
LOG.fatal(e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user