BrightSide Workbench Full Report + Source Code
org.turro.erp.task.TaskStatusWrapper Class Reference
Inheritance diagram for org.turro.erp.task.TaskStatusWrapper:
Collaboration diagram for org.turro.erp.task.TaskStatusWrapper:

Public Member Functions

 TaskStatusWrapper (Task task, Date now)
 
boolean canChangeTo (TaskStatus newStatus)
 

Protected Member Functions

TaskStatus doCheckStatus (Date now)
 
TaskStatus doChangeTo (TaskStatus newStatus)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 30 of file TaskStatusWrapper.java.

Constructor & Destructor Documentation

◆ TaskStatusWrapper()

org.turro.erp.task.TaskStatusWrapper.TaskStatusWrapper ( Task  task,
Date  now 
)

Definition at line 34 of file TaskStatusWrapper.java.

34  {
35  super(task.getStatus());
36  this.task = task;
37  checkStatus(now);
38  }
Here is the call graph for this function:

Member Function Documentation

◆ canChangeTo()

boolean org.turro.erp.task.TaskStatusWrapper.canChangeTo ( TaskStatus  newStatus)

Definition at line 93 of file TaskStatusWrapper.java.

Here is the call graph for this function:

◆ doChangeTo()

TaskStatus org.turro.erp.task.TaskStatusWrapper.doChangeTo ( TaskStatus  newStatus)
protected

Definition at line 87 of file TaskStatusWrapper.java.

87  {
88  task.setStatus(newStatus);
89  return newStatus;
90  }
Here is the call graph for this function:

◆ doCheckStatus()

TaskStatus org.turro.erp.task.TaskStatusWrapper.doCheckStatus ( Date  now)
protected

Definition at line 41 of file TaskStatusWrapper.java.

41  {
42  TaskStatus status = current;
43  boolean waiting = task.isWaiting();
44  if(TaskStatus.isReady(status)) {
45  for(RequiredUsage ru : task.getRequiredUsages()) {
46  if(ru.getStatus().hasMovement()) {
47  status = TaskStatus.TASK_ONWORK;
48  }
49  }
50  if(TaskStatus.isReady(status)) {
51  if(task.getStartDate() != null && task.getStartDate().after(now)) {
52  waiting = true;
53  } else {
54  waiting = false;
55  for(Predecessor p : task.getPredecessors()) {
56  Task tp = p.getPredecessor();
57  tp.checkStatus(now);
58  if(p.getType().equals(PredecessorType.START_WHEN_STARTS) && !TaskStatus.hasStarted(tp.getStatus())) {
59  waiting = true;
60  break;
61  } else if(p.getType().equals(PredecessorType.START_WHEN_ENDS) && !TaskStatus.isFinished(tp.getStatus())) {
62  waiting = true;
63  break;
64  }
65  }
66  }
67  }
68  }
69  if(TaskStatus.isOnWork(status) && !task.getRequiredUsages().isEmpty()) {
70  boolean isFinished = true;
71  for(RequiredUsage pu : task.getRequiredUsages()) {
72  if(pu.isHumanResourceType() ||
73  (pu.isProductType() && !pu.getStatus().equals(UsageStatus.USAGE_RECEIVED))) {
74  isFinished = false;
75  break;
76  }
77  }
78  if(isFinished) {
79  status = TaskStatus.TASK_FINISHED;
80  }
81  }
82  task.setWaiting(waiting);
83  return status;
84  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: