1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.edl.impl.dao.impl; |
18 | |
|
19 | |
import java.util.ArrayList; |
20 | |
import java.util.Iterator; |
21 | |
import java.util.List; |
22 | |
|
23 | |
import org.apache.ojb.broker.query.Criteria; |
24 | |
import org.apache.ojb.broker.query.QueryByCriteria; |
25 | |
import org.kuali.rice.edl.impl.bo.EDocLiteAssociation; |
26 | |
import org.kuali.rice.edl.impl.bo.EDocLiteDefinition; |
27 | |
import org.kuali.rice.edl.impl.dao.EDocLiteDAO; |
28 | |
import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport; |
29 | |
|
30 | |
|
31 | 0 | public class EDocLiteDAOOjbImpl extends PersistenceBrokerDaoSupport implements EDocLiteDAO { |
32 | |
|
33 | |
public void saveEDocLiteDefinition(EDocLiteDefinition edocLiteData) { |
34 | 0 | this.getPersistenceBrokerTemplate().store(edocLiteData); |
35 | 0 | } |
36 | |
|
37 | |
public void saveEDocLiteAssociation(EDocLiteAssociation assoc) { |
38 | 0 | this.getPersistenceBrokerTemplate().store(assoc); |
39 | 0 | } |
40 | |
|
41 | |
public EDocLiteDefinition getEDocLiteDefinition(String defName) { |
42 | 0 | Criteria criteria = new Criteria(); |
43 | 0 | criteria.addEqualTo("name", defName); |
44 | 0 | criteria.addEqualTo("activeInd", Boolean.TRUE); |
45 | 0 | return (EDocLiteDefinition) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteDefinition.class, criteria)); |
46 | |
} |
47 | |
|
48 | |
public EDocLiteAssociation getEDocLiteAssociation(String docTypeName) { |
49 | 0 | Criteria criteria = new Criteria(); |
50 | 0 | criteria.addEqualTo("edlName", docTypeName); |
51 | 0 | criteria.addEqualTo("activeInd", Boolean.TRUE); |
52 | 0 | return (EDocLiteAssociation) this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteAssociation.class, criteria)); |
53 | |
} |
54 | |
|
55 | |
public List getEDocLiteDefinitions() { |
56 | 0 | Criteria criteria = new Criteria(); |
57 | 0 | criteria.addEqualTo("activeInd", Boolean.TRUE); |
58 | 0 | Iterator it = this.getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(EDocLiteDefinition.class, criteria)); |
59 | 0 | List defs = new ArrayList(); |
60 | 0 | while (it.hasNext()) { |
61 | 0 | defs.add(((EDocLiteDefinition) it.next()).getName()); |
62 | |
} |
63 | 0 | return defs; |
64 | |
} |
65 | |
|
66 | |
public List getEDocLiteAssociations() { |
67 | 0 | Criteria criteria = new Criteria(); |
68 | 0 | criteria.addEqualTo("activeInd", Boolean.TRUE); |
69 | 0 | Iterator it = this.getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(EDocLiteAssociation.class, criteria)); |
70 | 0 | List assocs = new ArrayList(); |
71 | 0 | while (it.hasNext()) { |
72 | 0 | assocs.add(it.next()); |
73 | |
} |
74 | 0 | return assocs; |
75 | |
} |
76 | |
|
77 | |
public List search(EDocLiteAssociation edocLite) { |
78 | 0 | Criteria crit = new Criteria(); |
79 | 0 | if (edocLite.getActiveInd() != null) { |
80 | 0 | crit.addEqualTo("activeInd", edocLite.getActiveInd()); |
81 | |
} |
82 | 0 | if (edocLite.getDefinition() != null) { |
83 | 0 | crit.addLike("UPPER(definition)", "%"+edocLite.getDefinition().toUpperCase()+"%"); |
84 | |
} |
85 | 0 | if (edocLite.getEdlName() != null) { |
86 | 0 | crit.addLike("UPPER(edlName)", "%"+edocLite.getEdlName().toUpperCase()+"%"); |
87 | |
} |
88 | 0 | if (edocLite.getStyle() != null) { |
89 | 0 | crit.addLike("UPPER(style)", "%"+edocLite.getStyle().toUpperCase()+"%"); |
90 | |
} |
91 | 0 | return (List)this.getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(EDocLiteAssociation.class, crit)); |
92 | |
} |
93 | |
|
94 | |
public EDocLiteAssociation getEDocLiteAssociation(Long associationId) { |
95 | 0 | Criteria crit = new Criteria(); |
96 | 0 | crit.addEqualTo("edocLiteAssocId", associationId); |
97 | 0 | return (EDocLiteAssociation)this.getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(EDocLiteAssociation.class, crit)); |
98 | |
} |
99 | |
} |