create the interface DeliverDate and the comparator
DeliverDateComparator to sort the SubcontractorDeliverDate and the DeadlineCommunications. FEA: ItEr75S32AnA15S04UpdateDeliveringDateInSubcontracting
This commit is contained in:
parent
5e6622d71e
commit
e00ef6d40d
7 changed files with 46 additions and 9 deletions
|
|
@ -29,7 +29,7 @@ import org.libreplan.business.common.BaseEntity;
|
|||
*
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public class DeadlineCommunication extends BaseEntity {
|
||||
public class DeadlineCommunication extends BaseEntity implements DeliverDate{
|
||||
|
||||
private Date saveDate;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2011 WirelessGalicia, S.L.
|
||||
*
|
||||
* 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.libreplan.business.externalcompanies.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.libreplan.business.planner.entities.SubcontractorCommunication;
|
||||
|
||||
/**
|
||||
* Interface for {@link SubcontractorDeliverDate} and {@link DeadlineCommunication}
|
||||
*
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public interface DeliverDate {
|
||||
public Date getSaveDate();
|
||||
}
|
||||
|
|
@ -24,18 +24,18 @@ import java.util.Comparator;
|
|||
import org.libreplan.business.externalcompanies.entities.DeadlineCommunication;
|
||||
|
||||
/**
|
||||
* Comparator to {@link DeadlineCommunication}
|
||||
* Comparator to {@link DeliverDate} interface
|
||||
*
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
|
||||
public class DeadlineCommunicationComparator implements Comparator<DeadlineCommunication> {
|
||||
public class DeliverDateComparator implements Comparator<DeliverDate> {
|
||||
|
||||
public DeadlineCommunicationComparator(){
|
||||
public DeliverDateComparator(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(DeadlineCommunication arg0, DeadlineCommunication arg1) {
|
||||
public int compare(DeliverDate arg0, DeliverDate arg1) {
|
||||
if (arg0.getSaveDate() == arg1.getSaveDate()) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -48,7 +48,7 @@ import org.libreplan.business.common.entities.EntitySequence;
|
|||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.externalcompanies.entities.CustomerCommunication;
|
||||
import org.libreplan.business.externalcompanies.entities.DeadlineCommunication;
|
||||
import org.libreplan.business.externalcompanies.entities.DeadlineCommunicationComparator;
|
||||
import org.libreplan.business.externalcompanies.entities.DeliverDateComparator;
|
||||
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.libreplan.business.orders.daos.IOrderDAO;
|
||||
import org.libreplan.business.planner.entities.DayAssignment;
|
||||
|
|
@ -116,7 +116,7 @@ public class Order extends OrderLineGroup implements Comparable {
|
|||
|
||||
@Valid
|
||||
private SortedSet<DeadlineCommunication> deliveringDates = new TreeSet<DeadlineCommunication>(
|
||||
new DeadlineCommunicationComparator());
|
||||
new DeliverDateComparator());
|
||||
|
||||
public enum SchedulingMode {
|
||||
FORWARD, BACKWARDS;
|
||||
|
|
|
|||
|
|
@ -23,10 +23,14 @@ package org.libreplan.business.planner.entities;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.hibernate.validator.AssertTrue;
|
||||
import org.hibernate.validator.NotNull;
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.libreplan.business.common.BaseEntity;
|
||||
import org.libreplan.business.externalcompanies.entities.DeliverDateComparator;
|
||||
import org.libreplan.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.libreplan.business.util.deepcopy.OnCopy;
|
||||
import org.libreplan.business.util.deepcopy.Strategy;
|
||||
|
|
|
|||
|
|
@ -22,13 +22,14 @@ package org.libreplan.business.planner.entities;
|
|||
import java.util.Date;
|
||||
|
||||
import org.libreplan.business.common.BaseEntity;
|
||||
import org.libreplan.business.externalcompanies.entities.DeliverDate;
|
||||
|
||||
/**
|
||||
* Entity {@link SubcontractorDeliverDate}.
|
||||
*
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia>
|
||||
*/
|
||||
public class SubcontractorDeliverDate extends BaseEntity{
|
||||
public class SubcontractorDeliverDate extends BaseEntity implements DeliverDate{
|
||||
|
||||
private Date saveDate;
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
|
||||
<set name="deliveringDates" cascade="all,delete-orphan"
|
||||
inverse="true" access="field"
|
||||
sort="org.libreplan.business.externalcompanies.entities.DeadlineCommunicationComparator">
|
||||
sort="org.libreplan.business.externalcompanies.entities.DeliverDateComparator">
|
||||
<key column="order_id" />
|
||||
<one-to-many class="org.libreplan.business.externalcompanies.entities.DeadlineCommunication" />
|
||||
</set>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue