001/* 002 * openwms.org, the Open Warehouse Management System. 003 * Copyright (C) 2014 Heiko Scherrer 004 * 005 * This file is part of openwms.org. 006 * 007 * openwms.org is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU General Public License as 009 * published by the Free Software Foundation; either version 2 of the 010 * License, or (at your option) any later version. 011 * 012 * openwms.org is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with this software. If not, write to the Free Software 019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 020 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 021 */ 022package org.openwms.common.integration.jpa; 023 024import java.util.List; 025 026import org.openwms.common.domain.Location; 027import org.openwms.common.integration.LocationDao; 028import org.openwms.core.integration.jpa.AbstractGenericJpaDao; 029import org.springframework.stereotype.Repository; 030import org.springframework.transaction.annotation.Propagation; 031import org.springframework.transaction.annotation.Transactional; 032 033/** 034 * A LocationDaoImpl. 035 * 036 * @author <a href="mailto:scherrer@openwms.org">Heiko Scherrer</a> 037 * @version $Revision$ 038 * @since 0.1 039 * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao 040 * @see org.openwms.common.integration.LocationDao 041 */ 042@Transactional(propagation = Propagation.MANDATORY) 043@Repository(LocationDaoImpl.COMPONENT_NAME) 044public class LocationDaoImpl extends AbstractGenericJpaDao<Location, Long> implements LocationDao { 045 046 /** Springs component name. */ 047 public static final String COMPONENT_NAME = "locationDao"; 048 049 /** 050 * {@inheritDoc} 051 * 052 * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getFindAllQuery() 053 */ 054 @Override 055 protected String getFindAllQuery() { 056 return Location.NQ_FIND_ALL; 057 } 058 059 /** 060 * {@inheritDoc} 061 * 062 * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getFindByUniqueIdQuery() 063 */ 064 @Override 065 protected String getFindByUniqueIdQuery() { 066 return Location.NQ_FIND_BY_UNIQUE_QUERY; 067 } 068 069 /** 070 * {@inheritDoc} 071 * 072 * @see org.openwms.common.integration.LocationDao#getAllLocations() 073 */ 074 @Override 075 @Transactional(readOnly = true) 076 public List<Location> getAllLocations() { 077 return super.findByPositionalParameters(Location.NQ_FIND_ALL_EAGER); 078 } 079 080 /** 081 * {@inheritDoc} 082 * 083 * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getPersistentClass() 084 */ 085 @Override 086 protected Class<Location> getPersistentClass() { 087 return Location.class; 088 } 089}