예제 #1
0
 private boolean isPlannedStartTimeExceeded(
     ProcessProgressModel model, ProcessProgressInstance instance) {
   if (instance == null) {
     return model.getPlannedStartTime().before(new Date(this.now));
   } else {
     return model.getPlannedStartTime().before(instance.getStartTime());
   }
 }
예제 #2
0
 private boolean isPlannedTerminationTimeExceeded(
     ProcessProgressModel model, ProcessProgressInstance instance) {
   if (instance == null) {
     return model.getPlannedTerminationTime().before(new Date(this.now));
   } else {
     return instance.getTerminationTime() != null
         ? model.getPlannedTerminationTime().before(instance.getTerminationTime())
         : model.getPlannedTerminationTime().before(new Date(this.now));
   }
 }
예제 #3
0
  private boolean isProcessRunningLate(
      ProcessProgressModel model, ProcessProgressInstance instance) {
    boolean runningLate = false;

    long start = instance != null ? instance.getStartTime().getTime() : this.now;
    long end = model.getPlannedTerminationTime().getTime();

    if ((start + model.getEstimatedDuration()) > end) {
      runningLate = true;
    }

    long currentDuration = instance != null ? instance.getDuration() : 0;

    if (currentDuration > model.getEstimatedDuration()) {
      runningLate = true;
    }

    return runningLate;
  }
예제 #4
0
  private void calculateStatus(
      ProcessProgressModel model, ProcessProgressInstance instance, ModelTreeItem predecessor) {

    if (instance != null) {
      logger.info("Calculate progress status for instance with id : " + model.getId());
    }

    this.status = "scheduled";
    this.color = "scheduled";

    // running
    if (instance != null) {
      this.status = "running";
      this.color = "running";
    }

    if (model.getPlannedTerminationTime() != null) {
      // running late
      if (this.isProcessRunningLate(model, instance)) {
        this.status = "running late";
        this.color = "runningLate";
      }

      // running critical
      if (this.isProcessRunningCritical(model, instance)) {
        this.status = "running critical";
        this.color = "runningCritical";
      }
    }

    if (instance != null && instance.getTerminationTime() != null) {
      this.color = this.color + "Completed";
    }

    this.color = this.color + "Color";

    if (predecessor != null && predecessor.getProgressStatus() != null) {
      this.status = predecessor.getProgressStatus().getStatus();
      this.color = predecessor.getProgressStatus().getColor();
    }
  }
예제 #5
0
  private boolean isProcessRunningCritical(
      ProcessProgressModel model, ProcessProgressInstance instance) {

    boolean runningCritcal = false;

    long start = instance != null ? instance.getStartTime().getTime() : this.now;
    long end = model.getPlannedTerminationTime().getTime();

    if (start > end) {
      runningCritcal = true;
    }

    long currentDuration = instance != null ? instance.getDuration() : 0;
    long durationThreshold = model.getEstimatedDuration() / 100;
    durationThreshold = durationThreshold * (100 + model.getThresholdInPercentage());

    if (currentDuration > durationThreshold) {
      runningCritcal = true;
    }

    return runningCritcal;
  }
예제 #6
0
  public void calculateDiagramBars() {
    long startTime = instance != null ? instance.getStartTime().getTime() : 0;

    // calculate status and color
    this.calculateStatus(model, instance, predecessor);

    if (model.getPlannedStartTime() != null && model.getPlannedTerminationTime() != null) {
      // calculate barWidth
      this.calculateBarWidth(model.getPlannedStartTime(), model.getPlannedTerminationTime());

      // calculate barLeft
      this.calculateBarLeft(model.getPlannedStartTime(), startingPoint);
    }

    // calculate progressLeft
    this.calculateProgressLeft(startTime, startingPoint);

    // calculate progressWidth
    Calendar calculatedStartDate = timeUnit.calculateStartDate(startingPoint);
    this.progressWidth = 0;
    long duration = instance != null ? instance.getDuration() : 0;
    if (instance != null) {
      if (instance.getTerminationTime() != null) {
        this.progressWidth =
            new BigDecimal(new Long(duration).doubleValue())
                .divide(new BigDecimal(1000), BigDecimal.ROUND_HALF_UP)
                .divide(new BigDecimal(60), BigDecimal.ROUND_HALF_UP)
                .intValue();
      } else {
        BigDecimal nowBD =
            new BigDecimal(
                new Long(timeProvider.getCurrentTime() - calculatedStartDate.getTimeInMillis())
                    .doubleValue());
        double nowInTimeUnit =
            nowBD
                .divide(new BigDecimal(1000), 1, BigDecimal.ROUND_HALF_UP)
                .divide(new BigDecimal(60), 1, BigDecimal.ROUND_HALF_UP)
                .doubleValue();
        this.progressWidth = timeUnit.calculateSize(nowInTimeUnit) - getProgressLeft();
      }
    }

    if (model.getEstimatedDuration() != 0) {
      // calculate progress
      this.calculateProgress(duration, model.getEstimatedDuration());
      progressCalculated = true;
    }

    this.calculateIconStatus(instance);

    // calculate durationWidth
    this.durationWidth = new Long(model.getEstimatedDuration()).intValue() / 1000 / 60;

    if (model.getSuccessorId() != null && !"".equals(model.getSuccessorId())) {
      this.dependencyHeight = 0;
      //         this.dependencyWidth = 1;
    }

    // completed process instance
    if (instance != null && instance.getTerminationTime() != null) {
      this.completed = "background-color: #EEEFF7;";
      // this.durationWidth = 0;
      // this.barWidth = 0;
      // this.progressColor = this.color;
    }
  }