001/*
002 * Copyright 2008 The Kuali Foundation
003 * 
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 * http://www.opensource.org/licenses/ecl2.php
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.module.purap.businessobject;
017
018import org.kuali.ole.integration.purap.ItemCapitalAsset;
019import org.kuali.ole.module.purap.document.PurchaseOrderDocument;
020import org.kuali.ole.module.purap.document.PurchasingDocument;
021import org.kuali.rice.krad.util.ObjectUtils;
022
023import java.util.LinkedHashMap;
024
025public class PurchaseOrderCapitalAssetItem extends PurchasingCapitalAssetItemBase {
026
027    private String documentNumber;
028
029    public PurchaseOrderCapitalAssetItem() {
030        super();
031    }
032
033    public PurchaseOrderCapitalAssetItem(RequisitionCapitalAssetItem reqAssetItem, Integer itemIdentifier) {
034        this.setItemIdentifier(itemIdentifier);
035        this.setCapitalAssetTransactionTypeCode(reqAssetItem.getCapitalAssetTransactionTypeCode());
036        if (ObjectUtils.isNotNull(reqAssetItem.getPurchasingCapitalAssetSystem())) {
037            this.setPurchasingCapitalAssetSystem(new PurchaseOrderCapitalAssetSystem((RequisitionCapitalAssetSystem) reqAssetItem.getPurchasingCapitalAssetSystem()));
038        }
039    }
040
041    public String getDocumentNumber() {
042        return documentNumber;
043    }
044
045    public void setDocumentNumber(String documentNumber) {
046        this.documentNumber = documentNumber;
047    }
048
049
050    public void setPurchasingDocument(PurchasingDocument pd) {
051        super.setPurchasingDocument(pd);
052
053        PurchaseOrderDocument po = (PurchaseOrderDocument) pd;
054        if (po != null) {
055            setDocumentNumber(po.getDocumentNumber());
056        }
057    }
058
059    @Override
060    protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
061        LinkedHashMap m = new LinkedHashMap();
062        if (this.getCapitalAssetItemIdentifier() != null) {
063            m.put("capitalAssetItemIdentifier", this.getCapitalAssetItemIdentifier().toString());
064        }
065        if (this.getItemIdentifier() != null) {
066            m.put("itemIdentifier", this.getItemIdentifier().toString());
067        }
068        if (this.documentNumber != null) {
069            m.put("documentNumber", this.documentNumber);
070        }
071        return m;
072    }
073
074    @Override
075    public ItemCapitalAsset setupNewPurchasingItemCapitalAssetLine() {
076        ItemCapitalAsset asset = new PurchaseOrderItemCapitalAsset();
077        return asset;
078    }
079}