public static void delTaskDepLatest(JobPlan object, ObjectBroker Objbroker) {
   ArrayList<JobPlanTask> selectedTasks = GetMatchingTaskList(object, Objbroker);
   for (int i = 0; i < selectedTasks.size(); i++) {
     JobPlanTask jptask = selectedTasks.get(i);
     jptask.dependencies().setAtTheLatest(false);
     System.out.println(
         "\t ++ UPDATE: Remove Latest Option on Task Dependency: [ {"
             + jptask.getTaskName()
             + "("
             + jptask.getLnr()
             + ") | "
             + jptask.getType()
             + " | {"
             + jptask.getX()
             + ","
             + jptask.getY()
             + "} ]");
   }
 }
  public static void addDependency(JobPlan object, ObjectBroker Objbroker) throws IOException {

    // format can be ["TASKNAME","PREDECESSORNAME","STATUS"] or:
    // ["TASKNAME(4)","PREDECESSORNAME","STATUS"] or: ["TASKNAME","PREDECESSORNAME(5)","STATUS"]
    // => the task number isnt mandatory but is useful when the same job exists as several tasks
    // within one same WF

    // Getting the task Name and Task Number (if passed)
    String[] RawVals = ProcessSpecificCLI.U_ADDDEPENDENCY.split(",");
    String TaskName = RawVals[0].replace("[", "");
    String SanitizedTaskName = "";
    int TaskNameNumber = -1;
    String SanitizedPredecessorTaskName = "";
    int PredecessorTaskNameNumber = -1;
    if (TaskName.contains("(") && TaskName.contains(")")) {
      SanitizedTaskName = TaskName.split("\\(")[0];
      TaskNameNumber = Integer.parseInt(TaskName.split("\\(")[1].replace(")", ""));
    } else {
      SanitizedTaskName = TaskName;
    }

    // Getting the Predecessor task Name and Task Number (if passed)
    String TaskPredecessor = RawVals[1];
    String TaskStatus = RawVals[2].replace("]", "");

    if (TaskPredecessor.contains("(") && TaskPredecessor.contains(")")) {
      SanitizedPredecessorTaskName = TaskPredecessor.split("\\(")[0];
      PredecessorTaskNameNumber =
          Integer.parseInt(TaskPredecessor.split("\\(")[1].replace(")", ""));
    } else {
      SanitizedPredecessorTaskName = TaskPredecessor;
    }

    // Getting the task state.. no control here :(
    TaskState tState = new TaskState(TaskStatus);

    // handling the case where the Task Name is END (end of WF)
    ArrayList<JobPlanTask> TaskList = new ArrayList<JobPlanTask>();
    if (SanitizedTaskName.equalsIgnoreCase("END")) {
      TaskList.add(object.getEndTask());
    } else {
      TaskList = Objbroker.jobPlans.getTasksFromNameAndJobPlan(object, SanitizedTaskName);
    }

    // handling the case where the Predecessor Task Name is START (start of WF)
    ArrayList<JobPlanTask> PredecessorTaskList = new ArrayList<JobPlanTask>();
    if (SanitizedPredecessorTaskName.equalsIgnoreCase("START")) {
      PredecessorTaskList.add(object.getStartTask());
    } else {
      PredecessorTaskList =
          Objbroker.jobPlans.getTasksFromNameAndJobPlan(object, SanitizedPredecessorTaskName);
    }

    // For each task found
    for (int h = 0; h < TaskList.size(); h++) {
      JobPlanTask jptask = TaskList.get(h);
      // for each predecessor found
      for (int k = 0; k < PredecessorTaskList.size(); k++) {
        JobPlanTask jppredecessortask = PredecessorTaskList.get(k);
        // only create a dependency if: eithere there is no task number specified or.. if they
        // match.
        if ((TaskNameNumber == -1 || jptask.getLnr() == TaskNameNumber)
            && (PredecessorTaskNameNumber == -1
                || jppredecessortask.getLnr() == PredecessorTaskNameNumber)) {
          System.out.println(
              "\t ++ UPDATE: Adding Dependency to: "
                  + jptask.getTaskName()
                  + "("
                  + jptask.getLnr()
                  + ")"
                  + " on: "
                  + jppredecessortask.getTaskName()
                  + "("
                  + jppredecessortask.getLnr()
                  + ")"
                  + " in Status: "
                  + tState
                  + "");
          jptask.dependencies().addDependency(jppredecessortask, tState);
        }
      }
    }
  }