001    /*
002     * openwms.org, the Open Warehouse Management System.
003     *
004     * This file is part of openwms.org.
005     *
006     * openwms.org is free software: you can redistribute it and/or modify
007     * it under the terms of the GNU Lesser General Public License as 
008     * published by the Free Software Foundation, either version 3 of the
009     * License, or (at your option) any later version.
010     *
011     * openwms.org is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014     * GNU Lesser General Public License for more details.
015     *
016     * You should have received a copy of the GNU Lesser General Public
017     * License along with this software. If not, write to the Free
018     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019     * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
020     */
021    package org.openwms.common.integration.jpa;
022    
023    import java.util.Date;
024    
025    import org.openwms.common.domain.LocationGroup;
026    import org.openwms.common.integration.LocationGroupDao;
027    import org.openwms.core.integration.jpa.AbstractGenericJpaDao;
028    import org.springframework.stereotype.Repository;
029    
030    /**
031     * A LocationGroupDaoImpl.
032     * 
033     * @author <a href="mailto:scherrer@openwms.org">Heiko Scherrer</a>
034     * @version $Revision: 1583 $
035     * @since 0.1
036     * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao
037     * @see org.openwms.common.integration.LocationGroupDao
038     */
039    @Repository("locationGroupDao")
040    public class LocationGroupDaoImpl extends AbstractGenericJpaDao<LocationGroup, Long> implements LocationGroupDao {
041    
042        /**
043         * @return Name of the query
044         * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getFindAllQuery()
045         */
046        @Override
047        protected String getFindAllQuery() {
048            return LocationGroupDao.NQ_FIND_ALL;
049        }
050    
051        /**
052         * @return Name of the query
053         * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getFindByUniqueIdQuery()
054         */
055        @Override
056        protected String getFindByUniqueIdQuery() {
057            return LocationGroupDao.NQ_FIND_BY_NAME;
058        }
059    
060        /**
061         * Update the date of last change before update.
062         * 
063         * @param entity
064         *            LocationGroup to be updated
065         */
066        @Override
067        protected void beforeUpdate(LocationGroup entity) {
068            entity.setLastUpdated(new Date());
069        }
070    
071    }