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:
Purodha 2013-01-03 22:12:52 +00:00
parent f3b725d0d8
commit c1f04434a0
2 changed files with 23 additions and 17 deletions

View File

@ -23,6 +23,7 @@ import javax.persistence.Temporal;
import javax.persistence.Transient;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AnnModuleImpl;
import de.hsadmin.mods.pac.Pac;
import de.hsadmin.mods.user.UnixUser;
@ -80,9 +81,13 @@ public class Customer extends AbstractEntity implements Serializable {
private Set<Contact> contacts;
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
//@AnnFieldIO(referredProps = "customer")
//@AnnFieldIO(referredProps = "customer.CustomersTariffl")
//@AnnFieldIO(referredProps = "customer.CustomersTariff.domainDiscountUntil")
private BankAccount bankAccount;
@OneToOne(fetch = EAGER, cascade = ALL, mappedBy = "customer")
//@AnnFieldIO(referredProps = "domainDiscountUntil")
private CustomersTariff billData;
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "customer")

View File

@ -28,8 +28,7 @@ public class ModulePropertiesRemote implements IRemote {
InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream("org/apache/xmlrpc/webserver/XmlRpcServlet.properties");
Properties properties = new Properties();
properties.load(resourceAsStream);
for (Object moduleKey : properties.entrySet()) {
for (Object moduleKey : properties.keySet()) {
Class<?> remoteClass = Class.forName(properties.getProperty((String) moduleKey));
Object newInstance = remoteClass.newInstance();
if (newInstance instanceof AbstractRemote) {
@ -42,8 +41,8 @@ public class ModulePropertiesRemote implements IRemote {
// AnnFieldIO fieldIO = entityClass.getAnnotation(AnnFieldIO.class);
for (Field f: entityClass.getDeclaredFields()) {
HashMap<String, Object> propertyProperties = new HashMap<String, Object>();
propertiesList.add(propertyProperties);
AnnFieldIO fieldIO = f.getAnnotation(AnnFieldIO.class);
if (fieldIO != null){
String fieldName = f.getName();
propertyProperties.put("property", fieldName);
String regExp = fieldIO.validation();
@ -57,6 +56,8 @@ public class ModulePropertiesRemote implements IRemote {
String fullPropertyName = fieldName+"."+s;
propertiesList.add(createReferredPropertyInfo(fullPropertyName, declaringClass, fullPropertyName));
}
propertiesList.add(propertyProperties);
}
}
result.add(modMap);
}