ItEr19S08CUCreacionProxectoPlanificacionItEr18S08: Adding getIncomingDependencies method and renaming getOutgoingDepencies for consistency.
This commit is contained in:
parent
0e023365ba
commit
ee23eeb6ea
5 changed files with 31 additions and 11 deletions
|
|
@ -89,8 +89,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
|||
private Task extractTask(List<DomainDependency<T>> accumulatedDependencies,
|
||||
T data, TaskContainer parent) {
|
||||
ITaskFundamentalProperties adapted = adapter.adapt(data);
|
||||
accumulatedDependencies
|
||||
.addAll(adapter.getDependenciesOriginating(data));
|
||||
accumulatedDependencies.addAll(adapter.getOutcomingDependencies(data));
|
||||
final Task result;
|
||||
if (navigator.isLeaf(data)) {
|
||||
result = new TaskLeaf(adapted);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,13 @@ public class AutoAdapter implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DomainDependency<ITaskFundamentalProperties>> getDependenciesOriginating(
|
||||
public List<DomainDependency<ITaskFundamentalProperties>> getOutcomingDependencies(
|
||||
ITaskFundamentalProperties object) {
|
||||
return new ArrayList<DomainDependency<ITaskFundamentalProperties>>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DomainDependency<ITaskFundamentalProperties>> getIncomingDependencies(
|
||||
ITaskFundamentalProperties object) {
|
||||
return new ArrayList<DomainDependency<ITaskFundamentalProperties>>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ public interface IAdapterToTaskFundamentalProperties<T> {
|
|||
|
||||
public ITaskFundamentalProperties adapt(T object);
|
||||
|
||||
public List<DomainDependency<T>> getDependenciesOriginating(T object);
|
||||
public List<DomainDependency<T>> getOutcomingDependencies(T object);
|
||||
|
||||
public List<DomainDependency<T>> getIncomingDependencies(T object);
|
||||
|
||||
public boolean canAddDependency(DomainDependency<T> dependency);
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class DataForPlanner {
|
|||
return new PlannerConfiguration<ITaskFundamentalProperties>(
|
||||
new AutoAdapter() {
|
||||
@Override
|
||||
public List<DomainDependency<ITaskFundamentalProperties>> getDependenciesOriginating(
|
||||
public List<DomainDependency<ITaskFundamentalProperties>> getOutcomingDependencies(
|
||||
ITaskFundamentalProperties object) {
|
||||
List<DomainDependency<ITaskFundamentalProperties>> result = new ArrayList<DomainDependency<ITaskFundamentalProperties>>();
|
||||
if (child1 == object) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package org.navalplanner.web.planner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.navalplanner.business.orders.entities.Order;
|
||||
import org.navalplanner.business.planner.entities.Dependency;
|
||||
|
|
@ -115,13 +115,25 @@ public class TaskElementAdapter implements ITaskElementAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DomainDependency<TaskElement>> getDependenciesOriginating(
|
||||
public List<DomainDependency<TaskElement>> getIncomingDependencies(
|
||||
TaskElement taskElement) {
|
||||
Set<Dependency> dependenciesWithThisOrigin = taskElement
|
||||
.getDependenciesWithThisOrigin();
|
||||
return toDomainDependencies(taskElement
|
||||
.getDependenciesWithThisDestination());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DomainDependency<TaskElement>> getOutcomingDependencies(
|
||||
TaskElement taskElement) {
|
||||
return toDomainDependencies(taskElement
|
||||
.getDependenciesWithThisOrigin());
|
||||
}
|
||||
|
||||
private List<DomainDependency<TaskElement>> toDomainDependencies(
|
||||
Collection<? extends Dependency> dependencies) {
|
||||
List<DomainDependency<TaskElement>> result = new ArrayList<DomainDependency<TaskElement>>();
|
||||
for (Dependency dependency : dependenciesWithThisOrigin) {
|
||||
result.add(DomainDependency.createDependency(taskElement,
|
||||
for (Dependency dependency : dependencies) {
|
||||
result.add(DomainDependency.createDependency(
|
||||
dependency.getOrigin(),
|
||||
dependency.getDestination(), toGanntType(dependency
|
||||
.getType())));
|
||||
}
|
||||
|
|
@ -175,4 +187,5 @@ public class TaskElementAdapter implements ITaskElementAdapter {
|
|||
source.removeDependencyWithDestination(dependency.getDestination(),
|
||||
type);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue