Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1220
Modified Files:
SurfaceFacade.java
Log Message:
now makes shure no space is connected to the surface before removing it
Index: SurfaceFacade.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SurfaceFacade.java 17 Aug 2005 11:22:54 -0000 1.5
--- SurfaceFacade.java 12 Sep 2005 18:26:53 -0000 1.6
***************
*** 14,18 ****
import java.util.Iterator;
import java.util.Set;
-
import org.apache.log4j.Logger;
import org.hibernate.Query;
--- 14,17 ----
***************
*** 101,104 ****
--- 100,123 ----
*/
public synchronized void remove(Surface s) {
+ //to make it safe to remove a surface we need to remove it
+ //from any domain to which it belongs.
+
+ //This breaks the decoupling and should be changed!
+ Set fsSet = FunctionalSpaceFacade.getInstance().findBySurface(s);
+ Iterator fsIt = fsSet.iterator();
+ while (fsIt.hasNext()) {
+ FunctionalSpace fs = (FunctionalSpace)fsIt.next();
+ fs.removeSurface(s);
+ FunctionalSpaceFacade.getInstance().update(fs);
+ }
+
+ Set csSet = ConstructionSpaceFacade.getInstance().findBySurface(s);
+ Iterator csIt = csSet.iterator();
+ while (csIt.hasNext()) {
+ ConstructionSpace cs = (ConstructionSpace)csIt.next();
+ cs.removeSurface(s);
+ ConstructionSpaceFacade.getInstance().update(cs);
+ }
+
HibernateUtil hu = HibernateUtil.getInstance();
try {
|