dont delete domainoptions if no new value is given

This commit is contained in:
Peter Hormanns 2012-07-25 15:53:03 +00:00
parent 2171a5cf82
commit 3a386fb24e
2 changed files with 5 additions and 5 deletions

View File

@ -159,9 +159,9 @@ public class DomainModuleImpl extends AbstractModuleImpl {
DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() + DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
" opt WHERE opt.name=:optName"); " opt WHERE opt.name=:optName");
Set<DomainOption> domainOptions = updatedDom.getDomainOptions(); Set<DomainOption> domainOptions = updatedDom.getDomainOptions();
if (domainOptions == null) { // if (domainOptions == null) {
updatedDom.setDomainOptions(oldDom.getDomainOptions()); // updatedDom.setDomainOptions(oldDom.getDomainOptions());
} // }
for (DomainOption opt : domainOptions) { for (DomainOption opt : domainOptions) {
q.setParameter("optName", opt.getName()); q.setParameter("optName", opt.getName());
List<?> list = q.getResultList(); List<?> list = q.getResultList();

View File

@ -61,17 +61,17 @@ public class DomainRemote extends AbstractRemote {
u.setName(user); u.setName(user);
dom.setUser(u); dom.setUser(u);
} }
Set<DomainOption> domainOptionsSet = new HashSet<DomainOption>();
Object domOptsObj = setParams.get("domainoptions"); Object domOptsObj = setParams.get("domainoptions");
if (domOptsObj != null && domOptsObj instanceof Object[]) { if (domOptsObj != null && domOptsObj instanceof Object[]) {
Set<DomainOption> domainOptionsSet = new HashSet<DomainOption>();
Object[] domOptions = (Object[]) domOptsObj; Object[] domOptions = (Object[]) domOptsObj;
for (int i=0; i<domOptions.length; i++) { for (int i=0; i<domOptions.length; i++) {
DomainOption domainOption = new DomainOption(); DomainOption domainOption = new DomainOption();
domainOption.setName((String)domOptions[i]); domainOption.setName((String)domOptions[i]);
domainOptionsSet.add(domainOption); domainOptionsSet.add(domainOption);
} }
dom.setDomainOptions(domainOptionsSet);
} }
dom.setDomainOptions(domainOptionsSet);
} }
@Override @Override