Adds DTO representation for dependencies

FEA: ItEr77S05BasicProjectImport
This commit is contained in:
Alba Carro 2012-09-12 14:28:03 +02:00 committed by Manuel Rego Casasnovas
parent c696ac4670
commit 4a02db1a13
5 changed files with 124 additions and 2 deletions

View file

@ -0,0 +1,55 @@
/*
* This file is part of LibrePlan
*
* Copyright (C) 2012 Igalia, 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.importers;
/**
* Class that represents the dependencies between {@link OrderElementDTO}
*
* @author Alba Carro Pérez <alba.carro@gmail.com>
*/
public class DependencyDTO {
/**
* Enumerate that represent the different types
* of dependencies supported in LP
*/
public enum TypeOfDependencyDTO {
END_START, START_START, END_END, START_END;
}
/**
* Object that is the origin of the dependency.
* It can be a {@link OrderElementDTO} or a {@link MilestoneDTO}
*/
public IHasTaskAssociated origin;
/**
* Object that is the destination of the dependency.
* It can be a {@link OrderElementDTO} or a {@link MilestoneDTO}
*/
public IHasTaskAssociated destination;
/**
* Type of the dependency.
*/
public TypeOfDependencyDTO type;
}

View file

@ -0,0 +1,39 @@
/*
* This file is part of LibrePlan
*
* Copyright (C) 2012 Igalia, 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.importers;
import org.libreplan.business.planner.entities.TaskElement;
/**
* Contract for the {@link OrderElmentDTO} and {@link MilestoneDTO}.
*
* Has the method needed to successfully get the task associated.
*
* @author Alba Carro Pérez <alba.carro@gmail.com>
*/
public interface IHasTaskAssociated {
/**
* Return the {@link TaskElement} associated with the object.
*
* @return TaskElement associated.
*/
public TaskElement getTaskAssociated();
}

View file

@ -20,12 +20,14 @@ package org.libreplan.importers;
import java.util.Date;
import org.libreplan.business.planner.entities.TaskElement;
/**
* Class that represents no persistent milestones. <br />
*
* @author Alba Carro Pérez <alba.carro@gmail.com>
*/
public class MilestoneDTO {
public class MilestoneDTO implements IHasTaskAssociated {
/**
* Name of the milestone
@ -46,4 +48,14 @@ public class MilestoneDTO {
* String with the date of the constraint.
*/
public Date constraintDate;
/**
* TaskElement created with this data
*/
public TaskElement taskElement;
@Override
public TaskElement getTaskAssociated() {
return taskElement;
}
}

View file

@ -63,4 +63,9 @@ public class OrderDTO {
*/
public List<MilestoneDTO> milestones;
/**
* List of {@link DependencyDTO} of the project that is going to be imported.
*/
public List<DependencyDTO> dependencies;
}

View file

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.List;
import org.libreplan.business.orders.entities.OrderElement;
import org.libreplan.business.planner.entities.TaskElement;
/**
* Class that represents no persistent imported tasks. <br />
@ -32,7 +33,7 @@ import org.libreplan.business.orders.entities.OrderElement;
* @author Alba Carro Pérez <alba.carro@gmail.com>
* @todo It last hours, resources, relationships, etc.
*/
public class OrderElementDTO {
public class OrderElementDTO implements IHasTaskAssociated {
/**
* Name of the task
@ -84,4 +85,14 @@ public class OrderElementDTO {
*/
public Date constraintDate;
/**
* TaskElement associated with this data.
*/
public TaskElement taskElement;
@Override
public TaskElement getTaskAssociated() {
return taskElement;
}
}