use of org.kuali.kfs.module.purap.service.PurapAccountingService in project cu-kfs by CU-CommunityApps.
the class PurchasingAccountsPayableDocumentBase method getPersistedSourceAccountingLinesForComparison.
/**
* Accounting lines that are read-only should skip validation
*
* @see org.kuali.kfs.sys.document.AccountingDocumentBase#getPersistedSourceAccountingLinesForComparison()
*/
@SuppressWarnings("rawtypes")
@Override
protected List getPersistedSourceAccountingLinesForComparison() {
LOG.info("Checking persisted source accounting lines for read-only fields");
List<String> restrictedItemTypesList = new ArrayList<String>();
try {
restrictedItemTypesList = new ArrayList<String>(SpringContext.getBean(ParameterService.class).getParameterValuesAsString(this.getClass(), PurapParameterConstants.PURAP_ITEM_TYPES_RESTRICTING_ACCOUNT_EDIT));
} catch (IllegalArgumentException iae) {
// do nothing, not a problem if no restricted types are defined
}
PurapAccountingService purApAccountingService = SpringContext.getBean(PurapAccountingService.class);
List persistedSourceLines = new ArrayList();
for (PurApItem item : (List<PurApItem>) this.getItems()) {
// only check items that already have been persisted since last save
if (ObjectUtils.isNotNull(item.getItemIdentifier())) {
// Disable validation if the item is read-only
final boolean isNotReadOnly = !((restrictedItemTypesList != null) && restrictedItemTypesList.contains(item.getItemTypeCode()));
if (isNotReadOnly) {
persistedSourceLines.addAll(purApAccountingService.getAccountsFromItem(item));
}
}
}
return persistedSourceLines;
}
use of org.kuali.kfs.module.purap.service.PurapAccountingService in project cu-kfs by CU-CommunityApps.
the class PurchasingAccountsPayableDocumentBase method getSourceAccountingLinesForComparison.
/**
* Accounting lines that are read-only should skip validation
*
* @see org.kuali.kfs.sys.document.AccountingDocumentBase#getSourceAccountingLinesForComparison()
*/
@SuppressWarnings("rawtypes")
@Override
protected List getSourceAccountingLinesForComparison() {
LOG.info("Checking source accounting lines for read-only fields");
List<String> restrictedItemTypesList = new ArrayList<String>();
try {
restrictedItemTypesList = new ArrayList<String>(SpringContext.getBean(ParameterService.class).getParameterValuesAsString(this.getClass(), PurapParameterConstants.PURAP_ITEM_TYPES_RESTRICTING_ACCOUNT_EDIT));
} catch (IllegalArgumentException iae) {
// do nothing, not a problem if no restricted types are defined
}
PurapAccountingService purApAccountingService = SpringContext.getBean(PurapAccountingService.class);
List currentSourceLines = new ArrayList();
for (PurApItem item : (List<PurApItem>) this.getItems()) {
// Disable validation if the item is read-only
final boolean isNotReadOnly = !((restrictedItemTypesList != null) && restrictedItemTypesList.contains(item.getItemTypeCode()));
if (isNotReadOnly) {
currentSourceLines.addAll(item.getSourceAccountingLines());
}
}
return currentSourceLines;
}
Aggregations