1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging.bam.dao.impl;
17
18 import java.util.List;
19
20 import javax.xml.namespace.QName;
21
22 import org.apache.ojb.broker.query.Criteria;
23 import org.apache.ojb.broker.query.QueryByCriteria;
24 import org.kuali.rice.core.api.reflect.ObjectDefinition;
25 import org.kuali.rice.core.api.reflect.ObjectDefinition;
26 import org.kuali.rice.ksb.messaging.bam.BAMParam;
27 import org.kuali.rice.ksb.messaging.bam.BAMTargetEntry;
28 import org.kuali.rice.ksb.messaging.bam.dao.BAMDAO;
29 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
30
31
32 public class BAMDAOOjbImpl extends PersistenceBrokerDaoSupport implements BAMDAO {
33
34 public void clearBAMTables() {
35 getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(BAMTargetEntry.class));
36 getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(BAMParam.class));
37 }
38
39 @SuppressWarnings("unchecked")
40 public List<BAMTargetEntry> getCallsForService(QName serviceName, String methodName) {
41 Criteria crit = new Criteria();
42 crit.addEqualTo("serviceName", serviceName.toString());
43 crit.addEqualTo("methodName", methodName);
44 return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit));
45 }
46
47 public void save(BAMTargetEntry bamEntry) {
48 this.getPersistenceBrokerTemplate().store(bamEntry);
49 }
50
51 @SuppressWarnings("unchecked")
52 public List<BAMTargetEntry> getCallsForService(QName serviceName) {
53 Criteria crit = new Criteria();
54 crit.addEqualTo("serviceName", serviceName.toString());
55 return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit));
56 }
57
58 @SuppressWarnings("unchecked")
59 public List<BAMTargetEntry> getCallsForRemotedClasses(ObjectDefinition objDef) {
60 Criteria crit = new Criteria();
61 QName qname = new QName(objDef.getApplicationId(), objDef.getClassName());
62 crit.addLike("serviceName", qname.toString() + "%");
63 return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit));
64 }
65
66 @SuppressWarnings("unchecked")
67 public List<BAMTargetEntry> getCallsForRemotedClasses(ObjectDefinition objDef, String methodName) {
68 Criteria crit = new Criteria();
69 QName qname = new QName(objDef.getApplicationId(), objDef.getClassName());
70 crit.addLike("serviceName", qname.toString() + "%");
71 crit.addEqualTo("methodName", methodName);
72 return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit));
73 }
74 }