コード例 #1
0
  public IFrontLoaderTO mapFromProject(Project_Data project) {

    // map.
    // it is IMPERATIVE, that the roles know nothing about the data objects.  data objects
    // are in a different world than these service objects.
    Map<String, Task_Data> task_index = new HashMap<String, Task_Data>();
    Map<String, IActivityTO> activity_index = new HashMap<String, IActivityTO>();
    FrontLoaderRole fl = new FrontLoaderRole();
    for (Task_Data t : project.getTasks()) {
      IActivityTO a = new ActivityRole(t.getId(), t.getEstimatedMinutes());
      fl.getActivities().add(a);

      activity_index.put(t.getId(), a);
      task_index.put(t.getId(), t);
    }

    // now map dependencies
    for (IActivityTO a : fl.getActivities()) {
      Task_Data t = task_index.get(((ActivityRole) a).getId());
      for (Task_Data t2 : t.getDependencies()) {
        a.getPredecessors().add(activity_index.get(t2.getId()));
      }
    }

    return fl;
  }
コード例 #2
0
 public void mergeResults(Project_Data project, IFrontLoaderTO frontLoader) {
   for (IActivityTO activity : frontLoader.getActivities()) {
     ActivityRole ar = (ActivityRole) activity;
     for (Task_Data task : project.getTasks()) {
       if (ar.getId().equals(task.getId())) {
         task.setStart(ar.getStart());
         break;
       }
     }
   }
 }