/** * TNTConcept Easy Enterprise Management by Autentia Real Bussiness Solution S.L. * Copyright (C) 2007 Autentia Real Bussiness Solution S.L. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.autentia.tnt.dao.hibernate; import com.autentia.tnt.businessobject.Contact; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.autentia.tnt.businessobject.PeriodicalAccountEntry; import com.autentia.tnt.businessobject.Position; import com.autentia.tnt.dao.DataAccException; import com.autentia.tnt.dao.SearchCriteria; import com.autentia.tnt.dao.SortCriteria; import com.autentia.tnt.dao.search.AdvancedSearchContactSearch; import com.autentia.tnt.util.SpringUtils; public class PositionDAO extends HibernateManagerBase<Position> { /* Position - generated by stajanov (do not edit/delete) */ /** Logger */ private static final Log log = LogFactory.getLog(PositionDAO.class); /** * Get default PositionDAO as defined in Spring's configuration file. * * @return the default singleton PositionDAO */ public static PositionDAO getDefault() { return (PositionDAO) SpringUtils.getSpringBean("daoPosition"); } /** * Constructor * * @deprecated do not construct DAOs alone: use Spring's declared beans */ public PositionDAO() { super(false); } /** * Retrieve a Position object from database given its id * * @param id * primary key of Position object * @return the Position object identified by the id * @throws DataAccException * on error */ public Position getById(int id) throws DataAccException { return super.getByPk(Position.class, id); } /** * Get all Position objects from database sorted by the given criteria * * @param crit * the sorting criteria * @return a list with all existing Position objects * @throws DataAccException * on error */ public List<Position> search(SortCriteria crit) throws DataAccException { return super.list(Position.class, crit); } /** * Get specified Position objects from database sorted by the given criteria * * @param search * search criteria * @param sort * the sorting criteria * @return a list with Position objects matching the search criteria * @throws DataAccException * on error */ public List<Position> search(SearchCriteria search, SortCriteria sort) throws DataAccException { return super.search(Position.class, search, sort); } /** * Insert a new Position object in database * * @param dao * the Position object to insert * @throws DataAccException * on error */ public void insert(Position dao) throws DataAccException { super.insert(dao); } /** * Update an existing Position object in database * * @param dao * the Position object to update * @throws DataAccException * on error */ public void update(Position dao) throws DataAccException { super.update(dao, dao.getId()); } /** * Delete an existing Position object in database * * @param dao * the Position object to update * @throws DataAccException * on error */ public void delete(Position dao) throws DataAccException { super.delete(dao, dao.getId()); } public void delete(PeriodicalAccountEntry to) throws DataAccException { // TODO Auto-generated method stub } public void update(PeriodicalAccountEntry to) throws DataAccException { // TODO Auto-generated method stub } public List<Contact> getContactsForPosition (Position position) { return super.search("select distinct ci.contact from ContactInfo ci where ci.position.id = :arg0", position.getId()); } /** * Recovers the positions from the advanced search in contacts option */ public List<Object> contactAdvancedSearch(AdvancedSearchContactSearch search) throws DataAccException { return super.search(search.getPositionHQL(), search.getPositionArguments()); } /* public List<Object> contactChangesAdvancedSearch(AdvancedSearchContactSearch search) throws DataAccException { return super.search(search.getPositionChangesHQL(), search.getPositionArguments()); } */ /* Position - generated by stajanov (do not edit/delete) */ }