diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/DependencyDTO.java b/libreplan-webapp/src/main/java/org/libreplan/importers/DependencyDTO.java new file mode 100644 index 000000000..ce100e932 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/DependencyDTO.java @@ -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 . + */ +package org.libreplan.importers; + +/** + * Class that represents the dependencies between {@link OrderElementDTO} + * + * @author Alba Carro Pérez + */ +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; + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/IHasTaskAssociated.java b/libreplan-webapp/src/main/java/org/libreplan/importers/IHasTaskAssociated.java new file mode 100644 index 000000000..df67c8ee6 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/IHasTaskAssociated.java @@ -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 . + */ + +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 + */ +public interface IHasTaskAssociated { + + /** + * Return the {@link TaskElement} associated with the object. + * + * @return TaskElement associated. + */ + public TaskElement getTaskAssociated(); +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/MilestoneDTO.java b/libreplan-webapp/src/main/java/org/libreplan/importers/MilestoneDTO.java index 869701af3..efec8cf45 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/importers/MilestoneDTO.java +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/MilestoneDTO.java @@ -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.
* * @author Alba Carro Pérez */ -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; + } } diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/OrderDTO.java b/libreplan-webapp/src/main/java/org/libreplan/importers/OrderDTO.java index 2b20527e2..8027d0a5c 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/importers/OrderDTO.java +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/OrderDTO.java @@ -63,4 +63,9 @@ public class OrderDTO { */ public List milestones; + /** + * List of {@link DependencyDTO} of the project that is going to be imported. + */ + public List dependencies; + } diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/OrderElementDTO.java b/libreplan-webapp/src/main/java/org/libreplan/importers/OrderElementDTO.java index 17ea6bcda..3a893e73c 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/importers/OrderElementDTO.java +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/OrderElementDTO.java @@ -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.
@@ -32,7 +33,7 @@ import org.libreplan.business.orders.entities.OrderElement; * @author Alba Carro Pérez * @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; + } + }