/** * this needs to happen after the document itself is saved, to preserve consistency of the ver_nbr and in the case * of initial save, because this can't be saved until the document is saved initially * * @see org.kuali.rice.krad.document.DocumentBase#postProcessSave(org.kuali.rice.krad.rules.rule.event.DocumentEvent) */ @Override public void postProcessSave(DocumentEvent event) { Object bo = getNewMaintainableObject().getDataObject(); if (bo instanceof GlobalBusinessObject) { bo = KRADServiceLocatorWeb.getLegacyDataAdapter().save(bo); // KRAD/JPA - have to change the handle to object to that just saved getNewMaintainableObject().setDataObject(bo); } //currently only global documents could change the list of what they're affecting during routing, //so could restrict this to only happening with them, but who knows if that will change, so safest //to always do the delete and re-add...seems a bit inefficient though if nothing has changed, which is //most of the time...could also try to only add/update/delete what's changed, but this is easier if (!(event instanceof SaveDocumentEvent)) { //don't lock until they route getMaintenanceDocumentService().deleteLocks(MaintenanceDocumentBase.this.getDocumentNumber()); getMaintenanceDocumentService().storeLocks(MaintenanceDocumentBase.this.getNewMaintainableObject().generateMaintenanceLocks()); } }
@Override public void submitToWorkflow(LeavePayout leavePayout) throws WorkflowException { //leavePayout.setStatus(HrConstants.ROUTE_STATUS.ENROUTE); /*MaintenanceDocument document = KRADServiceLocatorWeb.getMaintenanceDocumentService().setupNewMaintenanceDocument(LeavePayout.class.getName(), "LeavePayoutDocumentType",KRADConstants.MAINTENANCE_NEW_ACTION);*/ MaintenanceDocument document = (MaintenanceDocument) KRADServiceLocatorWeb.getDocumentService().getNewDocument("LeavePayoutDocumentType"); document.getDocumentHeader().setDocumentDescription(TKUtils.getDocumentDescription(leavePayout.getPrincipalId(), leavePayout.getEffectiveLocalDate())); Map<String,String[]> params = new HashMap<String,String[]>(); KRADServiceLocatorWeb.getMaintenanceDocumentService().setupMaintenanceObject(document, KRADConstants.MAINTENANCE_NEW_ACTION, params); LeavePayout lpObj = (LeavePayout) document.getNewMaintainableObject().getDataObject(); lpObj.setAccrualCategoryRule(leavePayout.getAccrualCategoryRule()); lpObj.setEffectiveDate(leavePayout.getEffectiveDate()); lpObj.setLeaveCalendarDocumentId(leavePayout.getLeaveCalendarDocumentId()); lpObj.setForfeitedAmount(leavePayout.getForfeitedAmount()); lpObj.setFromAccrualCategory(leavePayout.getFromAccrualCategory()); lpObj.setPrincipalId(leavePayout.getPrincipalId()); lpObj.setEarnCode(leavePayout.getEarnCode()); lpObj.setPayoutAmount(leavePayout.getPayoutAmount()); lpObj.setDocumentHeaderId(document.getDocumentHeader().getWorkflowDocument().getDocumentId()); //document.getNewMaintainableObject().setDataObject(lpObj); KRADServiceLocatorWeb.getDocumentService().saveDocument(document); document.getDocumentHeader().getWorkflowDocument().saveDocument(""); document.getDocumentHeader().getWorkflowDocument().route(""); }
Map<String,String[]> params = new HashMap<String,String[]>(); KRADServiceLocatorWeb.getMaintenanceDocumentService().setupMaintenanceObject(document, KRADConstants.MAINTENANCE_NEW_ACTION, params); BalanceTransfer btObj = (BalanceTransfer) document.getNewMaintainableObject().getDataObject();