Clover Coverage Report - Implementation 2.0.0-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
40   141   12   10
8   77   0.3   4
4     3  
1    
 
  SearchableAttributeDAOOjbImpl       Line # 39 40 0% 12 52 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2007-2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10    * Unless required by applicable law or agreed to in writing, software
11    * distributed under the License is distributed on an "AS IS" BASIS,
12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13    * See the License for the specific language governing permissions and
14    * limitations under the License.
15    */
16    package org.kuali.rice.kew.docsearch.dao.impl;
17   
18    import java.math.BigDecimal;
19    import java.sql.Timestamp;
20    import java.util.ArrayList;
21    import java.util.Collection;
22    import java.util.List;
23   
24    import org.apache.ojb.broker.query.Criteria;
25    import org.apache.ojb.broker.query.QueryByCriteria;
26    import org.kuali.rice.kew.docsearch.SearchableAttributeDateTimeValue;
27    import org.kuali.rice.kew.docsearch.SearchableAttributeFloatValue;
28    import org.kuali.rice.kew.docsearch.SearchableAttributeLongValue;
29    import org.kuali.rice.kew.docsearch.SearchableAttributeStringValue;
30    import org.kuali.rice.kew.docsearch.dao.SearchableAttributeDAO;
31    import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
32   
33    /**
34    * OJB implementation of SearchableAttributeDAO
35    *
36    * @author Kuali Rice Team (rice.collab@kuali.org)
37    *
38    */
 
39    public class SearchableAttributeDAOOjbImpl extends PersistenceBrokerDaoSupport implements SearchableAttributeDAO {
40   
41    public static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(SearchableAttributeDAOOjbImpl.class);
42   
43    /**
44    * This overridden method queries the SearchableAttributeDateTimeValue persistence class
45    *
46    * @see org.kuali.rice.kew.docsearch.dao.SearchableAttributeDAO#getSearchableAttributeDateTimeValuesByKey(java.lang.Long, java.lang.String)
47    */
 
48  0 toggle public List<Timestamp> getSearchableAttributeDateTimeValuesByKey(
49    Long documentId, String key) {
50   
51  0 List<Timestamp> lRet = null;
52   
53  0 Criteria crit = new Criteria();
54  0 crit.addEqualTo("routeHeaderId", documentId);
55  0 crit.addEqualTo("searchableAttributeKey", key);
56  0 Collection<SearchableAttributeDateTimeValue> collection = getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(SearchableAttributeDateTimeValue.class, crit));
57   
58  0 if(collection != null && !collection.isEmpty()){
59  0 lRet = new ArrayList<Timestamp>();
60  0 for(SearchableAttributeDateTimeValue value:collection){
61  0 lRet.add(value.getSearchableAttributeValue());
62    }
63    }
64   
65  0 return lRet;
66    }
67   
68    /**
69    * This overridden method queries the SearchableAttributeFloatValue persistence class
70    *
71    * @see org.kuali.rice.kew.docsearch.dao.SearchableAttributeDAO#getSearchableAttributeFloatValuesByKey(java.lang.Long, java.lang.String)
72    */
 
73  0 toggle public List<BigDecimal> getSearchableAttributeFloatValuesByKey(
74    Long documentId, String key) {
75  0 List<BigDecimal> lRet = null;
76   
77  0 Criteria crit = new Criteria();
78  0 crit.addEqualTo("routeHeaderId", documentId);
79  0 crit.addEqualTo("searchableAttributeKey", key);
80  0 Collection<SearchableAttributeFloatValue> collection = getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(SearchableAttributeFloatValue.class, crit));
81   
82  0 if(collection != null && !collection.isEmpty()){
83  0 lRet = new ArrayList<BigDecimal>();
84  0 for(SearchableAttributeFloatValue value:collection){
85  0 lRet.add(value.getSearchableAttributeValue());
86    }
87    }
88   
89  0 return lRet;
90    }
91   
92    /**
93    * This overridden method queries the SearchableAttributeStringValue persistence class
94    *
95    * @see org.kuali.rice.kew.docsearch.dao.SearchableAttributeDAO#getSearchableAttributeStringValuesByKey(java.lang.Long, java.lang.String)
96    */
 
97  0 toggle public List<String> getSearchableAttributeStringValuesByKey(
98    Long documentId, String key) {
99   
100  0 List<String> lRet = null;
101   
102  0 Criteria crit = new Criteria();
103  0 crit.addEqualTo("routeHeaderId", documentId);
104  0 crit.addEqualTo("searchableAttributeKey", key);
105  0 Collection<SearchableAttributeStringValue> collection = getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(SearchableAttributeStringValue.class, crit));
106   
107  0 if(collection != null && !collection.isEmpty()){
108  0 lRet = new ArrayList<String>();
109  0 for(SearchableAttributeStringValue value:collection){
110  0 lRet.add(value.getSearchableAttributeValue());
111    }
112    }
113   
114  0 return lRet;
115    }
116   
117    /**
118    * This overridden method queries the SearchableAttributeLongValue persistence class
119    *
120    * @see org.kuali.rice.kew.docsearch.dao.SearchableAttributeDAO#getSearchableAttributeValuesByKey(java.lang.Long, java.lang.String)
121    */
 
122  0 toggle public List<Long> getSearchableAttributeLongValuesByKey(Long documentId,
123    String key) {
124  0 List<Long> lRet = null;
125   
126  0 Criteria crit = new Criteria();
127  0 crit.addEqualTo("routeHeaderId", documentId);
128  0 crit.addEqualTo("searchableAttributeKey", key);
129  0 Collection<SearchableAttributeLongValue> collection = getPersistenceBrokerTemplate().getCollectionByQuery(new QueryByCriteria(SearchableAttributeLongValue.class, crit));
130   
131  0 if(collection != null && !collection.isEmpty()){
132  0 lRet = new ArrayList<Long>();
133  0 for(SearchableAttributeLongValue value:collection){
134  0 lRet.add(value.getSearchableAttributeValue());
135    }
136    }
137   
138  0 return lRet;
139    }
140   
141    }