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);
      }
    }
  }
 protected void readStateFromResultSet(
     java.sql.ResultSet rs,
     pt.ist.fenixframework.backend.jvstmojb.pstm.OneBoxDomainObject.DO_State state)
     throws java.sql.SQLException {
   super.readStateFromResultSet(rs, state);
   DO_State castedState = (DO_State) state;
   set$type(
       pt.ist.fenixframework.backend.jvstmojb.repository.ResultSetReader.readEnum(
           org.fenixedu.academic.domain.phd.seminar.PublicPresentationSeminarProcessStateType
               .class,
           rs,
           "TYPE"),
       state);
   castedState.process =
       pt.ist.fenixframework.backend.jvstmojb.repository.ResultSetReader.readDomainObject(
           rs, "OID_PROCESS");
 }
 @Override
 protected void init$Instance(boolean allocateOnly) {
   super.init$Instance(allocateOnly);
 }
 protected void create$allLists() {
   super.create$allLists();
 }
 protected void checkDisconnected() {
   super.checkDisconnected();
   DO_State castedState = (DO_State) this.get$obj$state(false);
   if (castedState.process != null) handleAttemptToDeleteConnectedObject("Process");
 }
 @Override
 public int compare(PhdProcessState o1, PhdProcessState o2) {
   int result = o1.getStateDate().compareTo(o2.getStateDate());
   return result != 0 ? result : o1.getExternalId().compareTo(o2.getExternalId());
 }