use of edu.cornell.kfs.coa.businessobject.AccountReversionDetail in project cu-kfs by CU-CommunityApps.
the class AccountReversionRule method validateDetailBusinessObjects.
/**
* Tests each option attached to the main business object and validates its properties.
*
* @param orgReversion
* @return false if any of the detail objects fail with their validation
*/
protected boolean validateDetailBusinessObjects(AccountReversion orgReversion) {
GlobalVariables.getMessageMap().addToErrorPath("document.newMaintainableObject");
List<AccountReversionDetail> details = orgReversion.getAccountReversionDetails();
int index = 0;
int originalErrorCount = GlobalVariables.getMessageMap().getErrorCount();
for (AccountReversionDetail dtl : details) {
String errorPath = "accountReversionDetails[" + index + "]";
GlobalVariables.getMessageMap().addToErrorPath(errorPath);
validateAccountReversionDetail(dtl);
GlobalVariables.getMessageMap().removeFromErrorPath(errorPath);
index++;
}
GlobalVariables.getMessageMap().removeFromErrorPath("document.newMaintainableObject");
return GlobalVariables.getMessageMap().getErrorCount() == originalErrorCount;
}
use of edu.cornell.kfs.coa.businessobject.AccountReversionDetail in project cu-kfs by CU-CommunityApps.
the class AccountReversionDetailTrickleDownInactivationServiceImpl method trickleDownActivations.
/**
* The method which actually does the work of activating the details
* @param organizationReversionDetails the details to inactivate
* @param documentNumber the document number which has the inactivations as part of it
* @return an inactivation status object which will help us save notes
*/
protected void trickleDownActivations(List<AccountReversionDetail> accountReversionDetails, String documentNumber) {
TrickleDownStatus status = new TrickleDownStatus(CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_ACTIVATION, CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_ACTIVATION_ERROR_DURING_PERSISTENCE);
if (!ObjectUtils.isNull(accountReversionDetails) && !accountReversionDetails.isEmpty()) {
for (AccountReversionDetail detail : accountReversionDetails) {
if (!detail.isActive() && allowActivation(detail)) {
detail.setActive(true);
try {
businessObjectService.save(detail);
status.addAccountReversionDetail(detail);
} catch (RuntimeException re) {
LOG.error("Unable to trickle-down inactivate sub-account " + detail.toString(), re);
status.addErrorPersistingAccountReversionDetail(detail);
}
}
}
}
status.saveSuccesfullyChangedNotes(documentNumber);
status.saveErrorNotes(documentNumber);
}
use of edu.cornell.kfs.coa.businessobject.AccountReversionDetail in project cu-kfs by CU-CommunityApps.
the class AccountReversionDetailTrickleDownInactivationServiceImpl method trickleDownInactivations.
/**
* The method which actually does the work of inactivating the details
* @param organizationReversionDetails the details to inactivate
* @param documentNumber the document number which has the inactivations as part of it
* @return an inactivation status object which will help us save notes
*/
protected void trickleDownInactivations(List<AccountReversionDetail> accountReversionDetails, String documentNumber) {
TrickleDownStatus status = new TrickleDownStatus(CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_INACTIVATION, CUKFSKeyConstants.ACCOUNT_REVERSION_DETAIL_TRICKLE_DOWN_INACTIVATION_ERROR_DURING_PERSISTENCE);
if (!ObjectUtils.isNull(accountReversionDetails) && !accountReversionDetails.isEmpty()) {
for (AccountReversionDetail detail : accountReversionDetails) {
if (detail.isActive()) {
detail.setActive(false);
try {
businessObjectService.save(detail);
status.addAccountReversionDetail(detail);
} catch (RuntimeException re) {
LOG.error("Unable to trickle-down inactivate sub-account " + detail.toString(), re);
status.addErrorPersistingAccountReversionDetail(detail);
}
}
}
}
status.saveSuccesfullyChangedNotes(documentNumber);
status.saveErrorNotes(documentNumber);
}
use of edu.cornell.kfs.coa.businessobject.AccountReversionDetail in project cu-kfs by CU-CommunityApps.
the class AccountReversionDetailTrickleDownInactivationServiceImpl method trickleDownInactiveAccountReversionDetails.
/**
* @see org.kuali.kfs.coa.service.OrganizationReversionDetailTrickleDownInactivationService#trickleDownInactiveAccountReversionDetails(org.kuali.kfs.coa.businessobject.ReversionCategory, java.lang.String)
*/
public void trickleDownInactiveAccountReversionDetails(ReversionCategory reversionCategory, String documentNumber) {
Map<String, Object> fieldValues = new HashMap<String, Object>();
fieldValues.put("reversionCategoryCode", reversionCategory.getReversionCategoryCode());
Collection acctReversionDetails = businessObjectService.findMatching(AccountReversionDetail.class, fieldValues);
List<AccountReversionDetail> accountReversionDetailList = new ArrayList<AccountReversionDetail>();
for (Object acctRevDetailAsObject : acctReversionDetails) {
accountReversionDetailList.add((AccountReversionDetail) acctRevDetailAsObject);
}
trickleDownInactivations(accountReversionDetailList, documentNumber);
}
Aggregations