001    /**
002     * Copyright 2004-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.hr.time.position.dao;
017    
018    import org.apache.ojb.broker.query.Criteria;
019    import org.apache.ojb.broker.query.Query;
020    import org.apache.ojb.broker.query.QueryFactory;
021    import org.apache.ojb.broker.query.ReportQueryByCriteria;
022    import org.kuali.hr.time.position.Position;
023    import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
024    
025    public class PositionDaoSpringOjbImpl extends PlatformAwareDaoBaseOjb implements PositionDao {
026    
027        @Override
028        public Position getPosition(String hrPositionId) {
029            Criteria crit = new Criteria();
030            crit.addEqualTo("hrPositionId", hrPositionId);
031    
032            Query query = QueryFactory.newQuery(Position.class, crit);
033            return (Position) this.getPersistenceBrokerTemplate().getObjectByQuery(query);
034        }
035    
036    
037        @Override
038        public Position getPositionByPositionNumber(String hrPositionNbr) {
039            Criteria crit = new Criteria();
040            crit.addEqualTo("position_nbr", hrPositionNbr);
041    
042            Query query = QueryFactory.newQuery(Position.class, crit);
043            return (Position) this.getPersistenceBrokerTemplate().getObjectByQuery(query);
044        }
045    
046        /*@Override
047        public PositionNumber getNextUniquePositionNumber() {
048            Criteria crit = new Criteria();
049            ReportQueryByCriteria query = QueryFactory.newReportQuery(PositionNumber.class, crit);
050            query.setAttributes(new String[]{"max(id)"});
051            return (PositionNumber) this.getPersistenceBrokerTemplate().getObjectByQuery(query);
052        }
053    
054        @Override
055        public void saveOrUpdate(PositionNumber positionNumber) {
056            this.getPersistenceBrokerTemplate().store(positionNumber);
057        }*/
058    
059    }