Thread: [Bprocessor-commit] model/src/net/sourceforge/bprocessor/model PartFacade.java,1.7,1.8 EdgeFacade.ja
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-10-03 08:34:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3756/src/net/sourceforge/bprocessor/model Modified Files: PartFacade.java EdgeFacade.java ConstructionSpaceFacade.java ElementFacade.java VertexFacade.java SurfaceFacade.java Project.java FunctionalSpaceFacade.java Log Message: Moved remove and notification functionality from *Facade to Project Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ConstructionSpaceFacade.java 30 Sep 2005 11:35:06 -0000 1.12 --- ConstructionSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 88,94 **** tx.commit(); - - Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 85,88 ---- *************** *** 108,132 **** HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! ! //setting references to this space to null ! Set surfaces = c.getSurfaces(); ! if (surfaces != null) { ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surface = (Surface)surfIt.next(); ! Domain back = surface.getBackDomain(); ! if (back == c) { ! surface.setBackDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } else { ! Domain front = surface.getFrontDomain(); ! if (front == c) { ! surface.setFrontDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } ! } ! } ! } ! try { Session session = hu.currentSession(); --- 102,106 ---- HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! try { Session session = hu.currentSession(); *************** *** 137,142 **** tx.commit(); - Notification n = new Notification(Notification.CONSTRUCTION_SPACE_DELETED, c.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 111,114 ---- Index: ElementFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ElementFacade.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ElementFacade.java 30 Sep 2005 11:35:06 -0000 1.7 --- ElementFacade.java 3 Oct 2005 08:34:37 -0000 1.8 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); - Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,115 ---- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Project.java 2 Oct 2005 14:36:30 -0000 1.2 --- Project.java 3 Oct 2005 08:34:37 -0000 1.3 *************** *** 12,15 **** --- 12,18 ---- import java.util.Set; + import net.sourceforge.bprocessor.kernel.notification.Notification; + import net.sourceforge.bprocessor.kernel.notification.Notifier; + import org.apache.log4j.Logger; /** *************** *** 77,80 **** --- 80,85 ---- public void intern(ConstructionSpace c) { ConstructionSpaceFacade.getInstance().create(c); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 85,88 **** --- 90,95 ---- public void update(ConstructionSpace c) { ConstructionSpaceFacade.getInstance().update(c); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 92,96 **** --- 99,124 ---- */ public void remove(ConstructionSpace c) { + // setting references to this space to null + Set surfaces = c.getSurfaces(); + if (surfaces != null) { + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surface = (Surface)surfIt.next(); + Domain back = surface.getBackDomain(); + if (back == c) { + surface.setBackDomain(null); + SurfaceFacade.getInstance().update(surface); + } else { + Domain front = surface.getFrontDomain(); + if (front == c) { + surface.setFrontDomain(null); + SurfaceFacade.getInstance().update(surface); + } + } + } + } ConstructionSpaceFacade.getInstance().remove(c); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_DELETED, c.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 119,128 **** if (domain instanceof ConstructionSpace) { ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); } else if (domain instanceof FunctionalSpace) { FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); } else if (domain instanceof Element) { ! ElementFacade.getInstance().update((Element)domain); } else if (domain instanceof Part) { PartFacade.getInstance().update((Part)domain); } else { log.error("Unsupported type: " + domain.getClass().getName()); --- 147,163 ---- if (domain instanceof ConstructionSpace) { ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); + Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, domain.getId()); + Notifier.getInstance().sendNotification(n); } else if (domain instanceof FunctionalSpace) { FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); + Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, domain.getId()); + Notifier.getInstance().sendNotification(n); } else if (domain instanceof Element) { ! update((Element)domain); ! } else if (domain instanceof Part) { PartFacade.getInstance().update((Part)domain); + Notification n = new Notification(Notification.PART_MODIFIED, domain.getId()); + Notifier.getInstance().sendNotification(n); } else { log.error("Unsupported type: " + domain.getClass().getName()); *************** *** 153,156 **** --- 188,193 ---- public void intern(Edge e) { EdgeFacade.getInstance().create(e); + Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 161,164 **** --- 198,203 ---- public void update(Edge e) { EdgeFacade.getInstance().update(e); + Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 169,172 **** --- 208,213 ---- public void remove(Edge e) { EdgeFacade.getInstance().remove(e); + Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 194,197 **** --- 235,240 ---- public void intern(Element e) { ElementFacade.getInstance().create(e); + Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 202,205 **** --- 245,250 ---- public void update(Element e) { ElementFacade.getInstance().update(e); + Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 210,213 **** --- 255,260 ---- public void remove(Element e) { ElementFacade.getInstance().remove(e); + Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 235,238 **** --- 282,287 ---- public void intern(FunctionalSpace f) { FunctionalSpaceFacade.getInstance().create(f); + Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 250,254 **** --- 299,324 ---- */ public void remove(FunctionalSpace f) { + // setting references to this space to null + Set surfaces = f.getSurfaces(); + if (surfaces != null) { + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surface = (Surface)surfIt.next(); + Domain back = surface.getBackDomain(); + if (back == f) { + surface.setBackDomain(null); + SurfaceFacade.getInstance().update(surface); + } else { + Domain front = surface.getFrontDomain(); + if (front == f) { + surface.setFrontDomain(null); + SurfaceFacade.getInstance().update(surface); + } + } + } + } FunctionalSpaceFacade.getInstance().remove(f); + Notification n = new Notification(Notification.FUNCTIONAL_SPACE_DELETED, f.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 276,279 **** --- 346,351 ---- public void intern(Part p) { PartFacade.getInstance().create(p); + Notification n = new Notification(Notification.PART_CREATED, p.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 292,295 **** --- 364,369 ---- public void remove(Part p) { PartFacade.getInstance().remove(p); + Notification n = new Notification(Notification.PART_DELETED, p.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 317,320 **** --- 391,396 ---- public void intern(Surface s) { SurfaceFacade.getInstance().create(s); + Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 325,328 **** --- 401,406 ---- public void update(Surface s) { SurfaceFacade.getInstance().update(s); + Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 332,336 **** --- 410,434 ---- */ public void remove(Surface s) { + // to make it safe to remove a surface we need to remove it + //from any domain to which it belongs. + + Domain back = s.getBackDomain(); + if (back != null) { + if (back.removeSurface(s)) { + DomainFacade.getInstance().update(back); + } + s.setBackDomain(null); + } + Domain front = s.getFrontDomain(); + if (front != null) { + if (front.removeSurface(s)) { + DomainFacade.getInstance().update(front); + } + s.setFrontDomain(null); + } + SurfaceFacade.getInstance().remove(s); + Notification n = new Notification(Notification.SURFACE_DELETED, s.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 358,361 **** --- 456,461 ---- public void intern(Vertex v) { VertexFacade.getInstance().create(v); + Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 366,369 **** --- 466,471 ---- public void update(Vertex v) { VertexFacade.getInstance().update(v); + Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); + Notifier.getInstance().sendNotification(n); } *************** *** 374,377 **** --- 476,481 ---- public void remove(Vertex v) { VertexFacade.getInstance().remove(v); + Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); + Notifier.getInstance().sendNotification(n); } Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SurfaceFacade.java 30 Sep 2005 12:47:46 -0000 1.13 --- SurfaceFacade.java 3 Oct 2005 08:34:37 -0000 1.14 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 61,66 **** tx.commit(); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 59,63 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 88,93 **** tx.commit(); ! Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 85,89 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 105,126 **** */ 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. - Domain back = s.getBackDomain(); - if (back != null) { - if (back.removeSurface(s)) { - DomainFacade.getInstance().update(back); - } - s.setBackDomain(null); - } - Domain front = s.getFrontDomain(); - if (front != null) { - if (front.removeSurface(s)) { - DomainFacade.getInstance().update(front); - } - s.setFrontDomain(null); - } - HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; --- 101,105 ---- *************** *** 132,138 **** tx.commit(); - - Notification n = new Notification(Notification.SURFACE_DELETED, s.getId()); - Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 111,114 ---- Index: VertexFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/VertexFacade.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** VertexFacade.java 30 Sep 2005 12:47:46 -0000 1.10 --- VertexFacade.java 3 Oct 2005 08:34:37 -0000 1.11 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); ! Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,116 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { Index: PartFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/PartFacade.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PartFacade.java 30 Sep 2005 11:35:06 -0000 1.7 --- PartFacade.java 3 Oct 2005 08:34:37 -0000 1.8 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.PART_CREATED, p.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.PART_MODIFIED, p.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); ! Notification n = new Notification(Notification.PART_DELETED, p.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,116 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { Index: EdgeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EdgeFacade.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EdgeFacade.java 30 Sep 2005 12:47:46 -0000 1.9 --- EdgeFacade.java 3 Oct 2005 08:34:37 -0000 1.10 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 116,121 **** tx.commit(); ! Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 112,116 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** FunctionalSpaceFacade.java 30 Sep 2005 11:35:06 -0000 1.12 --- FunctionalSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import net.sourceforge.bprocessor.kernel.notification.Notification; - import net.sourceforge.bprocessor.kernel.notification.Notifier; import net.sourceforge.bprocessor.model.db.HibernateUtil; --- 7,10 ---- *************** *** 62,67 **** tx.commit(); ! Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 60,64 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 89,94 **** tx.commit(); ! Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, f.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 86,90 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { *************** *** 108,132 **** HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! ! //setting references to this space to null ! Set surfaces = f.getSurfaces(); ! if (surfaces != null) { ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surface = (Surface)surfIt.next(); ! Domain back = surface.getBackDomain(); ! if (back == f) { ! surface.setBackDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } else { ! Domain front = surface.getFrontDomain(); ! if (front == f) { ! surface.setFrontDomain(null); ! SurfaceFacade.getInstance().update(surface); ! } ! } ! } ! } ! try { Session session = hu.currentSession(); --- 104,108 ---- HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; ! try { Session session = hu.currentSession(); *************** *** 137,142 **** tx.commit(); ! Notification n = new Notification(Notification.FUNCTIONAL_SPACE_DELETED, f.getId()); ! Notifier.getInstance().sendNotification(n); } catch (Exception ex) { if (tx != null) { --- 113,117 ---- tx.commit(); ! } catch (Exception ex) { if (tx != null) { |