public boolean isAuthorized(String userId, ProposalTask task) { KraDocumentRejectionService documentRejectionService = KraServiceLocator.getService(KraDocumentRejectionService.class); ProposalDevelopmentDocument doc = task.getDocument(); boolean rejectedDocument = documentRejectionService.isDocumentOnInitialNode(doc.getDocumentNumber()); boolean hasPermission = false; if ((!kraWorkflowService.isInWorkflow(doc) || rejectedDocument) && !doc.isViewOnly() && !doc.getDevelopmentProposal().getSubmitFlag()) { hasPermission = hasProposalPermission(userId, doc, PermissionConstants.MODIFY_NARRATIVE); } return hasPermission; }
/** * Added method to detect when the document is being approved from the initial node. In this case * the document is actually being re-submitted after a rejection. The award budget status then * changes back to In Progress. * * @see * org.kuali.rice.kns.document.DocumentBase#doActionTaken(org.kuali.rice.kew.dto.ActionTakenEventDTO) */ public void doActionTaken(ActionTakenEventDTO event) { super.doActionTaken(event); ActionTakenDTO actionTaken = event.getActionTaken(); KraDocumentRejectionService documentRejectionService = KraServiceLocator.getService(KraDocumentRejectionService.class); if (LOG.isDebugEnabled()) { LOG.debug( String.format( "Action taken on document %s: event code %s, action taken is %s", getDocumentNumber(), event.getDocumentEventCode(), actionTaken.getActionTaken())); } if (StringUtils.equals(KEWConstants.ACTION_TAKEN_APPROVED_CD, actionTaken.getActionTaken()) && documentRejectionService.isDocumentOnInitialNode(this)) { // the document is being approved from the initial node. // this means it was rejected and is now being approved by the initiator. // set the status back to in progress getAwardBudget().setAwardBudgetStatusCode(Constants.BUDGET_STATUS_CODE_IN_PROGRESS); try { KraServiceLocator.getService(DocumentService.class).saveDocument(this); } catch (WorkflowException e) { throw new RuntimeException("Could not save award document on action taken."); } } }