[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model DatabaseFacade.java,NONE,1.1 DomainFa
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-10-05 08:05:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24041/src/net/sourceforge/bprocessor/model Modified Files: DomainFacade.java PartFacade.java EdgeFacade.java ConstructionSpaceFacade.java ElementFacade.java AttributeFacade.java VertexFacade.java SurfaceFacade.java Project.java FunctionalSpaceFacade.java Added Files: DatabaseFacade.java Log Message: Project now uses DatabaseFacade instead of EdgeFacade etc. Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ConstructionSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 --- ConstructionSpaceFacade.java 5 Oct 2005 08:05:36 -0000 1.14 *************** *** 45,124 **** } ! /** ! * Create a construction space ! * @param c The construction space ! */ ! public synchronized void create(ConstructionSpace c) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(c); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update a construction space ! * @param c The construction space ! */ ! public synchronized void update(ConstructionSpace c) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(c); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove a construction space ! * @param c The construction space ! */ ! public synchronized void remove(ConstructionSpace c) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(c); ! ! tx.commit(); ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all construction spaces --- 45,49 ---- } ! /** * Find all construction spaces Index: ElementFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ElementFacade.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ElementFacade.java 3 Oct 2005 08:34:37 -0000 1.8 --- ElementFacade.java 5 Oct 2005 08:05:36 -0000 1.9 *************** *** 44,125 **** return instance; } ! ! /** ! * Create an element ! * @param e The element ! */ ! public synchronized void create(Element e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update an element ! * @param e The element ! */ ! public synchronized void update(Element e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove an element ! * @param e The element ! */ ! public synchronized void remove(Element e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(e); ! ! tx.commit(); ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all elements --- 44,48 ---- return instance; } ! /** * Find all elements Index: AttributeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/AttributeFacade.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AttributeFacade.java 30 Sep 2005 11:35:06 -0000 1.3 --- AttributeFacade.java 5 Oct 2005 08:05:36 -0000 1.4 *************** *** 39,115 **** return instance; } ! ! /** ! * Create an attribute ! * @param a The attribute ! */ ! public synchronized void create(Attribute a) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(a); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update an attribute ! * @param a The attribute ! */ ! public synchronized void update(Attribute a) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(a); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove an attribute ! * @param a The attribute ! */ ! public synchronized void remove(Attribute a) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(a); ! ! tx.commit(); ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find a attribute by id --- 39,43 ---- return instance; } ! /** * Find a attribute by id --- NEW FILE: DatabaseFacade.java --- //--------------------------------------------------------------------------------- // $Id: DatabaseFacade.java,v 1.1 2005/10/05 08:05:36 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.util.Set; import net.sourceforge.bprocessor.model.db.HibernateUtil; import org.apache.log4j.Logger; import org.hibernate.Session; import org.hibernate.Transaction; /** * Facade for database */ public class DatabaseFacade { /** The logger */ private static Logger log = Logger.getLogger(DatabaseFacade.class); /** The instance */ private static DatabaseFacade instance; /** * Get the instance * @return The instance */ public static synchronized DatabaseFacade getInstance() { if (instance == null) { instance = new DatabaseFacade(); } return instance; } /** * Insert an object into the database * @param o The object */ public void intern(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.save(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Update an object * @param o The object */ public void update(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.update(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Remove and object * @param o The object */ public void remove(Object o) { HibernateUtil hu = HibernateUtil.getInstance(); Transaction tx = null; try { Session session = hu.currentSession(); tx = session.beginTransaction(); session.delete(o); tx.commit(); } catch (Exception ex) { if (tx != null) { tx.rollback(); } log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } } /** * Find a attribute by id * @param id The id * @return The attribute */ public Attribute findAttributeById(Long id) { return AttributeFacade.getInstance().findById(id); } /** * Find all construction spaces * @return The construction spaces */ public Set getConstructionSpaces() { return ConstructionSpaceFacade.getInstance().findAll(); } /** * Find a construction space by id * @param id The id * @return The construction space */ public ConstructionSpace findConstructionSpaceById(Long id) { return ConstructionSpaceFacade.getInstance().findById(id); } /** * Find all domains * @return the set of all domains */ public Set getDomains() { return DomainFacade.getInstance().findAll(); } /** * Find a domain by id * @param id The id * @return The domain */ public Domain findDomainById(Long id) { return DomainFacade.getInstance().findById(id); } /** * Find all edges * @return The edges */ public Set getEdges() { return EdgeFacade.getInstance().findAll(); } /** * Find an edge by id * @param id The id * @return The edge */ public Edge findEdgeById(Long id) { return EdgeFacade.getInstance().findById(id); } /** * Find all elements * @return The elements */ public Set getElements() { return ElementFacade.getInstance().findAll(); } /** * Find a element by id * @param id The id * @return The element */ public Element findElementById(Long id) { return ElementFacade.getInstance().findById(id); } /** * Find all functional spaces * @return The functional spaces */ public Set getFunctionalSpaces() { return FunctionalSpaceFacade.getInstance().findAll(); } /** * Find a functional space by id * @param id The id * @return The functional space */ public FunctionalSpace findFunctionalSpaceById(Long id) { return FunctionalSpaceFacade.getInstance().findById(id); } /** * Find all parts * @return The parts */ public Set getParts() { return PartFacade.getInstance().findAll(); } /** * Find a part by id * @param id The id * @return The part */ public Part findPartById(Long id) { return PartFacade.getInstance().findById(id); } /** * Find all surfaces * @return The surfaces */ public Set getSurfaces() { return SurfaceFacade.getInstance().findAll(); } /** * Find a surface by id * @param id The id * @return The surface */ public Surface findSurfaceById(Long id) { return SurfaceFacade.getInstance().findById(id); } /** * Find all vertexs * @return The vertexs */ public Set getVertices() { return VertexFacade.getInstance().findAll(); } /** * Find a vertex by id * @param id The id * @return The vertex */ public Vertex findVertexById(Long id) { return VertexFacade.getInstance().findById(id); } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Project.java 3 Oct 2005 08:34:37 -0000 1.3 --- Project.java 5 Oct 2005 08:05:36 -0000 1.4 *************** *** 46,50 **** */ public void intern(Attribute a) { ! AttributeFacade.getInstance().create(a); } --- 46,50 ---- */ public void intern(Attribute a) { ! DatabaseFacade.getInstance().intern((Object) a); } *************** *** 54,58 **** */ public void update(Attribute a) { ! AttributeFacade.getInstance().update(a); } --- 54,58 ---- */ public void update(Attribute a) { ! DatabaseFacade.getInstance().update(a); } *************** *** 62,66 **** */ public void remove(Attribute a) { ! AttributeFacade.getInstance().remove(a); } --- 62,66 ---- */ public void remove(Attribute a) { ! DatabaseFacade.getInstance().remove(a); } *************** *** 71,75 **** */ public Attribute findAttributeById(Long id) { ! return AttributeFacade.getInstance().findById(id); } --- 71,75 ---- */ public Attribute findAttributeById(Long id) { ! return DatabaseFacade.getInstance().findAttributeById(id); } *************** *** 79,83 **** */ public void intern(ConstructionSpace c) { ! ConstructionSpaceFacade.getInstance().create(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); Notifier.getInstance().sendNotification(n); --- 79,83 ---- */ public void intern(ConstructionSpace c) { ! DatabaseFacade.getInstance().intern((Object) c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, c.getId()); Notifier.getInstance().sendNotification(n); *************** *** 89,93 **** */ public void update(ConstructionSpace c) { ! ConstructionSpaceFacade.getInstance().update(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); Notifier.getInstance().sendNotification(n); --- 89,93 ---- */ public void update(ConstructionSpace c) { ! DatabaseFacade.getInstance().update(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, c.getId()); Notifier.getInstance().sendNotification(n); *************** *** 108,122 **** 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); --- 108,122 ---- if (back == c) { surface.setBackDomain(null); ! DatabaseFacade.getInstance().update(surface); } else { Domain front = surface.getFrontDomain(); if (front == c) { surface.setFrontDomain(null); ! DatabaseFacade.getInstance().update(surface); } } } } ! DatabaseFacade.getInstance().remove(c); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_DELETED, c.getId()); Notifier.getInstance().sendNotification(n); *************** *** 128,132 **** */ public Set getConstructionSpaces() { ! return ConstructionSpaceFacade.getInstance().findAll(); } --- 128,132 ---- */ public Set getConstructionSpaces() { ! return DatabaseFacade.getInstance().getConstructionSpaces(); } *************** *** 137,141 **** */ public ConstructionSpace findConstructionSpaceById(Long id) { ! return ConstructionSpaceFacade.getInstance().findById(id); } --- 137,141 ---- */ public ConstructionSpace findConstructionSpaceById(Long id) { ! return DatabaseFacade.getInstance().findConstructionSpaceById(id); } *************** *** 146,154 **** public void update(Domain domain) { 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); --- 146,154 ---- public void update(Domain domain) { if (domain instanceof ConstructionSpace) { ! DatabaseFacade.getInstance().update((ConstructionSpace)domain); Notification n = new Notification(Notification.CONSTRUCTION_SPACE_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); } else if (domain instanceof FunctionalSpace) { ! DatabaseFacade.getInstance().update((FunctionalSpace)domain); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); *************** *** 157,161 **** } else if (domain instanceof Part) { ! PartFacade.getInstance().update((Part)domain); Notification n = new Notification(Notification.PART_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); --- 157,161 ---- } else if (domain instanceof Part) { ! DatabaseFacade.getInstance().update((Part)domain); Notification n = new Notification(Notification.PART_MODIFIED, domain.getId()); Notifier.getInstance().sendNotification(n); *************** *** 170,174 **** */ public Set getDomains() { ! return DomainFacade.getInstance().findAll(); } --- 170,174 ---- */ public Set getDomains() { ! return DatabaseFacade.getInstance().getDomains(); } *************** *** 179,183 **** */ public Domain findDomainById(Long id) { ! return DomainFacade.getInstance().findById(id); } --- 179,183 ---- */ public Domain findDomainById(Long id) { ! return DatabaseFacade.getInstance().findDomainById(id); } *************** *** 187,191 **** */ public void intern(Edge e) { ! EdgeFacade.getInstance().create(e); Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); --- 187,191 ---- */ public void intern(Edge e) { ! DatabaseFacade.getInstance().intern((Object) e); Notification n = new Notification(Notification.EDGE_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 197,201 **** */ public void update(Edge e) { ! EdgeFacade.getInstance().update(e); Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); --- 197,201 ---- */ public void update(Edge e) { ! DatabaseFacade.getInstance().update(e); Notification n = new Notification(Notification.EDGE_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 207,211 **** */ public void remove(Edge e) { ! EdgeFacade.getInstance().remove(e); Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); --- 207,211 ---- */ public void remove(Edge e) { ! DatabaseFacade.getInstance().remove(e); Notification n = new Notification(Notification.EDGE_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 217,221 **** */ public Set getEdges() { ! return EdgeFacade.getInstance().findAll(); } --- 217,221 ---- */ public Set getEdges() { ! return DatabaseFacade.getInstance().getEdges(); } *************** *** 226,230 **** */ public Edge findEdgeById(Long id) { ! return EdgeFacade.getInstance().findById(id); } --- 226,230 ---- */ public Edge findEdgeById(Long id) { ! return DatabaseFacade.getInstance().findEdgeById(id); } *************** *** 234,238 **** */ public void intern(Element e) { ! ElementFacade.getInstance().create(e); Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); --- 234,238 ---- */ public void intern(Element e) { ! DatabaseFacade.getInstance().intern((Object) e); Notification n = new Notification(Notification.ELEMENT_CREATED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 244,248 **** */ public void update(Element e) { ! ElementFacade.getInstance().update(e); Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); --- 244,248 ---- */ public void update(Element e) { ! DatabaseFacade.getInstance().update(e); Notification n = new Notification(Notification.ELEMENT_MODIFIED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 254,258 **** */ public void remove(Element e) { ! ElementFacade.getInstance().remove(e); Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); --- 254,258 ---- */ public void remove(Element e) { ! DatabaseFacade.getInstance().remove(e); Notification n = new Notification(Notification.ELEMENT_DELETED, e.getId()); Notifier.getInstance().sendNotification(n); *************** *** 264,268 **** */ public Set getElements() { ! return ElementFacade.getInstance().findAll(); } --- 264,268 ---- */ public Set getElements() { ! return DatabaseFacade.getInstance().getElements(); } *************** *** 273,277 **** */ public Element findElementById(Long id) { ! return ElementFacade.getInstance().findById(id); } --- 273,277 ---- */ public Element findElementById(Long id) { ! return DatabaseFacade.getInstance().findElementById(id); } *************** *** 281,285 **** */ public void intern(FunctionalSpace f) { ! FunctionalSpaceFacade.getInstance().create(f); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); Notifier.getInstance().sendNotification(n); --- 281,285 ---- */ public void intern(FunctionalSpace f) { ! DatabaseFacade.getInstance().intern((Object) f); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_CREATED, f.getId()); Notifier.getInstance().sendNotification(n); *************** *** 291,295 **** */ public void update(FunctionalSpace f) { ! FunctionalSpaceFacade.getInstance().update(f); } --- 291,295 ---- */ public void update(FunctionalSpace f) { ! DatabaseFacade.getInstance().update(f); } *************** *** 308,322 **** 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); --- 308,322 ---- if (back == f) { surface.setBackDomain(null); ! DatabaseFacade.getInstance().update(surface); } else { Domain front = surface.getFrontDomain(); if (front == f) { surface.setFrontDomain(null); ! DatabaseFacade.getInstance().update(surface); } } } } ! DatabaseFacade.getInstance().remove(f); Notification n = new Notification(Notification.FUNCTIONAL_SPACE_DELETED, f.getId()); Notifier.getInstance().sendNotification(n); *************** *** 328,332 **** */ public Set getFunctionalSpaces() { ! return FunctionalSpaceFacade.getInstance().findAll(); } --- 328,332 ---- */ public Set getFunctionalSpaces() { ! return DatabaseFacade.getInstance().getFunctionalSpaces(); } *************** *** 337,341 **** */ public FunctionalSpace findFunctionalSpaceById(Long id) { ! return FunctionalSpaceFacade.getInstance().findById(id); } --- 337,341 ---- */ public FunctionalSpace findFunctionalSpaceById(Long id) { ! return DatabaseFacade.getInstance().findFunctionalSpaceById(id); } *************** *** 345,349 **** */ public void intern(Part p) { ! PartFacade.getInstance().create(p); Notification n = new Notification(Notification.PART_CREATED, p.getId()); Notifier.getInstance().sendNotification(n); --- 345,349 ---- */ public void intern(Part p) { ! DatabaseFacade.getInstance().intern((Object) p); Notification n = new Notification(Notification.PART_CREATED, p.getId()); Notifier.getInstance().sendNotification(n); *************** *** 355,359 **** */ public void update(Part p) { ! PartFacade.getInstance().update(p); } --- 355,359 ---- */ public void update(Part p) { ! DatabaseFacade.getInstance().update(p); } *************** *** 363,367 **** */ public void remove(Part p) { ! PartFacade.getInstance().remove(p); Notification n = new Notification(Notification.PART_DELETED, p.getId()); Notifier.getInstance().sendNotification(n); --- 363,367 ---- */ public void remove(Part p) { ! DatabaseFacade.getInstance().remove(p); Notification n = new Notification(Notification.PART_DELETED, p.getId()); Notifier.getInstance().sendNotification(n); *************** *** 373,377 **** */ public Set getParts() { ! return PartFacade.getInstance().findAll(); } --- 373,377 ---- */ public Set getParts() { ! return DatabaseFacade.getInstance().getParts(); } *************** *** 382,386 **** */ public Part findPartById(Long id) { ! return PartFacade.getInstance().findById(id); } --- 382,386 ---- */ public Part findPartById(Long id) { ! return DatabaseFacade.getInstance().findPartById(id); } *************** *** 390,394 **** */ public void intern(Surface s) { ! SurfaceFacade.getInstance().create(s); Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); --- 390,394 ---- */ public void intern(Surface s) { ! DatabaseFacade.getInstance().intern((Object) s); Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); *************** *** 400,404 **** */ public void update(Surface s) { ! SurfaceFacade.getInstance().update(s); Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); Notifier.getInstance().sendNotification(n); --- 400,404 ---- */ public void update(Surface s) { ! DatabaseFacade.getInstance().update(s); Notification n = new Notification(Notification.SURFACE_MODIFIED, s.getId()); Notifier.getInstance().sendNotification(n); *************** *** 416,420 **** if (back != null) { if (back.removeSurface(s)) { ! DomainFacade.getInstance().update(back); } s.setBackDomain(null); --- 416,420 ---- if (back != null) { if (back.removeSurface(s)) { ! DatabaseFacade.getInstance().update(back); } s.setBackDomain(null); *************** *** 423,432 **** 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); --- 423,432 ---- if (front != null) { if (front.removeSurface(s)) { ! DatabaseFacade.getInstance().update(front); } s.setFrontDomain(null); } ! DatabaseFacade.getInstance().remove(s); Notification n = new Notification(Notification.SURFACE_DELETED, s.getId()); Notifier.getInstance().sendNotification(n); *************** *** 438,442 **** */ public Set getSurfaces() { ! return SurfaceFacade.getInstance().findAll(); } --- 438,442 ---- */ public Set getSurfaces() { ! return DatabaseFacade.getInstance().getSurfaces(); } *************** *** 447,451 **** */ public Surface findSurfaceById(Long id) { ! return SurfaceFacade.getInstance().findById(id); } --- 447,451 ---- */ public Surface findSurfaceById(Long id) { ! return DatabaseFacade.getInstance().findSurfaceById(id); } *************** *** 455,459 **** */ public void intern(Vertex v) { ! VertexFacade.getInstance().create(v); Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); Notifier.getInstance().sendNotification(n); --- 455,459 ---- */ public void intern(Vertex v) { ! DatabaseFacade.getInstance().intern((Object) v); Notification n = new Notification(Notification.VERTEX_CREATED, v.getId()); Notifier.getInstance().sendNotification(n); *************** *** 465,469 **** */ public void update(Vertex v) { ! VertexFacade.getInstance().update(v); Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); Notifier.getInstance().sendNotification(n); --- 465,469 ---- */ public void update(Vertex v) { ! DatabaseFacade.getInstance().update(v); Notification n = new Notification(Notification.VERTEX_MODIFIED, v.getId()); Notifier.getInstance().sendNotification(n); *************** *** 475,479 **** */ public void remove(Vertex v) { ! VertexFacade.getInstance().remove(v); Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); Notifier.getInstance().sendNotification(n); --- 475,479 ---- */ public void remove(Vertex v) { ! DatabaseFacade.getInstance().remove(v); Notification n = new Notification(Notification.VERTEX_DELETED, v.getId()); Notifier.getInstance().sendNotification(n); *************** *** 485,489 **** */ public Set getVertices() { ! return VertexFacade.getInstance().findAll(); } --- 485,489 ---- */ public Set getVertices() { ! return DatabaseFacade.getInstance().getVertices(); } *************** *** 494,498 **** */ public Vertex findVertexById(Long id) { ! return VertexFacade.getInstance().findById(id); } --- 494,498 ---- */ public Vertex findVertexById(Long id) { ! return DatabaseFacade.getInstance().findVertexById(id); } Index: DomainFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DomainFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DomainFacade.java 30 Sep 2005 11:15:34 -0000 1.5 --- DomainFacade.java 5 Oct 2005 08:05:36 -0000 1.6 *************** *** 43,64 **** return instance; } - - /** - * Update the Domain - * @param domain The domain to update - */ - public synchronized void update(Domain domain) { - 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()); - } - } /** --- 43,46 ---- Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SurfaceFacade.java 3 Oct 2005 08:34:37 -0000 1.14 --- SurfaceFacade.java 5 Oct 2005 08:05:36 -0000 1.15 *************** *** 45,125 **** /** - * Create a surface - * @param s The surface - */ - public synchronized void create(Surface s) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.save(s); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Update a surface - * @param s The surface - */ - public synchronized void update(Surface s) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.update(s); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Remove a surface - * @param s The surface - */ - public synchronized void remove(Surface s) { - - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.delete(s); - - tx.commit(); - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** * Find all surfaces * @return The surfaces --- 45,48 ---- Index: VertexFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/VertexFacade.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** VertexFacade.java 3 Oct 2005 08:34:37 -0000 1.11 --- VertexFacade.java 5 Oct 2005 08:05:36 -0000 1.12 *************** *** 46,127 **** /** - * Create a vertex - * @param v The vertex - */ - public synchronized void create(Vertex v) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.save(v); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Update a vertex - * @param v The vertex - */ - public synchronized void update(Vertex v) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.update(v); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Remove a vertex - * @param v The vertex - */ - public synchronized void remove(Vertex v) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.delete(v); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** * Find all vertexs * @return The vertexs --- 46,49 ---- Index: PartFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/PartFacade.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PartFacade.java 3 Oct 2005 08:34:37 -0000 1.8 --- PartFacade.java 5 Oct 2005 08:05:36 -0000 1.9 *************** *** 46,127 **** /** - * Create a part - * @param p The part - */ - public synchronized void create(Part p) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.save(p); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Update a part - * @param p The part - */ - public synchronized void update(Part p) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.update(p); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** - * Remove a part - * @param p The part - */ - public synchronized void remove(Part p) { - HibernateUtil hu = HibernateUtil.getInstance(); - Transaction tx = null; - try { - Session session = hu.currentSession(); - tx = session.beginTransaction(); - - session.delete(p); - - tx.commit(); - - - } catch (Exception ex) { - if (tx != null) { - tx.rollback(); - } - log.error(ex.getMessage(), ex); - } finally { - hu.closeSession(); - } - } - - /** * Find all parts * @return The parts --- 46,49 ---- Index: EdgeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EdgeFacade.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EdgeFacade.java 3 Oct 2005 08:34:37 -0000 1.10 --- EdgeFacade.java 5 Oct 2005 08:05:36 -0000 1.11 *************** *** 44,126 **** return instance; } ! ! /** ! * Create an edge ! * @param e The edge ! */ ! public synchronized void create(Edge e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update an edge ! * @param e The edge ! */ ! public synchronized void update(Edge e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove an edge ! * @param e The edge ! */ ! public synchronized void remove(Edge e) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(e); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all edges --- 44,48 ---- return instance; } ! /** * Find all edges Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** FunctionalSpaceFacade.java 3 Oct 2005 08:34:37 -0000 1.13 --- FunctionalSpaceFacade.java 5 Oct 2005 08:05:36 -0000 1.14 *************** *** 44,127 **** return instance; } ! ! /** ! * Create a functional space ! * @param f The functional space ! */ ! public synchronized void create(FunctionalSpace f) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.save(f); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Update a functional space ! * @param f The functional space ! */ ! public synchronized void update(FunctionalSpace f) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.update(f); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! ! /** ! * Remove a functional space ! * @param f The functional space ! */ ! public synchronized void remove(FunctionalSpace f) { ! HibernateUtil hu = HibernateUtil.getInstance(); ! Transaction tx = null; ! ! try { ! Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! ! session.delete(f); ! ! tx.commit(); ! ! ! } catch (Exception ex) { ! if (tx != null) { ! tx.rollback(); ! } ! log.error(ex.getMessage(), ex); ! } finally { ! hu.closeSession(); ! } ! } ! /** * Find all functional spaces --- 44,48 ---- return instance; } ! /** * Find all functional spaces |