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 | 0 | public class BAMDAOOjbImpl extends PersistenceBrokerDaoSupport implements BAMDAO { |
33 | |
|
34 | |
public void clearBAMTables() { |
35 | 0 | getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(BAMTargetEntry.class)); |
36 | 0 | getPersistenceBrokerTemplate().deleteByQuery(new QueryByCriteria(BAMParam.class)); |
37 | 0 | } |
38 | |
|
39 | |
@SuppressWarnings("unchecked") |
40 | |
public List<BAMTargetEntry> getCallsForService(QName serviceName, String methodName) { |
41 | 0 | Criteria crit = new Criteria(); |
42 | 0 | crit.addEqualTo("serviceName", serviceName.toString()); |
43 | 0 | crit.addEqualTo("methodName", methodName); |
44 | 0 | return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit)); |
45 | |
} |
46 | |
|
47 | |
public void save(BAMTargetEntry bamEntry) { |
48 | 0 | this.getPersistenceBrokerTemplate().store(bamEntry); |
49 | 0 | } |
50 | |
|
51 | |
@SuppressWarnings("unchecked") |
52 | |
public List<BAMTargetEntry> getCallsForService(QName serviceName) { |
53 | 0 | Criteria crit = new Criteria(); |
54 | 0 | crit.addEqualTo("serviceName", serviceName.toString()); |
55 | 0 | return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit)); |
56 | |
} |
57 | |
|
58 | |
@SuppressWarnings("unchecked") |
59 | |
public List<BAMTargetEntry> getCallsForRemotedClasses(ObjectDefinition objDef) { |
60 | 0 | Criteria crit = new Criteria(); |
61 | 0 | QName qname = new QName(objDef.getApplicationId(), objDef.getClassName()); |
62 | 0 | crit.addLike("serviceName", qname.toString() + "%"); |
63 | 0 | 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 | 0 | Criteria crit = new Criteria(); |
69 | 0 | QName qname = new QName(objDef.getApplicationId(), objDef.getClassName()); |
70 | 0 | crit.addLike("serviceName", qname.toString() + "%"); |
71 | 0 | crit.addEqualTo("methodName", methodName); |
72 | 0 | return (List<BAMTargetEntry>)getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(BAMTargetEntry.class, crit)); |
73 | |
} |
74 | |
} |