ItEr45S23CUImportacionTiposEtiquetasEEtiquetas: Added code field to Label and LabelType, making them inherit from IntegrationEntity.
This commit is contained in:
parent
c07108eca8
commit
68ca6ad686
7 changed files with 28 additions and 13 deletions
|
|
@ -22,14 +22,14 @@ package org.navalplanner.business.labels.daos;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.navalplanner.business.common.daos.IGenericDAO;
|
||||
import org.navalplanner.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.navalplanner.business.labels.entities.Label;
|
||||
import org.navalplanner.business.labels.entities.LabelType;
|
||||
|
||||
/**
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*/
|
||||
public interface ILabelDAO extends IGenericDAO<Label, Long> {
|
||||
public interface ILabelDAO extends IIntegrationEntityDAO<Label> {
|
||||
|
||||
List<Label> getAll();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ package org.navalplanner.business.labels.daos;
|
|||
import java.util.List;
|
||||
|
||||
import org.hibernate.NonUniqueResultException;
|
||||
import org.navalplanner.business.common.daos.IGenericDAO;
|
||||
import org.navalplanner.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.labels.entities.LabelType;
|
||||
|
||||
/**
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*/
|
||||
public interface ILabelTypeDAO extends IGenericDAO<LabelType, Long> {
|
||||
public interface ILabelTypeDAO extends IIntegrationEntityDAO<LabelType> {
|
||||
|
||||
List<LabelType> getAll();
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.navalplanner.business.common.daos.GenericDAOHibernate;
|
||||
import org.navalplanner.business.common.daos.IntegrationEntityDAO;
|
||||
import org.navalplanner.business.labels.entities.Label;
|
||||
import org.navalplanner.business.labels.entities.LabelType;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
|
@ -38,8 +38,7 @@ import org.springframework.stereotype.Repository;
|
|||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class LabelDAO extends GenericDAOHibernate<Label, Long> implements
|
||||
ILabelDAO {
|
||||
public class LabelDAO extends IntegrationEntityDAO<Label> implements ILabelDAO {
|
||||
|
||||
@Override
|
||||
public List<Label> getAll() {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.apache.commons.lang.Validate;
|
|||
import org.hibernate.Criteria;
|
||||
import org.hibernate.NonUniqueResultException;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.navalplanner.business.common.daos.GenericDAOHibernate;
|
||||
import org.navalplanner.business.common.daos.IntegrationEntityDAO;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.labels.entities.LabelType;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
|
@ -42,7 +42,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class LabelTypeDAO extends GenericDAOHibernate<LabelType, Long> implements
|
||||
public class LabelTypeDAO extends IntegrationEntityDAO<LabelType> implements
|
||||
ILabelTypeDAO {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ import java.util.Set;
|
|||
import org.apache.commons.lang.Validate;
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.common.IntegrationEntity;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
import org.navalplanner.business.labels.daos.ILabelDAO;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
|
||||
/**
|
||||
|
|
@ -36,7 +38,7 @@ import org.navalplanner.business.orders.entities.OrderElement;
|
|||
* @author Diego Pino Garcia<dpino@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class Label extends BaseEntity {
|
||||
public class Label extends IntegrationEntity {
|
||||
|
||||
@NotEmpty(message = "name not specified")
|
||||
private String name;
|
||||
|
|
@ -104,4 +106,9 @@ public class Label extends BaseEntity {
|
|||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ILabelDAO getIntegrationEntityDAO() {
|
||||
return Registry.getLabelDAO();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.common.IntegrationEntity;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
import org.navalplanner.business.labels.daos.ILabelTypeDAO;
|
||||
|
||||
/**
|
||||
* LabeType entity
|
||||
|
|
@ -34,7 +36,7 @@ import org.navalplanner.business.common.BaseEntity;
|
|||
* @author Diego Pino Garcia<dpino@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class LabelType extends BaseEntity implements Comparable {
|
||||
public class LabelType extends IntegrationEntity implements Comparable {
|
||||
|
||||
@NotEmpty(message = "name not specified")
|
||||
private String name;
|
||||
|
|
@ -83,4 +85,9 @@ public class LabelType extends BaseEntity implements Comparable {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ILabelTypeDAO getIntegrationEntityDAO() {
|
||||
return Registry.getLabelTypeDAO();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="code" access="property" not-null="true" unique="true"/>
|
||||
<properties name="nameAndType" unique="true">
|
||||
<property name="name" />
|
||||
<many-to-one name="type" class="LabelType" column="LABEL_TYPE_ID" />
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="code" access="property" not-null="true" unique="true"/>
|
||||
<property name="name" unique="true"/>
|
||||
|
||||
<set name="labels" inverse="false" cascade="all">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue