use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.
the class PurchasingDocumentBase method deleteItem.
/**
* @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocument#deleteItem(int lineNum)
*/
@Override
public void deleteItem(int lineNum) {
// remove associated asset items
PurApItem item = items.get(lineNum);
if (ObjectUtils.isNotNull(item) && item.getItemIdentifier() != null) {
PurchasingCapitalAssetItem purchasingCapitalAssetItem = getPurchasingCapitalAssetItemByItemIdentifier(item.getItemIdentifier());
if (ObjectUtils.isNotNull(purchasingCapitalAssetItem)) {
getPurchasingCapitalAssetItems().remove(purchasingCapitalAssetItem);
}
// no more capital asset items, clear cap asset fields
if (getPurchasingCapitalAssetItems().size() == 0) {
clearCapitalAssetFields();
}
}
super.deleteItem(lineNum);
}
use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.
the class PurchasingDocumentBase method buildListOfDeletionAwareLists.
/**
* @see org.kuali.kfs.module.purap.document.PurchasingAccountsPayableDocumentBase#buildListOfDeletionAwareLists()
*/
@Override
public List buildListOfDeletionAwareLists() {
List managedLists = new ArrayList<List>();
managedLists.add(getDeletionAwareAccountingLines());
managedLists.add(getDeletionAwareUseTaxItems());
if (allowDeleteAwareCollection) {
List<ItemCapitalAsset> assetLists = new ArrayList<ItemCapitalAsset>();
if (StringUtils.equals(this.getCapitalAssetSystemTypeCode(), PurapConstants.CapitalAssetSystemTypes.INDIVIDUAL)) {
for (PurchasingCapitalAssetItem capitalAssetItem : this.getPurchasingCapitalAssetItems()) {
// just let the assetLists be empty ArrayList.
if (capitalAssetItem.getPurchasingCapitalAssetSystem() != null) {
assetLists.addAll(capitalAssetItem.getPurchasingCapitalAssetSystem().getItemCapitalAssets());
}
}
} else {
for (CapitalAssetSystem system : this.getPurchasingCapitalAssetSystems()) {
assetLists.addAll(system.getItemCapitalAssets());
}
}
managedLists.add(assetLists);
managedLists.add(this.getPurchasingCapitalAssetSystems());
managedLists.add(this.getPurchasingCapitalAssetItems());
managedLists.add(this.getItems());
}
return managedLists;
}
use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method deleteItemCapitalAssetByItem.
public ActionForward deleteItemCapitalAssetByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase purchasingForm = (PurchasingFormBase) form;
PurchasingDocument purDocument = (PurchasingDocument) purchasingForm.getDocument();
// get specific asset item
PurchasingCapitalAssetItem assetItem = purDocument.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
ItemCapitalAsset asset = assetItem.getNewPurchasingItemCapitalAssetLine();
boolean rulePassed = true;
if (rulePassed) {
String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
String assetIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
PurchasingCapitalAssetSystemBase system = (PurchasingCapitalAssetSystemBase) assetItem.getPurchasingCapitalAssetSystem();
system.getItemCapitalAssets().remove(Integer.parseInt(assetIndex));
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method clearNotCurrentYearByItem.
public ActionForward clearNotCurrentYearByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingAccountsPayableFormBase purchasingForm = (PurchasingAccountsPayableFormBase) form;
PurchasingDocument document = (PurchasingDocument) purchasingForm.getDocument();
PurchasingCapitalAssetItem assetItem = document.getPurchasingCapitalAssetItems().get(getSelectedLine(request));
CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
if (system != null) {
system.setCapitalAssetNotReceivedCurrentFiscalYearIndicator(false);
system.setCapitalAssetTypeCode("");
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
use of org.kuali.kfs.module.purap.businessobject.PurchasingCapitalAssetItem in project cu-kfs by CU-CommunityApps.
the class PurchasingActionBase method useOffCampusAssetLocationBuildingByItem.
public ActionForward useOffCampusAssetLocationBuildingByItem(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
PurchasingFormBase baseForm = (PurchasingFormBase) form;
PurchasingDocument document = (PurchasingDocument) baseForm.getDocument();
String fullParameter = (String) request.getAttribute(KFSConstants.METHOD_TO_CALL_ATTRIBUTE);
String assetItemIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL);
String assetLocationIndex = StringUtils.substringBetween(fullParameter, KFSConstants.METHOD_TO_CALL_PARM2_LEFT_DEL, KFSConstants.METHOD_TO_CALL_PARM2_RIGHT_DEL);
PurchasingCapitalAssetItem assetItem = document.getPurchasingCapitalAssetItems().get(Integer.parseInt(assetItemIndex));
CapitalAssetSystem system = assetItem.getPurchasingCapitalAssetSystem();
if ("new".equals(assetLocationIndex)) {
useOffCampusAssetLocationBuilding(system.getNewPurchasingCapitalAssetLocationLine());
} else {
useOffCampusAssetLocationBuilding(system.getCapitalAssetLocations().get(Integer.parseInt(assetLocationIndex)));
}
return mapping.findForward(KFSConstants.MAPPING_BASIC);
}
Aggregations