01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.cg.dao.ojb;
17:
18: import java.util.Collection;
19:
20: import org.apache.ojb.broker.query.Criteria;
21: import org.apache.ojb.broker.query.QueryFactory;
22: import org.kuali.core.dao.ojb.PlatformAwareDaoBaseOjb;
23: import org.kuali.module.cg.bo.Award;
24: import org.kuali.module.cg.bo.Close;
25: import org.kuali.module.cg.dao.AwardDao;
26:
27: /**
28: * @see AwardDao
29: */
30: public class AwardDaoOjb extends PlatformAwareDaoBaseOjb implements
31: AwardDao {
32:
33: /**
34: * @see org.kuali.module.cg.dao.AwardDao#deleteAll()
35: */
36: public void deleteAll() {
37: getPersistenceBrokerTemplate().deleteByQuery(
38: QueryFactory.newQuery(Award.class, new Criteria()));
39: }
40:
41: /**
42: * @see org.kuali.module.cg.dao.AwardDao#getAwardsToClose(org.kuali.module.cg.bo.Close)
43: */
44: public Collection<Award> getAwardsToClose(Close close) {
45:
46: Criteria criteria = new Criteria();
47: criteria.addIsNull("awardClosingDate");
48: criteria.addLessOrEqualThan("awardEntryDate", close
49: .getCloseOnOrBeforeDate());
50: criteria.addNotEqualTo("awardStatusCode", "U");
51:
52: return (Collection<Award>) getPersistenceBrokerTemplate()
53: .getCollectionByQuery(
54: QueryFactory.newQuery(Award.class, criteria));
55: }
56:
57: /**
58: * @see org.kuali.module.cg.dao.AwardDao#save(org.kuali.module.cg.bo.Award)
59: */
60: public void save(Award award) {
61: getPersistenceBrokerTemplate().store(award);
62: }
63:
64: }
|