01: package org.osbl.riskmanagement.logic;
02:
03: import org.hibernate.*;
04: import org.osbl.riskmanagement.model.*;
05: import org.osbl.persistence.logic.DefaultTreeLogic;
06:
07: import java.util.List;
08:
09: /**
10: * @author hengels
11: * @version $Revision$
12: */
13: public class DefaultRiskManagementLogic extends
14: DefaultTreeLogic<Classification, RiskType> implements
15: RiskManagementLogic {
16: protected String getNodeType() {
17: return RiskType.class.getName();
18: }
19:
20: protected String getTreeType() {
21: return Classification.class.getName();
22: }
23:
24: public List<Risk> risks(Long riskType) {
25: Session session = getSessionFactory().getCurrentSession();
26: Query query = session
27: .createQuery("from Risk r where r.type.id = :riskType and obsolete is null");
28: query.setLong("riskType", riskType);
29: return query.list();
30: }
31: }
|