Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
66349fbd80 | ||
|
c205ce0975 | ||
|
254db2b9a1 | ||
|
bb44a3233a | ||
|
8b5994e429 | ||
|
2304ce3f23 | ||
|
d7a4a4f63d |
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,4 +11,4 @@ hs_err_pid*
|
|||||||
/.settings
|
/.settings
|
||||||
/.classpath
|
/.classpath
|
||||||
/.project
|
/.project
|
||||||
*/bin/
|
db-migration/bin/
|
||||||
|
35
README.md
35
README.md
@ -18,38 +18,3 @@ und Ihrer Rolle für die Genossenschaft (technischer oder kaufmännischer Anspre
|
|||||||
## pac
|
## pac
|
||||||
|
|
||||||
Das neue Paket-Modul ist in Entwicklung https://dev.hostsharing.net/doc/hsadmin!hs.hsadmin.jee.git/master/services!doc!package.md
|
Das neue Paket-Modul ist in Entwicklung https://dev.hostsharing.net/doc/hsadmin!hs.hsadmin.jee.git/master/services!doc!package.md
|
||||||
|
|
||||||
## run locally
|
|
||||||
|
|
||||||
Alles bauen und Eclipse Konfiguration erzeugen:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mvn clean install eclipse:clean eclipse
|
|
||||||
```
|
|
||||||
|
|
||||||
Backend auf localhost:8080 starten:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd cust-services
|
|
||||||
# entweder:
|
|
||||||
mvn tomee:run
|
|
||||||
# oder:
|
|
||||||
mvn tomee:debug
|
|
||||||
```
|
|
||||||
|
|
||||||
Frontend auf localhost:8081 starten:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd ../web
|
|
||||||
# entweder:
|
|
||||||
mvn tomcat7:run
|
|
||||||
# oder:
|
|
||||||
mvnDebug tomcat7:run
|
|
||||||
```
|
|
||||||
|
|
||||||
Sobald der Debugger unter dem in der Programmausgabe genannten Port verbunden ist, startet der Server.
|
|
||||||
|
|
||||||
Login unter http://localhost:8081/ mit ad/ad.
|
|
||||||
|
|
||||||
Im Webfrontend funktioniert natürlich nur der Customer-Teil,
|
|
||||||
weil sich die anderen Module im Legacy Backend befinden.
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
backendURL=https://config.hostsharing.net:443/hsar/backend
|
backendURL=https://config.hostsharing.net:443/hsar/backend
|
||||||
xmlrpcURL=https://config.hostsharing.net:443/hsar/xmlrpc/hsadmin,https://config2.hostsharing.net:443/hsar/xmlrpc/hsadmin
|
;xmlrpcURL=https://config.hostsharing.net:443/hsar/xmlrpc/hsadmin
|
||||||
loginURL=https://login.hostsharing.net:443/cas/v1/tickets
|
;loginURL=https://login.hostsharing.net:443/cas/v1/tickets
|
||||||
;xmlrpcURL=http://localhost:8080/cust-webapp/xmlrpc/hsadmin
|
xmlrpcURL=http://localhost:8080/cust-webapp/xmlrpc/hsadmin
|
||||||
;loginURL=TestUmgebung
|
loginURL=TestUmgebung
|
||||||
|
26
cli/pom.xml
26
cli/pom.xml
@ -1,14 +1,14 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>hsadmin-parent</artifactId>
|
<artifactId>hsadmin-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hsadmin-cli</artifactId>
|
<artifactId>hsadmin-cli</artifactId>
|
||||||
<version>1.3.0</version>
|
<version>1.0.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HSAdmin-Cli</name>
|
<name>HSAdmin-Cli</name>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<version>${hsadmin.version}</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
@ -37,17 +37,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jline</groupId>
|
<groupId>jline</groupId>
|
||||||
<artifactId>jline</artifactId>
|
<artifactId>jline</artifactId>
|
||||||
<version>2.14.6</version>
|
<version>2.14.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-cli</groupId>
|
<groupId>commons-cli</groupId>
|
||||||
<artifactId>commons-cli</artifactId>
|
<artifactId>commons-cli</artifactId>
|
||||||
<version>1.6.0</version>
|
<version>1.3.1</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.openjdk.nashorn</groupId>
|
|
||||||
<artifactId>nashorn-core</artifactId>
|
|
||||||
<version>15.4</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
@ -78,13 +73,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.vafer</groupId>
|
<groupId>org.vafer</groupId>
|
||||||
<artifactId>jdeb</artifactId>
|
<artifactId>jdeb</artifactId>
|
||||||
<version>1.10</version>
|
<version>1.5</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
<dataSet>
|
<dataSet>
|
||||||
<data>
|
<data>
|
||||||
<src>
|
<src>${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar</src>
|
||||||
${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar</src>
|
|
||||||
<dst>hsscript-full.jar</dst>
|
<dst>hsscript-full.jar</dst>
|
||||||
<type>file</type>
|
<type>file</type>
|
||||||
<mapper>
|
<mapper>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
JAVA_HOME=/usr/lib/jvm/default-java/
|
||||||
ls /usr/lib/jvm/java-11-openjdk-amd64 >/dev/null 2>&1 && JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
|
|
||||||
JAVA=$JAVA_HOME/bin/java
|
JAVA=$JAVA_HOME/bin/java
|
||||||
exec $JAVA $JVM_ARGS -jar /usr/local/lib/hostsharing/hsadmin/hsscript-full.jar "$@"
|
exec $JAVA -jar /usr/local/lib/hostsharing/hsadmin/hsscript-full.jar "$@"
|
@ -3,7 +3,7 @@ Version: [[version]]
|
|||||||
Section: misc
|
Section: misc
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: openjdk-11-jre | openjdk-17-jre
|
Depends: default-jre
|
||||||
Maintainer: Peter Hormanns <peter.hormanns@hostsharing.net>
|
Maintainer: Peter Hormanns <peter.hormanns@hostsharing.net>
|
||||||
Description: hostsharing command and scripting shell
|
Description: hostsharing command and scripting shell
|
||||||
Distribution: hostsharing
|
Distribution: hostsharing
|
@ -75,12 +75,6 @@ public class Main {
|
|||||||
for (String ll : lines) {
|
for (String ll : lines) {
|
||||||
console.println(ll);
|
console.println(ll);
|
||||||
}
|
}
|
||||||
} catch (RuntimeException re) {
|
|
||||||
if (re.getCause() instanceof JSCliException) {
|
|
||||||
console.println(findRootException(re.getCause()));
|
|
||||||
} else {
|
|
||||||
throw re;
|
|
||||||
}
|
|
||||||
} catch (JSCliException e) {
|
} catch (JSCliException e) {
|
||||||
console.println(findRootException(e));
|
console.println(findRootException(e));
|
||||||
}
|
}
|
||||||
@ -98,7 +92,7 @@ public class Main {
|
|||||||
return "bye".equals(trimmedCommand) || "exit".equals(trimmedCommand) || "quit".equals(trimmedCommand);
|
return "bye".equals(trimmedCommand) || "exit".equals(trimmedCommand) || "quit".equals(trimmedCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String findRootException(final Throwable exp) {
|
private static String findRootException(final Exception exp) {
|
||||||
Throwable cause = exp;
|
Throwable cause = exp;
|
||||||
while (cause.getCause() != null && cause.getCause() != cause) {
|
while (cause.getCause() != null && cause.getCause() != cause) {
|
||||||
cause = cause.getCause();
|
cause = cause.getCause();
|
||||||
|
@ -11,10 +11,9 @@ import javax.script.ScriptEngine;
|
|||||||
import javax.script.ScriptEngineManager;
|
import javax.script.ScriptEngineManager;
|
||||||
import javax.script.ScriptException;
|
import javax.script.ScriptException;
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.jscli.cas.TicketProviderFactory;
|
||||||
import de.hsadmin.jscli.console.ConsoleWrapper;
|
import de.hsadmin.jscli.console.ConsoleWrapper;
|
||||||
import de.hsadmin.jscli.exception.JSCliException;
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
import de.hsadmin.login.cas.TicketProviderFactory;
|
|
||||||
|
|
||||||
public class ScriptClient {
|
public class ScriptClient {
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ public class ScriptClient {
|
|||||||
|
|
||||||
public ScriptClient(final ConsoleWrapper console, final String user, final String runAs, final String... arguments) throws JSCliException {
|
public ScriptClient(final ConsoleWrapper console, final String user, final String runAs, final String... arguments) throws JSCliException {
|
||||||
final RpcClient rpcClient = new RpcClient();
|
final RpcClient rpcClient = new RpcClient();
|
||||||
try {
|
|
||||||
engine = new ScriptEngineManager().getEngineByName("js");
|
engine = new ScriptEngineManager().getEngineByName("js");
|
||||||
engine.put("casgrantingticket", TicketProviderFactory.getInstance(console, user, runAs));
|
engine.put("casgrantingticket", TicketProviderFactory.getInstance(console, user, runAs));
|
||||||
engine.put("xmlrpcclient", rpcClient);
|
engine.put("xmlrpcclient", rpcClient);
|
||||||
@ -33,10 +31,8 @@ public class ScriptClient {
|
|||||||
completionStrings.add("where");
|
completionStrings.add("where");
|
||||||
considerArguments(arguments);
|
considerArguments(arguments);
|
||||||
try {
|
try {
|
||||||
final ClassLoader classLoader = getClass().getClassLoader();
|
final InputStream inputResource = getClass().getClassLoader().getResourceAsStream("js/functions.js");
|
||||||
final InputStream inputResource = classLoader.getResourceAsStream("js/functions.js");
|
engine.eval(new InputStreamReader(inputResource));
|
||||||
final InputStreamReader inputStreamReader = new InputStreamReader(inputResource);
|
|
||||||
engine.eval(inputStreamReader);
|
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
throw new JSCliException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
@ -71,9 +67,6 @@ public class ScriptClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.codeCompletion(getCodeCompletionStrings());
|
console.codeCompletion(getCodeCompletionStrings());
|
||||||
} catch (TechnicalException e) {
|
|
||||||
throw new JSCliException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getCodeCompletionStrings() {
|
public String[] getCodeCompletionStrings() {
|
||||||
|
13
cli/src/main/java/de/hsadmin/jscli/TicketProvider.java
Normal file
13
cli/src/main/java/de/hsadmin/jscli/TicketProvider.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package de.hsadmin.jscli;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
|
public interface TicketProvider {
|
||||||
|
|
||||||
|
public String getTicket() throws JSCliException, FileNotFoundException;
|
||||||
|
|
||||||
|
public String getRunAs();
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
package de.hsadmin.login.cas;
|
package de.hsadmin.jscli.cas;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -19,7 +20,9 @@ import javax.net.ssl.HttpsURLConnection;
|
|||||||
|
|
||||||
import de.hsadmin.common.config.Config;
|
import de.hsadmin.common.config.Config;
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.login.TicketProvider;
|
import de.hsadmin.jscli.TicketProvider;
|
||||||
|
import de.hsadmin.jscli.console.PasswordReader;
|
||||||
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
public class CASTicketProvider implements TicketProvider {
|
public class CASTicketProvider implements TicketProvider {
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
|
|
||||||
private String grantingTicket;
|
private String grantingTicket;
|
||||||
|
|
||||||
public CASTicketProvider(final PasswordReader console, final String user, final String runAs, final String backendURL, final String loginURL) throws TechnicalException {
|
public CASTicketProvider(final PasswordReader console, final String user, final String runAs, final String backendURL, final String loginURL) throws JSCliException {
|
||||||
this.passwordReader = console;
|
this.passwordReader = console;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.runAs = runAs;
|
this.runAs = runAs;
|
||||||
@ -41,7 +44,7 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTicket() throws TechnicalException {
|
public String getTicket() throws JSCliException {
|
||||||
try {
|
try {
|
||||||
final String encodedParams =
|
final String encodedParams =
|
||||||
URLEncoder.encode("service", "UTF-8") + "=" + URLEncoder.encode(backendURL, "UTF-8");
|
URLEncoder.encode("service", "UTF-8") + "=" + URLEncoder.encode(backendURL, "UTF-8");
|
||||||
@ -61,14 +64,14 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
}
|
}
|
||||||
trails++;
|
trails++;
|
||||||
if (trails > 3) {
|
if (trails > 3) {
|
||||||
throw new TechnicalException("exceeded number of login attempts");
|
throw new JSCliException("exceeded number of login attempts");
|
||||||
}
|
}
|
||||||
urlString = getGrantingTicket();
|
urlString = getGrantingTicket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new TechnicalException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +80,7 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
return runAs;
|
return runAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getGrantingTicket() throws TechnicalException {
|
private String getGrantingTicket() throws JSCliException {
|
||||||
grantingTicket = null;
|
grantingTicket = null;
|
||||||
try {
|
try {
|
||||||
String password = Config.getInstance().getProperty(user + ".passWord");
|
String password = Config.getInstance().getProperty(user + ".passWord");
|
||||||
@ -90,21 +93,25 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
+ "=" + URLEncoder.encode(password, "UTF-8");
|
+ "=" + URLEncoder.encode(password, "UTF-8");
|
||||||
grantingTicket = requestForGrantingTicket(loginURL, encodedParams);
|
grantingTicket = requestForGrantingTicket(loginURL, encodedParams);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new TechnicalException(e);
|
throw new JSCliException(e);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new JSCliException("cas server not available: " + loginURL);
|
||||||
|
} catch (TechnicalException e) {
|
||||||
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
return grantingTicket;
|
return grantingTicket;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String readPasswordFromConsole() throws TechnicalException {
|
private String readPasswordFromConsole() throws JSCliException {
|
||||||
return passwordReader.readPassword();
|
return passwordReader.readPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String requestForGrantingTicket(final String urlString, final String encodedParams) throws TechnicalException {
|
private String requestForGrantingTicket(final String urlString, final String encodedParams) throws JSCliException, FileNotFoundException {
|
||||||
try {
|
try {
|
||||||
final HttpsURLConnection connection = doConnect(urlString, encodedParams);
|
final HttpsURLConnection connection = doConnect(urlString, encodedParams);
|
||||||
return connection.getHeaderField("Location");
|
return connection.getHeaderField("Location");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new TechnicalException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +148,7 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readFiledGrantingTicket() throws TechnicalException {
|
private void readFiledGrantingTicket() throws JSCliException {
|
||||||
final File file = getTicketFile();
|
final File file = getTicketFile();
|
||||||
final Properties properties = loadProperties(file);
|
final Properties properties = loadProperties(file);
|
||||||
final String filedTicket = properties.getProperty(user);
|
final String filedTicket = properties.getProperty(user);
|
||||||
@ -155,25 +162,25 @@ public class CASTicketProvider implements TicketProvider {
|
|||||||
return new File(ticketFileName);
|
return new File(ticketFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveProperties(final String filedTicket, final File file) throws TechnicalException {
|
private void saveProperties(final String filedTicket, final File file) throws JSCliException {
|
||||||
final Properties properties = loadProperties(file);
|
final Properties properties = loadProperties(file);
|
||||||
if (filedTicket != null) {
|
if (filedTicket != null) {
|
||||||
properties.setProperty(user, filedTicket);
|
properties.setProperty(user, filedTicket);
|
||||||
try {
|
try {
|
||||||
properties.store(new FileOutputStream(file), "stored cas tickets");
|
properties.store(new FileOutputStream(file), "stored cas tickets");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new TechnicalException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Properties loadProperties(final File file) throws TechnicalException {
|
private Properties loadProperties(final File file) throws JSCliException {
|
||||||
final Properties properties = new Properties();
|
final Properties properties = new Properties();
|
||||||
if (file.isFile() && file.canRead()) {
|
if (file.isFile() && file.canRead()) {
|
||||||
try {
|
try {
|
||||||
properties.load(new FileReader(file));
|
properties.load(new FileReader(file));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new TechnicalException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return properties;
|
return properties;
|
@ -1,7 +1,9 @@
|
|||||||
package de.hsadmin.login.cas;
|
package de.hsadmin.jscli.cas;
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import java.io.FileNotFoundException;
|
||||||
import de.hsadmin.login.TicketProvider;
|
|
||||||
|
import de.hsadmin.jscli.TicketProvider;
|
||||||
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
public class TestTicketProvider implements TicketProvider {
|
public class TestTicketProvider implements TicketProvider {
|
||||||
|
|
||||||
@ -14,7 +16,7 @@ public class TestTicketProvider implements TicketProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTicket() throws TechnicalException {
|
public String getTicket() throws JSCliException, FileNotFoundException {
|
||||||
return grantingTicket;
|
return grantingTicket;
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
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.console.PasswordReader;
|
||||||
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
|
public class TicketProviderFactory {
|
||||||
|
|
||||||
|
private static final String HOSTSHARING_LOGIN_URL = "https://login.hostsharing.net:443/cas/v1/tickets";
|
||||||
|
private static final String HOSTSHARING_BACKEND_URL = "https://config.hostsharing.net:443/hsar/backend";
|
||||||
|
|
||||||
|
public static TicketProvider getInstance(final PasswordReader console, final String user, final String runAs) throws JSCliException
|
||||||
|
{
|
||||||
|
Config config;
|
||||||
|
try {
|
||||||
|
config = Config.getInstance();
|
||||||
|
final String backendURL = config.getProperty("backendURL", HOSTSHARING_BACKEND_URL);
|
||||||
|
final String loginURL = config.getProperty("loginURL", HOSTSHARING_LOGIN_URL);
|
||||||
|
if ("TestUmgebung".equalsIgnoreCase(loginURL)) {
|
||||||
|
return new TestTicketProvider(user, runAs);
|
||||||
|
} else {
|
||||||
|
return new CASTicketProvider(console, user, runAs, backendURL, loginURL);
|
||||||
|
}
|
||||||
|
} catch (TechnicalException e) {
|
||||||
|
throw new JSCliException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package de.hsadmin.jscli.conf;
|
package de.hsadmin.jscli.conf;
|
||||||
|
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
import org.apache.commons.cli.DefaultParser;
|
|
||||||
import org.apache.commons.cli.HelpFormatter;
|
import org.apache.commons.cli.HelpFormatter;
|
||||||
import org.apache.commons.cli.Options;
|
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 de.hsadmin.common.config.Config;
|
import de.hsadmin.common.config.Config;
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
@ -24,7 +24,7 @@ public class CommandlineParser {
|
|||||||
opts.addOption("e", "expr", true, "expression to execute");
|
opts.addOption("e", "expr", true, "expression to execute");
|
||||||
opts.addOption("f", "file", true, "script file to execute");
|
opts.addOption("f", "file", true, "script file to execute");
|
||||||
opts.addOption("i", "interactive", false, "interactive shell");
|
opts.addOption("i", "interactive", false, "interactive shell");
|
||||||
DefaultParser parser = new DefaultParser();
|
PosixParser parser = new PosixParser();
|
||||||
try {
|
try {
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
printHelp();
|
printHelp();
|
||||||
|
@ -3,9 +3,7 @@ package de.hsadmin.jscli.console;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.jscli.exception.JSCliException;
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
import de.hsadmin.login.cas.PasswordReader;
|
|
||||||
import jline.console.ConsoleReader;
|
import jline.console.ConsoleReader;
|
||||||
import jline.console.completer.StringsCompleter;
|
import jline.console.completer.StringsCompleter;
|
||||||
import jline.console.history.FileHistory;
|
import jline.console.history.FileHistory;
|
||||||
@ -13,7 +11,6 @@ import jline.console.history.FileHistory;
|
|||||||
public class ConsoleWrapper implements PasswordReader {
|
public class ConsoleWrapper implements PasswordReader {
|
||||||
|
|
||||||
private ConsoleReader cons;
|
private ConsoleReader cons;
|
||||||
private FileHistory history;
|
|
||||||
private String prompt;
|
private String prompt;
|
||||||
|
|
||||||
public void open(final String prompt) throws JSCliException {
|
public void open(final String prompt) throws JSCliException {
|
||||||
@ -23,8 +20,7 @@ public class ConsoleWrapper implements PasswordReader {
|
|||||||
cons.setExpandEvents(false);
|
cons.setExpandEvents(false);
|
||||||
cons.setPrompt(prompt);
|
cons.setPrompt(prompt);
|
||||||
final String userHome = System.getProperty("user.home");
|
final String userHome = System.getProperty("user.home");
|
||||||
history = new FileHistory(new File(userHome + "/.hsscript_history"));
|
cons.setHistory(new FileHistory(new File(userHome + "/.hsscript_history")));
|
||||||
cons.setHistory(history);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new JSCliException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
@ -39,34 +35,28 @@ public class ConsoleWrapper implements PasswordReader {
|
|||||||
return line;
|
return line;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new JSCliException(e);
|
throw new JSCliException(e);
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
history.flush();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// dont care about
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void println(final String text) throws TechnicalException {
|
public void println(final String text) throws JSCliException {
|
||||||
try {
|
try {
|
||||||
if (cons != null) {
|
if (cons != null) {
|
||||||
cons.println(text);
|
cons.println(text);
|
||||||
} else {
|
} else {
|
||||||
throw new TechnicalException("cannot write console");
|
throw new JSCliException("cannot write console");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new TechnicalException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String readPassword() throws TechnicalException {
|
public String readPassword() throws JSCliException {
|
||||||
try {
|
try {
|
||||||
final String pw = cons.readLine("Password: ", Character.valueOf('*'));
|
final String pw = cons.readLine("Password: ", new Character('*'));
|
||||||
cons.setPrompt(prompt);
|
cons.setPrompt(prompt);
|
||||||
return pw;
|
return pw;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new TechnicalException(e);
|
throw new JSCliException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package de.hsadmin.jscli.console;
|
||||||
|
|
||||||
|
import de.hsadmin.jscli.exception.JSCliException;
|
||||||
|
|
||||||
|
public interface PasswordReader {
|
||||||
|
|
||||||
|
public String readPassword() throws JSCliException;
|
||||||
|
|
||||||
|
public void println(final String text) throws JSCliException;
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
var JArrayList = Java.type("java.util.ArrayList")
|
importClass(java.util.ArrayList);
|
||||||
var JHashMap = Java.type("java.util.HashMap")
|
importClass(java.util.HashMap);
|
||||||
|
|
||||||
function hsaParseParam(val) {
|
function hsaParseParam(val) {
|
||||||
if (val === null) {
|
if (val === null) {
|
||||||
@ -20,7 +20,7 @@ function hsaParseParam(val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hsaParseParamArray(o) {
|
function hsaParseParamArray(o) {
|
||||||
var lst = new JArrayList();
|
var lst = new ArrayList();
|
||||||
var val = '';
|
var val = '';
|
||||||
for (var idx=0; idx < o.length; idx++) {
|
for (var idx=0; idx < o.length; idx++) {
|
||||||
val = o[idx];
|
val = o[idx];
|
||||||
@ -36,7 +36,7 @@ function hsaParseParamArray(o) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hsaParseParamObject(o) {
|
function hsaParseParamObject(o) {
|
||||||
var hsh = new JHashMap();
|
var hsh = new HashMap();
|
||||||
for (var key in o) {
|
for (var key in o) {
|
||||||
var val = o[key];
|
var val = o[key];
|
||||||
if (!val === null) {
|
if (!val === null) {
|
||||||
@ -73,7 +73,7 @@ function hsaToNativeJSObject(val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hsaModuleCall(mod, fct, json) {
|
function hsaModuleCall(mod, fct, json) {
|
||||||
var params = new JArrayList();
|
var params = new ArrayList();
|
||||||
params.add(casgrantingticket.getRunAs());
|
params.add(casgrantingticket.getRunAs());
|
||||||
params.add(casgrantingticket.getTicket());
|
params.add(casgrantingticket.getTicket());
|
||||||
if (typeof json === "undefined") {
|
if (typeof json === "undefined") {
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
|
||||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="enhance,"/>
|
|
||||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="enhance,"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
|
||||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
|
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="cust-webapp"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/cust-webapp/builder_project/enhance.xml}"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-Dopenjpa.libs -Dbuild.dir"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/cust-webapp/builder_project}"/>
|
|
||||||
</launchConfiguration>
|
|
1
cust-services/.gitignore
vendored
1
cust-services/.gitignore
vendored
@ -11,4 +11,3 @@ hs_err_pid*
|
|||||||
/.settings
|
/.settings
|
||||||
/.classpath
|
/.classpath
|
||||||
/.project
|
/.project
|
||||||
/derby.log
|
|
||||||
|
@ -1,52 +1,44 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>hsadmin-parent</artifactId>
|
<artifactId>hsadmin-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cust-webapp</artifactId>
|
<artifactId>cust-webapp</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>HSAdmin XML-RPC Customers Webapp</name>
|
<name>HSAdmin XML-RPC Customers Webapp</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<version>${hsadmin.version}</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.platform</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
<artifactId>geronimo-jpa_2.0_spec</artifactId>
|
||||||
<version>8.0.0</version>
|
<version>1.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.bval</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>org.apache.bval.bundle</artifactId>
|
<artifactId>geronimo-ejb_3.0_spec</artifactId>
|
||||||
<version>${bval.version}</version>
|
<version>1.0.1</version>
|
||||||
<scope>test</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openjpa</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>openjpa</artifactId>
|
<artifactId>geronimo-validation_1.0_spec</artifactId>
|
||||||
<version>${openjpa.version}</version>
|
<version>1.1</version>
|
||||||
<scope>test</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.liquibase</groupId>
|
|
||||||
<artifactId>liquibase-core</artifactId>
|
|
||||||
<version>${liquibase.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
<artifactId>xmlrpc-server</artifactId>
|
<artifactId>xmlrpc-server</artifactId>
|
||||||
<version>${xmlrpc.version}</version>
|
<version>3.1.3</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
@ -58,69 +50,67 @@
|
|||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<version>3.3.1</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<archiveClasses>true</archiveClasses>
|
<archiveClasses>true</archiveClasses>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>3.2.0</version>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>**/XmlRpcServlet.properties</exclude>
|
<exclude>**/XmlRpcServlet.properties</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-a-jar</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.tomee.maven</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>tomee-maven-plugin</artifactId>
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
<version>${tomee.version}</version>
|
<version>1.7</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-artifacts</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>attach-artifact</goal>
|
||||||
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<tomeeVersion>${tomee.version}</tomeeVersion>
|
<artifacts>
|
||||||
|
<artifact>
|
||||||
|
<file>${project.basedir}/target/cust-webapp-1.0-SNAPSHOT.jar</file>
|
||||||
|
<type>jar</type>
|
||||||
|
</artifact>
|
||||||
|
</artifacts>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.openejb.maven</groupId>
|
||||||
|
<artifactId>tomee-maven-plugin</artifactId>
|
||||||
|
<version>1.7.4</version>
|
||||||
|
<configuration>
|
||||||
|
<tomeeVersion>1.7.4</tomeeVersion>
|
||||||
<tomeeClassifier>webprofile</tomeeClassifier>
|
<tomeeClassifier>webprofile</tomeeClassifier>
|
||||||
<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>${postgresql.lib}</lib>
|
<lib>org.postgresql:postgresql:9.4.1212.jre7</lib>
|
||||||
</libs>
|
</libs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.openjpa</groupId>
|
|
||||||
<artifactId>openjpa-maven-plugin</artifactId>
|
|
||||||
<version>${openjpa.version}</version>
|
|
||||||
<configuration>
|
|
||||||
<includes>**/bo/*.class</includes>
|
|
||||||
<addDefaultConstructor>true</addDefaultConstructor>
|
|
||||||
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>enhancer</id>
|
|
||||||
<phase>process-classes</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>enhance</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.openjpa</groupId>
|
|
||||||
<artifactId>openjpa</artifactId>
|
|
||||||
<version>${openjpa.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package de.hsadmin.bo.customer;
|
||||||
|
|
||||||
|
public enum AssetAction {
|
||||||
|
PAYMENT,
|
||||||
|
PAYBACK,
|
||||||
|
ADOPTION,
|
||||||
|
HANDOVER,
|
||||||
|
LOSS,
|
||||||
|
CLEARING,
|
||||||
|
PRESCRIPTION
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,13 @@ public class Customer implements Serializable {
|
|||||||
@Temporal(javax.persistence.TemporalType.DATE)
|
@Temporal(javax.persistence.TemporalType.DATE)
|
||||||
private Date nonDiscContract;
|
private Date nonDiscContract;
|
||||||
|
|
||||||
|
@Column(name = "shares_updated", columnDefinition = "date", nullable = true)
|
||||||
|
@Temporal(javax.persistence.TemporalType.DATE)
|
||||||
|
private Date sharesUpdated;
|
||||||
|
|
||||||
|
@Column(name = "shares_signed", columnDefinition = "integer")
|
||||||
|
private int sharesSigned;
|
||||||
|
|
||||||
@Column(name = "free", nullable = false)
|
@Column(name = "free", nullable = false)
|
||||||
private boolean free = false;
|
private boolean free = false;
|
||||||
|
|
||||||
@ -169,6 +176,22 @@ public class Customer implements Serializable {
|
|||||||
this.nonDiscContract = nonDiscContract;
|
this.nonDiscContract = nonDiscContract;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getSharesUpdated() {
|
||||||
|
return sharesUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSharesUpdated(final Date sharesUpdated) {
|
||||||
|
this.sharesUpdated = sharesUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSharesSigned() {
|
||||||
|
return sharesSigned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSharesSigned(final int sharesSigned) {
|
||||||
|
this.sharesSigned = sharesSigned;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUidVAT() {
|
public String getUidVAT() {
|
||||||
return uidVAT;
|
return uidVAT;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,6 @@ import java.util.Date;
|
|||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
@ -26,7 +24,7 @@ public class MemberAsset implements Serializable {
|
|||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "member_asset_id", columnDefinition = "integer")
|
@Column(name = "member_share_id", columnDefinition = "integer")
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
@JoinColumn(name = "bp_id", columnDefinition = "integer", nullable = false)
|
@JoinColumn(name = "bp_id", columnDefinition = "integer", nullable = false)
|
||||||
@ -38,8 +36,7 @@ public class MemberAsset implements Serializable {
|
|||||||
private Date date;
|
private Date date;
|
||||||
|
|
||||||
@Column(name="action", nullable = false)
|
@Column(name="action", nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
private ShareAction action;
|
||||||
private MemberAssetAction action;
|
|
||||||
|
|
||||||
@Column(name="amount", nullable = false)
|
@Column(name="amount", nullable = false)
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
@ -79,14 +76,16 @@ public class MemberAsset implements Serializable {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemberAssetAction getAction() {
|
public ShareAction getAction() {
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAction(MemberAssetAction action) {
|
public void setAction(ShareAction action) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getComment() {
|
public String getComment() {
|
||||||
return comment;
|
return comment;
|
||||||
}
|
}
|
||||||
@ -95,10 +94,4 @@ public class MemberAsset implements Serializable {
|
|||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "MemberAsset [id=" + id + ", customer=" + (customer!=null ? customer.getName() : null) + ", date=" + date + ", action=" + action
|
|
||||||
+ ", amount=" + amount + ", comment=" + comment + "]";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
package de.hsadmin.bo.customer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transaktionstyp für Geschaeftsguthaben {@link MemberAsset}.
|
|
||||||
*/
|
|
||||||
public enum MemberAssetAction {
|
|
||||||
|
|
||||||
/** Einzahlung */
|
|
||||||
PAYMENT,
|
|
||||||
|
|
||||||
/** Auszahlung */
|
|
||||||
PAYBACK,
|
|
||||||
|
|
||||||
/** Empfaenger einer Uebertragung */
|
|
||||||
ADOPTION,
|
|
||||||
|
|
||||||
/** Sender einer Uebertragung */
|
|
||||||
HANDOVER,
|
|
||||||
|
|
||||||
/** Verlustabschreibung */
|
|
||||||
LOSS,
|
|
||||||
|
|
||||||
/** Verrechnung mit Schulden */
|
|
||||||
CLEARING,
|
|
||||||
|
|
||||||
/** Verjaehrung **/
|
|
||||||
PRESCRIPTION
|
|
||||||
}
|
|
@ -7,8 +7,6 @@ import java.util.Date;
|
|||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EnumType;
|
|
||||||
import javax.persistence.Enumerated;
|
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
@ -37,8 +35,7 @@ public class MemberShare implements Serializable {
|
|||||||
private Date date;
|
private Date date;
|
||||||
|
|
||||||
@Column(name="action", nullable = false)
|
@Column(name="action", nullable = false)
|
||||||
@Enumerated(EnumType.STRING)
|
private ShareAction action;
|
||||||
private MemberShareAction action;
|
|
||||||
|
|
||||||
@Column(name="quantity", nullable = false)
|
@Column(name="quantity", nullable = false)
|
||||||
private int quantity;
|
private int quantity;
|
||||||
@ -70,11 +67,11 @@ public class MemberShare implements Serializable {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemberShareAction getAction() {
|
public ShareAction getAction() {
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAction(MemberShareAction action) {
|
public void setAction(ShareAction action) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +91,4 @@ public class MemberShare implements Serializable {
|
|||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "MemberShare [id=" + id + ", customer=" + (customer!=null ? customer.getName() : null) + ", date=" + date + ", action=" + action
|
|
||||||
+ ", quantity=" + quantity + ", comment=" + comment + "]";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
package de.hsadmin.bo.customer;
|
|
||||||
|
|
||||||
/** Transaktionstyp für Geschaeftsanteile {@link MemberShare}.
|
|
||||||
*/
|
|
||||||
public enum MemberShareAction {
|
|
||||||
|
|
||||||
|
|
||||||
/** Zeichnung */
|
|
||||||
SUBSCRIPTION,
|
|
||||||
|
|
||||||
/** Kuendigung */
|
|
||||||
UNSUBSCRIPTION
|
|
||||||
|
|
||||||
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package de.hsadmin.bo.customer;
|
||||||
|
|
||||||
|
public enum ShareAction {
|
||||||
|
|
||||||
|
SUBSCRIPTION,
|
||||||
|
UNSUBSCRIPTION
|
||||||
|
|
||||||
|
}
|
@ -13,8 +13,6 @@ import javax.persistence.ManyToMany;
|
|||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
@Table(name="domain_option")
|
@Table(name="domain_option")
|
||||||
@Entity(name="DomainOption")
|
@Entity(name="DomainOption")
|
||||||
@SequenceGenerator(name = "DomainOptionSeqGen", sequenceName = "domain_option_id_seq")
|
@SequenceGenerator(name = "DomainOptionSeqGen", sequenceName = "domain_option_id_seq")
|
||||||
@ -51,14 +49,14 @@ public class DomainOption {
|
|||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof DomainOption) {
|
if (obj instanceof DomainOption) {
|
||||||
DomainOption opt = (DomainOption) obj;
|
DomainOption opt = (DomainOption) obj;
|
||||||
return StringUtils.equals(getName(), opt.getName());
|
return getName().equals(opt.getName());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (getName()!=null ? getName() : "").hashCode();
|
return getName().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +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.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
@ -25,10 +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})
|
||||||
public class Pac implements Serializable {
|
public class Pac implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -80,6 +83,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");
|
||||||
qAttachedBasepac.setParameter("valid", Boolean.TRUE);
|
qAttachedBasepac.setParameter("valid", Boolean.TRUE);
|
||||||
@ -203,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 + " }";
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EntityListeners;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
@ -19,6 +20,7 @@ import javax.persistence.TemporalType;
|
|||||||
@Entity(name = "PacComponents")
|
@Entity(name = "PacComponents")
|
||||||
@Table(name = "packet_component")
|
@Table(name = "packet_component")
|
||||||
@SequenceGenerator(name = "PacCompSeqGen", sequenceName = "packet_component_id_seq")
|
@SequenceGenerator(name = "PacCompSeqGen", sequenceName = "packet_component_id_seq")
|
||||||
|
@EntityListeners({PacEntityListener.class})
|
||||||
public class PacComponent implements Serializable {
|
public class PacComponent implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -93,7 +95,7 @@ public class PacComponent implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "pac=" + (pac!=null?pac.getName():"") + ";comp=" + (getBaseComponent()!=null?getBaseComponent().getFeature():"") + ";quantity=" + getQuantity();
|
return "pac=" + pac.getName() + ";comp=" + getBaseComponent().getFeature() + ";quantity=" + getQuantity();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,131 @@
|
|||||||
|
package de.hsadmin.bo.pac;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
//import javax.jms.JMSException;
|
||||||
|
//import javax.jms.Queue;
|
||||||
|
//import javax.jms.QueueConnection;
|
||||||
|
//import javax.jms.QueueSender;
|
||||||
|
//import javax.jms.QueueSession;
|
||||||
|
//import javax.jms.Session;
|
||||||
|
//import javax.jms.TextMessage;
|
||||||
|
import javax.persistence.PostLoad;
|
||||||
|
import javax.persistence.PostPersist;
|
||||||
|
import javax.persistence.PostUpdate;
|
||||||
|
import javax.persistence.PreRemove;
|
||||||
|
|
||||||
|
//import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
|
|
||||||
|
public class PacEntityListener {
|
||||||
|
|
||||||
|
public PacEntityListener() {
|
||||||
|
System.out.println("PacEntityListener()");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostLoad
|
||||||
|
public void onLoad(final Object entity) {
|
||||||
|
System.out.println("onLoad");
|
||||||
|
Pac pac = null;
|
||||||
|
if (entity instanceof PacComponent) {
|
||||||
|
final PacComponent component = (PacComponent) entity;
|
||||||
|
pac = component.getPac();
|
||||||
|
}
|
||||||
|
if (entity instanceof Pac) {
|
||||||
|
pac = (Pac) entity;
|
||||||
|
System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree());
|
||||||
|
}
|
||||||
|
System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree());
|
||||||
|
System.out.println(" from: " + this.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostPersist
|
||||||
|
public void onCreate(final Object entity) {
|
||||||
|
System.out.println("onCreate");
|
||||||
|
Pac pac = null;
|
||||||
|
if (entity instanceof PacComponent) {
|
||||||
|
final PacComponent component = (PacComponent) entity;
|
||||||
|
pac = component.getPac();
|
||||||
|
}
|
||||||
|
if (entity instanceof Pac) {
|
||||||
|
pac = (Pac) entity;
|
||||||
|
System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree());
|
||||||
|
}
|
||||||
|
if (pac != null) {
|
||||||
|
final String name = pac.getName();
|
||||||
|
System.out.println("Pac: " + name + " free:" + pac.isFree());
|
||||||
|
sendNotification("pac", "add", name);
|
||||||
|
}
|
||||||
|
System.out.println(" from: " + this.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostUpdate
|
||||||
|
public void onUpdate(final Object entity) {
|
||||||
|
System.out.println("onUpdate");
|
||||||
|
Pac pac = null;
|
||||||
|
if (entity instanceof PacComponent) {
|
||||||
|
final PacComponent component = (PacComponent) entity;
|
||||||
|
pac = component.getPac();
|
||||||
|
}
|
||||||
|
if (entity instanceof Pac) {
|
||||||
|
pac = (Pac) entity;
|
||||||
|
System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree());
|
||||||
|
}
|
||||||
|
if (pac != null) {
|
||||||
|
final String name = pac.getName();
|
||||||
|
System.out.println("Pac: " + name + " free:" + pac.isFree());
|
||||||
|
sendNotification("pac", "update", name);
|
||||||
|
}
|
||||||
|
System.out.println(" from: " + this.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreRemove
|
||||||
|
public void onDelete(final Object entity) {
|
||||||
|
System.out.println("onDelete");
|
||||||
|
Pac pac = null;
|
||||||
|
if (entity instanceof PacComponent) {
|
||||||
|
final PacComponent component = (PacComponent) entity;
|
||||||
|
pac = component.getPac();
|
||||||
|
}
|
||||||
|
if (entity instanceof Pac) {
|
||||||
|
pac = (Pac) entity;
|
||||||
|
System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree());
|
||||||
|
}
|
||||||
|
if (pac != null) {
|
||||||
|
System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree());
|
||||||
|
final String name = pac.getName();
|
||||||
|
System.out.println("Pac: " + name + " free:" + pac.isFree());
|
||||||
|
sendNotification("pac", "delete", name);
|
||||||
|
}
|
||||||
|
System.out.println(" from: " + this.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendNotification(final String module, final String opCode, final String name)
|
||||||
|
{
|
||||||
|
// final ActiveMQConnectionFactory connFactory = new ActiveMQConnectionFactory("ssl://hsh03.hostsharing.net:61617");
|
||||||
|
// QueueConnection connection = null;
|
||||||
|
// try {
|
||||||
|
// connection = connFactory.createQueueConnection("user-pactasks", "Ohf4oh");
|
||||||
|
// connection.start();
|
||||||
|
// final QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
|
// final Queue queue = session.createQueue("queue.hsadminSystem-pactasks");
|
||||||
|
// final String string = module + "." + opCode + ":" + name + ":" + new Date();
|
||||||
|
// System.out.println(string);
|
||||||
|
// final TextMessage message = session.createTextMessage(string);
|
||||||
|
// final QueueSender sender = session.createSender(queue);
|
||||||
|
// sender.send(message);
|
||||||
|
// sender.close();
|
||||||
|
// session.close();
|
||||||
|
// } catch (JMSException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// } finally {
|
||||||
|
// if (connection != null) { try { connection.close(); } catch(JMSException e) { } }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
PacEntityListener listener = new PacEntityListener();
|
||||||
|
listener.sendNotification("pac", "add", "xyz01");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,39 +0,0 @@
|
|||||||
package de.hsadmin.dao.customer;
|
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
|
|
||||||
import de.hsadmin.bo.customer.Customer;
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
import de.hsadmin.service.customer.CustomerVO;
|
|
||||||
|
|
||||||
@Stateless
|
|
||||||
public class CustomerDao {
|
|
||||||
|
|
||||||
@PersistenceContext(name="hsar")
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
public CustomerDao() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public CustomerDao(EntityManager em) {
|
|
||||||
this.entityManager = em;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Customer findCustomerByName(final String customerName) throws UserException {
|
|
||||||
return findCustomerByNameImpl(customerName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Customer findCustomerByName(final CustomerVO prototype) throws UserException, TechnicalException {
|
|
||||||
return findCustomerByNameImpl(prototype.get("name").getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Customer findCustomerByNameImpl(final Object customerName) throws UserException {
|
|
||||||
final Query query = entityManager.createQuery("SELECT c FROM Customer c WHERE c.name = :name");
|
|
||||||
query.setParameter("name", customerName);
|
|
||||||
return (Customer) query.getSingleResult();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package de.hsadmin.rest.customer;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.HeaderParam;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
import de.hsadmin.login.LoginServiceLocal;
|
|
||||||
import de.hsadmin.login.RequestContext;
|
|
||||||
import de.hsadmin.service.customer.ContactServiceLocal;
|
|
||||||
import de.hsadmin.service.customer.ContactVO;
|
|
||||||
|
|
||||||
@Path("/contacts")
|
|
||||||
public class ContactsAPI {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
LoginServiceLocal loginEJB;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
ContactServiceLocal contactEJB;
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Path("/{customer}")
|
|
||||||
public List<ContactVO> getContactsByMember(@PathParam("customer") String customer, @HeaderParam("X-HS-Auth") String ticket) throws UserException, TechnicalException {
|
|
||||||
System.out.println("customer: " + customer);
|
|
||||||
System.out.println("ticket: " + ticket);
|
|
||||||
System.out.println("LoginService: " + loginEJB);
|
|
||||||
RequestContext context = loginEJB.createContext(ticket.trim(), "");
|
|
||||||
ContactVO vo = new ContactVO();
|
|
||||||
vo.setCustomer(customer);
|
|
||||||
List<ContactVO> list = contactEJB.read(context, vo);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
|||||||
package de.hsadmin.service.customer;
|
package de.hsadmin.service.customer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
@ -14,7 +11,6 @@ import de.hsadmin.bo.customer.Contact;
|
|||||||
import de.hsadmin.bo.customer.Customer;
|
import de.hsadmin.bo.customer.Customer;
|
||||||
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.dao.customer.CustomerDao;
|
|
||||||
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;
|
||||||
@ -28,9 +24,6 @@ public class ContactService extends AbstractModule<ContactVO> implements Contact
|
|||||||
@PersistenceContext(name="hsar")
|
@PersistenceContext(name="hsar")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@EJB
|
|
||||||
private CustomerDao customerDao;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContactVO buildVO() throws TechnicalException {
|
public ContactVO buildVO() throws TechnicalException {
|
||||||
return new ContactVO();
|
return new ContactVO();
|
||||||
@ -42,22 +35,7 @@ public class ContactService extends AbstractModule<ContactVO> implements Contact
|
|||||||
throws UserException, TechnicalException {
|
throws UserException, TechnicalException {
|
||||||
final ContactVO vo = super.create(requestContext, prototype);
|
final ContactVO vo = super.create(requestContext, prototype);
|
||||||
final Contact bo = new Contact();
|
final Contact bo = new Contact();
|
||||||
final Customer cust = customerDao.findCustomerByName(prototype.getCustomer());
|
bo.setCustomer(findCustomerByName(prototype.getCustomer()));
|
||||||
final Set<Contact> existingContacts = cust.getContacts();
|
|
||||||
final String[] givenRoles = vo.getRoles();
|
|
||||||
if ((existingContacts == null || existingContacts.isEmpty()) && (givenRoles == null || givenRoles.length == 0)) {
|
|
||||||
final Query query = entityManager.createNativeQuery("SELECT role_name FROM role");
|
|
||||||
final List<?> rolesList = query.getResultList();
|
|
||||||
final List<String> roles = new ArrayList<>();
|
|
||||||
for (int idx = 0; idx < rolesList.size(); idx++) {
|
|
||||||
final Object role = rolesList.get(idx);
|
|
||||||
if (role instanceof String) {
|
|
||||||
roles.add((String) role);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bo.setRoles(roles);
|
|
||||||
}
|
|
||||||
bo.setCustomer(cust);
|
|
||||||
vo.copyPropertiesToPersistentObject(bo);
|
vo.copyPropertiesToPersistentObject(bo);
|
||||||
entityManager.persist(bo);
|
entityManager.persist(bo);
|
||||||
final Contact newBO = findContactByNames(vo);
|
final Contact newBO = findContactByNames(vo);
|
||||||
@ -113,4 +91,10 @@ public class ContactService extends AbstractModule<ContactVO> implements Contact
|
|||||||
return (Contact) query.getSingleResult();
|
return (Contact) query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Customer findCustomerByName(final String customer) throws UserException {
|
||||||
|
final Query query = entityManager.createQuery("SELECT c FROM Customer c WHERE c.name = :name");
|
||||||
|
query.setParameter("name", customer);
|
||||||
|
return (Customer) query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
@ -104,6 +112,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();
|
||||||
roles = new StringSet();
|
roles = new StringSet();
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
import javax.persistence.Query;
|
||||||
|
|
||||||
import de.hsadmin.bo.customer.Customer;
|
import de.hsadmin.bo.customer.Customer;
|
||||||
import de.hsadmin.bo.pac.Pac;
|
import de.hsadmin.bo.pac.Pac;
|
||||||
@ -16,14 +16,11 @@ import de.hsadmin.common.error.UserError;
|
|||||||
import de.hsadmin.common.error.UserErrorList;
|
import de.hsadmin.common.error.UserErrorList;
|
||||||
import de.hsadmin.common.error.UserException;
|
import de.hsadmin.common.error.UserException;
|
||||||
import de.hsadmin.common.util.DateUtil;
|
import de.hsadmin.common.util.DateUtil;
|
||||||
import de.hsadmin.dao.customer.CustomerDao;
|
|
||||||
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;
|
||||||
import de.hsadmin.login.ScopePolicy;
|
import de.hsadmin.login.ScopePolicy;
|
||||||
import de.hsadmin.module.impl.AbstractModule;
|
import de.hsadmin.module.impl.AbstractModule;
|
||||||
import de.hsadmin.module.property.StringSet;
|
|
||||||
import de.hsadmin.module.property.StringSetProperty;
|
|
||||||
import de.hsadmin.module.util.QueryBuilder;
|
import de.hsadmin.module.util.QueryBuilder;
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
@ -32,9 +29,6 @@ public class CustomerService extends AbstractModule<CustomerVO> implements Custo
|
|||||||
@PersistenceContext(name="hsar")
|
@PersistenceContext(name="hsar")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@EJB
|
|
||||||
private CustomerDao customerDao;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustomerVO buildVO() throws TechnicalException {
|
public CustomerVO buildVO() throws TechnicalException {
|
||||||
return new CustomerVO();
|
return new CustomerVO();
|
||||||
@ -47,14 +41,12 @@ public class CustomerService extends AbstractModule<CustomerVO> implements Custo
|
|||||||
final CustomerVO customerVO = super.create(requestContext, prototype);
|
final CustomerVO customerVO = super.create(requestContext, prototype);
|
||||||
final String[] priceLists = customerVO.getPriceLists();
|
final String[] priceLists = customerVO.getPriceLists();
|
||||||
if (priceLists == null) {
|
if (priceLists == null) {
|
||||||
final StringSet stringSet = new StringSet();
|
customerVO.setPriceLists(new String[] { "Standard" });
|
||||||
stringSet.setStrings(new String[] { "Standard" });
|
|
||||||
((StringSetProperty) customerVO.get("priceLists")).setValue(stringSet);
|
|
||||||
}
|
}
|
||||||
final Customer customerBO = new Customer();
|
final Customer customerBO = new Customer();
|
||||||
customerVO.copyPropertiesToPersistentObject(customerBO);
|
customerVO.copyPropertiesToPersistentObject(customerBO);
|
||||||
entityManager.persist(customerBO);
|
entityManager.persist(customerBO);
|
||||||
final Customer newBO = customerDao.findCustomerByName(prototype);
|
final Customer newBO = findCustomerByName(prototype);
|
||||||
final CustomerVO newVO = new CustomerVO();
|
final CustomerVO newVO = new CustomerVO();
|
||||||
newVO.copyPropertiesFromPersistentObject(newBO);
|
newVO.copyPropertiesFromPersistentObject(newBO);
|
||||||
return newVO;
|
return newVO;
|
||||||
@ -79,7 +71,7 @@ public class CustomerService extends AbstractModule<CustomerVO> implements Custo
|
|||||||
throws UserException, TechnicalException {
|
throws UserException, TechnicalException {
|
||||||
final List<CustomerVO> customersForUpdate = super.update(requestContext, criteria, prototype);
|
final List<CustomerVO> customersForUpdate = super.update(requestContext, criteria, prototype);
|
||||||
for (CustomerVO vo : customersForUpdate) {
|
for (CustomerVO vo : customersForUpdate) {
|
||||||
final Customer customer = customerDao.findCustomerByName(vo);
|
final Customer customer = findCustomerByName(vo);
|
||||||
prototype.copyPropertiesToPersistentObject(customer);
|
prototype.copyPropertiesToPersistentObject(customer);
|
||||||
vo.copyPropertiesFromPersistentObject(customer);
|
vo.copyPropertiesFromPersistentObject(customer);
|
||||||
}
|
}
|
||||||
@ -119,4 +111,10 @@ public class CustomerService extends AbstractModule<CustomerVO> implements Custo
|
|||||||
errors.raiseException();
|
errors.raiseException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Customer findCustomerByName(final CustomerVO prototype) throws UserException, TechnicalException {
|
||||||
|
final Query query = entityManager.createQuery("SELECT c FROM Customer c WHERE c.name = :name");
|
||||||
|
query.setParameter("name", prototype.get("name").getValue());
|
||||||
|
return (Customer) query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,12 @@ public class CustomerVO extends AbstractVO {
|
|||||||
@ReadWrite(ReadWritePolicy.READWRITE)
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
private Date nonDiscContract;
|
private Date nonDiscContract;
|
||||||
|
|
||||||
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
|
private Date sharesUpdated;
|
||||||
|
|
||||||
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
|
private Integer sharesSigned;
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.READWRITE)
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
private Boolean free;
|
private Boolean free;
|
||||||
|
|
||||||
@ -68,11 +74,10 @@ public class CustomerVO extends AbstractVO {
|
|||||||
|
|
||||||
@ElementsType(SEPADirectDebitVO.class)
|
@ElementsType(SEPADirectDebitVO.class)
|
||||||
@ReadWrite(ReadWritePolicy.READ)
|
@ReadWrite(ReadWritePolicy.READ)
|
||||||
@Display(visible=DisplayPolicy.OPTIONAL)
|
@Display(visible=DisplayPolicy.NEVER)
|
||||||
private List<SEPADirectDebitVO> sepaDirectDebits;
|
private List<SEPADirectDebitVO> sepaDirectDebits;
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.READWRITE)
|
@ReadWrite(ReadWritePolicy.READWRITE)
|
||||||
@Display(visible=DisplayPolicy.NEVER)
|
|
||||||
private final StringSet priceLists;
|
private final StringSet priceLists;
|
||||||
|
|
||||||
public CustomerVO() throws TechnicalException {
|
public CustomerVO() throws TechnicalException {
|
||||||
@ -136,6 +141,22 @@ public class CustomerVO extends AbstractVO {
|
|||||||
this.nonDiscContract = nonDiscContract;
|
this.nonDiscContract = nonDiscContract;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getSharesUpdated() {
|
||||||
|
return sharesUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSharesUpdated(Date sharesUpdated) {
|
||||||
|
this.sharesUpdated = sharesUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSharesSigned() {
|
||||||
|
return sharesSigned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSharesSigned(Integer sharesSigned) {
|
||||||
|
this.sharesSigned = sharesSigned;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getFree() {
|
public Boolean getFree() {
|
||||||
return free;
|
return free;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import de.hsadmin.xmlrpc.AbstractRemote;
|
|
||||||
import de.hsadmin.xmlrpc.Remote;
|
|
||||||
|
|
||||||
public class MemberAssetRemote extends AbstractRemote<MemberAssetVO> implements Remote {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getModuleLookup() {
|
|
||||||
return MemberAssetServiceLocal.class.getSimpleName();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.NotImplementedException;
|
|
||||||
|
|
||||||
import de.hsadmin.bo.customer.MemberAsset;
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
import de.hsadmin.dao.customer.CustomerDao;
|
|
||||||
import de.hsadmin.login.RequestContext;
|
|
||||||
import de.hsadmin.login.RequiredScope;
|
|
||||||
import de.hsadmin.login.Role;
|
|
||||||
import de.hsadmin.login.ScopePolicy;
|
|
||||||
import de.hsadmin.module.impl.AbstractModule;
|
|
||||||
import de.hsadmin.module.util.QueryBuilder;
|
|
||||||
|
|
||||||
@Stateless
|
|
||||||
public class MemberAssetService extends AbstractModule<MemberAssetVO> implements MemberAssetServiceLocal {
|
|
||||||
|
|
||||||
@PersistenceContext(name="hsar")
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
@EJB
|
|
||||||
private CustomerDao customerDao;
|
|
||||||
|
|
||||||
public MemberAssetService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public MemberAssetService(final EntityManager em, final CustomerDao customerDao) {
|
|
||||||
this.entityManager = em;
|
|
||||||
this.customerDao = customerDao;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MemberAssetVO buildVO() throws TechnicalException {
|
|
||||||
return new MemberAssetVO();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
|
|
||||||
public MemberAssetVO create(final RequestContext requestContext, final MemberAssetVO prototype)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
final MemberAssetVO vo = super.create(requestContext, prototype);
|
|
||||||
final MemberAsset bo = new MemberAsset();
|
|
||||||
bo.setCustomer(customerDao.findCustomerByName(prototype.getCustomer()));
|
|
||||||
vo.copyPropertiesToPersistentObject(bo);
|
|
||||||
entityManager.persist(bo);
|
|
||||||
final MemberAssetVO newVO = new MemberAssetVO();
|
|
||||||
newVO.copyPropertiesFromPersistentObject(bo);
|
|
||||||
return newVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM), @ScopePolicy(value=Role.CUSTOMER, property="customer")})
|
|
||||||
public List<MemberAssetVO> read(final RequestContext requestContext, final MemberAssetVO criteria)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
final List<MemberAssetVO> emptyList = super.read(requestContext, criteria);
|
|
||||||
final List<MemberAsset> list = runCriteriaQuery(criteria);
|
|
||||||
for (MemberAsset c : list) {
|
|
||||||
final MemberAssetVO vo = new MemberAssetVO();
|
|
||||||
vo.copyPropertiesFromPersistentObject(c);
|
|
||||||
emptyList.add(vo);
|
|
||||||
}
|
|
||||||
return emptyList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
|
|
||||||
public List<MemberAssetVO> update(final RequestContext requestContext, final MemberAssetVO criteria, final MemberAssetVO prototype)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
throw new TechnicalException(new NotImplementedException("MemberAsset are immutable"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
|
|
||||||
public void delete(final RequestContext requestContext, final MemberAssetVO criteria)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
throw new TechnicalException(new NotImplementedException("MemberAsset are immutable"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// macht diese Klasse Unit-testbar
|
|
||||||
List<MemberAsset> runCriteriaQuery(final MemberAssetVO criteria) throws UserException, TechnicalException {
|
|
||||||
return QueryBuilder.newBuilder(entityManager, MemberAsset.class).getResultList(criteria);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import javax.ejb.Local;
|
|
||||||
|
|
||||||
import de.hsadmin.module.Module;
|
|
||||||
|
|
||||||
@Local
|
|
||||||
public interface MemberAssetServiceLocal extends Module<MemberAssetVO> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,98 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
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.Required;
|
|
||||||
import de.hsadmin.module.property.Search;
|
|
||||||
import de.hsadmin.module.property.SearchPolicy;
|
|
||||||
import de.hsadmin.module.property.mapping.DefaultEnumPersistentObjectMapper;
|
|
||||||
import de.hsadmin.module.property.mapping.DefaultStringParameterMapMapper;
|
|
||||||
import de.hsadmin.module.property.mapping.Mapping;
|
|
||||||
import de.hsadmin.module.property.mapping.ReferredStringPersistentObjectMapper;
|
|
||||||
|
|
||||||
public class MemberAssetVO extends AbstractVO implements ValueObject {
|
|
||||||
|
|
||||||
@Mapping(boMapping=ReferredStringPersistentObjectMapper.class,
|
|
||||||
rpcMapping=DefaultStringParameterMapMapper.class,
|
|
||||||
boMappingPath="customer.name")
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
@Search(SearchPolicy.EQUALS)
|
|
||||||
private String customer;
|
|
||||||
|
|
||||||
@Mapping(boMapping=DefaultEnumPersistentObjectMapper.class,
|
|
||||||
rpcMapping=DefaultStringParameterMapMapper.class,
|
|
||||||
boMappingPath="customer.name")
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
@Search(SearchPolicy.EQUALS)
|
|
||||||
private String action;
|
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
private Date date;
|
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
private BigDecimal amount;
|
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
private String comment;
|
|
||||||
|
|
||||||
public MemberAssetVO() throws TechnicalException {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCustomer() {
|
|
||||||
return customer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomer(String customer) {
|
|
||||||
this.customer = customer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAction() {
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAction(String action) {
|
|
||||||
this.action = action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(Date date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAmount() {
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAmount(BigDecimal amount) {
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "MemberShareVO [customer=" + customer + ", action=" + action + ", date=" + date + ", amount="
|
|
||||||
+ amount + ", comment=" + comment + "]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import de.hsadmin.xmlrpc.AbstractRemote;
|
|
||||||
import de.hsadmin.xmlrpc.Remote;
|
|
||||||
|
|
||||||
|
|
||||||
public class MemberShareRemote extends AbstractRemote<MemberShareVO> implements Remote {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getModuleLookup() {
|
|
||||||
return MemberShareServiceLocal.class.getSimpleName();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.NotImplementedException;
|
|
||||||
|
|
||||||
import de.hsadmin.bo.customer.MemberShare;
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
import de.hsadmin.dao.customer.CustomerDao;
|
|
||||||
import de.hsadmin.login.RequestContext;
|
|
||||||
import de.hsadmin.login.RequiredScope;
|
|
||||||
import de.hsadmin.login.Role;
|
|
||||||
import de.hsadmin.login.ScopePolicy;
|
|
||||||
import de.hsadmin.module.impl.AbstractModule;
|
|
||||||
import de.hsadmin.module.util.QueryBuilder;
|
|
||||||
|
|
||||||
@Stateless
|
|
||||||
public class MemberShareService extends AbstractModule<MemberShareVO> implements MemberShareServiceLocal {
|
|
||||||
|
|
||||||
@PersistenceContext(name="hsar")
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
@EJB
|
|
||||||
private CustomerDao customerDao;
|
|
||||||
|
|
||||||
public MemberShareService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public MemberShareService(final EntityManager em, final CustomerDao customerDao) {
|
|
||||||
this.entityManager = em;
|
|
||||||
this.customerDao = customerDao;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MemberShareVO buildVO() throws TechnicalException {
|
|
||||||
return new MemberShareVO();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
|
|
||||||
public MemberShareVO create(final RequestContext requestContext, final MemberShareVO prototype)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
final MemberShareVO vo = super.create(requestContext, prototype);
|
|
||||||
final MemberShare bo = new MemberShare();
|
|
||||||
bo.setCustomer(customerDao.findCustomerByName(prototype.getCustomer()));
|
|
||||||
vo.copyPropertiesToPersistentObject(bo);
|
|
||||||
entityManager.persist(bo);
|
|
||||||
final MemberShareVO newVO = new MemberShareVO();
|
|
||||||
newVO.copyPropertiesFromPersistentObject(bo);
|
|
||||||
return newVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM), @ScopePolicy(value=Role.CUSTOMER, property="customer")})
|
|
||||||
public List<MemberShareVO> read(final RequestContext requestContext, final MemberShareVO criteria)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
final List<MemberShareVO> emptyList = super.read(requestContext, criteria);
|
|
||||||
final List<MemberShare> list = runCriteriaQuery(criteria);
|
|
||||||
for (MemberShare c : list) {
|
|
||||||
final MemberShareVO vo = new MemberShareVO();
|
|
||||||
vo.copyPropertiesFromPersistentObject(c);
|
|
||||||
emptyList.add(vo);
|
|
||||||
}
|
|
||||||
return emptyList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
|
|
||||||
public List<MemberShareVO> update(final RequestContext requestContext, final MemberShareVO criteria, final MemberShareVO prototype)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
throw new TechnicalException(new NotImplementedException("MemberShares are immutable"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({@ScopePolicy(Role.SYSTEM)})
|
|
||||||
public void delete(final RequestContext requestContext, final MemberShareVO criteria)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
throw new TechnicalException(new NotImplementedException("MemberShares are immutable"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// macht diese Klasse Unit-testbar
|
|
||||||
List<MemberShare> runCriteriaQuery(final MemberShareVO criteria) throws UserException, TechnicalException {
|
|
||||||
return QueryBuilder.newBuilder(entityManager, MemberShare.class).getResultList(criteria);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import javax.ejb.Local;
|
|
||||||
|
|
||||||
import de.hsadmin.module.Module;
|
|
||||||
|
|
||||||
@Local
|
|
||||||
public interface MemberShareServiceLocal extends Module<MemberShareVO> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
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.Required;
|
|
||||||
import de.hsadmin.module.property.Search;
|
|
||||||
import de.hsadmin.module.property.SearchPolicy;
|
|
||||||
import de.hsadmin.module.property.mapping.DefaultEnumPersistentObjectMapper;
|
|
||||||
import de.hsadmin.module.property.mapping.DefaultStringParameterMapMapper;
|
|
||||||
import de.hsadmin.module.property.mapping.Mapping;
|
|
||||||
import de.hsadmin.module.property.mapping.ReferredStringPersistentObjectMapper;
|
|
||||||
|
|
||||||
public class MemberShareVO extends AbstractVO implements ValueObject {
|
|
||||||
|
|
||||||
@Mapping(boMapping=ReferredStringPersistentObjectMapper.class,
|
|
||||||
rpcMapping=DefaultStringParameterMapMapper.class,
|
|
||||||
boMappingPath="customer.name")
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
@Search(SearchPolicy.EQUALS)
|
|
||||||
private String customer;
|
|
||||||
|
|
||||||
@Mapping(boMapping=DefaultEnumPersistentObjectMapper.class,
|
|
||||||
rpcMapping=DefaultStringParameterMapMapper.class,
|
|
||||||
boMappingPath="customer.name")
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
@Search(SearchPolicy.EQUALS)
|
|
||||||
private String action;
|
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
private Date date;
|
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
private Integer quantity;
|
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.WRITEONCE)
|
|
||||||
@Required(true)
|
|
||||||
private String comment;
|
|
||||||
|
|
||||||
public MemberShareVO() throws TechnicalException {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCustomer() {
|
|
||||||
return customer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCustomer(String customer) {
|
|
||||||
this.customer = customer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAction() {
|
|
||||||
return action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAction(String action) {
|
|
||||||
this.action = action;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getDate() {
|
|
||||||
return date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDate(Date date) {
|
|
||||||
this.date = date;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getQuantity() {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantity(Integer quantity) {
|
|
||||||
this.quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "MemberShareVO [customer=" + customer + ", action=" + action + ", date=" + date + ", quantity="
|
|
||||||
+ quantity + ", comment=" + comment + "]";
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import de.hsadmin.xmlrpc.AbstractRemote;
|
|
||||||
import de.hsadmin.xmlrpc.Remote;
|
|
||||||
|
|
||||||
public class RoleRemote extends AbstractRemote<RoleVO> implements Remote {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getModuleLookup() {
|
|
||||||
return "RoleServiceLocal";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
import de.hsadmin.login.RequestContext;
|
|
||||||
import de.hsadmin.login.RequiredScope;
|
|
||||||
import de.hsadmin.login.Role;
|
|
||||||
import de.hsadmin.login.ScopePolicy;
|
|
||||||
import de.hsadmin.module.impl.AbstractModule;
|
|
||||||
import de.hsadmin.module.property.StringProperty;
|
|
||||||
|
|
||||||
@Stateless
|
|
||||||
public class RoleService extends AbstractModule<RoleVO> implements RoleServiceLocal {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RoleVO buildVO() throws TechnicalException {
|
|
||||||
return new RoleVO();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({ @ScopePolicy(Role.NONE) })
|
|
||||||
public RoleVO create(RequestContext requestContext, RoleVO prototype) throws UserException, TechnicalException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({ @ScopePolicy(Role.ANY) })
|
|
||||||
public List<RoleVO> read(RequestContext requestContext, RoleVO criteria) throws UserException, TechnicalException {
|
|
||||||
final Role loginRole = requestContext.getLoginRole();
|
|
||||||
final ArrayList<RoleVO> userRoles = new ArrayList<RoleVO>();
|
|
||||||
final RoleVO roleVO = buildVO();
|
|
||||||
roleVO.setRole(loginRole.name());
|
|
||||||
((StringProperty) roleVO.get("role")).setValue(loginRole.name());
|
|
||||||
userRoles.add(roleVO);
|
|
||||||
return userRoles;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({ @ScopePolicy(Role.NONE) })
|
|
||||||
public List<RoleVO> update(RequestContext requestContext, RoleVO criteria, RoleVO prototype)
|
|
||||||
throws UserException, TechnicalException {
|
|
||||||
return new ArrayList<RoleVO>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@RequiredScope({ @ScopePolicy(Role.NONE) })
|
|
||||||
public void delete(RequestContext requestContext, RoleVO criteria) throws UserException, TechnicalException {
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import javax.ejb.Local;
|
|
||||||
|
|
||||||
import de.hsadmin.module.Module;
|
|
||||||
|
|
||||||
@Local
|
|
||||||
public interface RoleServiceLocal extends Module<RoleVO> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package de.hsadmin.service.customer;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
|
|
||||||
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.Required;
|
|
||||||
|
|
||||||
public class RoleVO extends AbstractVO implements ValueObject {
|
|
||||||
|
|
||||||
@ReadWrite(ReadWritePolicy.READ)
|
|
||||||
@Required(true)
|
|
||||||
@Size(min=1,max=24)
|
|
||||||
private String role;
|
|
||||||
|
|
||||||
public RoleVO() throws TechnicalException {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRole() {
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRole(String role) {
|
|
||||||
this.role = role;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -2,16 +2,16 @@ package de.hsadmin.service.customer;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
||||||
|
import de.hsadmin.bo.customer.Contact;
|
||||||
|
import de.hsadmin.bo.customer.Customer;
|
||||||
import de.hsadmin.bo.customer.SEPADirectDebit;
|
import de.hsadmin.bo.customer.SEPADirectDebit;
|
||||||
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.dao.customer.CustomerDao;
|
|
||||||
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;
|
||||||
@ -25,9 +25,6 @@ public class SEPADirectDebitService extends AbstractModule<SEPADirectDebitVO> im
|
|||||||
@PersistenceContext(name="hsar")
|
@PersistenceContext(name="hsar")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@EJB
|
|
||||||
private CustomerDao customerDao;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SEPADirectDebitVO buildVO() throws TechnicalException {
|
public SEPADirectDebitVO buildVO() throws TechnicalException {
|
||||||
return new SEPADirectDebitVO();
|
return new SEPADirectDebitVO();
|
||||||
@ -39,7 +36,7 @@ public class SEPADirectDebitService extends AbstractModule<SEPADirectDebitVO> im
|
|||||||
throws UserException, TechnicalException {
|
throws UserException, TechnicalException {
|
||||||
final SEPADirectDebitVO vo = super.create(requestContext, prototype);
|
final SEPADirectDebitVO vo = super.create(requestContext, prototype);
|
||||||
final SEPADirectDebit bo = new SEPADirectDebit();
|
final SEPADirectDebit bo = new SEPADirectDebit();
|
||||||
bo.setCustomer(customerDao.findCustomerByName(prototype.getCustomer()));
|
bo.setCustomer(findCustomerByName(prototype.getCustomer()));
|
||||||
vo.copyPropertiesToPersistentObject(bo);
|
vo.copyPropertiesToPersistentObject(bo);
|
||||||
entityManager.persist(bo);
|
entityManager.persist(bo);
|
||||||
final SEPADirectDebit newBO = findMandatByValues(vo);
|
final SEPADirectDebit newBO = findMandatByValues(vo);
|
||||||
@ -80,9 +77,9 @@ public class SEPADirectDebitService extends AbstractModule<SEPADirectDebitVO> im
|
|||||||
public void delete(final RequestContext requestContext, final SEPADirectDebitVO criteria)
|
public void delete(final RequestContext requestContext, final SEPADirectDebitVO criteria)
|
||||||
throws UserException, TechnicalException {
|
throws UserException, TechnicalException {
|
||||||
super.delete(requestContext, criteria);
|
super.delete(requestContext, criteria);
|
||||||
final List<SEPADirectDebit> list = QueryBuilder.newBuilder(entityManager, SEPADirectDebit.class).getResultList(criteria);
|
final List<Contact> list = QueryBuilder.newBuilder(entityManager, Contact.class).getResultList(criteria);
|
||||||
for (SEPADirectDebit m : list) {
|
for (Contact c : list) {
|
||||||
entityManager.remove(m);
|
entityManager.remove(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,4 +91,11 @@ public class SEPADirectDebitService extends AbstractModule<SEPADirectDebitVO> im
|
|||||||
query.setParameter("mandatSigned", prototype.get("mandatSigned").getValue());
|
query.setParameter("mandatSigned", prototype.get("mandatSigned").getValue());
|
||||||
return (SEPADirectDebit) query.getSingleResult();
|
return (SEPADirectDebit) query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Customer findCustomerByName(final String customer) throws UserException {
|
||||||
|
final Query query = entityManager.createQuery("SELECT c FROM Customer c WHERE c.name = :name");
|
||||||
|
query.setParameter("name", customer);
|
||||||
|
return (Customer) query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import java.net.UnknownHostException;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
@ -27,7 +26,6 @@ import de.hsadmin.login.Role;
|
|||||||
import de.hsadmin.login.ScopePolicy;
|
import de.hsadmin.login.ScopePolicy;
|
||||||
import de.hsadmin.module.impl.AbstractModule;
|
import de.hsadmin.module.impl.AbstractModule;
|
||||||
import de.hsadmin.module.util.QueryBuilder;
|
import de.hsadmin.module.util.QueryBuilder;
|
||||||
import de.hsadmin.dao.customer.CustomerDao;
|
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class PacService extends AbstractModule<PacVO> implements PacServiceLocal {
|
public class PacService extends AbstractModule<PacVO> implements PacServiceLocal {
|
||||||
@ -35,9 +33,6 @@ public class PacService extends AbstractModule<PacVO> implements PacServiceLocal
|
|||||||
@PersistenceContext(name="hsar")
|
@PersistenceContext(name="hsar")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@EJB
|
|
||||||
private CustomerDao customerDao;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PacVO buildVO() throws TechnicalException {
|
public PacVO buildVO() throws TechnicalException {
|
||||||
return new PacVO();
|
return new PacVO();
|
||||||
@ -69,7 +64,7 @@ public class PacService extends AbstractModule<PacVO> implements PacServiceLocal
|
|||||||
throw new UserException(new UserError(UserError.MSG_MISSING_AUTHORIZATION, "add"));
|
throw new UserException(new UserError(UserError.MSG_MISSING_AUTHORIZATION, "add"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bo.setCustomer(customerDao.findCustomerByName(customerProperty));
|
bo.setCustomer(findCustomerByName(customerProperty));
|
||||||
vo.copyPropertiesToPersistentObject(bo);
|
vo.copyPropertiesToPersistentObject(bo);
|
||||||
if (bo.getCreated() == null) {
|
if (bo.getCreated() == null) {
|
||||||
bo.setCreated(new Date());
|
bo.setCreated(new Date());
|
||||||
@ -105,7 +100,7 @@ public class PacService extends AbstractModule<PacVO> implements PacServiceLocal
|
|||||||
final Pac bo = findPacByName(vo.getName());
|
final Pac bo = findPacByName(vo.getName());
|
||||||
final String customerName = prototype.getCustomer();
|
final String customerName = prototype.getCustomer();
|
||||||
if (customerName != null && !customerName.isEmpty()) {
|
if (customerName != null && !customerName.isEmpty()) {
|
||||||
final Customer customer = customerDao.findCustomerByName(customerName);
|
final Customer customer = findCustomerByName(customerName);
|
||||||
bo.setCustomer(customer);
|
bo.setCustomer(customer);
|
||||||
}
|
}
|
||||||
prototype.copyPropertiesToPersistentObject(bo);
|
prototype.copyPropertiesToPersistentObject(bo);
|
||||||
@ -167,4 +162,11 @@ public class PacService extends AbstractModule<PacVO> implements PacServiceLocal
|
|||||||
query.setParameter("name", value);
|
query.setParameter("name", value);
|
||||||
return (BasePac) query.getSingleResult();
|
return (BasePac) query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Customer findCustomerByName(final String value) {
|
||||||
|
final Query query = entityManager.createQuery("SELECT c FROM Customer c WHERE c.name = :name");
|
||||||
|
query.setParameter("name", value);
|
||||||
|
return (Customer) query.getSingleResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,8 @@
|
|||||||
<jta-data-source>HsarDataSource</jta-data-source>
|
<jta-data-source>HsarDataSource</jta-data-source>
|
||||||
<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.MemberShare</class>
|
|
||||||
<class>de.hsadmin.bo.customer.MemberAsset</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>
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
role=de.hsadmin.service.customer.RoleRemote
|
|
||||||
customer=de.hsadmin.service.customer.CustomerRemote
|
customer=de.hsadmin.service.customer.CustomerRemote
|
||||||
contact=de.hsadmin.service.customer.ContactRemote
|
contact=de.hsadmin.service.customer.ContactRemote
|
||||||
mandat=de.hsadmin.service.customer.SEPADirectDebitRemote
|
mandat=de.hsadmin.service.customer.SEPADirectDebitRemote
|
||||||
memberShare=de.hsadmin.service.customer.MemberShareRemote
|
|
||||||
memberAsset=de.hsadmin.service.customer.MemberAssetRemote
|
|
||||||
hive=de.hsadmin.service.pac.HiveRemote
|
hive=de.hsadmin.service.pac.HiveRemote
|
||||||
|
pac=de.hsadmin.service.pac.PacRemote
|
||||||
property=de.hsadmin.service.property.PropertyRemote
|
property=de.hsadmin.service.property.PropertyRemote
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
version="2.5">
|
version="2.5">
|
||||||
|
|
||||||
@ -17,4 +18,5 @@
|
|||||||
<url-pattern>/xmlrpc/*</url-pattern>
|
<url-pattern>/xmlrpc/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
34
cust-services/src/test/java/de/hsadmin/test/pac/PacIT.java
Normal file
34
cust-services/src/test/java/de/hsadmin/test/pac/PacIT.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package de.hsadmin.test.pac;
|
||||||
|
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class PacIT {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUpBeforeClass() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void tearDownAfterClass() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
|
|
||||||
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
|
||||||
<persistence-unit name="HSADMIN_H2_TEST_DB" transaction-type="RESOURCE_LOCAL">
|
|
||||||
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
|
|
||||||
|
|
||||||
<!-- auto scanning fails if there are methods returning entities in the test :-( -->
|
|
||||||
<class>de.hsadmin.bo.customer.Contact</class>
|
|
||||||
<class>de.hsadmin.bo.customer.Customer</class>
|
|
||||||
<class>de.hsadmin.bo.customer.MemberShare</class>
|
|
||||||
<class>de.hsadmin.bo.customer.MemberAsset</class>
|
|
||||||
<class>de.hsadmin.bo.customer.SEPADirectDebit</class>
|
|
||||||
<class>de.hsadmin.bo.domain.Domain</class>
|
|
||||||
<class>de.hsadmin.bo.domain.DomainOption</class>
|
|
||||||
<class>de.hsadmin.bo.domain.EMailAddress</class>
|
|
||||||
<class>de.hsadmin.bo.pac.BaseComponent</class>
|
|
||||||
<class>de.hsadmin.bo.pac.BasePac</class>
|
|
||||||
<class>de.hsadmin.bo.pac.Component</class>
|
|
||||||
<class>de.hsadmin.bo.pac.EMailAlias</class>
|
|
||||||
<class>de.hsadmin.bo.pac.Hive</class>
|
|
||||||
<class>de.hsadmin.bo.pac.INetAddress</class>
|
|
||||||
<class>de.hsadmin.bo.pac.Pac</class>
|
|
||||||
<class>de.hsadmin.bo.pac.PacComponent</class>
|
|
||||||
<class>de.hsadmin.bo.pac.UnixUser</class>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
|
|
||||||
<!-- HSQLDB
|
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver" />
|
|
||||||
<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:.hsadmin-test-db" />
|
|
||||||
<property name="javax.persistence.jdbc.user" value="sa" />
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- H2 -->
|
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
|
|
||||||
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:.hsadmin-test-db;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;MVCC=true" />
|
|
||||||
<property name="javax.persistence.jdbc.user" value="sa" />
|
|
||||||
|
|
||||||
<!-- Derby
|
|
||||||
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
|
|
||||||
<property name="javax.persistence.jdbc.url" value="jdbc:derby:.hsadmin-test-db/derbydb3;create=true" /> -->
|
|
||||||
|
|
||||||
<!-- OpenJPA -->
|
|
||||||
<property name="openjpa.RuntimeUnenhancedClasses" value="warn" />
|
|
||||||
</properties>
|
|
||||||
</persistence-unit>
|
|
||||||
</persistence>
|
|
@ -1,4 +1,4 @@
|
|||||||
ticketvalidator.class=de.hsadmin.login.cas.TestTicketValidator
|
ticketvalidator.class=de.hsadmin.login.TestTicketValidator
|
||||||
cas.validate.url=https://login.hostsharing.net:443/cas/proxyValidate
|
cas.validate.url=https://login.hostsharing.net:443/cas/proxyValidate
|
||||||
cas.service.url=https://config.hostsharing.net:443/hsar/backend
|
cas.service.url=https://config.hostsharing.net:443/hsar/backend
|
||||||
accountprefix.hostmaster=hsh01
|
accountprefix.hostmaster=hsh01
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>hsadmin-parent</artifactId>
|
<artifactId>hsadmin-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>database-webapp</artifactId>
|
<artifactId>database-webapp</artifactId>
|
||||||
@ -15,34 +15,35 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<version>${hsadmin.version}</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>cust-webapp</artifactId>
|
<artifactId>cust-webapp</artifactId>
|
||||||
<version>${hsadmin.version}</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.geronimo.specs</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>geronimo-jpa_2.2_spec</artifactId>
|
<artifactId>geronimo-jpa_2.0_spec</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.geronimo.specs</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>geronimo-ejb_3.1_spec</artifactId>
|
<artifactId>geronimo-ejb_3.0_spec</artifactId>
|
||||||
<version>1.0.2</version>
|
<version>1.0.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.geronimo.specs</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>geronimo-validation_2.0_spec</artifactId>
|
<artifactId>geronimo-validation_1.0_spec</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
<artifactId>xmlrpc-server</artifactId>
|
<artifactId>xmlrpc-server</artifactId>
|
||||||
<version>${xmlrpc.version}</version>
|
<version>3.1.3</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
@ -55,17 +56,23 @@
|
|||||||
<finalName>database-webapp</finalName>
|
<finalName>database-webapp</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.tomee.maven</groupId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<artifactId>tomee-maven-plugin</artifactId>
|
|
||||||
<version>${tomee.version}</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<tomeeVersion>${tomee.version}</tomeeVersion>
|
<archiveClasses>true</archiveClasses>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.openejb.maven</groupId>
|
||||||
|
<artifactId>tomee-maven-plugin</artifactId>
|
||||||
|
<version>1.7.4</version>
|
||||||
|
<configuration>
|
||||||
|
<tomeeVersion>1.7.4</tomeeVersion>
|
||||||
<tomeeClassifier>webprofile</tomeeClassifier>
|
<tomeeClassifier>webprofile</tomeeClassifier>
|
||||||
<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>
|
||||||
<libs>
|
<libs>
|
||||||
<lib>${postgresql.lib}</lib>
|
<lib>org.postgresql:postgresql:9.4.1212.jre7</lib>
|
||||||
</libs>
|
</libs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
1
db-migration/.gitignore
vendored
1
db-migration/.gitignore
vendored
@ -2,4 +2,3 @@
|
|||||||
/.classpath
|
/.classpath
|
||||||
/.project
|
/.project
|
||||||
/.settings/
|
/.settings/
|
||||||
/bin/
|
|
||||||
|
@ -74,17 +74,31 @@ INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quanti
|
|||||||
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
|
||||||
SELECT basepacket_id, basecomponent_id, 10, 1000, 10, 10, 0, false, 430 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND basecomponent_code='TRAFFIC';
|
SELECT basepacket_id, basecomponent_id, 10, 1000, 10, 10, 0, false, 430 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND basecomponent_code='TRAFFIC';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table: role
|
||||||
|
--
|
||||||
|
INSERT INTO role (role_name) VALUES ('billing');
|
||||||
|
INSERT INTO role (role_name) VALUES ('operation');
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table: business_partner
|
-- Table: business_partner
|
||||||
--
|
--
|
||||||
INSERT INTO business_partner (member_id, member_code, member_since, free, indicator_vat, exempt_vat)
|
INSERT INTO business_partner (member_id, member_code, member_since, shares_signed, free, indicator_vat, exempt_vat)
|
||||||
VALUES (10000, 'hsh00-hsh', current_date, TRUE, 'NET', FALSE);
|
VALUES (10000, 'hsh00-hsh', current_date, 0, TRUE, 'NET', FALSE);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- table: contact
|
-- table: contact
|
||||||
--
|
--
|
||||||
INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
|
INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
|
||||||
SELECT bp_id, 'Herr', 'Uwe', 'Mueller', 'Hostsharing eG', 'service@hostsharing.net' FROM business_partner WHERE member_id=10000;
|
SELECT bp_id, 'Herr', 'Sigi', 'Superb', 'Hosting Inc.', 'info@example.com' FROM business_partner WHERE member_id=10000;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- table: contactrole_ref
|
||||||
|
--
|
||||||
|
INSERT INTO contactrole_ref ( contact_id, role )
|
||||||
|
SELECT contact_id, 'billing' FROM contact WHERE email='info@example.com';
|
||||||
|
INSERT INTO contactrole_ref ( contact_id, role )
|
||||||
|
SELECT contact_id, 'operation' FROM contact WHERE email='info@example.com';
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table: inet_addr
|
-- Table: inet_addr
|
||||||
@ -199,11 +213,10 @@ INSERT INTO domain_option (domain_option_name)
|
|||||||
--
|
--
|
||||||
-- table: price_list
|
-- table: price_list
|
||||||
--
|
--
|
||||||
INSERT INTO price_list (name) VALUES ('Default Price List');
|
INSERT INTO price_list VALUES (1, 'Default Price List');
|
||||||
|
|
||||||
--
|
--
|
||||||
-- table: customer_price_list_mapping
|
-- table: customer_price_list_mapping
|
||||||
--
|
--
|
||||||
INSERT INTO pricelist_ref (SELECT business_partner.bp_id, price_list.name FROM business_partner, price_list);
|
INSERT INTO pricelist_ref (SELECT bp_id, 'Default Price List' FROM business_partner);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
DROP TABLE pricelist_ref ;
|
|
||||||
DROP TABLE price ;
|
|
||||||
DROP TABLE price_list CASCADE ;
|
|
||||||
-- DROP VIEW business_partner_ticket ;
|
|
||||||
DROP TABLE sepa_mandat ;
|
|
||||||
DROP SEQUENCE sepa_mandat_id_seq ;
|
|
||||||
DROP SEQUENCE contact_contact_id_seq ;
|
|
||||||
DROP TABLE contact CASCADE ;
|
|
||||||
DROP TABLE database ;
|
|
||||||
DROP TABLE database_user ;
|
|
||||||
DROP SEQUENCE database_database_id_seq ;
|
|
||||||
DROP SEQUENCE dbuser_dbuser_id_seq ;
|
|
||||||
DROP TABLE emailaddr ;
|
|
||||||
DROP SEQUENCE emailaddr_emailaddr_id_seq ;
|
|
||||||
DROP TABLE emailalias ;
|
|
||||||
DROP SEQUENCE emailalias_emailalias_id_seq ;
|
|
||||||
DROP TABLE domain__domain_option ;
|
|
||||||
DROP TABLE domain_option ;
|
|
||||||
DROP SEQUENCE domain_option_id_seq ;
|
|
||||||
DROP TABLE domain ;
|
|
||||||
DROP SEQUENCE domain_domain_id_seq ;
|
|
||||||
DROP TABLE queue_task ;
|
|
||||||
DROP SEQUENCE queue_task_id_seq ;
|
|
||||||
DROP TABLE unixuser CASCADE ;
|
|
||||||
DROP SEQUENCE unixuser_unixuser_id_seq ;
|
|
||||||
DROP TABLE packet_component ;
|
|
||||||
DROP TABLE component ;
|
|
||||||
DROP TABLE basecomponent ;
|
|
||||||
DROP TABLE basepacket CASCADE ;
|
|
||||||
DROP SEQUENCE basecomponent_basecomponent_seq ;
|
|
||||||
DROP SEQUENCE basepacket_basepacket_id_seq ;
|
|
||||||
DROP TABLE packet ;
|
|
||||||
DROP SEQUENCE packet_packet_id_seq ;
|
|
||||||
DROP TABLE hive ;
|
|
||||||
DROP SEQUENCE hive_hive_id_seq ;
|
|
||||||
DROP TABLE inet_addr ;
|
|
||||||
DROP SEQUENCE inet_addr_inet_addr_id_seq ;
|
|
||||||
DROP TABLE business_partner CASCADE ;
|
|
||||||
DROP SEQUENCE business_partner_bp_id_seq ;
|
|
||||||
DROP SEQUENCE packet_component_id_seq ;
|
|
||||||
DROP SEQUENCE component_id_seq ;
|
|
||||||
DROP TABLE contactrole_ref CASCADE ;
|
|
||||||
DROP TABLE role CASCADE ;
|
|
@ -1,50 +0,0 @@
|
|||||||
|
|
||||||
CREATE TABLE member_asset (
|
|
||||||
member_asset_id integer NOT NULL,
|
|
||||||
bp_id integer NOT NULL,
|
|
||||||
date date,
|
|
||||||
action character varying(60),
|
|
||||||
amount numeric,
|
|
||||||
comment character varying(160)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE SEQUENCE member_asset_member_asset_id_seq
|
|
||||||
START WITH 1
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MINVALUE
|
|
||||||
NO MAXVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
ALTER SEQUENCE member_asset_member_asset_id_seq OWNED BY member_asset.member_asset_id;
|
|
||||||
|
|
||||||
ALTER TABLE ONLY member_asset ALTER COLUMN member_asset_id SET DEFAULT nextval('member_asset_member_asset_id_seq'::regclass);
|
|
||||||
|
|
||||||
CREATE TABLE member_share (
|
|
||||||
member_share_id integer NOT NULL,
|
|
||||||
bp_id integer NOT NULL,
|
|
||||||
date date,
|
|
||||||
action character varying(60),
|
|
||||||
quantity integer,
|
|
||||||
comment character varying(160)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE SEQUENCE member_share_member_share_id_seq
|
|
||||||
START WITH 1
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MINVALUE
|
|
||||||
NO MAXVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
ALTER SEQUENCE member_share_member_share_id_seq OWNED BY member_share.member_share_id;
|
|
||||||
|
|
||||||
ALTER TABLE ONLY member_share ALTER COLUMN member_share_id SET DEFAULT nextval('member_share_member_share_id_seq'::regclass);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY member_asset
|
|
||||||
ADD CONSTRAINT pk_member_asset PRIMARY KEY (member_asset_id);
|
|
||||||
|
|
||||||
ALTER TABLE ONLY member_share
|
|
||||||
ADD CONSTRAINT pk_member_share PRIMARY KEY (member_share_id);
|
|
||||||
|
|
||||||
ALTER TABLE business_partner DROP COLUMN shares_updated ;
|
|
||||||
|
|
||||||
ALTER TABLE business_partner DROP COLUMN shares_signed ;
|
|
File diff suppressed because it is too large
Load Diff
29
db-migration/database/migrate.sql
Normal file
29
db-migration/database/migrate.sql
Normal file
@ -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);
|
@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>hsadmin-parent</artifactId>
|
<artifactId>hsadmin-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>db-migration</artifactId>
|
<artifactId>db-migration</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
@ -12,13 +12,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
<version>${servlet.version}</version>
|
<version>3.0.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.liquibase</groupId>
|
<groupId>org.liquibase</groupId>
|
||||||
<artifactId>liquibase-core</artifactId>
|
<artifactId>liquibase-core</artifactId>
|
||||||
<version>${liquibase.version}</version>
|
<version>3.5.3</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@ -26,26 +26,20 @@
|
|||||||
<finalName>db-migration</finalName>
|
<finalName>db-migration</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.tomee.maven</groupId>
|
<groupId>org.apache.openejb.maven</groupId>
|
||||||
<artifactId>tomee-maven-plugin</artifactId>
|
<artifactId>tomee-maven-plugin</artifactId>
|
||||||
<version>${tomee.version}</version>
|
<version>1.7.4</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<tomeeVersion>${tomee.version}</tomeeVersion>
|
<tomeeVersion>1.7.4</tomeeVersion>
|
||||||
<tomeeClassifier>webprofile</tomeeClassifier>
|
<tomeeClassifier>webprofile</tomeeClassifier>
|
||||||
<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>
|
||||||
<libs>
|
<libs>
|
||||||
<lib>${postgresql.lib}</lib>
|
<lib>org.postgresql:postgresql:9.4.1212.jre7</lib>
|
||||||
</libs>
|
</libs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<version>2.2</version>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
@ -752,11 +752,33 @@
|
|||||||
</createTable>
|
</createTable>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
<changeSet author="phormanns" id="ph-20170729-01">
|
<changeSet author="phormanns" id="ph-20170412-01">
|
||||||
<dropColumn tableName="business_partner"
|
<createTable tableName="pac_administration">
|
||||||
columnName="shares_updated"/>
|
<column autoIncrement="true" name="pac_administration_id" type="SERIAL">
|
||||||
<dropColumn tableName="business_partner"
|
<constraints primaryKey="true" primaryKeyName="pk_pac_administration"/>
|
||||||
columnName="shares_signed"/>
|
</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>
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
@ -6,49 +6,55 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>de.hsadmin</groupId>
|
<groupId>de.hsadmin</groupId>
|
||||||
<artifactId>hsadmin-parent</artifactId>
|
<artifactId>hsadmin-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>framework</artifactId>
|
<artifactId>framework</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HSAdmin Framework</name>
|
<name>HSAdmin Framework</name>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<testFailureIgnore>true</testFailureIgnore>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.platform</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>jakarta.jakartaee-api</artifactId>
|
<artifactId>geronimo-jpa_2.0_spec</artifactId>
|
||||||
<version>8.0.0</version>
|
<version>1.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.bval</groupId>
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
<artifactId>org.apache.bval.bundle</artifactId>
|
<artifactId>geronimo-ejb_3.0_spec</artifactId>
|
||||||
<version>${bval.version}</version>
|
<version>1.0.1</version>
|
||||||
<scope>test</scope>
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.geronimo.specs</groupId>
|
||||||
|
<artifactId>geronimo-validation_1.0_spec</artifactId>
|
||||||
|
<version>1.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlrpc</groupId>
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
<artifactId>xmlrpc-server</artifactId>
|
<artifactId>xmlrpc-server</artifactId>
|
||||||
<version>${xmlrpc.version}</version>
|
<version>3.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<version>${log4j.version}</version>
|
<version>1.2.17</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.openjpa</groupId>
|
|
||||||
<artifactId>openjpa</artifactId>
|
|
||||||
<version>${openjpa.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.liquibase</groupId>
|
|
||||||
<artifactId>liquibase-core</artifactId>
|
|
||||||
<version>${liquibase.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
@ -4,10 +4,6 @@ public class TechnicalException extends Exception {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public TechnicalException(String message, Exception e) {
|
|
||||||
super(message, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TechnicalException(Exception e) {
|
public TechnicalException(Exception e) {
|
||||||
super(e);
|
super(e);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ public class UserError {
|
|||||||
public static final String MSG_INVALID_DATEFORMAT = "MSG_INVALID_DATEFORMAT";
|
public static final String MSG_INVALID_DATEFORMAT = "MSG_INVALID_DATEFORMAT";
|
||||||
public static final String MSG_FIELD_REQUIRES_MINLENGTH = "MSG_FIELD_REQUIRES_MINLENGTH";
|
public static final String MSG_FIELD_REQUIRES_MINLENGTH = "MSG_FIELD_REQUIRES_MINLENGTH";
|
||||||
public static final String MSG_FIELD_EXCEEDS_MAXLENGTH = "MSG_FIELD_EXCEEDS_MAXLENGTH";
|
public static final String MSG_FIELD_EXCEEDS_MAXLENGTH = "MSG_FIELD_EXCEEDS_MAXLENGTH";
|
||||||
|
public static final String MSG_FIELD_DOESNOT_MATCH_REGEXP = "MSG_FIELD_DOESNOT_MATCH_REGEXP";
|
||||||
public static final String MSG_UNKNOWN_KEY = "MSG_UNKNOWN_KEY";
|
public static final String MSG_UNKNOWN_KEY = "MSG_UNKNOWN_KEY";
|
||||||
public static final String MSG_INT_VALUE_EXPECTED = "MSG_INT_VALUE_EXPECTED";
|
public static final String MSG_INT_VALUE_EXPECTED = "MSG_INT_VALUE_EXPECTED";
|
||||||
public static final String MSG_PAC_NOT_CANCELLED = "MSG_PAC_NOT_CANCELLED";
|
public static final String MSG_PAC_NOT_CANCELLED = "MSG_PAC_NOT_CANCELLED";
|
||||||
|
@ -5,11 +5,6 @@ import java.beans.PropertyDescriptor;
|
|||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.common.error.UserError;
|
import de.hsadmin.common.error.UserError;
|
||||||
@ -43,7 +38,7 @@ public class ReflectionUtil {
|
|||||||
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass());
|
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass());
|
||||||
return propertyDescriptor.getReadMethod().invoke(anObject);
|
return propertyDescriptor.getReadMethod().invoke(anObject);
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | IntrospectionException e) {
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | IntrospectionException e) {
|
||||||
throw new TechnicalException("cannot get value from " + anObject + "." + propertyName, e);
|
throw new TechnicalException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,50 +47,17 @@ public class ReflectionUtil {
|
|||||||
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass());
|
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass());
|
||||||
propertyDescriptor.getWriteMethod().invoke(anObject, value);
|
propertyDescriptor.getWriteMethod().invoke(anObject, value);
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | IntrospectionException e) {
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | IntrospectionException e) {
|
||||||
throw new TechnicalException("cannot set " + value + " to " + anObject + "." + propertyName, e);
|
throw new TechnicalException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object newInstance(final Object anObject, String propertyName) throws TechnicalException {
|
public static Object newInstance(final Object anObject, String propertyName) throws TechnicalException {
|
||||||
try {
|
try {
|
||||||
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass());
|
final PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, anObject.getClass());
|
||||||
final Object newInstance = propertyDescriptor.getReadMethod().getReturnType().getDeclaredConstructor().newInstance();
|
final Object newInstance = propertyDescriptor.getReadMethod().getReturnType().newInstance();
|
||||||
invokeSetter(anObject, propertyName, newInstance);
|
invokeSetter(anObject, propertyName, newInstance);
|
||||||
return newInstance;
|
return newInstance;
|
||||||
} catch (InstantiationException | IllegalAccessException | IntrospectionException | TechnicalException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
} catch (InstantiationException | IllegalAccessException | IntrospectionException | TechnicalException e) {
|
||||||
throw new TechnicalException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Collection<String> getDeclaredFieldNames(Class<?> clazz) {
|
|
||||||
Field[] fields = clazz.getDeclaredFields();
|
|
||||||
Collection<String> fieldNames = new ArrayList<String>();
|
|
||||||
for ( Field f: fields ) {
|
|
||||||
if ( (f.getModifiers() & Modifier.STATIC) == 0 ) {
|
|
||||||
fieldNames.add(f.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fieldNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean reflectionEquals(Object o1, Object o2) {
|
|
||||||
Collection<String> excludesFieldNames = new ArrayList<String>();
|
|
||||||
|
|
||||||
// ignore generated fields, e.g. for OpenJPA proxies
|
|
||||||
if ( o1.getClass().isSynthetic() ) {
|
|
||||||
excludesFieldNames.addAll(ReflectionUtil.getDeclaredFieldNames(o1.getClass()));
|
|
||||||
}
|
|
||||||
ReflectionUtil.getDeclaredFieldNames(o2.getClass());
|
|
||||||
if ( o2.getClass().isSynthetic() ) {
|
|
||||||
excludesFieldNames.addAll(ReflectionUtil.getDeclaredFieldNames(o2.getClass()));
|
|
||||||
}
|
|
||||||
return EqualsBuilder.reflectionEquals(o1, 2, excludesFieldNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Class<?> getFieldType(Object persistentObject, String propertyName) throws TechnicalException {
|
|
||||||
try {
|
|
||||||
return persistentObject.getClass().getDeclaredField(propertyName).getType();
|
|
||||||
} catch (NoSuchFieldException | SecurityException e) {
|
|
||||||
throw new TechnicalException(e);
|
throw new TechnicalException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package de.hsadmin.login.cas;
|
package de.hsadmin.login;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -11,7 +11,6 @@ import de.hsadmin.common.config.Config;
|
|||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.common.error.UserError;
|
import de.hsadmin.common.error.UserError;
|
||||||
import de.hsadmin.common.error.UserException;
|
import de.hsadmin.common.error.UserException;
|
||||||
import de.hsadmin.login.TicketValidator;
|
|
||||||
|
|
||||||
public class CASTicketValidator implements TicketValidator {
|
public class CASTicketValidator implements TicketValidator {
|
||||||
|
|
||||||
@ -30,22 +29,20 @@ public class CASTicketValidator implements TicketValidator {
|
|||||||
throw new TechnicalException("TicketValidator is not initialized.");
|
throw new TechnicalException("TicketValidator is not initialized.");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final URL url = new URL(proxyValidateURL + "?service=" + proxyServiceURL + "&ticket=" + ticket);
|
URL url = new URL(proxyValidateURL + "?service=" + proxyServiceURL + "&ticket=" + ticket);
|
||||||
final URLConnection httpConnection = url.openConnection();
|
URLConnection httpConnection = url.openConnection();
|
||||||
httpConnection.connect();
|
httpConnection.connect();
|
||||||
final InputStream inputStream = httpConnection.getInputStream();
|
InputStream inputStream = httpConnection.getInputStream();
|
||||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
String nextLine = reader.readLine();
|
String nextLine = reader.readLine();
|
||||||
while (nextLine != null) {
|
while (nextLine != null) {
|
||||||
if (nextLine.contains("<cas:user>")) {
|
if (nextLine.contains("<cas:user>")) {
|
||||||
String user = extractUser(nextLine);
|
String user = extractUser(nextLine);
|
||||||
reader.close();
|
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
nextLine = reader.readLine();
|
nextLine = reader.readLine();
|
||||||
}
|
}
|
||||||
reader.close();
|
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
throw new UserException(new UserError(UserError.MSG_INVALID_TICKET));
|
throw new UserException(new UserError(UserError.MSG_INVALID_TICKET));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
@ -8,7 +8,6 @@ import de.hsadmin.common.config.Config;
|
|||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.common.error.UserError;
|
import de.hsadmin.common.error.UserError;
|
||||||
import de.hsadmin.common.error.UserException;
|
import de.hsadmin.common.error.UserException;
|
||||||
import de.hsadmin.login.cas.TicketValidatorFactory;
|
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class LoginService implements LoginServiceLocal {
|
public class LoginService implements LoginServiceLocal {
|
||||||
@ -16,6 +15,8 @@ public class LoginService implements LoginServiceLocal {
|
|||||||
@PersistenceContext(name = "hsar")
|
@PersistenceContext(name = "hsar")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
private TicketValidator ticketValidator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RequestContext createContext(final String ticket, final String runAsUser) throws UserException, TechnicalException {
|
public RequestContext createContext(final String ticket, final String runAsUser) throws UserException, TechnicalException {
|
||||||
if (ticket != null && !ticket.isEmpty()) {
|
if (ticket != null && !ticket.isEmpty()) {
|
||||||
@ -73,8 +74,21 @@ public class LoginService implements LoginServiceLocal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String validateTicket(final String ticket) throws TechnicalException, UserException {
|
private String validateTicket(final String ticket) throws TechnicalException, UserException {
|
||||||
final TicketValidator ticketValidator = TicketValidatorFactory.getTicketValidator();
|
final TicketValidator ticketValidator = getTicketValidator();
|
||||||
return ticketValidator.validate(ticket);
|
return ticketValidator.validate(ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TicketValidator getTicketValidator() throws TechnicalException {
|
||||||
|
if (ticketValidator == null) {
|
||||||
|
try {
|
||||||
|
final String property = Config.getInstance().getProperty(Config.TICKETVALIDATOR_CLASS);
|
||||||
|
final Class<?> validatorClass = Class.forName(property);
|
||||||
|
ticketValidator = (TicketValidator) validatorClass.newInstance();
|
||||||
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||||
|
throw new TechnicalException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ticketValidator;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
package de.hsadmin.login.cas;
|
package de.hsadmin.login;
|
||||||
|
|
||||||
import de.hsadmin.login.TicketValidator;
|
|
||||||
|
|
||||||
public class TestTicketValidator implements TicketValidator {
|
public class TestTicketValidator implements TicketValidator {
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
package de.hsadmin.login;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
|
|
||||||
public interface TicketProvider {
|
|
||||||
|
|
||||||
public String getTicket() throws TechnicalException;
|
|
||||||
|
|
||||||
public String getRunAs();
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package de.hsadmin.login.cas;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
|
|
||||||
public interface PasswordReader {
|
|
||||||
|
|
||||||
public String readPassword() throws TechnicalException;
|
|
||||||
|
|
||||||
public void println(final String text) throws TechnicalException;
|
|
||||||
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
package de.hsadmin.login.cas;
|
|
||||||
|
|
||||||
import de.hsadmin.common.config.Config;
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.login.TicketProvider;
|
|
||||||
|
|
||||||
public class TicketProviderFactory {
|
|
||||||
|
|
||||||
private static final String HOSTSHARING_LOGIN_URL = "https://login.hostsharing.net:443/cas/v1/tickets";
|
|
||||||
private static final String HOSTSHARING_BACKEND_URL = "https://config.hostsharing.net:443/hsar/backend";
|
|
||||||
|
|
||||||
public static TicketProvider getInstance(final PasswordReader console, final String user, final String runAs) throws TechnicalException
|
|
||||||
{
|
|
||||||
final Config config = Config.getInstance();
|
|
||||||
final String backendURL = config.getProperty("backendURL", HOSTSHARING_BACKEND_URL);
|
|
||||||
final String loginURL = config.getProperty("loginURL", HOSTSHARING_LOGIN_URL);
|
|
||||||
if ("TestUmgebung".equalsIgnoreCase(loginURL)) {
|
|
||||||
return new TestTicketProvider(user, runAs);
|
|
||||||
} else {
|
|
||||||
return new CASTicketProvider(console, user, runAs, backendURL, loginURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package de.hsadmin.login.cas;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
import de.hsadmin.common.config.Config;
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.login.TicketValidator;
|
|
||||||
|
|
||||||
public class TicketValidatorFactory {
|
|
||||||
|
|
||||||
public static TicketValidator getTicketValidator() throws TechnicalException {
|
|
||||||
TicketValidator ticketValidator = null;
|
|
||||||
if (ticketValidator == null) {
|
|
||||||
try {
|
|
||||||
final String property = Config.getInstance().getProperty(Config.TICKETVALIDATOR_CLASS, "de.hsadmin.login.cas.CASTicketValidator");
|
|
||||||
final Class<?> validatorClass = Class.forName(property);
|
|
||||||
ticketValidator = (TicketValidator) validatorClass.getDeclaredConstructor().newInstance();
|
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
|
||||||
throw new TechnicalException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ticketValidator;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -12,8 +12,6 @@ public interface ValueObject {
|
|||||||
|
|
||||||
public Property<?> get(String propertyName) throws UserException;
|
public Property<?> get(String propertyName) throws UserException;
|
||||||
|
|
||||||
public Class<?> getType(String name) throws TechnicalException;
|
|
||||||
|
|
||||||
public boolean hasProperty(String propertyName) throws UserException;
|
public boolean hasProperty(String propertyName) throws UserException;
|
||||||
|
|
||||||
public void copyPropertiesToPersistentObject(Object persistentObject)
|
public void copyPropertiesToPersistentObject(Object persistentObject)
|
||||||
@ -21,4 +19,5 @@ public interface ValueObject {
|
|||||||
|
|
||||||
public void copyPropertiesFromPersistentObject(Object persistentObject)
|
public void copyPropertiesFromPersistentObject(Object persistentObject)
|
||||||
throws UserException, TechnicalException;
|
throws UserException, TechnicalException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -87,12 +87,13 @@ public abstract class AbstractProperty<T> implements Property<T> {
|
|||||||
return (Class<? extends Property<T>>) getClass();
|
return (Class<? extends Property<T>>) getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public T getValue() throws TechnicalException {
|
public T getValue() throws TechnicalException {
|
||||||
if (undefinedValue) {
|
if (undefinedValue) {
|
||||||
throw new TechnicalException("undefined value");
|
throw new TechnicalException("undefined value");
|
||||||
}
|
}
|
||||||
return getValueImpl();
|
return (T) ReflectionUtil.invokeGetter(owningVO, getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -139,28 +140,7 @@ public abstract class AbstractProperty<T> implements Property<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void copyValueFromParameterMap(Map<String, Object> rpcParameter) throws TechnicalException, UserException {
|
public void copyValueFromParameterMap(Map<String, Object> rpcParameter) throws TechnicalException, UserException {
|
||||||
final String propName = getName();
|
setValue(getParameterMapMapper().readValueFromParameterMap(rpcParameter, getName()));
|
||||||
final Class<?> propType = owningVO.getType(propName);
|
|
||||||
final ParameterMapMapper<T> paramMapMapper = getParameterMapMapper();
|
|
||||||
final T valueFromParameterMap = paramMapMapper.readValueFromParameterMap(rpcParameter, propName, propType);
|
|
||||||
setValue(valueFromParameterMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initValueFromVO() throws TechnicalException, UserException {
|
|
||||||
setValue(getValueImpl());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Class<?> getFieldType() throws TechnicalException {
|
|
||||||
try {
|
|
||||||
return owningVO.getClass().getDeclaredField(getName()).getType();
|
|
||||||
} catch (NoSuchFieldException | SecurityException e) {
|
|
||||||
throw new TechnicalException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private T getValueImpl() throws TechnicalException {
|
|
||||||
return (T) ReflectionUtil.invokeGetter(owningVO, getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -39,15 +39,6 @@ public abstract class AbstractVO implements ValueObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initPropertyValues() throws UserException, TechnicalException {
|
|
||||||
final Field[] fields = getClass().getDeclaredFields();
|
|
||||||
for (Field f : fields) {
|
|
||||||
if (isPropertyField(f)) {
|
|
||||||
get(f.getName()).initValueFromVO();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Property<?>> properties() throws UserException, TechnicalException {
|
public List<Property<?>> properties() throws UserException, TechnicalException {
|
||||||
final List<Property<?>> result = new ArrayList<>();
|
final List<Property<?>> result = new ArrayList<>();
|
||||||
@ -70,15 +61,6 @@ public abstract class AbstractVO implements ValueObject {
|
|||||||
return propertiesMap.get(propertyName);
|
return propertiesMap.get(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> getType(String propertyName) throws TechnicalException {
|
|
||||||
try {
|
|
||||||
return getClass().getDeclaredField(propertyName).getType();
|
|
||||||
} catch (NoSuchFieldException | SecurityException e) {
|
|
||||||
throw new TechnicalException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasProperty(final String propertyName) throws UserException {
|
public boolean hasProperty(final String propertyName) throws UserException {
|
||||||
assert propertyName != null && propertyName.length() > 0;
|
assert propertyName != null && propertyName.length() > 0;
|
||||||
@ -131,8 +113,8 @@ public abstract class AbstractVO implements ValueObject {
|
|||||||
final 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().getDeclaredConstructor().newInstance();
|
PersistentObjectMapper<?> persistentObjectMapper = mapping.boMapping().newInstance();
|
||||||
ParameterMapMapper<?> parameterMapMapper = mapping.rpcMapping().getDeclaredConstructor().newInstance();
|
ParameterMapMapper<?> parameterMapMapper = mapping.rpcMapping().newInstance();
|
||||||
prop.setParameterMapMapper(parameterMapMapper);
|
prop.setParameterMapMapper(parameterMapMapper);
|
||||||
prop.setPersistentObjectMapper(persistentObjectMapper);
|
prop.setPersistentObjectMapper(persistentObjectMapper);
|
||||||
if (persistentObjectMapper instanceof ReferredPropertyPath) {
|
if (persistentObjectMapper instanceof ReferredPropertyPath) {
|
||||||
@ -179,4 +161,5 @@ public abstract class AbstractVO implements ValueObject {
|
|||||||
}
|
}
|
||||||
return rwPolicy;
|
return rwPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class ValidationDelegate<T extends ValueObject> {
|
|||||||
if (rwPolicy != ReadWritePolicy.READWRITE && rwPolicy != ReadWritePolicy.WRITEONCE) {
|
if (rwPolicy != ReadWritePolicy.READWRITE && rwPolicy != ReadWritePolicy.WRITEONCE) {
|
||||||
errors.add(UserError.MSG_NO_FIELD_WRITEACCESS, p.getName());
|
errors.add(UserError.MSG_NO_FIELD_WRITEACCESS, p.getName());
|
||||||
} else {
|
} else {
|
||||||
final Set<ConstraintViolation<T>> validateResults = vf.getValidator().validate(prototype);
|
Set<ConstraintViolation<T>> validateResults = vf.getValidator().validate(prototype);
|
||||||
if (!validateResults.isEmpty()) {
|
if (!validateResults.isEmpty()) {
|
||||||
for (ConstraintViolation<T> violation: validateResults) {
|
for (ConstraintViolation<T> violation: validateResults) {
|
||||||
errors.add(UserError.MSG_FIELD_DOESNOT_VALIDATE, violation.getMessage(), violation.getPropertyPath().toString(), violation.getInvalidValue().toString());
|
errors.add(UserError.MSG_FIELD_DOESNOT_VALIDATE, violation.getMessage(), violation.getPropertyPath().toString(), violation.getInvalidValue().toString());
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package de.hsadmin.module.property;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import de.hsadmin.module.ValueObject;
|
|
||||||
import de.hsadmin.module.impl.AbstractProperty;
|
|
||||||
import de.hsadmin.module.property.mapping.DefaultBigDecimalParameterMapMapper;
|
|
||||||
import de.hsadmin.module.property.mapping.DefaultBigDecimalPersistentObjectMapper;
|
|
||||||
import de.hsadmin.module.property.mapping.ParameterMapMapper;
|
|
||||||
import de.hsadmin.module.property.mapping.PersistentObjectMapper;
|
|
||||||
|
|
||||||
public class BigDecimalProperty extends AbstractProperty<BigDecimal> implements Property<BigDecimal> {
|
|
||||||
|
|
||||||
private static final PersistentObjectMapper<BigDecimal> defaultPersistentObjectMapper;
|
|
||||||
private static final ParameterMapMapper<BigDecimal> defaultParameterMapMapper;
|
|
||||||
|
|
||||||
static {
|
|
||||||
defaultPersistentObjectMapper = new DefaultBigDecimalPersistentObjectMapper();
|
|
||||||
defaultParameterMapMapper = new DefaultBigDecimalParameterMapMapper();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimalProperty(final ValueObject ownerVO, final String propertyName, final ReadWritePolicy readWritePolicy, final SearchPolicy searchPolicy, final boolean required) {
|
|
||||||
super(ownerVO, propertyName, readWritePolicy, searchPolicy, required);
|
|
||||||
setPersistentObjectMapper(defaultPersistentObjectMapper);
|
|
||||||
setParameterMapMapper(defaultParameterMapMapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> getValueType() {
|
|
||||||
return BigDecimal.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -35,7 +35,6 @@ public interface Property<T> {
|
|||||||
|
|
||||||
public void copyValueFromParameterMap(final Map<String, Object> rpcParameter) throws TechnicalException, UserException;
|
public void copyValueFromParameterMap(final Map<String, Object> rpcParameter) throws TechnicalException, UserException;
|
||||||
|
|
||||||
public void initValueFromVO() throws TechnicalException, UserException;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package de.hsadmin.module.property.mapping;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
|
|
||||||
public class DefaultBigDecimalParameterMapMapper implements ParameterMapMapper<BigDecimal> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeValueToParameterMap(final Map<String, Object> rpcParameter,
|
|
||||||
final String propertyName, final BigDecimal value)
|
|
||||||
throws TechnicalException, UserException {
|
|
||||||
if (value != null) {
|
|
||||||
rpcParameter.put(propertyName, value.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
|
||||||
final String propertyName, final Class<?> propertyClass) throws TechnicalException, UserException {
|
|
||||||
final Object object = rpcParameter.get(propertyName);
|
|
||||||
if (object instanceof BigDecimal) {
|
|
||||||
return (BigDecimal) object;
|
|
||||||
}
|
|
||||||
if (object instanceof String) {
|
|
||||||
try {
|
|
||||||
BigDecimal value = new BigDecimal((String) object);
|
|
||||||
return value;
|
|
||||||
} catch (NumberFormatException exc) {
|
|
||||||
throw new TechnicalException("invalid decimal number '" + object + "'", exc);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package de.hsadmin.module.property.mapping;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.util.ReflectionUtil;
|
|
||||||
|
|
||||||
public class DefaultBigDecimalPersistentObjectMapper implements PersistentObjectMapper<BigDecimal> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeValueToPersistentObject(final Object persistentObject, final String propertyName, final BigDecimal value) throws TechnicalException {
|
|
||||||
ReflectionUtil.invokeSetter(persistentObject, propertyName, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal readValueFromPersistentObject(final Object persistentObject, final String propertyName) throws TechnicalException {
|
|
||||||
final Object object = ReflectionUtil.invokeGetter(persistentObject, propertyName);
|
|
||||||
if (object instanceof BigDecimal) {
|
|
||||||
return (BigDecimal) object;
|
|
||||||
} else {
|
|
||||||
if (object instanceof String) {
|
|
||||||
try {
|
|
||||||
return new BigDecimal((String)object);
|
|
||||||
} catch ( NumberFormatException exc ) {
|
|
||||||
throw new TechnicalException(exc);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,7 @@ public class DefaultBooleanParameterMapMapper implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
public Boolean readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
||||||
final String propertyName, final Class<?> propertyClass) throws TechnicalException, UserException {
|
final String propertyName) throws TechnicalException, UserException {
|
||||||
final Object value = rpcParameter.get(propertyName);
|
final Object value = rpcParameter.get(propertyName);
|
||||||
if (value instanceof Boolean) {
|
if (value instanceof Boolean) {
|
||||||
return (Boolean) value;
|
return (Boolean) value;
|
||||||
|
@ -22,19 +22,16 @@ public class DefaultDateParameterMapMapper implements ParameterMapMapper<Date> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
public Date readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
||||||
final String propertyName, final Class<?> propertyClass) throws TechnicalException, UserException {
|
final String propertyName) throws TechnicalException, UserException {
|
||||||
final Object value = rpcParameter.get(propertyName);
|
final Object value = rpcParameter.get(propertyName);
|
||||||
if (value instanceof Date) {
|
if (value instanceof Date) {
|
||||||
return (Date) value;
|
return (Date) value;
|
||||||
}
|
}
|
||||||
if (value instanceof String) {
|
if (value instanceof String) {
|
||||||
final String valueAsString = ((String) value).trim();
|
|
||||||
if (valueAsString.length() > 0) {
|
|
||||||
try {
|
try {
|
||||||
return DateUtil.DEFAULT_DATEFORMAT.parse(valueAsString);
|
return DateUtil.DEFAULT_DATEFORMAT.parse((String) value);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new UserException(new UserError(UserError.MSG_INVALID_DATEFORMAT, propertyName, valueAsString));
|
throw new UserException(new UserError(UserError.MSG_INVALID_DATEFORMAT, propertyName, (String) value));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package de.hsadmin.module.property.mapping;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserError;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
|
|
||||||
public class DefaultEnumParameterMapMapper implements ParameterMapMapper<Enum<?>> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeValueToParameterMap(final Map<String, Object> rpcParameter,
|
|
||||||
final String propertyName, Enum<?> value)
|
|
||||||
throws TechnicalException, UserException {
|
|
||||||
if (value != null) {
|
|
||||||
rpcParameter.put(propertyName, value.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enum<?> readValueFromParameterMap(Map<String, Object> rpcParameter,
|
|
||||||
final String propertyName, final Class<?> propertyClass)
|
|
||||||
throws TechnicalException, UserException {
|
|
||||||
final Object value = rpcParameter.get(propertyName);
|
|
||||||
if (value instanceof Enum<?>) {
|
|
||||||
return (Enum<?>) value;
|
|
||||||
}
|
|
||||||
if (value instanceof String) {
|
|
||||||
try {
|
|
||||||
return Enum.valueOf(propertyClass.asSubclass(Enum.class), (String) value);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
throw new UserException(new UserError(UserError.MSG_INT_VALUE_EXPECTED, propertyName, (String) value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package de.hsadmin.module.property.mapping;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
|
||||||
import de.hsadmin.common.error.UserException;
|
|
||||||
import de.hsadmin.common.util.ReflectionUtil;
|
|
||||||
|
|
||||||
public class DefaultEnumPersistentObjectMapper implements PersistentObjectMapper<String> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String readValueFromPersistentObject(Object persistentObject, String propertyName)
|
|
||||||
throws TechnicalException, UserException {
|
|
||||||
final Object object = ReflectionUtil.invokeGetter(persistentObject, propertyName);
|
|
||||||
if (object instanceof String) {
|
|
||||||
return (String) object;
|
|
||||||
} else {
|
|
||||||
if (object instanceof Enum) {
|
|
||||||
return object.toString();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeValueToPersistentObject(Object persistentObject, String propertyName, String value)
|
|
||||||
throws TechnicalException, UserException {
|
|
||||||
|
|
||||||
final Class<?> propertyClass = ReflectionUtil.getFieldType(persistentObject, propertyName);
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
final Class<? extends Enum> aSubclass = propertyClass.asSubclass(Enum.class);
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final Enum<?> enumValue = Enum.valueOf(aSubclass, value);
|
|
||||||
ReflectionUtil.invokeSetter(persistentObject, propertyName, enumValue);
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,7 +10,7 @@ public class DefaultIntegerParameterMapMapper implements ParameterMapMapper<Inte
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeValueToParameterMap(final Map<String, Object> rpcParameter,
|
public void writeValueToParameterMap(final Map<String, Object> rpcParameter,
|
||||||
final String propertyName, final Integer value)
|
final String propertyName, Integer value)
|
||||||
throws TechnicalException, UserException {
|
throws TechnicalException, UserException {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
rpcParameter.put(propertyName, value.toString());
|
rpcParameter.put(propertyName, value.toString());
|
||||||
@ -19,7 +19,7 @@ public class DefaultIntegerParameterMapMapper implements ParameterMapMapper<Inte
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
public Integer readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
||||||
final String propertyName, final Class<?> propertyClass)
|
final String propertyName)
|
||||||
throws TechnicalException, UserException {
|
throws TechnicalException, UserException {
|
||||||
final Object value = rpcParameter.get(propertyName);
|
final Object value = rpcParameter.get(propertyName);
|
||||||
if (value instanceof Integer) {
|
if (value instanceof Integer) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package de.hsadmin.module.property.mapping;
|
package de.hsadmin.module.property.mapping;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,8 +37,7 @@ public class DefaultListParameterMapMapper<VO extends ValueObject> implements Pa
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public List<VO> readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
public List<VO> readValueFromParameterMap(Map<String, Object> rpcParameter, String propertyName)
|
||||||
final String propertyName, final Class<?> propertyClass)
|
|
||||||
throws TechnicalException, UserException {
|
throws TechnicalException, UserException {
|
||||||
final List<VO> value = new ArrayList<>();
|
final List<VO> value = new ArrayList<>();
|
||||||
final Object list = rpcParameter.get(propertyName);
|
final Object list = rpcParameter.get(propertyName);
|
||||||
@ -47,7 +45,7 @@ public class DefaultListParameterMapMapper<VO extends ValueObject> implements Pa
|
|||||||
if (list instanceof Object[]) {
|
if (list instanceof Object[]) {
|
||||||
for (Object obj : (Object[])list) {
|
for (Object obj : (Object[])list) {
|
||||||
if (obj instanceof Map<?, ?>) {
|
if (obj instanceof Map<?, ?>) {
|
||||||
final VO vo = (VO) elementsType.getDeclaredConstructor().newInstance();
|
final VO vo = (VO) elementsType.newInstance();
|
||||||
final Map<?, ?> map = (Map<?, ?>) obj;
|
final Map<?, ?> map = (Map<?, ?>) obj;
|
||||||
for (Object key : map.keySet()) {
|
for (Object key : map.keySet()) {
|
||||||
if (key instanceof String) {
|
if (key instanceof String) {
|
||||||
@ -59,7 +57,7 @@ public class DefaultListParameterMapMapper<VO extends ValueObject> implements Pa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
throw new TechnicalException(e);
|
throw new TechnicalException(e);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package de.hsadmin.module.property.mapping;
|
package de.hsadmin.module.property.mapping;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -32,10 +31,10 @@ public class DefaultListPersistentObjectMapper<VO extends ValueObject> implement
|
|||||||
final Collection<?> coll = (Collection<?>) object;
|
final Collection<?> coll = (Collection<?>) object;
|
||||||
for (Object o : coll) {
|
for (Object o : coll) {
|
||||||
try {
|
try {
|
||||||
final VO newInstance = elementsType.getDeclaredConstructor().newInstance();
|
final VO newInstance = elementsType.newInstance();
|
||||||
newInstance.copyPropertiesFromPersistentObject(o);
|
newInstance.copyPropertiesFromPersistentObject(o);
|
||||||
valueList.add(newInstance);
|
valueList.add(newInstance);
|
||||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
throw new TechnicalException(e);
|
throw new TechnicalException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,7 @@ public class DefaultStringParameterMapMapper implements ParameterMapMapper<Strin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
public String readValueFromParameterMap(final Map<String, Object> rpcParameter,
|
||||||
final String propertyName, final Class<?> propertyClass)
|
final String propertyName) throws TechnicalException, UserException {
|
||||||
throws TechnicalException, UserException {
|
|
||||||
final Object value = rpcParameter.get(propertyName);
|
final Object value = rpcParameter.get(propertyName);
|
||||||
if (value instanceof String) {
|
if (value instanceof String) {
|
||||||
return (String) value;
|
return (String) value;
|
||||||
|
@ -2,7 +2,6 @@ package de.hsadmin.module.property.mapping;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import de.hsadmin.common.error.TechnicalException;
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
import de.hsadmin.common.error.UserException;
|
import de.hsadmin.common.error.UserException;
|
||||||
@ -23,7 +22,7 @@ public class DefaultStringSetParameterMapMapper implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StringSet readValueFromParameterMap(
|
public StringSet readValueFromParameterMap(
|
||||||
final Map<String, Object> rpcParameter, final String propertyName, final Class<?> propertyClass)
|
final Map<String, Object> rpcParameter, final String propertyName)
|
||||||
throws TechnicalException, UserException {
|
throws TechnicalException, UserException {
|
||||||
final Object rpcParam = rpcParameter.get(propertyName);
|
final Object rpcParam = rpcParameter.get(propertyName);
|
||||||
final StringSet value = new StringSet();
|
final StringSet value = new StringSet();
|
||||||
@ -36,16 +35,6 @@ public class DefaultStringSetParameterMapMapper implements
|
|||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rpcParam instanceof Map<?, ?>) {
|
|
||||||
final Map<?, ?> rpcParamMap = (Map<?, ?>) rpcParam;
|
|
||||||
final Set<?> keySet = rpcParamMap.keySet();
|
|
||||||
strings = new String[rpcParamMap.size()];
|
|
||||||
for (int idx = 0; idx < strings.length; idx++) {
|
|
||||||
final Object object = keySet.toArray()[idx];
|
|
||||||
final String val = (String) rpcParamMap.get(object);
|
|
||||||
strings[idx] = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
value.setStrings(strings);
|
value.setStrings(strings);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ public interface ParameterMapMapper<T> {
|
|||||||
|
|
||||||
void writeValueToParameterMap(Map<String, Object> rpcParameter, String propertyName, T value) throws TechnicalException, UserException;
|
void writeValueToParameterMap(Map<String, Object> rpcParameter, String propertyName, T value) throws TechnicalException, UserException;
|
||||||
|
|
||||||
T readValueFromParameterMap(Map<String, Object> rpcParameter, String propertyName, Class<?> propertyClass) throws TechnicalException, UserException;
|
T readValueFromParameterMap(Map<String, Object> rpcParameter, String propertyName) throws TechnicalException, UserException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,7 @@ public class ReferredStringPersistentObjectMapper implements PersistentObjectMap
|
|||||||
@Override
|
@Override
|
||||||
public void writeValueToPersistentObject(final Object persistentObject,
|
public void writeValueToPersistentObject(final Object persistentObject,
|
||||||
final String propertyName, final String value) throws TechnicalException {
|
final String propertyName, final String value) throws TechnicalException {
|
||||||
// FIXME MHOENNIG->PHORMANS: Statt dieser Exception muesste man evtl. nur sicherstellen,
|
throw new TechnicalException("writeValueToPersistentObject not implemented");
|
||||||
// dass der Service das Feld belegt hat, oder?
|
|
||||||
// Verstehe ur nicht, wie das jemals funktioniert haben konnte.
|
|
||||||
// throw new TechnicalException("writeValueToPersistentObject not implemented");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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.InvocationTargetException;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -67,7 +66,7 @@ public class PropertyService extends AbstractModule<PropertyVO> implements Prope
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final Class<?> serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(moduleName));
|
final Class<?> serviceRemoteClass = Class.forName(remoteServicesProperties.getProperty(moduleName));
|
||||||
final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.getDeclaredConstructor().newInstance();
|
final AbstractRemote<ValueObject> serviceRemote = (AbstractRemote<ValueObject>) serviceRemoteClass.newInstance();
|
||||||
final ValueObject valueObject = serviceRemote.createValueObject();
|
final ValueObject valueObject = serviceRemote.createValueObject();
|
||||||
final Class<? extends ValueObject> voClass = valueObject.getClass();
|
final Class<? extends ValueObject> voClass = valueObject.getClass();
|
||||||
final List<Property<?>> propertiesList = valueObject.properties();
|
final List<Property<?>> propertiesList = valueObject.properties();
|
||||||
@ -114,7 +113,7 @@ public class PropertyService extends AbstractModule<PropertyVO> implements Prope
|
|||||||
emptyList.add(vo);
|
emptyList.add(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
} catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
|
||||||
throw new TechnicalException(e);
|
throw new TechnicalException(e);
|
||||||
}
|
}
|
||||||
return emptyList;
|
return emptyList;
|
||||||
|
14
ldap-services/.gitignore
vendored
14
ldap-services/.gitignore
vendored
@ -1,14 +0,0 @@
|
|||||||
*.class
|
|
||||||
|
|
||||||
# Package Files #
|
|
||||||
*.jar
|
|
||||||
*.war
|
|
||||||
*.ear
|
|
||||||
|
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
|
||||||
hs_err_pid*
|
|
||||||
/target
|
|
||||||
/.settings
|
|
||||||
/.classpath
|
|
||||||
/.project
|
|
||||||
/derby.log
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user