/**
* 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.*;
import com.autentia.tnt.dao.*;
import com.autentia.tnt.util.SpringUtils;
import java.util.*;
import org.apache.commons.logging.*;
/**
* DAO for BulletinBoard objects.
* @author stajanov code generator
*/
public class DocumentCategoryDAO extends HibernateManagerBase<DocumentCategory>
{
/* documentCategory - generated by stajanov (do not edit/delete) */
/** Logger */
private static final Log log = LogFactory.getLog(DocumentCategoryDAO.class);
/**
* Get default DocumentCategoryDAO as defined in Spring's configuration file.
* @return the default singleton DocumentCategoryDAO
*/
public static DocumentCategoryDAO getDefault()
{
return (DocumentCategoryDAO)SpringUtils.getSpringBean("daoDocumentCategory");
}
/**
* Constructor
* @deprecated do not construct DAOs alone: use Spring's declared beans
*/
public DocumentCategoryDAO(){
super(false);
}
/**
* Retrieve a DocumentCategory object from database given its id
* @param id primary key of DocumentCategory object
* @return the DocumentCategory object identified by the id
* @throws DataAccException on error
*/
public DocumentCategory getById( int id ) throws DataAccException {
return super.getByPk(DocumentCategory.class,id);
}
/**
* Get all DocumentCategory objects from database sorted by the given criteria
* @param crit the sorting criteria
* @return a list with all existing DocumentCategory objects
* @throws DataAccException on error
*/
public List<DocumentCategory> search( SortCriteria crit ) throws DataAccException {
return super.list(DocumentCategory.class,crit);
}
/**
* Get specified DocumentCategory objects from database sorted by the given criteria
* @param search search criteria
* @param sort the sorting criteria
* @return a list with DocumentCategory objects matching the search criteria
* @throws DataAccException on error
*/
public List<DocumentCategory> search(SearchCriteria search, SortCriteria sort) throws DataAccException {
return super.search(DocumentCategory.class,search,sort);
}
/**
* Insert a new DocumentCategory object in database
* @param dao the DocumentCategory object to insert
* @throws DataAccException on error
*/
public void insert(DocumentCategory dao) throws DataAccException {
super.insert(dao);
}
/**
* Update an existing DocumentCategory object in database
* @param dao the DocumentCategory object to update
* @throws DataAccException on error
*/
public void update(DocumentCategory dao) throws DataAccException {
super.update(dao,dao.getId());
}
/**
* Delete an existing DocumentCategory object in database
* @param dao the DocumentCategory object to update
* @throws DataAccException on error
*/
public void delete(DocumentCategory dao) throws DataAccException {
super.delete(dao,dao.getId());
}
public DocumentCategory recoverDocumentCategoryFromUser (User user) throws DataAccException {
final List<DocumentCategory> documentCategory = super.search("select u.documentCategory from User u where u=:arg0", user);
if (documentCategory != null && !documentCategory.isEmpty()) {
return documentCategory.get(0);
}
return null;
}
/* documentCategory - generated by stajanov (do not edit/delete) */
}