From 3a386fb24e9ca3a7e1b8f793fd7cd44fedc8a824 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@hostsharing.net>
Date: Wed, 25 Jul 2012 17:53:03 +0200
Subject: [PATCH] dont delete domainoptions if no new value is given

---
 hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java |    6 +++---
 hsarback/src/de/hsadmin/remote/DomainRemote.java       |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
index 85c0066..18ba7f6 100644
--- a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
@@ -159,9 +159,9 @@
 				DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
 				" opt WHERE opt.name=:optName");
 		Set<DomainOption> domainOptions = updatedDom.getDomainOptions();
-		if (domainOptions == null) {
-			updatedDom.setDomainOptions(oldDom.getDomainOptions());
-		}
+//		if (domainOptions == null) {
+//			updatedDom.setDomainOptions(oldDom.getDomainOptions());
+//		}
 		for (DomainOption opt : domainOptions) {
 			q.setParameter("optName", opt.getName());
 			List<?> list = q.getResultList();
diff --git a/hsarback/src/de/hsadmin/remote/DomainRemote.java b/hsarback/src/de/hsadmin/remote/DomainRemote.java
index f01cd7d..f432859 100644
--- a/hsarback/src/de/hsadmin/remote/DomainRemote.java
+++ b/hsarback/src/de/hsadmin/remote/DomainRemote.java
@@ -61,17 +61,17 @@
 			u.setName(user);
 			dom.setUser(u);
 		}
-		Set<DomainOption> domainOptionsSet = new HashSet<DomainOption>();
 		Object domOptsObj = setParams.get("domainoptions");
 		if (domOptsObj != null && domOptsObj instanceof Object[]) {
+			Set<DomainOption> domainOptionsSet = new HashSet<DomainOption>();
 			Object[] domOptions = (Object[]) domOptsObj;
 			for (int i=0; i<domOptions.length; i++) {
 				DomainOption domainOption = new DomainOption();
 				domainOption.setName((String)domOptions[i]);
 				domainOptionsSet.add(domainOption);
 			}
+			dom.setDomainOptions(domainOptionsSet);
 		}
-		dom.setDomainOptions(domainOptionsSet);
 	}
 
 	@Override

--
Gitblit v1.9.0-SNAPSHOT