001 /* 002 * Copyright 2011 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 */ 016 package org.kuali.kfs.module.endow.document.service.impl; 017 018 import java.util.ArrayList; 019 import java.util.Collection; 020 import java.util.HashMap; 021 import java.util.Map; 022 023 import org.apache.commons.lang.StringUtils; 024 import org.kuali.kfs.module.endow.businessobject.HoldingHistory; 025 import org.kuali.kfs.module.endow.document.HoldingHistoryValueAdjustmentDocument; 026 import org.kuali.kfs.module.endow.document.service.HoldingHistoryValueAdjustmentDocumentService; 027 import org.kuali.rice.kns.service.BusinessObjectService; 028 029 /** 030 * This class provides service for Security maintenance 031 */ 032 public class HoldingHistoryValueAdjustmentDocumentServiceImpl implements HoldingHistoryValueAdjustmentDocumentService { 033 034 private BusinessObjectService businessObjectService; 035 036 /** 037 * @see org.kuali.kfs.module.endow.document.service.HoldingHistoryValueAdjustmentDocumentService#getHoldingHistoryValueAdjustmentDocument(String) 038 */ 039 public Collection<HoldingHistoryValueAdjustmentDocument> getHoldingHistoryValueAdjustmentDocument(String transactionPosted) { 040 041 Collection<HoldingHistoryValueAdjustmentDocument> holdingHistoryValueAdjustmentDocument = new ArrayList(); 042 043 if (StringUtils.isNotBlank(transactionPosted)) { 044 Map criteria = new HashMap(); 045 046 criteria.put("transactionPosted", transactionPosted); 047 holdingHistoryValueAdjustmentDocument = businessObjectService.findMatching(HoldingHistoryValueAdjustmentDocument.class, criteria); 048 } 049 050 return holdingHistoryValueAdjustmentDocument; 051 } 052 053 /** 054 * @see org.kuali.kfs.module.endow.document.service.HoldingHistoryValueAdjustmentDocumentService#saveHoldingHistory(HoldingHistoryValueAdjustmentDocument) 055 */ 056 public boolean saveHoldingHistory(HoldingHistoryValueAdjustmentDocument holdingHistoryValueAdjustmentDocument) { 057 boolean success = true; 058 059 try { 060 businessObjectService.save(holdingHistoryValueAdjustmentDocument); 061 } 062 catch (Exception ex) { 063 success = false; 064 } 065 066 return success; 067 } 068 069 /** 070 * @see org.kuali.kfs.module.endow.document.service.HoldingHistoryValueAdjustmentDocumentService#saveHoldingHistory#getHoldingHistoryValueAdjustmentDocumentByDocumentNumber(String) 071 */ 072 public Collection<HoldingHistoryValueAdjustmentDocument> getHoldingHistoryValueAdjustmentDocumentByDocumentNumber(String documentNumber) { 073 Collection<HoldingHistoryValueAdjustmentDocument> holdingHistoryValueAdjustmentDocument = new ArrayList(); 074 075 if (StringUtils.isNotBlank(documentNumber)) { 076 Map criteria = new HashMap(); 077 078 criteria.put("documentNumber", documentNumber); 079 holdingHistoryValueAdjustmentDocument = businessObjectService.findMatching(HoldingHistoryValueAdjustmentDocument.class, criteria); // .findMatching(HoldingHistoryValueAdjustmentDocument.class, criteria); 080 } 081 082 return holdingHistoryValueAdjustmentDocument; 083 } 084 085 /** 086 * This method gets the businessObjectService. 087 * 088 * @return businessObjectService 089 */ 090 public BusinessObjectService getBusinessObjectService() { 091 return businessObjectService; 092 } 093 094 /** 095 * This method sets the businessObjectService 096 * 097 * @param businessObjectService 098 */ 099 public void setBusinessObjectService(BusinessObjectService businessObjectService) { 100 this.businessObjectService = businessObjectService; 101 } 102 }