Package com.projity.pm.task

Examples of com.projity.pm.task.Task


            taskMap.put(t.getUniqueId(),t);
        }

        Project owningProject;
        if (parent!=null && parent.getImpl() instanceof Task){
          Task task=(Task)parent.getImpl();
          if (task.isSubproject()) owningProject=((SubProj)task).getSubproject();
          else owningProject=task.getOwningProject();
        }else owningProject=(Project)model.getDataFactory();

          for (int i=0;i<descendants.length;i++){
            if (descendants[i].getImpl() instanceof Task){
              Task task=(Task)descendants[i].getImpl();

              Node parentSubproject=getParentSubproject((Node)descendants[i].getParent());
              if (parentSubproject!=null) owningProject=((SubProj)parentSubproject.getImpl()).getSubproject();
              if (!task.isExternal()) // fixes  subproject bug with external links
                task.setProjectId(owningProject.getUniqueId()); //useful?
              owningProject.validateObject(task,model,this,null,false);

              Set<Dependency> depsSet=new HashSet<Dependency>();
            List pdeps=task.getDependencyList(true);
            if (pdeps!=null&&pdeps.size()>0){
              if (Environment.isKeepExternalLinks()){
                for (Iterator k=pdeps.iterator();k.hasNext();){
                  Dependency d=(Dependency)k.next();
                  if (!(d.getPredecessor() instanceof Task)){
                    TaskLinkReference ref=(TaskLinkReference)d.getPredecessor();
                    Task t=taskMap.get(ref.getUniqueId());
                    if (t==null){
                      k.remove();
                      continue;
                    } else{
                      d.setPredecessor(t);
                      t.getSuccessorList().add(d);
                      //DependencyService.getInstance().updateSentinels(d);
                      //DependencyService.getInstance().connect(d, this);
                    }
                  }
                  depsSet.add(d);
                }
               }
            }
            List sdeps=task.getDependencyList(false);
            if (sdeps!=null&&sdeps.size()>0){
              if (Environment.isKeepExternalLinks()){
                for (Iterator k=sdeps.iterator();k.hasNext();){
                  Dependency d=(Dependency)k.next();
                  if (!(d.getSuccessor() instanceof Task)){
                    TaskLinkReference ref=(TaskLinkReference)d.getSuccessor();
                    Task t=taskMap.get(ref.getUniqueId());
                    if (t==null){
                      k.remove();
                      continue;
                    } else{
                      d.setSuccessor(t);
                      t.getPredecessorList().add(d);
                      //DependencyService.getInstance().updateSentinels(d);
                      //DependencyService.getInstance().connect(d, this);
                    }
                  }
                  depsSet.add(d);
View Full Code Here


  /**
   * convert to text.  The format is either, 123, 123FF, or 123FS-1d
   */
  public StringBuffer format(Object dependencyObject,  StringBuffer string, FieldPosition fieldPos) {
    Dependency dependency = (Dependency)dependencyObject;
    Task task = (Task) ((parameters.isLeftAssociation()) ? dependency.getPredecessor() : dependency.getSuccessor());
    string.append(parameters.getIdField().getValue(task,null));
    boolean hasLag = !Duration.isZero(dependency.getLag());

    StringBuffer details = new StringBuffer();
    if (!DependencyType.isDefault(dependency.getDependencyType()) || hasLag)
View Full Code Here

    if (unopenedSubproject) { // need to put back old dates because we want the reverse pass to work right
      newBegin = oldBegin;
      newEnd = oldEnd;
    }
    Collection list = task.getDependencyList(!forward);
    Task parent = task.getWbsParentTask();
    TaskSchedule parentSchedule = null;
    long parentEnd = 0;
    if (parent != null) {
      parentSchedule = parent.getSchedule(type);
      parentEnd = parentSchedule.getEnd();
    }
     
    if (context.taskReferenceType == PredecessorTaskList.TaskReference.PARENT_BEGIN) {
      if (oldBegin != newBegin) { // if parent start (finish) changed, then all of its children need to me marked
       
        flagChildren();
        setDependencyDate(newBegin); //This fixes a problem in incorrect propagation of constraints to children hk 16/8/05

       
//         make sure that in second pass over this, the schedule will change so it will be marked in backward pass.  However, we don't want to lose
//        information - specificially whether this task affects its parent's task.  In case it does, it is marked with a special value (Dependency.NEEDS_CALCULATION)
//        This is a bit of a hack, but it's for optimization purposes.       

        if (parentEnd == oldEnd)
          setEnd(needsCalculation);
        else
          setEnd(0);
      }
      return;
    }

    Dependency dependency;
   
    if (list.isEmpty()) {
      if (!task.isExternal() && task != context.sentinel) { // When the task is the sentinel, do nothing, otherwise find dependency and update it
        dependency = (Dependency) context.sentinel.getDependencyList(forward).find(forward,task); // find sentinel's dependency concerning this task
       
        if (dependency != null) { // tasks in a subproject won't have a sentinel dependency
          dependency.calcDependencyDate(forward,newBegin,newEnd,false); // calculate it to store off value
          context.sentinel.setCalculationStateCount(context.stateCount); // need to process successor(predecessor) later on in pass
          context.sentinel.getSchedule(type).setDependencyDate(needsCalculation); //sentinel needs dependencies calculated - I assume more than one
        }
      }
    } else {
//      Go Thru Successors (Predecessors) and calculate a dependency date for them and mark them for further treatment.  There is an optimization here:
//      If the successor(pred) task only has one predecessor(succ), then just set its dependency date instead of calculating it.  This avoids reprocessing
//      the predecessor(successor) list of that task later on.  Since in most cases, a task has only one predecessor, this saves time.
      for (Iterator d = list.iterator(); d.hasNext();) {
        Task dependencyTask;
        TaskSchedule dependencyTaskSchedule;
       
        dependency = (Dependency) d.next();
        if (dependency.isDisabled())
          continue;
        dependencyTask = (Task) dependency.getTask(!forward);        // get the successor(pred) task
        dependencyTaskSchedule = dependencyTask.getSchedule(type);
        // if this task is the only predecessor(successor) for the successor(predecessor) task, avoid long calculation and just calculate the date, otherwise
        // flag the task for later calculation
        long dependencyCount = dependencyTask.getDependencyList(forward).size();

        long dep = newBegin; // by default (if no preds for example)
        if (dependencyCount > 0) {
          boolean useSooner = !dependencyTask.isWbsParent() && dependencyTask.hasDuration();
          dep = dependency.calcDependencyDate(forward,newBegin,newEnd,useSooner); // calculate it and store off value
          if (dependencyCount > 1) // can't just set date directly because more than one
            dep = needsCalculation; // it will need to be calculated later
        }
        dependencyTaskSchedule.setDependencyDate(dep);
        dependencyTask.setCalculationStateCount(context.stateCount); // need to process successor(predecessor) later on in pass
      }
    }
   
    // mark parent also if it is affected and isn't marked already
    if (parent != null && parent.getCalculationStateCount() != context.stateCount) {
View Full Code Here

   * @param early
   * @return
   */
  private void calcStartAndFinish(CalculationContext context) {
    long begin = getBeginDependency();
    Task parent = task.getWbsParentTask();
   
    //boolean useSooner = (forward != task.hasDuration()); // shortcut: if forward and is milestone, use sooner, otherwise later.  And conversely, if reverse and isn't milestone, use sooner, othewise later
    boolean useSooner = !task.hasDuration();
   
    if (parent != null) {
      TaskSchedule parentSchedule = parent.getSchedule(type);
      long parentDependency = parentSchedule.getBeginDependency();
      long parentWindow = parentSchedule.getWindowBegin();
      if (parentDependency == 0 || (parentWindow != 0 && parentWindow > parentDependency))
        parentDependency = parentWindow;
      // in case where parent determines start time, make sure that this
View Full Code Here

      return;
    }
    final Node node=(Node)nodes.get(0);
    Object impl=node.getImpl();
    if (impl instanceof Task||(impl instanceof Assignment&&taskType)){
      Task task=(Task)((impl instanceof Assignment)?(((Assignment)impl).getTask()):impl);
      if (taskInformationDialog == null) {
        taskInformationDialog = TaskInformationDialog.getInstance(getFrame(),task, notes);
        taskInformationDialog.pack();
        taskInformationDialog.setModal(false);
      } else {
View Full Code Here

                  transformSubprojectBranches(node,model.getDataFactory(),new Predicate(){
                public boolean evaluate(Object arg0) {
                  Node parent=(Node)arg0;
                  //change implementation
                  NormalTask task=new NormalTask();
                  Task source=((Task)parent.getImpl());
                  source.cloneTo(task);
                  //task.setDuration(source.getActualDuration());
                  parent.setImpl(task);
                  return true;
                }  
              });
View Full Code Here

      label.add(parentAssignment);
      text.append(Messages.getString("TaskIndicatorsComponent.ThisParentTaskHasResources") + ((NormalTask)indicators).getResourceNames()+"<br>"); //$NON-NLS-1$ //$NON-NLS-2$
    }
   
    if (indicators instanceof Task) {
      Task t = (Task)indicators;
      if (t.isSubproject()) {
        SubProj s = (SubProj)t;
        if (s.isValid()) {
          setLook(subproject,isSelected,hasFocus);
          label.add(subproject);
          text.append(Messages.getString("TaskIndicatorsComponent.ThisTasksRepresentsThe") + (s.isSubprojectOpen() ? Messages.getString("TaskIndicatorsComponent.opened") : Messages.getString("TaskIndicatorsComponent.unopened")) + Messages.getString("TaskIndicatorsComponent.subproject") + ((Task)s).getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        } else {
          setLook(invalidProject,isSelected,hasFocus);
          label.add(invalidProject);
          text.append(Messages.getString("TaskIndicatorsComponent.ThisSubprojectIsNotValid")); //$NON-NLS-1$
        }
      }
     
     
      if (t.isMissedDeadline()) {
        setLook(missedDeadline,isSelected,hasFocus);
        label.add(missedDeadline);
        text.append(Messages.getString("TaskIndicatorsComponent.ThisTaskFinishesOn") + finish.getText(indicators,null) //$NON-NLS-1$
            Messages.getString("TaskIndicatorsComponent.whichIsAfterItsDeadline") + deadlineField.getText(indicators,null)); //$NON-NLS-1$
      }
      if (t.getDelegatedTo() != null) {
        if (t.isDelegatedToUser()) {
          setLook(delegatedMe,isSelected,hasFocus);
          label.add(delegatedMe);
          text.append(Messages.getString("TaskIndicatorsComponent.ThisTaskHasBeenDelegatedToYou")); //$NON-NLS-1$

        } else {
          setLook(delegated,isSelected,hasFocus);
          label.add(delegated);
          text.append(Messages.getString("TaskIndicatorsComponent.ThisTaskHasBeenDelegatedTo") + t.getDelegatedTo().getName()); //$NON-NLS-1$
        }
      }
    }
  }
View Full Code Here

  }

  public Dependency newDependency(HasDependencies predecessor, HasDependencies successor, int dependencyType, long lead, Object eventSource) throws InvalidAssociationException {
    if (predecessor == successor)
      throw new InvalidAssociationException(Messages.getString("Message.cantLinkToSelf"));
    Task successorTask = (Task)successor;
    if (successorTask.isExternal())
      throw new InvalidAssociationException(Messages.getString("Message.cantLinkToExternal"));
    if (successorTask.isSubproject() && !((SubProj)successorTask).isWritable())
      throw new InvalidAssociationException(Messages.getString("Message.cantLinkToClosedSubproject"));

    Dependency dependency = Dependency.getInstance(predecessor, successor, dependencyType, lead);
    dependency.testValid(false); // throws if exception
    connect(dependency,eventSource);
View Full Code Here

  }

// update the starting and ending sentinels of the project - the sentinels keep track of which
//  tasks have no preds or no successors
  public void updateSentinels(Dependency dependency) {
    Task predecessor = (Task) dependency.getPredecessor();
    Task successor = (Task) dependency.getSuccessor();
    predecessor.updateEndSentinel();
    successor.updateStartSentinel();
  }
View Full Code Here

* Initialize the sentinels so that the start sentinel has all start tasks as successors, and the end sentinel has all end tasks as predecessors
*
*/
  private void initSentinelsFromTasks() {
    Iterator i = predecessorTaskList.listIterator();
    Task task;
    while (i.hasNext()) {
      task = ((PredecessorTaskList.TaskReference)i.next()).getTask();
      if (task.getPredecessorList().size() == 0)
        addStartSentinelDependency(task);
      if (task.getSuccessorList().size() == 0)
        addEndSentinelDependency(task);
    }
//    System.out.println("start sentinel successors");
//    startSentinel.getSuccessorList().dump(false);
//    System.out.println("end sentinel preds");
View Full Code Here

TOP

Related Classes of com.projity.pm.task.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.