Package com.projity.pm.assignment

Examples of com.projity.pm.assignment.Assignment


          if (assignments.size()>0)
            for (Iterator j=assignments.iterator();j.hasNext();){
              Object obj=j.next();
              AssignmentData assignmentData=null;
              Assignment assignment=null;
              Resource resource;
              boolean assigned=true;
              int s;
//              if (loadResources!=null&&obj instanceof PersistedAssignment){ //claur
//                PersistedAssignment pa=(PersistedAssignment)obj;
//                assignment=pa.getAssignment();
//                s=pa.getSnapshot();
//
//                 long resId=pa.getResourceId();
//              Node node=(Node)resourceNodeMap.get(resId);
//              resource=node==null?ResourceImpl.getUnassignedInstance():(Resource)node.getImpl();
//
//              if (resource==null) assigned=false;
//              }else{
                assignmentData=(AssignmentData)obj;
                if (loadResources==null){
                  EnterpriseResourceData r=assignmentData.getResource();
                  if (r==null) assigned=false;
                  resource=(r==null)?ResourceImpl.getUnassignedInstance():(Resource)((Node)resourceNodeMap.get(r)).getImpl();
                }else{
                  long resId=assignmentData.getResourceId();
                  Node node=(Node)resourceNodeMap.get(resId);
                  resource=node==null?ResourceImpl.getUnassignedInstance():(Resource)node.getImpl();
                }
                if (assignmentData.getSerialized() != null){
                  try {
                    assignment=(Assignment)deserialize(assignmentData,reindex);
                  } catch (Exception e) {
                    e.printStackTrace();
                  }
                }
                if (assignmentData.getSerialized() == null||(assignmentData.getSerialized() != null&&assignment==null)) { // timesheet created
                  assignment = Assignment.getInstance(task,resource,  1.0, 0);
                  if (assignment.getCachedStart() == null) { //doesn't occur filtered above
                    System.out.println("==== no cached start found " + task.getName());

                  } else {
                    task.setActualStart(assignment.getCachedStart().getTime());
                    task.setActualFinish(assignment.getCachedEnd().getTime());
                  }
                }
                assignment.setCachedStart(assignmentData.getCachedStart());
                assignment.setCachedEnd(assignmentData.getCachedEnd());
                assignment.setTimesheetStatus(assignmentData.getTimesheetStatus());
                long lastUpdate = (assignmentData.getLastTimesheetUpdate() == null) ? 0 : assignmentData.getLastTimesheetUpdate().getTime();
                assignment.setLastTimesheetUpdate(lastUpdate);
                assignment.setWorkflowState(assignmentData.getWorkflowState());
                s=assignmentData.getSnapshotId();
//              }

              assignment.getDetail().setTask(task);
              assignment.getDetail().setResource(resource);
              Object snapshotId=new Integer(s);
              TaskSnapshot snapshot=(TaskSnapshot)task.getSnapshot(snapshotId);

              //TODO was commented but needed for loading  because task.getSnapshot(snapshotId)==null
              //for snapshots other than CURRENT
              if (snapshot==null){
                snapshot=new TaskSnapshot();
                snapshot.setCurrentSchedule(task.getCurrentSchedule());
                task.setSnapshot(snapshotId,snapshot);
              }
              if (Snapshottable.TIMESHEET.equals(snapshotId)) {
                assignment.setTimesheetAssignment(true);
              }
              //

              snapshot.addAssignment(assignment);
View Full Code Here


public class AssignmentCompositionFilter extends PreCompositionNodeFilter {
   
    public boolean evaluate(NodeFilter filter,Object node) {
        Object impl=((Node)node).getImpl();
        if (!(impl instanceof Assignment)) return super.evaluate(filter,node);
        Assignment assignment=(Assignment)impl;
        return super.evaluate(filter,assignment.getResource());
    }
View Full Code Here

                    if (snapshot==null) continue;
                  AssociationList snapshotAssignments=snapshot.getHasAssignments().getAssignments();
                  if (snapshotAssignments.size()>0){
//                    ArrayList<Assignment> assignmentsToLink=new ArrayList<Assignment>();
                      for (Iterator a=snapshotAssignments.listIterator();a.hasNext();){
                          Assignment assignment=(Assignment)a.next();
                          Resource resource=assignment.getResource();
                      if (resource==ResourceImpl.getUnassignedInstance()) continue;
                      Resource destResource=resourceMap.get(resource.getUniqueId());
                      if (destResource!=null){
                          if (Snapshottable.CURRENT.equals(s)){
                            if (destResource!=resource){ // use destination resource
                              resource=destResource;
                              assignment.getDetail().setResource(resource);
                            }
//                            assignmentsToLink.add(assignment);
                            resource.addAssignment(assignment);
                            NodeUndoInfo undo=new NodeUndoInfo(false);
                            ((ResourcePool)assignment.getResource().getDocument()).getObjectEventManager().fireCreateEvent(this,assignment,undo);
                          }
                      }else{
                        assignment.getDetail().setResource(ResourceImpl.getUnassignedInstance());
                      }
                      }
//                      for (Assignment assignment: assignmentsToLink){
//                        AssignmentService.getInstance().remove(assignmentsToLink, this,false);
//                        AssignmentService.getInstance().connect(assignment, this);
View Full Code Here

        if (implToShow == null)
          return false; //TODO Shouldn't happen. to reproduce, create a new project, select a sub view and then unselect it.  Then create a task
        if (impl instanceof HasAssignments)
            return implToShow.contains(impl);
        else if (impl instanceof Assignment){
            Assignment a=(Assignment)impl;
            return selectedImpl.contains(a.getTask())||selectedImpl.contains(a.getResource());
        }
        else return false;
    }
View Full Code Here

    TimeIterator timeIterator = null;
    TimeIteratorGenerator generator;
    Iterator i = taskIterator;
    Object current;
    Assignment assignment; 
    double resourceMaxUnits = 0;
    ArrayList assignmentResourcesUsed = new ArrayList();
    boolean hasValues = false;
    while (i.hasNext()) { //loop thru tasks
      current = i.next();
      if (current instanceof HasAssignments) {
        List list = ((HasAssignments)current).getAssignments();

        Iterator a = list.iterator();
        while (a.hasNext()) { // loop through assignments,
         
          assignment = (Assignment)a.next();
          if (histogram) {
            timeIterator = coord.getProjectTimeIterator();
            generator = histogram ? TimeIteratorGenerator.getInstance(timeIterator) : null;
          } else {
            generator = null;
          }
          if (isTaskBased(trace)) {
            hasValues = true;
            assignment.calcDataBetween(trace,generator,calculatedValues);
            break;
          }
          if (!assignment.isDefault()) {// skip dummy assignment
            if (resources == null || resources.contains(assignment.getResource())) {
              hasValues = true;
              assignment.calcDataBetween(trace,generator,calculatedValues);
            }
          }
        }
      }
    }
View Full Code Here

    } else if (changedObject instanceof WorkingCalendar) { // if whole project changed, such
      //TODO for now just invalidating all projects, eventually be smarter
      project.markAllTasksAsNeedingRecalculation(false);
      calculate(true,null);
    } else if (changedObject instanceof Assignment) {
      Assignment assignment = (Assignment)changedObject;
      task = assignment.getTask();
      if (task.getProject().getSchedulingAlgorithm() != this)
        return;
//      if (((NormalTask)task).isEffortDriven())
      calculate(true,task);
    } else if (changedObject instanceof BelongsToDocument){ // for other things, such as assignment entry
View Full Code Here

  }


  public void objectChanged(ObjectEvent objectEvent) {
    if (objectEvent.getObject() instanceof Assignment) {
      Assignment assignment = ((Assignment)objectEvent.getObject());
      if (assignment.isDefault()) return;
      if (assignment.getDocument(containsLeftObjects) == document) { //TODO check if it's correct
        if (objectEvent.isCreate()) {
          Object parentObject=containsLeftObjects ? assignment.getLeft() : assignment.getRight();
              Node parent=search(parentObject);
          if (parent != null){ // the new assignment has to be added
            Node child=null;
            if (objectEvent.getInfo()!=null && dataFactory instanceof Project ){
              //don't want a node shared by Projet and ResourcePool
View Full Code Here

      if (! (parent.getImpl() instanceof HasAssignments)) {
        continue; //TODO currently getting voidNodeImpl's.  This should go away when fixed
      }
      HasAssignments hasAssignments = (HasAssignments)parent.getImpl();
      for (j = hasAssignments.getAssignments().iterator();j.hasNext();) {
        Assignment assignment = (Assignment)j.next();
        if (assignment.isDefault()) continue;
        child = NodeFactory.getInstance().createNode(assignment);
        assignments.put(child,parent);
      }
    }
    boolean found;
View Full Code Here

    for (Iterator i=roots.iterator();i.hasNext();)
      hierarchy.visitLeaves((Node)i.next(), new Closure(){
        public void execute(Object o) {
          Node node=(Node)o;
          if (node.getImpl() instanceof Assignment){
            Assignment assignment=(Assignment)node.getImpl();
            Node parent=(Node)node.getParent();
            if (parent.getImpl() instanceof NormalTask){
              NormalTask task=(NormalTask)parent.getImpl();
              if (task.findAssignment(assignment.getResource())==null){
                freeAssignments.add(node);
              }
            }
          }
        }
View Full Code Here

    //Microsoft Project does something strange: The unassigned resource has a 0 id for the resource, but assignments use the (short)-1 value.
    if (mpx.getResourceUniqueID() == 0)
      xml.setResourceUID(BigInteger.valueOf(EnterpriseResource.UNASSIGNED_ID));

    Assignment projityAssignment = (Assignment) projityAssignmentMap.get(mpx);
    Calendar stop = DateTime.calendarInstance();
    stop.setTimeInMillis(projityAssignment.getStop());
    xml.setStop(stop);
    Calendar resume = DateTime.calendarInstance();
    resume.setTimeInMillis(projityAssignment.getResume());
    xml.setResume(resume);
    writeAssigmentBaselinesAndTimephased(xml, mpx);

    return (xml);
  }
View Full Code Here

TOP

Related Classes of com.projity.pm.assignment.Assignment

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.