/** * 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.manager.account; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.autentia.tnt.businessobject.Account; import com.autentia.tnt.businessobject.AccountType; import com.autentia.tnt.dao.SortCriteria; import com.autentia.tnt.dao.hibernate.AccountDAO; import com.autentia.tnt.dao.hibernate.AccountTypeDAO; import com.autentia.tnt.dao.search.AccountSearch; import com.autentia.tnt.util.SpringUtils; public class AccountManager { /* Account - generated by stajanov (do not edit/delete) */ /** Logger */ private static final Log log = LogFactory.getLog(AccountManager.class); /** Account DAO **/ private AccountDAO accountDAO; /** * Get default AccountManager as defined in Spring's configuration file. * @return the default singleton AccountManager */ public static AccountManager getDefault() { return (AccountManager)SpringUtils.getSpringBean("managerAccount"); } /** * Empty constructor needed by CGLIB (Spring AOP) */ protected AccountManager() { } /** * Default constructor * @deprecated do not construct managers alone: use Spring's declared beans */ public AccountManager( AccountDAO accountDAO ) { this.accountDAO = accountDAO; } /** * List accounts. * @param search search filter to apply * @param sort sorting criteria * @return the list of all accounts sorted by requested criterion */ public List<Account> getAllEntities(AccountSearch search, SortCriteria sort){ return accountDAO.search( search, sort ); } /** * Get account by primary key. * @return account selected by id. */ public Account getEntityById(int id){ return accountDAO.getById(id); } /** * Insert account. */ public void insertEntity(Account account) { accountDAO.insert(account); } /** * Update account. */ public void updateEntity(Account account) { accountDAO.update(account); } /** * Delete account. */ public void deleteEntity(Account account) { accountDAO.delete(account); } /* Account - generated by stajanov (do not edit/delete) */ }