use of org.kuali.kfs.kew.api.exception.WorkflowException in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method autoApproveDisbursementVouchersSpawnedByRecurringDvs.
@Override
public boolean autoApproveDisbursementVouchersSpawnedByRecurringDvs() {
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: Entered.");
int approvalCount = 0;
int errorCount = 0;
List<String> dvDocIdsCausingError = new ArrayList<String>();
Collection<String> dvDocIds = getRecurringDisbursementVoucherSearchDao().findSavedDvIdsSpawnedByRecurringDvForCurrentAndPastFiscalPeriods(getCurrentFiscalPeriodEndDate());
if (ObjectUtils.isNotNull(dvDocIds) && !(dvDocIds.isEmpty())) {
for (String dvDocId : dvDocIds) {
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: Processing start for DV ID:: " + dvDocId);
CuDisbursementVoucherDocument dv = null;
try {
dv = getDisbursementVoucher(dvDocId);
} catch (WorkflowException e) {
dvDocIdsCausingError.add(new String("DocId=" + dvDocId));
errorCount++;
}
if (ObjectUtils.isNotNull(dv)) {
if (isKfsSystemUserDvInitiator(dv)) {
try {
addNoteToAutoApproveDv(dv, "Batch job Submit and Blanket Approve performed for DV spawned by Recurring DV.");
try {
blanketApproveDisbursementVoucherDocument(dv);
approvalCount++;
} catch (WorkflowException e) {
dvDocIdsCausingError.add(new String("DocId=" + dvDocId));
errorCount++;
}
} catch (WorkflowException e) {
dvDocIdsCausingError.add(new String("DocId=" + dvDocId));
errorCount++;
}
} else {
LOG.error("autoApproveDisbursementVouchersSpawnedByRecurringDvs: Detected document initiator was not KFS System user. Auto blanket approval was NOT attemtped for document ID: " + dv.getDocumentNumber());
dvDocIdsCausingError.add(new String("DocId=" + dvDocId));
errorCount++;
}
}
}
} else {
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: No DV's spwned by Recurring DV found. Nothing will be auto approved. ");
}
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: **************** Batch Job Processing Results ****************");
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: Number of Disbursement Vouchers that generated Errors:: " + errorCount);
for (Iterator iterator = dvDocIdsCausingError.iterator(); iterator.hasNext(); ) {
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: Erroring " + (String) iterator.next());
}
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: Number of Disbursement Vouchers successfuly Blanket Approved (fully processed):: " + approvalCount);
LOG.info("autoApproveDisbursementVouchersSpawnedByRecurringDvs: Leaving.");
return errorCount == 0;
}
use of org.kuali.kfs.kew.api.exception.WorkflowException in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method saveDisbursementVouchers.
private void saveDisbursementVouchers(List<DisbursementVoucherDocument> dvs, RecurringDisbursementVoucherDocument recurringDV) {
for (DisbursementVoucherDocument dv : dvs) {
try {
dv.getDocumentHeader().setDocumentDescription(recurringDV.getDocumentHeader().getDocumentDescription());
dv.getDocumentHeader().setExplanation(buildDVExplanation(recurringDV));
getDocumentService().saveDocument(dv);
getBusinessObjectService().save(recurringDV.getRecurringDisbursementVoucherDetails());
updateGLPEDatesAndAddRecurringDocumentLinks(dv, recurringDV.getDocumentNumber());
} catch (WorkflowException e) {
;
LOG.error("saveDisbursementVouchers: There was an error trying to save our route the created Disbursement Voucher documents: ", e);
throw new RuntimeException(e);
}
}
}
use of org.kuali.kfs.kew.api.exception.WorkflowException in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method findPdpStatuses.
@Override
public List<RecurringDisbursementVoucherPDPStatus> findPdpStatuses(RecurringDisbursementVoucherDocument recurringDV) {
List<RecurringDisbursementVoucherPDPStatus> pdpStatuses = new ArrayList<RecurringDisbursementVoucherPDPStatus>();
for (RecurringDisbursementVoucherDetail detail : recurringDV.getRecurringDisbursementVoucherDetails()) {
if (StringUtils.isNotEmpty(detail.getDvDocumentNumber())) {
DisbursementVoucherDocument disbursementVoucherDocument;
try {
disbursementVoucherDocument = (DisbursementVoucherDocument) getDocumentService().getByDocumentHeaderId(detail.getDvDocumentNumber());
} catch (WorkflowException e) {
LOG.error("findPdpStatuses: There was a problem getting DV from the recurring DV detail: " + e);
throw new RuntimeException(e);
}
pdpStatuses.add(buildRecurringDisbursementVoucherPDPStatus(disbursementVoucherDocument));
}
}
Collections.sort(pdpStatuses);
return pdpStatuses;
}
use of org.kuali.kfs.kew.api.exception.WorkflowException in project cu-kfs by CU-CommunityApps.
the class SecurityRequestDerivedRoleTypeServiceImpl method getRoleMembersFromDerivedRole.
@Override
public List<RoleMembership> getRoleMembersFromDerivedRole(String namespaceCode, String roleName, Map<String, String> qualification) {
final List<RoleMembership> members = new ArrayList<RoleMembership>();
LOG.info("getRoleMembersFromDerivedRole() Generating role membership for role: " + roleName + " with qualification " + qualification);
String documentNumber = qualification.get(AttributeConstants.DOCUMENT_NUMBER);
SecurityRequestDocument document = null;
try {
document = (SecurityRequestDocument) KRADServiceLocatorWeb.getDocumentService().getByDocumentHeaderId(documentNumber);
} catch (WorkflowException e) {
LOG.error("getRoleMembersFromDerivedRole() Unable to retrieve security request document: " + documentNumber, e);
throw new RuntimeException("Unable to retrieve security request document: " + documentNumber, e);
}
for (final SecurityRequestRole requestRole : document.getSecurityRequestRoles()) {
members.addAll(getRoleMembersFromDerivedRole(roleName, document, requestRole));
}
LOG.info("getRoleMembersFromDerivedRole() Returning " + members.size() + " members");
return members;
}
use of org.kuali.kfs.kew.api.exception.WorkflowException in project cu-kfs by CU-CommunityApps.
the class CuRequisitionDocument method getRoutedByPrincipalId.
public String getRoutedByPrincipalId() {
DocumentService documentService = SpringContext.getBean(DocumentService.class);
RequisitionDocument document = null;
String principalId = null;
try {
document = (RequisitionDocument) documentService.getByDocumentHeaderId(this.getDocumentNumber());
principalId = document.getDocumentHeader().getWorkflowDocument().getRoutedByPrincipalId();
} catch (WorkflowException we) {
}
return principalId;
}
Aggregations