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.List;
024    
025    import org.openwms.common.domain.Location;
026    import org.openwms.common.integration.LocationDao;
027    import org.openwms.core.integration.jpa.AbstractGenericJpaDao;
028    import org.springframework.stereotype.Repository;
029    import org.springframework.transaction.annotation.Transactional;
030    
031    /**
032     * A LocationDaoImpl.
033     * 
034     * @author <a href="mailto:scherrer@openwms.org">Heiko Scherrer</a>
035     * @version $Revision: 1409 $
036     * @since 0.1
037     * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao
038     * @see org.openwms.common.integration.LocationDao
039     */
040    @Repository("locationDao")
041    public class LocationDaoImpl extends AbstractGenericJpaDao<Location, Long> implements LocationDao {
042    
043        /**
044         * @return Name of the query
045         * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getFindAllQuery()
046         */
047        @Override
048        protected String getFindAllQuery() {
049            return Location.NQ_FIND_ALL;
050        }
051    
052        /**
053         * @return Name of the query
054         * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getFindByUniqueIdQuery()
055         */
056        @Override
057        protected String getFindByUniqueIdQuery() {
058            return Location.NQ_FIND_BY_UNIQUE_QUERY;
059        }
060    
061        /**
062         * @return A List of all {@link Location}s
063         * @see org.openwms.common.integration.LocationDao#getAllLocations()
064         */
065        @Override
066        @Transactional(readOnly = true)
067        public List<Location> getAllLocations() {
068            return super.findByPositionalParameters(Location.NQ_FIND_ALL_EAGER);
069        }
070    
071    }