ItEr55S12CUConsolidacionDeAvancesItEr54S13 : Adds the business entities for the advances consolidation functionality.
This commit is contained in:
parent
6d94ccc991
commit
6a04e2ce30
20 changed files with 604 additions and 0 deletions
|
|
@ -22,13 +22,16 @@ package org.navalplanner.business.advance.entities;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.validator.AssertTrue;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.planner.entities.consolidations.NonCalculatedConsolidatedValue;
|
||||
|
||||
public class AdvanceMeasurement extends BaseEntity {
|
||||
|
||||
|
|
@ -53,6 +56,9 @@ public class AdvanceMeasurement extends BaseEntity {
|
|||
|
||||
private Date communicationDate;
|
||||
|
||||
@Valid
|
||||
private Set<NonCalculatedConsolidatedValue> nonCalculatedConsolidatedValues = new HashSet<NonCalculatedConsolidatedValue>();
|
||||
|
||||
public AdvanceMeasurement() {
|
||||
}
|
||||
|
||||
|
|
@ -165,4 +171,13 @@ public class AdvanceMeasurement extends BaseEntity {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setNonCalculatedConsolidatedValues(
|
||||
Set<NonCalculatedConsolidatedValue> nonCalculatedConsolidatedValues) {
|
||||
this.nonCalculatedConsolidatedValues = nonCalculatedConsolidatedValues;
|
||||
}
|
||||
|
||||
public Set<NonCalculatedConsolidatedValue> getNonCalculatedConsolidatedValues() {
|
||||
return nonCalculatedConsolidatedValues;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ package org.navalplanner.business.advance.entities;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
|
@ -31,6 +33,7 @@ import org.hibernate.validator.NotNull;
|
|||
import org.hibernate.validator.Valid;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.planner.entities.consolidations.NonCalculatedConsolidation;
|
||||
|
||||
/**
|
||||
* Represents an {@link AdvanceAssignment} that is own of this
|
||||
|
|
@ -60,6 +63,9 @@ public class DirectAdvanceAssignment extends AdvanceAssignment {
|
|||
private SortedSet<AdvanceMeasurement> advanceMeasurements = new TreeSet<AdvanceMeasurement>(
|
||||
new AdvanceMeasurementComparator());
|
||||
|
||||
@Valid
|
||||
private Set<NonCalculatedConsolidation> nonCalculatedConsolidations = new HashSet<NonCalculatedConsolidation>();
|
||||
|
||||
private boolean fake = false;
|
||||
|
||||
public DirectAdvanceAssignment() {
|
||||
|
|
@ -195,4 +201,13 @@ public class DirectAdvanceAssignment extends AdvanceAssignment {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void setNonCalculatedConsolidation(
|
||||
Set<NonCalculatedConsolidation> nonCalculatedConsolidation) {
|
||||
this.nonCalculatedConsolidations = nonCalculatedConsolidation;
|
||||
}
|
||||
|
||||
public Set<NonCalculatedConsolidation> getNonCalculatedConsolidation() {
|
||||
return nonCalculatedConsolidations;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,12 @@
|
|||
|
||||
package org.navalplanner.business.advance.entities;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.navalplanner.business.orders.entities.OrderLineGroup;
|
||||
import org.navalplanner.business.planner.entities.consolidations.CalculatedConsolidation;
|
||||
|
||||
/**
|
||||
* Represents an {@link AdvanceAssignment} that is defined in some of the
|
||||
|
|
@ -30,6 +35,9 @@ import org.navalplanner.business.orders.entities.OrderLineGroup;
|
|||
*/
|
||||
public class IndirectAdvanceAssignment extends AdvanceAssignment {
|
||||
|
||||
@Valid
|
||||
private Set<CalculatedConsolidation> calculatedConsolidations = new HashSet<CalculatedConsolidation>();
|
||||
|
||||
public static IndirectAdvanceAssignment create() {
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment = new IndirectAdvanceAssignment();
|
||||
indirectAdvanceAssignment.setNewObject(true);
|
||||
|
|
@ -63,4 +71,13 @@ public class IndirectAdvanceAssignment extends AdvanceAssignment {
|
|||
super(reportGlobalAdvance);
|
||||
}
|
||||
|
||||
public void setCalculatedConsolidation(
|
||||
Set<CalculatedConsolidation> calculatedConsolidations) {
|
||||
this.calculatedConsolidations = calculatedConsolidations;
|
||||
}
|
||||
|
||||
public Set<CalculatedConsolidation> getCalculatedConsolidation() {
|
||||
return calculatedConsolidations;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,8 @@ public abstract class DayAssignment extends BaseEntity {
|
|||
@NotNull
|
||||
private Resource resource;
|
||||
|
||||
private Boolean consolidated;
|
||||
|
||||
protected DayAssignment() {
|
||||
|
||||
}
|
||||
|
|
@ -176,6 +178,14 @@ public abstract class DayAssignment extends BaseEntity {
|
|||
return day;
|
||||
}
|
||||
|
||||
public void setConsolidated(Boolean consolidated) {
|
||||
this.consolidated = consolidated;
|
||||
}
|
||||
|
||||
public Boolean getConsolidated() {
|
||||
return consolidated == null ? false : consolidated;
|
||||
}
|
||||
|
||||
public static Comparator<DayAssignment> byDayComparator() {
|
||||
return new Comparator<DayAssignment>() {
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.util.Set;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.hibernate.validator.Min;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.calendars.entities.AvailabilityTimeLine;
|
||||
|
|
@ -300,6 +301,9 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
|
||||
private Set<LimitingResourceQueueElement> limitingResourceQueueElements = new HashSet<LimitingResourceQueueElement>();
|
||||
|
||||
@Min(0)
|
||||
private int originalTotalAssignment = 0;
|
||||
|
||||
/**
|
||||
* Constructor for hibernate. Do not use!
|
||||
*/
|
||||
|
|
@ -339,6 +343,14 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
return task;
|
||||
}
|
||||
|
||||
public void setOriginalTotalAssigment(int originalTotalAssigment) {
|
||||
this.originalTotalAssignment = originalTotalAssigment;
|
||||
}
|
||||
|
||||
public int getOriginalTotalAssigment() {
|
||||
return originalTotalAssignment;
|
||||
}
|
||||
|
||||
public abstract ResourcesPerDayModification withDesiredResourcesPerDay(
|
||||
ResourcesPerDay resourcesPerDay);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import org.navalplanner.business.orders.entities.TaskSource;
|
|||
import org.navalplanner.business.planner.entities.DerivedAllocationGenerator.IWorkerFinder;
|
||||
import org.navalplanner.business.planner.entities.allocationalgorithms.HoursModification;
|
||||
import org.navalplanner.business.planner.entities.allocationalgorithms.ResourcesPerDayModification;
|
||||
import org.navalplanner.business.planner.entities.consolidations.Consolidation;
|
||||
import org.navalplanner.business.resources.daos.IResourceDAO;
|
||||
import org.navalplanner.business.resources.entities.Criterion;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
|
|
@ -90,6 +91,9 @@ public class Task extends TaskElement {
|
|||
|
||||
private Integer priority;
|
||||
|
||||
@Valid
|
||||
private Consolidation consolidation;
|
||||
|
||||
/**
|
||||
* Constructor for hibernate. Do not use!
|
||||
*/
|
||||
|
|
@ -580,4 +584,12 @@ public class Task extends TaskElement {
|
|||
this.priority = priority;
|
||||
}
|
||||
|
||||
public void setConsolidation(Consolidation consolidation) {
|
||||
this.consolidation = consolidation;
|
||||
}
|
||||
|
||||
public Consolidation getConsolidation() {
|
||||
return consolidation;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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.consolidations;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
|
||||
public class CalculatedConsolidatedValue extends ConsolidatedValue {
|
||||
|
||||
public static CalculatedConsolidatedValue create() {
|
||||
return create(new CalculatedConsolidatedValue());
|
||||
}
|
||||
|
||||
public static CalculatedConsolidatedValue create(LocalDate date, int value) {
|
||||
return create(new CalculatedConsolidatedValue(date, value));
|
||||
}
|
||||
|
||||
protected CalculatedConsolidatedValue(LocalDate date, int value) {
|
||||
super(date, value);
|
||||
}
|
||||
|
||||
protected CalculatedConsolidatedValue() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.consolidations;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.navalplanner.business.advance.entities.IndirectAdvanceAssignment;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
|
||||
public class CalculatedConsolidation extends Consolidation {
|
||||
|
||||
private SortedSet<CalculatedConsolidatedValue> consolidatedValues = new TreeSet<CalculatedConsolidatedValue>(
|
||||
new ConsolidatedValueComparator());
|
||||
|
||||
private IndirectAdvanceAssignment indirectAdvanceAssignment;
|
||||
|
||||
public static CalculatedConsolidation create(
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
return create(new CalculatedConsolidation(indirectAdvanceAssignment));
|
||||
}
|
||||
|
||||
public static CalculatedConsolidation create(
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment,
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
return create(new CalculatedConsolidation(indirectAdvanceAssignment,
|
||||
consolidatedValues));
|
||||
}
|
||||
|
||||
protected CalculatedConsolidation() {
|
||||
|
||||
}
|
||||
|
||||
protected CalculatedConsolidation(
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment,
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
this(indirectAdvanceAssignment);
|
||||
this.setConsolidatedValues(consolidatedValues);
|
||||
}
|
||||
|
||||
public CalculatedConsolidation(
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
this.indirectAdvanceAssignment = indirectAdvanceAssignment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<ConsolidatedValue> getConsolidatedValues() {
|
||||
return new TreeSet<ConsolidatedValue>(consolidatedValues);
|
||||
}
|
||||
|
||||
public void setConsolidatedValues(
|
||||
SortedSet<CalculatedConsolidatedValue> consolidatedValues) {
|
||||
this.consolidatedValues = consolidatedValues;
|
||||
}
|
||||
|
||||
public void setIndirectAdvanceAssignment(
|
||||
IndirectAdvanceAssignment indirectAdvanceAssignment) {
|
||||
this.indirectAdvanceAssignment = indirectAdvanceAssignment;
|
||||
}
|
||||
|
||||
public IndirectAdvanceAssignment getIndirectAdvanceAssignment() {
|
||||
return indirectAdvanceAssignment;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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.consolidations;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
|
||||
public class ConsolidatedValue extends BaseEntity {
|
||||
|
||||
private LocalDate date;
|
||||
private int value;
|
||||
|
||||
protected ConsolidatedValue() {
|
||||
|
||||
}
|
||||
|
||||
protected ConsolidatedValue(LocalDate date, int value) {
|
||||
this.date = date;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.consolidations;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public class ConsolidatedValueComparator implements
|
||||
Comparator<ConsolidatedValue> {
|
||||
|
||||
public ConsolidatedValueComparator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(ConsolidatedValue arg0, ConsolidatedValue arg1) {
|
||||
if (arg0.getDate() == arg1.getDate()) {
|
||||
return 0;
|
||||
}
|
||||
if (arg0.getDate() == null) {
|
||||
return -1;
|
||||
}
|
||||
if (arg1.getDate() == null) {
|
||||
return 1;
|
||||
}
|
||||
return arg1.getDate().compareTo(arg0.getDate());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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.consolidations;
|
||||
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.navalplanner.business.common.BaseEntity;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public abstract class Consolidation extends BaseEntity {
|
||||
|
||||
public abstract SortedSet<ConsolidatedValue> getConsolidatedValues();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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.consolidations;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.advance.entities.AdvanceMeasurement;
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
|
||||
public class NonCalculatedConsolidatedValue extends ConsolidatedValue {
|
||||
|
||||
private AdvanceMeasurement advanceMeasurement;
|
||||
|
||||
public static NonCalculatedConsolidatedValue create() {
|
||||
return create(new NonCalculatedConsolidatedValue());
|
||||
}
|
||||
|
||||
public static NonCalculatedConsolidatedValue create(LocalDate date,
|
||||
int value) {
|
||||
return create(new NonCalculatedConsolidatedValue(date, value));
|
||||
}
|
||||
|
||||
protected NonCalculatedConsolidatedValue(LocalDate date, int value) {
|
||||
super(date, value);
|
||||
}
|
||||
|
||||
public NonCalculatedConsolidatedValue() {
|
||||
}
|
||||
|
||||
public void setAdvanceMeasurement(AdvanceMeasurement advanceMeasurement) {
|
||||
this.advanceMeasurement = advanceMeasurement;
|
||||
}
|
||||
|
||||
public AdvanceMeasurement getAdvanceMeasurement() {
|
||||
return advanceMeasurement;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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.consolidations;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.navalplanner.business.advance.entities.DirectAdvanceAssignment;
|
||||
|
||||
|
||||
/**
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
|
||||
public class NonCalculatedConsolidation extends Consolidation {
|
||||
|
||||
private SortedSet<NonCalculatedConsolidatedValue> consolidatedValues = new TreeSet<NonCalculatedConsolidatedValue>(
|
||||
new ConsolidatedValueComparator());
|
||||
|
||||
private DirectAdvanceAssignment directAdvanceAssignment;
|
||||
|
||||
public static NonCalculatedConsolidation create(
|
||||
DirectAdvanceAssignment directAdvanceAssignment) {
|
||||
return create(new NonCalculatedConsolidation(directAdvanceAssignment));
|
||||
}
|
||||
|
||||
public static NonCalculatedConsolidation create(
|
||||
DirectAdvanceAssignment directAdvanceAssignment,
|
||||
SortedSet<NonCalculatedConsolidatedValue> consolidatedValues) {
|
||||
return create(new NonCalculatedConsolidation(directAdvanceAssignment,
|
||||
consolidatedValues));
|
||||
}
|
||||
|
||||
protected NonCalculatedConsolidation() {
|
||||
|
||||
}
|
||||
|
||||
protected NonCalculatedConsolidation(
|
||||
DirectAdvanceAssignment directAdvanceAssignment,
|
||||
SortedSet<NonCalculatedConsolidatedValue> consolidatedValues) {
|
||||
this(directAdvanceAssignment);
|
||||
this.setConsolidatedValues(consolidatedValues);
|
||||
}
|
||||
|
||||
public NonCalculatedConsolidation(
|
||||
DirectAdvanceAssignment directAdvanceAssignment) {
|
||||
this.directAdvanceAssignment = directAdvanceAssignment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<ConsolidatedValue> getConsolidatedValues() {
|
||||
return new TreeSet<ConsolidatedValue>(consolidatedValues);
|
||||
}
|
||||
|
||||
public void setConsolidatedValues(
|
||||
SortedSet<NonCalculatedConsolidatedValue> consolidatedValues) {
|
||||
this.consolidatedValues = consolidatedValues;
|
||||
}
|
||||
|
||||
public void setDirectAdvanceAssignment(
|
||||
DirectAdvanceAssignment directAdvanceAssignment) {
|
||||
this.directAdvanceAssignment = directAdvanceAssignment;
|
||||
}
|
||||
|
||||
public DirectAdvanceAssignment getDirectAdvanceAssignment() {
|
||||
return directAdvanceAssignment;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -76,6 +76,9 @@
|
|||
<value>
|
||||
org/navalplanner/business/externalcompanies/entities/ExternalCompanies.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/planner/entities/AdvanceConsolidations.hbm.xml
|
||||
</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
|
|||
|
|
@ -50,12 +50,31 @@
|
|||
<key column="ADVANCE_ASSIGNMENT_ID" />
|
||||
<one-to-many class="org.navalplanner.business.advance.entities.AdvanceMeasurement"></one-to-many>
|
||||
</set>
|
||||
|
||||
<set name="nonCalculatedConsolidations"
|
||||
cascade="none"
|
||||
inverse="true"
|
||||
access="field"
|
||||
>
|
||||
<key column="ADVANCE_ASSIGNMENT_ID" />
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.consolidations.NonCalculatedConsolidation" />
|
||||
</set>
|
||||
|
||||
</joined-subclass>
|
||||
|
||||
<joined-subclass name="IndirectAdvanceAssignment">
|
||||
<key column="ADVANCE_ASSIGNMENT_ID"></key>
|
||||
|
||||
<many-to-one name="orderElement" class="org.navalplanner.business.orders.entities.OrderElement" column="INDIRECT_ORDER_ELEMENT_ID"/>
|
||||
|
||||
<set name="calculatedConsolidations"
|
||||
cascade="none"
|
||||
inverse="true"
|
||||
access="field">
|
||||
<key column="ADVANCE_ASSIGNMENT_ID" />
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.consolidations.CalculatedConsolidation" />
|
||||
</set>
|
||||
|
||||
</joined-subclass>
|
||||
|
||||
</class>
|
||||
|
|
@ -73,6 +92,12 @@
|
|||
<property name="value" scale="2" access="field" />
|
||||
<many-to-one name="advanceAssignment" class="AdvanceAssignment" column="ADVANCE_ASSIGNMENT_ID" access="field" />
|
||||
<property name="communicationDate" access="field" />
|
||||
|
||||
<set name="nonCalculatedConsolidatedValues" access="field" cascade="none" inverse="true">
|
||||
<key column="ADVANCE_MEASUREMENT_ID" />
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.consolidations.NonCalculatedConsolidatedValue" />
|
||||
</set>
|
||||
|
||||
</class>
|
||||
|
||||
<class name="AdvanceAssignmentTemplate">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping package="org.navalplanner.business.planner.entities.consolidations" default-access="field">
|
||||
|
||||
<class name="ConsolidatedValue">
|
||||
<id name="id" column="id" type="long" access="property">
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
<discriminator column="CONSOLIDATED_VALUE_TYPE" type="string"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<property name="date" access="field" type="org.joda.time.contrib.hibernate.PersistentLocalDate" />
|
||||
<property name="value" scale="2" access="field" />
|
||||
|
||||
<subclass name="NonCalculatedConsolidatedValue" discriminator-value="NonCalculated">
|
||||
<many-to-one name="advanceMeasurement" class="org.navalplanner.business.advance.entities.AdvanceMeasurement" column="ADVANCE_MEASUREMENT_ID" access="field" />
|
||||
</subclass>
|
||||
|
||||
<subclass name="CalculatedConsolidatedValue" discriminator-value="Calculated">
|
||||
</subclass>
|
||||
|
||||
</class>
|
||||
|
||||
<class name="Consolidation">
|
||||
<id name="id" column="id" type="long" access="property">
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
<discriminator column="CONSOLIDATION_TYPE" type="string"/>
|
||||
<version name="version" access="property" type="long" />
|
||||
|
||||
<subclass name="NonCalculatedConsolidation" discriminator-value="NonCalculated">
|
||||
|
||||
<many-to-one name="directAdvanceAssignment" column="ADVANCE_ASSIGNMENT_ID" access="field"
|
||||
class="org.navalplanner.business.advance.entities.DirectAdvanceAssignment" />
|
||||
|
||||
<set name="consolidatedValues" access="field" cascade="all,delete-orphan"
|
||||
sort="org.navalplanner.business.planner.entities.consolidations.ConsolidatedValueComparator">
|
||||
<key column="CONSOLIDATION_ID" />
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.consolidations.NonCalculatedConsolidatedValue" />
|
||||
</set>
|
||||
|
||||
</subclass>
|
||||
|
||||
<subclass name="CalculatedConsolidation" discriminator-value="Calculated">
|
||||
|
||||
<many-to-one name="indirectAdvanceAssignment" class="org.navalplanner.business.advance.entities.IndirectAdvanceAssignment" column="INADVANCE_ASSIGNMENT_ID" access="field" />
|
||||
|
||||
<set name="consolidatedValues" access="field" cascade="all,delete-orphan"
|
||||
sort="org.navalplanner.business.planner.entities.consolidations.ConsolidatedValueComparator">
|
||||
<key column="CONSOLIDATION_ID" />
|
||||
<one-to-many class="org.navalplanner.business.planner.entities.consolidations.CalculatedConsolidatedValue" />
|
||||
</set>
|
||||
|
||||
</subclass>
|
||||
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
<property name="intendedTotalHours" column="intended_total_hours" />
|
||||
|
||||
<property name="originalTotalAssignment" access="field"/>
|
||||
|
||||
<many-to-one class="Task" name="task" column="TASK" />
|
||||
|
||||
<many-to-one class="AssignmentFunction" name="assignmentFunction"
|
||||
|
|
@ -100,8 +102,11 @@
|
|||
|
||||
<property name="hours" not-null="true"/>
|
||||
|
||||
<property name="consolidated" access="field"/>
|
||||
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
</property>
|
||||
<property name="constraintDate" />
|
||||
</component>
|
||||
|
||||
<one-to-one name="consolidation" class="org.navalplanner.business.planner.entities.consolidations.Consolidation"
|
||||
cascade="all" access="field"/>
|
||||
|
||||
<set name="resourceAllocations" cascade="all-delete-orphan">
|
||||
<key column="TASK" />
|
||||
<one-to-many class="ResourceAllocation" />
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@
|
|||
<value>
|
||||
org/navalplanner/business/externalcompanies/entities/ExternalCompanies.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/planner/entities/AdvanceConsolidations.hbm.xml
|
||||
</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@
|
|||
<value>
|
||||
org/navalplanner/business/externalcompanies/entities/ExternalCompanies.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/navalplanner/business/planner/entities/AdvanceConsolidations.hbm.xml
|
||||
</value>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue