コード例 #1
0
  private void checkStateDate(DateTime stateDate, final PhdProcessStateType type) {
    Collection<? extends PhdProcessState> orderedStates = getProcess().getOrderedStates();

    for (PhdProcessState phdProcessState : orderedStates) {
      if (phdProcessState == this) {
        continue;
      }

      if (phdProcessState.getStateDate() != null
          && phdProcessState.getStateDate().isAfter(stateDate)) {
        String newStateDate = stateDate.toString("dd/MM/yyyy") + " - " + type.getLocalizedName();
        String actualStateDate =
            phdProcessState.getStateDate().toString("dd/MM/yyyy")
                + " - "
                + phdProcessState.getType().getLocalizedName();

        throw new PhdDomainOperationException(
            "error.PhdProcessState.state.date.is.previous.of.actual.state.on.process",
            newStateDate,
            actualStateDate);
      }
    }
  }
コード例 #2
0
 @Override
 public int compare(PhdProcessState o1, PhdProcessState o2) {
   int result = o1.getStateDate().compareTo(o2.getStateDate());
   return result != 0 ? result : o1.getExternalId().compareTo(o2.getExternalId());
 }