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: /*
17: * Created on Aug 16, 2004
18: *
19: */
20: package org.kuali.module.pdp.dao.ojb;
21:
22: import java.sql.Timestamp;
23: import java.util.Date;
24:
25: import org.apache.ojb.broker.query.Criteria;
26: import org.apache.ojb.broker.query.QueryByCriteria;
27: import org.kuali.core.dao.ojb.PlatformAwareDaoBaseOjb;
28: import org.kuali.module.pdp.bo.FormatProcess;
29: import org.kuali.module.pdp.dao.FormatProcessDao;
30:
31: /**
32: * @author jsissom
33: */
34: public class FormatProcessDaoOjb extends PlatformAwareDaoBaseOjb
35: implements FormatProcessDao {
36: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
37: .getLogger(FormatProcessDaoOjb.class);
38:
39: public FormatProcessDaoOjb() {
40: super ();
41: }
42:
43: public FormatProcess getByCampus(String campus) {
44: LOG.debug("getByCampus() starting");
45:
46: Criteria c = new Criteria();
47: c.addEqualTo("physicalCampusProcessCode", campus);
48:
49: return (FormatProcess) getPersistenceBrokerTemplate()
50: .getObjectByQuery(
51: new QueryByCriteria(FormatProcess.class, c));
52: }
53:
54: public void removeByCampus(String campus) {
55: LOG.debug("removeByCampus() starting");
56:
57: FormatProcess fp = getByCampus(campus);
58: if (fp != null) {
59: getPersistenceBrokerTemplate().delete(fp);
60: }
61: }
62:
63: public void add(String campus, Date now) {
64: LOG.debug("add() starting");
65:
66: FormatProcess fp = new FormatProcess();
67: fp.setPhysicalCampusProcessCode(campus);
68: fp.setBeginFormat(new Timestamp(now.getTime()));
69:
70: getPersistenceBrokerTemplate().store(fp);
71: }
72: }
|