Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31875
Modified Files:
ConstructionSpaceFacade.java
Log Message:
added method to find the set of constructionspace's given a surface
Index: ConstructionSpaceFacade.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConstructionSpaceFacade.java 17 Aug 2005 11:22:54 -0000 1.4
--- ConstructionSpaceFacade.java 12 Sep 2005 18:17:58 -0000 1.5
***************
*** 203,205 ****
--- 203,237 ----
return result;
}
+
+ /**
+ * Find the Construction spaces matched with a surface
+ * @param surface The the surface
+ * @return The space the given surface is conected with
+ */
+ public Set findBySurface(Surface surface) {
+ Set result = new HashSet();
+
+ HibernateUtil hu = HibernateUtil.getInstance();
+ try {
+ Session session = hu.currentSession();
+ Transaction tx = session.beginTransaction();
+
+ Query q = session.createQuery("SELECT f FROM ConstructionSpace AS f," +
+ "Domain AS d " +
+ "JOIN d.surfaces AS surfaces " +
+ "WHERE surfaces.id = :id AND d.id = f.id");
+ q.setLong("id", surface.getId().longValue());
+
+ Iterator it = q.iterate();
+ while (it.hasNext()) {
+ result.add((ConstructionSpace)it.next());
+ }
+ tx.commit();
+ } catch (Exception ex) {
+ log.error(ex.getMessage(), ex);
+ } finally {
+ hu.closeSession();
+ }
+ return result;
+ }
}
|