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 018 019import org.kuali.ole.integration.purap.CapitalAssetLocation; 020import org.kuali.ole.integration.purap.CapitalAssetSystem; 021import org.kuali.ole.integration.purap.ItemCapitalAsset; 022 023/** 024 * @author Kuali Nervous System Team (kualidev@oncourse.iu.edu) 025 */ 026 027public class RequisitionCapitalAssetSystem extends PurchasingCapitalAssetSystemBase { 028 029 protected Integer purapDocumentIdentifier; 030 031 /** 032 * Default constructor. 033 */ 034 public RequisitionCapitalAssetSystem() { 035 super(); 036 } 037 038 public RequisitionCapitalAssetSystem(CapitalAssetSystem originalSystem) { 039 super(); 040 if (originalSystem != null) { 041 this.setCapitalAssetSystemDescription(originalSystem.getCapitalAssetSystemDescription()); 042 this.setCapitalAssetNotReceivedCurrentFiscalYearIndicator(originalSystem.isCapitalAssetNotReceivedCurrentFiscalYearIndicator()); 043 this.setCapitalAssetTypeCode(originalSystem.getCapitalAssetTypeCode()); 044 this.setCapitalAssetManufacturerName(originalSystem.getCapitalAssetManufacturerName()); 045 this.setCapitalAssetModelDescription(originalSystem.getCapitalAssetModelDescription()); 046 this.setCapitalAssetNoteText(originalSystem.getCapitalAssetNoteText()); 047 populatePurchaseOrderItemCapitalAssets(originalSystem); 048 populateCapitalAssetLocations(originalSystem); 049 this.setCapitalAssetCountAssetNumber(originalSystem.getCapitalAssetCountAssetNumber()); 050 } 051 } 052 053 private void populatePurchaseOrderItemCapitalAssets(CapitalAssetSystem originalSystem) { 054 for (ItemCapitalAsset reqAsset : originalSystem.getItemCapitalAssets()) { 055 PurchaseOrderItemCapitalAsset poAsset = new PurchaseOrderItemCapitalAsset(reqAsset.getCapitalAssetNumber()); 056 this.getItemCapitalAssets().add(poAsset); 057 } 058 } 059 060 private void populateCapitalAssetLocations(CapitalAssetSystem originalSystem) { 061 for (CapitalAssetLocation reqLocation : originalSystem.getCapitalAssetLocations()) { 062 PurchaseOrderCapitalAssetLocation poLocation = new PurchaseOrderCapitalAssetLocation(); 063 poLocation.setItemQuantity(reqLocation.getItemQuantity()); 064 poLocation.setCampusCode(reqLocation.getCampusCode()); 065 poLocation.setOffCampusIndicator(reqLocation.isOffCampusIndicator()); 066 poLocation.setBuildingCode(reqLocation.getBuildingCode()); 067 poLocation.setBuildingRoomNumber(reqLocation.getBuildingRoomNumber()); 068 poLocation.setCapitalAssetLine1Address(reqLocation.getCapitalAssetLine1Address()); 069 poLocation.setCapitalAssetCityName(reqLocation.getCapitalAssetCityName()); 070 poLocation.setCapitalAssetStateCode(reqLocation.getCapitalAssetStateCode()); 071 poLocation.setCapitalAssetPostalCode(reqLocation.getCapitalAssetPostalCode()); 072 poLocation.setCapitalAssetCountryCode(reqLocation.getCapitalAssetCountryCode()); 073 this.getCapitalAssetLocations().add(poLocation); 074 } 075 } 076 077 @Override 078 public Class getCapitalAssetLocationClass() { 079 return RequisitionCapitalAssetLocation.class; 080 } 081 082 @Override 083 public Class getItemCapitalAssetClass() { 084 return RequisitionItemCapitalAsset.class; 085 } 086 087 public Integer getPurapDocumentIdentifier() { 088 return purapDocumentIdentifier; 089 } 090 091 public void setPurapDocumentIdentifier(Integer purapDocumentIdentifier) { 092 this.purapDocumentIdentifier = purapDocumentIdentifier; 093 } 094 095}