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.Date;
025
026import org.openwms.common.domain.LocationGroup;
027import org.openwms.common.integration.LocationGroupDao;
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 LocationGroupDaoImpl.
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.LocationGroupDao
041 */
042@Transactional(propagation = Propagation.MANDATORY)
043@Repository(LocationGroupDaoImpl.COMPONENT_NAME)
044public class LocationGroupDaoImpl extends AbstractGenericJpaDao<LocationGroup, Long> implements LocationGroupDao {
045
046    /** Springs component name. */
047    public static final String COMPONENT_NAME = "locationGroupDao";
048
049    /**
050     * {@inheritDoc}
051     * 
052     * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getFindAllQuery()
053     */
054    @Override
055    protected String getFindAllQuery() {
056        return LocationGroupDao.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 LocationGroupDao.NQ_FIND_BY_NAME;
067    }
068
069    /**
070     * {@inheritDoc}
071     */
072    @Override
073    protected void beforeUpdate(LocationGroup entity) {
074        entity.setLastUpdated(new Date());
075    }
076
077    /**
078     * {@inheritDoc}
079     * 
080     * @see org.openwms.core.integration.jpa.AbstractGenericJpaDao#getPersistentClass()
081     */
082    @Override
083    protected Class<LocationGroup> getPersistentClass() {
084        return LocationGroup.class;
085    }
086}