Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16219/src/net/sourceforge/bprocessor/model
Modified Files:
SurfaceFacade.java
Log Message:
Added findByEdge()
Index: SurfaceFacade.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SurfaceFacade.java 28 Jul 2005 06:48:54 -0000 1.2
--- SurfaceFacade.java 28 Jul 2005 07:39:05 -0000 1.3
***************
*** 192,194 ****
--- 192,227 ----
return result;
}
+
+ /**
+ * Find surfaces based upon an edge
+ * @param e The edge
+ * @return The surfaces
+ */
+ public Set findByEdge(Edge e) {
+ Set result = new HashSet();
+
+ HibernateUtil hu = HibernateUtil.getInstance();
+ try {
+ Session session = hu.currentSession();
+ Transaction tx = session.beginTransaction();
+
+ Query q = session.createQuery("SELECT s FROM Surface AS s " +
+ "JOIN s.edges AS edges " +
+ "WHERE edges.id = :id");
+ q.setLong("id", e.getId().longValue());
+
+ Iterator it = q.iterate();
+ while (it.hasNext()) {
+ result.add((Surface)it.next());
+ }
+
+ tx.commit();
+ } catch (Exception ex) {
+ log.error(ex.getMessage(), ex);
+ } finally {
+ hu.closeSession();
+ }
+
+ return result;
+ }
}
|