Some minor fixes in moduleprop, som commented out debugging stuff. Bug null pointer exception when referredProps have indirect fields, i.e. dot notation.
This commit is contained in:
parent
f3b725d0d8
commit
c1f04434a0
@ -23,6 +23,7 @@ import javax.persistence.Temporal;
|
|||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import de.hsadmin.core.model.AbstractEntity;
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
|
import de.hsadmin.core.model.AnnFieldIO;
|
||||||
import de.hsadmin.core.model.AnnModuleImpl;
|
import de.hsadmin.core.model.AnnModuleImpl;
|
||||||
import de.hsadmin.mods.pac.Pac;
|
import de.hsadmin.mods.pac.Pac;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
@ -80,9 +81,13 @@ public class Customer extends AbstractEntity implements Serializable {
|
|||||||
private Set<Contact> contacts;
|
private Set<Contact> contacts;
|
||||||
|
|
||||||
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
|
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
|
||||||
|
//@AnnFieldIO(referredProps = "customer")
|
||||||
|
//@AnnFieldIO(referredProps = "customer.CustomersTariffl")
|
||||||
|
//@AnnFieldIO(referredProps = "customer.CustomersTariff.domainDiscountUntil")
|
||||||
private BankAccount bankAccount;
|
private BankAccount bankAccount;
|
||||||
|
|
||||||
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
|
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
|
||||||
|
//@AnnFieldIO(referredProps = "domainDiscountUntil")
|
||||||
private CustomersTariff billData;
|
private CustomersTariff billData;
|
||||||
|
|
||||||
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "customer")
|
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "customer")
|
||||||
|
@ -27,9 +27,8 @@ public class ModulePropertiesRemote implements IRemote {
|
|||||||
if (transaction.login(user, ticket)) {
|
if (transaction.login(user, ticket)) {
|
||||||
InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("org/apache/xmlrpc/webserver/XmlRpcServlet.properties");
|
InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("org/apache/xmlrpc/webserver/XmlRpcServlet.properties");
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.load(resourceAsStream);
|
properties.load(resourceAsStream);
|
||||||
|
for (Object moduleKey : properties.keySet()) {
|
||||||
for (Object moduleKey : properties.entrySet()) {
|
|
||||||
Class<?> remoteClass = Class.forName(properties.getProperty((String) moduleKey));
|
Class<?> remoteClass = Class.forName(properties.getProperty((String) moduleKey));
|
||||||
Object newInstance = remoteClass.newInstance();
|
Object newInstance = remoteClass.newInstance();
|
||||||
if (newInstance instanceof AbstractRemote) {
|
if (newInstance instanceof AbstractRemote) {
|
||||||
@ -42,20 +41,22 @@ public class ModulePropertiesRemote implements IRemote {
|
|||||||
// AnnFieldIO fieldIO = entityClass.getAnnotation(AnnFieldIO.class);
|
// AnnFieldIO fieldIO = entityClass.getAnnotation(AnnFieldIO.class);
|
||||||
for (Field f: entityClass.getDeclaredFields()) {
|
for (Field f: entityClass.getDeclaredFields()) {
|
||||||
HashMap<String, Object> propertyProperties = new HashMap<String, Object>();
|
HashMap<String, Object> propertyProperties = new HashMap<String, Object>();
|
||||||
propertiesList.add(propertyProperties);
|
|
||||||
AnnFieldIO fieldIO = f.getAnnotation(AnnFieldIO.class);
|
AnnFieldIO fieldIO = f.getAnnotation(AnnFieldIO.class);
|
||||||
String fieldName = f.getName();
|
if (fieldIO != null){
|
||||||
propertyProperties.put("property", fieldName);
|
String fieldName = f.getName();
|
||||||
String regExp = fieldIO.validation();
|
propertyProperties.put("property", fieldName);
|
||||||
propertyProperties.put("validation", regExp);
|
String regExp = fieldIO.validation();
|
||||||
ReadWriteAccess rw = fieldIO.rw();
|
propertyProperties.put("validation", regExp);
|
||||||
propertyProperties.put("rw", rw.name());
|
ReadWriteAccess rw = fieldIO.rw();
|
||||||
String[] referredProps = fieldIO.referredProps();
|
propertyProperties.put("rw", rw.name());
|
||||||
propertyProperties.put("referredProps", referredProps);
|
String[] referredProps = fieldIO.referredProps();
|
||||||
Class<?> declaringClass = f.getDeclaringClass();
|
propertyProperties.put("referredProps", referredProps);
|
||||||
for(String s : referredProps){
|
Class<?> declaringClass = f.getDeclaringClass();
|
||||||
String fullPropertyName = fieldName+"."+s;
|
for(String s : referredProps){
|
||||||
propertiesList.add(createReferredPropertyInfo(fullPropertyName, declaringClass, fullPropertyName));
|
String fullPropertyName = fieldName+"."+s;
|
||||||
|
propertiesList.add(createReferredPropertyInfo(fullPropertyName, declaringClass, fullPropertyName));
|
||||||
|
}
|
||||||
|
propertiesList.add(propertyProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.add(modMap);
|
result.add(modMap);
|
||||||
@ -77,7 +78,7 @@ public class ModulePropertiesRemote implements IRemote {
|
|||||||
int indexOfDot = propertyName.indexOf('.');
|
int indexOfDot = propertyName.indexOf('.');
|
||||||
if (indexOfDot>=0) {
|
if (indexOfDot>=0) {
|
||||||
String prefix = propertyName.substring(0, indexOfDot);
|
String prefix = propertyName.substring(0, indexOfDot);
|
||||||
String remainingPart = propertyName.substring(indexOfDot + 1);
|
String remainingPart = propertyName.substring(indexOfDot + 1);
|
||||||
return createReferredPropertyInfo(fieldName, declaringClass.getDeclaredField(prefix).getDeclaringClass(), remainingPart);
|
return createReferredPropertyInfo(fieldName, declaringClass.getDeclaredField(prefix).getDeclaringClass(), remainingPart);
|
||||||
} else {
|
} else {
|
||||||
Map<String, Object> result = new HashMap<String, Object>();
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
Loading…
Reference in New Issue
Block a user