ItEr20S04ArquitecturaServidorItEr19S04: Making all the business entities extend the BaseEntity.
This commit is contained in:
parent
55f7bd3c55
commit
08f6cb7c90
18 changed files with 41 additions and 178 deletions
|
|
@ -3,14 +3,10 @@ package org.navalplanner.business.advance.entities;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.Set;
|
||||
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportLine;
|
||||
|
||||
public class AdvanceAssigment{
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class AdvanceAssigment extends BaseEntity {
|
||||
|
||||
private boolean reportGlobalAdvance;
|
||||
|
||||
|
|
@ -28,14 +24,6 @@ public class AdvanceAssigment{
|
|||
this.maxValue.setScale(2);
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setMaxValue(BigDecimal maxValue) {
|
||||
this.maxValue = maxValue;
|
||||
this.maxValue.setScale(2);
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ package org.navalplanner.business.advance.entities;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class AdvanceMeasurement {
|
||||
private Long id;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class AdvanceMeasurement extends BaseEntity {
|
||||
|
||||
private Date date;
|
||||
|
||||
|
|
@ -21,14 +19,6 @@ public class AdvanceMeasurement {
|
|||
this.value.setScale(2);
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,14 @@ import java.math.BigDecimal;
|
|||
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
|
||||
public class AdvanceType {
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class AdvanceType extends BaseEntity {
|
||||
|
||||
@NotEmpty
|
||||
private String unitName;
|
||||
|
|
@ -47,14 +44,6 @@ public class AdvanceType {
|
|||
this.active = active;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setUnitName(String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,23 +6,20 @@ import java.util.List;
|
|||
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
|
||||
/**
|
||||
* It represents an {@link Order} with its related information. <br />
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public class Order implements IOrderLineGroup {
|
||||
public class Order extends BaseEntity implements IOrderLineGroup {
|
||||
|
||||
private static Date copy(Date date) {
|
||||
return date != null ? new Date(date.getTime()) : date;
|
||||
}
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long version;
|
||||
|
||||
@NotEmpty
|
||||
private String name;
|
||||
|
||||
|
|
@ -42,15 +39,6 @@ public class Order implements IOrderLineGroup {
|
|||
@Valid
|
||||
private List<OrderElement> orderElements = new ArrayList<OrderElement>();
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public class Dependency {
|
||||
public class Dependency extends BaseEntity {
|
||||
|
||||
public enum Type {
|
||||
END_START, START_START, END_END, START_END;
|
||||
|
|
@ -19,10 +20,6 @@ public class Dependency {
|
|||
return dependency;
|
||||
}
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long version;
|
||||
|
||||
private TaskElement origin;
|
||||
|
||||
private TaskElement destination;
|
||||
|
|
@ -58,11 +55,4 @@ public class Dependency {
|
|||
return type;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getVersion() {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,17 +9,14 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.planner.entities.Dependency.Type;
|
||||
|
||||
/**
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public abstract class TaskElement {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long version;
|
||||
public abstract class TaskElement extends BaseEntity {
|
||||
|
||||
private Date startDate;
|
||||
|
||||
|
|
@ -138,14 +135,6 @@ public abstract class TaskElement {
|
|||
}
|
||||
}
|
||||
|
||||
public Long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
private void removeDependenciesWithThisOrigin(TaskElement origin, Type type) {
|
||||
ArrayList<Dependency> toBeRemoved = new ArrayList<Dependency>();
|
||||
for (Dependency dependency : dependenciesWithThisDestination) {
|
||||
|
|
|
|||
|
|
@ -7,19 +7,13 @@ import org.apache.commons.lang.builder.EqualsBuilder;
|
|||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.resources.services.ICriterionTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
/**
|
||||
* A criterion stored in the database <br />
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public class Criterion implements ICriterion {
|
||||
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class Criterion extends BaseEntity implements ICriterion {
|
||||
|
||||
@NotEmpty
|
||||
private String name;
|
||||
|
|
@ -57,10 +51,6 @@ public class Criterion implements ICriterion {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSatisfiedBy(Resource resource) {
|
||||
return !resource.getCurrentSatisfactionsFor(this).isEmpty();
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@ import java.util.Date;
|
|||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
/**
|
||||
* Declares a interval of time in which the criterion is satisfied <br />
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public class CriterionSatisfaction {
|
||||
public class CriterionSatisfaction extends BaseEntity {
|
||||
|
||||
public static final Comparator<CriterionSatisfaction> BY_START_COMPARATOR;
|
||||
|
||||
|
|
@ -25,11 +26,6 @@ public class CriterionSatisfaction {
|
|||
};
|
||||
}
|
||||
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
|
||||
public CriterionSatisfaction() {
|
||||
|
||||
}
|
||||
|
|
@ -52,10 +48,6 @@ public class CriterionSatisfaction {
|
|||
}
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
private Date startDate;
|
||||
|
||||
private Date finishDate;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.resources.services.ICriterionTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -14,12 +15,8 @@ import org.springframework.stereotype.Component;
|
|||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
@Component
|
||||
public class CriterionType implements ICriterionType<Criterion> {
|
||||
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class CriterionType extends BaseEntity implements
|
||||
ICriterionType<Criterion> {
|
||||
|
||||
@Autowired
|
||||
ICriterionTypeService criterionTypeService;
|
||||
|
|
@ -77,10 +74,6 @@ public class CriterionType implements ICriterionType<Criterion> {
|
|||
return ResourceEnum.getDefault();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import java.util.ListIterator;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.resources.daos.ResourcesDAORegistry;
|
||||
|
||||
|
|
@ -29,11 +30,7 @@ import org.navalplanner.business.resources.daos.ResourcesDAORegistry;
|
|||
* @author Fernando Bellas Permuy <fbellas@udc.es>
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public abstract class Resource {
|
||||
|
||||
private Long id;
|
||||
|
||||
private long version;
|
||||
public abstract class Resource extends BaseEntity {
|
||||
|
||||
private Set<CriterionSatisfaction> criterionSatisfactions = new HashSet<CriterionSatisfaction>();
|
||||
|
||||
|
|
@ -173,10 +170,6 @@ public abstract class Resource {
|
|||
return new Query();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void forceLoadSatisfactions() {
|
||||
for (CriterionSatisfaction criterionSatisfaction : criterionSatisfactions) {
|
||||
criterionSatisfaction.getCriterion().getName();
|
||||
|
|
@ -186,10 +179,6 @@ public abstract class Resource {
|
|||
|
||||
public abstract int getDailyCapacity();
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* It removes the resource from the database and updates references. The
|
||||
* default implementation removes the resource from the resource group it
|
||||
|
|
|
|||
|
|
@ -6,16 +6,12 @@ import java.util.Set;
|
|||
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
public class WorkReport {
|
||||
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class WorkReport extends BaseEntity {
|
||||
|
||||
@NotNull
|
||||
Date date;
|
||||
|
|
@ -45,14 +41,6 @@ public class WorkReport {
|
|||
this.workReportLines = workReportLines;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.resources.entities.Criterion;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
|
|
@ -12,12 +13,7 @@ import org.navalplanner.business.resources.entities.Resource;
|
|||
* @author Diego Pino García <dpino@igalia.com>
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public class WorkReportLine {
|
||||
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class WorkReportLine extends BaseEntity {
|
||||
|
||||
Integer numHours;
|
||||
|
||||
|
|
@ -47,14 +43,6 @@ public class WorkReportLine {
|
|||
this.criterions = criterions;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public Integer getNumHours() {
|
||||
return numHours;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,14 @@ package org.navalplanner.business.workreports.entities;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.resources.entities.CriterionType;
|
||||
|
||||
/**
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
*/
|
||||
|
||||
public class WorkReportType {
|
||||
private Long id;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private long version;
|
||||
public class WorkReportType extends BaseEntity {
|
||||
|
||||
String name;
|
||||
|
||||
|
|
@ -27,14 +24,6 @@ public class WorkReportType {
|
|||
this.criterionTypes = criterionTypes;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="unitName" access="field"/>
|
||||
<property name="defaultMaxValue" access="field" scale="4"/>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="maxValue" />
|
||||
<property name="reportGlobalAdvance"/>
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="date"/>
|
||||
<property name="value" scale="2"/>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<id access="field" type="long" name="id">
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<version name="version" access="field" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
<property name="initDate" access="field"></property>
|
||||
<property name="endDate" access="field"></property>
|
||||
<property name="name" access="field"></property>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<id name="id" column="id" type="long">
|
||||
<generator class="native" />
|
||||
</id>
|
||||
<version name="version" type="long"></version>
|
||||
<version name="version" access="property" type="long" />
|
||||
<property name="shareOfHours"></property>
|
||||
<property name="name" />
|
||||
<property name="notes"/>
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
<id name="id">
|
||||
<generator class="native"></generator>
|
||||
</id>
|
||||
<version name="version" type="long"></version>
|
||||
<version name="version" access="property" type="long" />
|
||||
<many-to-one class="TaskElement" name="origin"
|
||||
column="ORIGIN" />
|
||||
<many-to-one class="TaskElement" name="destination"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
IMPORTANT: type="long" must be specified (otherwise,
|
||||
Hibernate infers type="integer".
|
||||
-->
|
||||
<version access="field" name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
<set access="field" cascade="all-delete-orphan" inverse="true" name="criterionSatisfactions">
|
||||
<key column="resource" not-null="true"/>
|
||||
<one-to-many class="CriterionSatisfaction"/>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
<id access="field" name="id">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version access="field" name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
<property access="field" name="name"/>
|
||||
<property access="field" name="active"/>
|
||||
<many-to-one access="field" name="type" column="id_criterion_type" not-null="true" />
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<id access="field" name="id">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version access="field" name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
<property access="field" name="startDate" not-null="true"/>
|
||||
<property access="field" name="finishDate"/>
|
||||
<many-to-one access="field" name="criterion" not-null="true"/>
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
<id name="id">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
<property name="name" unique="true"/>
|
||||
<property name="allowSimultaneousCriterionsPerResource"/>
|
||||
<property name="allowHierarchy"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="name"/>
|
||||
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="date"/>
|
||||
<property name="place"/>
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
<id name="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
<version name="version" type="long"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="numHours"/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue