ItEr54S11CUPantallaAsignacionRecursoLimitanteItEr53S13: Create entity 'LimitingResourceQueueElement'
* Add field 'priority' to 'Task'
This commit is contained in:
parent
14290c8990
commit
bb13b594ae
7 changed files with 156 additions and 14 deletions
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.resources.entities.LimitingResourceQueue;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*
|
||||
*/
|
||||
public class LimitingResourceQueueElement extends BaseEntity {
|
||||
|
||||
private ResourceAllocation<?> resourceAllocation;
|
||||
|
||||
private LimitingResourceQueue limitingResourceQueue;
|
||||
|
||||
private Date earlierStartDateBecauseOfGantt;
|
||||
|
||||
public Date getEarlierStartDateBecauseOfGantt() {
|
||||
return earlierStartDateBecauseOfGantt;
|
||||
}
|
||||
|
||||
public void setEarlierStartDateBecauseOfGantt(
|
||||
Date earlierStartDateBecauseOfGantt) {
|
||||
this.earlierStartDateBecauseOfGantt = earlierStartDateBecauseOfGantt;
|
||||
}
|
||||
|
||||
public static LimitingResourceQueueElement create() {
|
||||
return create(new LimitingResourceQueueElement());
|
||||
}
|
||||
|
||||
protected LimitingResourceQueueElement() {
|
||||
|
||||
}
|
||||
|
||||
public ResourceAllocation<?> getResourceAllocation() {
|
||||
return resourceAllocation;
|
||||
}
|
||||
|
||||
public void setResourceAllocation(ResourceAllocation<?> resourceAllocation) {
|
||||
this.resourceAllocation = resourceAllocation;
|
||||
}
|
||||
|
||||
public LimitingResourceQueue getLimitingResourceQueue() {
|
||||
return limitingResourceQueue;
|
||||
}
|
||||
|
||||
public void setLimitingResourceQueue(LimitingResourceQueue limitingResourceQueue) {
|
||||
this.limitingResourceQueue = limitingResourceQueue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -296,6 +296,8 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
|
||||
private Set<DerivedAllocation> derivedAllocations = new HashSet<DerivedAllocation>();
|
||||
|
||||
private LimitingResourceQueueElement limitingResourceQueueElement;
|
||||
|
||||
/**
|
||||
* Constructor for hibernate. Do not use!
|
||||
*/
|
||||
|
|
@ -822,6 +824,15 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
return !getAssignments().isEmpty();
|
||||
}
|
||||
|
||||
public LimitingResourceQueueElement getLimitingResourceQueueElement() {
|
||||
return limitingResourceQueueElement;
|
||||
}
|
||||
|
||||
public void setLimitingResourceQueueElement(
|
||||
LimitingResourceQueueElement limitingResourceQueueElement) {
|
||||
this.limitingResourceQueueElement = limitingResourceQueueElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a query to recover a list of resources that are suitable for this
|
||||
* allocation. For a {@link SpecificResourceAllocation} returns the current
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ public class Task extends TaskElement {
|
|||
@Valid
|
||||
private SubcontractedTaskData subcontractedTaskData;
|
||||
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* Constructor for hibernate. Do not use!
|
||||
*/
|
||||
|
|
@ -517,4 +519,12 @@ public class Task extends TaskElement {
|
|||
return !resourceAllocations.isEmpty();
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,12 @@
|
|||
|
||||
package org.navalplanner.business.resources.entities;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.planner.entities.LimitingResourceQueueElement;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -31,6 +36,9 @@ public class LimitingResourceQueue extends BaseEntity {
|
|||
|
||||
private Resource resource;
|
||||
|
||||
private Set<LimitingResourceQueueElement> limitingResourceQueueElements =
|
||||
new HashSet<LimitingResourceQueueElement>();
|
||||
|
||||
public static LimitingResourceQueue create() {
|
||||
return create(new LimitingResourceQueue());
|
||||
}
|
||||
|
|
@ -47,4 +55,17 @@ public class LimitingResourceQueue extends BaseEntity {
|
|||
this.resource = resource;
|
||||
}
|
||||
|
||||
public void addLimitingResourceQueueElement(LimitingResourceQueueElement element) {
|
||||
element.setLimitingResourceQueue(this);
|
||||
limitingResourceQueueElements.add(element);
|
||||
}
|
||||
|
||||
public void removeLimitingResourceQueueElement(LimitingResourceQueueElement element) {
|
||||
limitingResourceQueueElements.remove(element);
|
||||
}
|
||||
|
||||
public Set<LimitingResourceQueueElement> getLimitingResourceQueueElements() {
|
||||
return Collections.unmodifiableSet(limitingResourceQueueElements);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
<one-to-many class="DerivedAllocation"/>
|
||||
</set>
|
||||
|
||||
<one-to-one name="limitingResourceQueueElement" property-ref="resourceAllocation" cascade="all" />
|
||||
|
||||
<joined-subclass name="SpecificResourceAllocation" table="specific_resource_allocation">
|
||||
<key column="RESOURCE_ALLOCATION_ID" />
|
||||
|
||||
|
|
@ -53,6 +55,22 @@
|
|||
|
||||
</class>
|
||||
|
||||
<class name="LimitingResourceQueueElement" table="limiting_resource_queue_element">
|
||||
<id name="id" type="long" access="property">
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<many-to-one name="resourceAllocation" column="RESOURCE_ALLOCATION_ID" not-null="false" unique="true" />
|
||||
|
||||
<many-to-one name="limitingResourceQueue" column="LIMITING_RESOURCE_QUEUE_ID" />
|
||||
|
||||
<property name="earlierStartDateBecauseOfGantt" column="EARLIER_START_DATE_BECAUSE_OF_GANTT" />
|
||||
|
||||
</class>
|
||||
|
||||
<!-- DayAssignment -->
|
||||
<class name="DayAssignment" table="day_assignment">
|
||||
<id name="id" type="long" access="property">
|
||||
|
|
@ -60,17 +78,17 @@
|
|||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
<discriminator column="DAY_ASSIGNMENT_TYPE" type="string"/>
|
||||
<discriminator column="DAY_ASSIGNMENT_TYPE" type="string"/>
|
||||
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="hours" not-null="true"/>
|
||||
<property name="hours" not-null="true"/>
|
||||
|
||||
<property name="day" type="org.joda.time.contrib.hibernate.PersistentLocalDate" not-null="true"/>
|
||||
<property name="day" type="org.joda.time.contrib.hibernate.PersistentLocalDate" not-null="true"/>
|
||||
|
||||
<many-to-one name="resource" class="org.navalplanner.business.resources.entities.Resource"
|
||||
column="RESOURCE_ID" not-null="true">
|
||||
</many-to-one>
|
||||
<many-to-one name="resource" class="org.navalplanner.business.resources.entities.Resource"
|
||||
column="RESOURCE_ID" not-null="true">
|
||||
</many-to-one>
|
||||
|
||||
<!-- SpecificDayAssignment -->
|
||||
<subclass name="SpecificDayAssignment" discriminator-value="SPECIFIC_DAY">
|
||||
|
|
@ -112,18 +130,18 @@
|
|||
</composite-element>
|
||||
</list>
|
||||
<property name="type">
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.navalplanner.business.planner.entities.StretchesFunction$Type</param>
|
||||
</type>
|
||||
</property>
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.navalplanner.business.planner.entities.StretchesFunction$Type</param>
|
||||
</type>
|
||||
</property>
|
||||
</joined-subclass>
|
||||
</class>
|
||||
|
||||
<class name="DerivedAllocation">
|
||||
<id name="id" type="long" access="property" >
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
<many-to-one class="ResourceAllocation" column="RESOURCE_ALLOCATION_ID"
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@
|
|||
column="SUBCONTRATED_TASK_DATA_ID"
|
||||
unique="true" cascade="all" lazy="false" />
|
||||
|
||||
<property name="priority" />
|
||||
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="TaskGroup">
|
||||
|
|
|
|||
|
|
@ -76,7 +76,13 @@
|
|||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<many-to-one name="resource" not-null="false" unique="true" />
|
||||
<many-to-one name="resource" column="RESOURCE_ID" not-null="false" unique="true" />
|
||||
|
||||
<set name="limitingResourceQueueElements" cascade="all-delete-orphan" inverse="true" >
|
||||
<key column="LIMITING_RESOURCE_QUEUE_ID" not-null="true" />
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.LimitingResourceQueueElement" />
|
||||
</set>
|
||||
|
||||
</class>
|
||||
|
||||
<!-- Criterion -->
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue