Skip to content

Instantly share code, notes, and snippets.

@krizajb
Last active Mar 17, 2020
Embed
What would you like to do?
CPC business process bug
// note: all steps check if the logged in user is the CPC_AUTHORITY (Role)
// was the chief selected (via dialog)
if (null != this.selectedChief) {
// store selected chief id to the application
this.application.setChiefId(this.selectedChief.getId());
// remove chiefs if from the visited id list (so the chief sees the application as "new" in the list)
this.application.removeVisitedId(this.selectedChief.getId());
// is registrar only changing the chief selection
if (this.getChangeSelection()) {
// keep the status and record the change in application log with the (new) selected chief
this.changeApplicationStatus(this.application.getApplStatus(), this.selectedChief.getFullName());
}
// is application submitted and registrar is logged in
// OR
// is application draft and is the registrar an author of the application
// (author is the same if the author id matches with user id or if the authors BIN/INN
// match the applicants BIN/IN)
else if (this.isRegistrarPhase() || this.isEditableByRegistrar()) {
// skipping SUBMITTED application phase - going straight to the CHIEF_SELECTED phase
// validates the form && requests for nicad number before changing the application
// status
this.submit(ApplicationStatus.CHIEF_SELECTED, this.selectedChief.getFullName());
}
// else -- THIS IS TRIGGERED AND IT SHOULDN'T BE
else {
// change application to either TO_SIGN_APPROVED or TO_SIGN_REJECTED depending
// on the experts decision in the previous steps
ApplicationStatus status = ApplicationStatus.TO_SIGN_APPROVED;
if (this.isExpertRejected()) {
status = ApplicationStatus.TO_SIGN_REJECTED;
}
this.changeApplicationStatus(status, this.selectedChief.getFullName());
}
}
// if chief was not selected the action is not completed
else {
String msg = String.format("Unable to set application status '%s', Chief is not selected.",
ApplicationStatus.CHIEF_SELECTED.name());
logger.log(Logger.Level.ERROR, msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment