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.reflect.ObjectDefinition; |
25 | |
import org.kuali.rice.ksb.messaging.bam.BAMParam; |
26 | |
import org.kuali.rice.ksb.messaging.bam.BAMTargetEntry; |
27 | |
import org.kuali.rice.ksb.messaging.bam.dao.BAMDAO; |
28 | |
import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport; |
29 | |
|
30 | |
|
31 | 0 | public class BAMDAOOjbImpl extends PersistenceBrokerDaoSupport implements BAMDAO { |
32 | |
|
33 | |
public void clearBAMTables() { |
34 | 0 | getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(BAMTargetEntry.class)); |
35 | 0 | getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(BAMParam.class)); |
36 | 0 | } |
37 | |
|
38 | |
@SuppressWarnings("unchecked") |
39 | |
public List<BAMTargetEntry> getCallsForService(QName serviceName, String methodName) { |
40 | 0 | Criteria crit = new Criteria(); |
41 | 0 | crit.addEqualTo("serviceName", serviceName.toString()); |
42 | 0 | crit.addEqualTo("methodName", methodName); |
43 | 0 | return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit)); |
44 | |
} |
45 | |
|
46 | |
public void save(BAMTargetEntry bamEntry) { |
47 | 0 | this.getPersistenceBrokerTemplate().store(bamEntry); |
48 | 0 | } |
49 | |
|
50 | |
@SuppressWarnings("unchecked") |
51 | |
public List<BAMTargetEntry> getCallsForService(QName serviceName) { |
52 | 0 | Criteria crit = new Criteria(); |
53 | 0 | crit.addEqualTo("serviceName", serviceName.toString()); |
54 | 0 | return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit)); |
55 | |
} |
56 | |
|
57 | |
@SuppressWarnings("unchecked") |
58 | |
public List<BAMTargetEntry> getCallsForRemotedClasses(ObjectDefinition objDef) { |
59 | 0 | Criteria crit = new Criteria(); |
60 | 0 | QName qname = new QName(objDef.getServiceNamespace(), objDef.getClassName()); |
61 | 0 | crit.addLike("serviceName", qname.toString() + "%"); |
62 | 0 | return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit)); |
63 | |
} |
64 | |
|
65 | |
@SuppressWarnings("unchecked") |
66 | |
public List<BAMTargetEntry> getCallsForRemotedClasses(ObjectDefinition objDef, String methodName) { |
67 | 0 | Criteria crit = new Criteria(); |
68 | 0 | QName qname = new QName(objDef.getServiceNamespace(), objDef.getClassName()); |
69 | 0 | crit.addLike("serviceName", qname.toString() + "%"); |
70 | 0 | crit.addEqualTo("methodName", methodName); |
71 | 0 | return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit)); |
72 | |
} |
73 | |
} |