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 */ 016package org.kuali.ole.select.document.service.impl; 017 018import org.apache.log4j.Logger; 019import org.kuali.ole.select.businessobject.OleRequestor; 020import org.kuali.ole.select.businessobject.OleRequestorType; 021import org.kuali.ole.select.document.service.OleRequestorService; 022import org.kuali.rice.krad.service.BusinessObjectService; 023 024import java.util.HashMap; 025import java.util.List; 026import java.util.Map; 027 028public class OleRequestorServiceImpl implements OleRequestorService { 029 private static Logger LOG = Logger.getLogger(OleRequestorServiceImpl.class); 030 031 private BusinessObjectService businessObjectService; 032 033 034 /** 035 * @see org.kuali.ole.select.document.service.OleRequestorService#saveRequestor(org.kuali.ole.select.businessobject.OleRequestor) 036 */ 037 public void saveRequestor(OleRequestor oleRequestor) { 038 oleRequestor.setActive(true); 039 businessObjectService.save(oleRequestor); 040 } 041 042 /** 043 * @see org.kuali.ole.select.document.service.OleRequestorService#saveRequestorType(org.kuali.ole.select.businessobject.OleRequestorType) 044 */ 045 public void saveRequestorType(OleRequestorType oleRequestorType) { 046 businessObjectService.save(oleRequestorType); 047 } 048 049 /** 050 * @see org.kuali.ole.select.document.service.OleRequestorService#getRequestorDetails(String) 051 */ 052 public OleRequestor getRequestorDetails(String requestorId) { 053 Map keys = new HashMap(); 054 keys.put("requestorId", requestorId); 055 return (OleRequestor) businessObjectService.findByPrimaryKey(OleRequestor.class, keys); 056 } 057 058 /** 059 * @see org.kuali.ole.select.document.service.OleRequestorService#getRequestorTypeDetails(String) 060 */ 061 public OleRequestorType getRequestorTypeDetails(String requestorType) { 062 Map keys = new HashMap(); 063 keys.put("requestorType", requestorType); 064 return (OleRequestorType) businessObjectService.findByPrimaryKey(OleRequestorType.class, keys); 065 } 066 067 /** 068 * @see org.kuali.ole.select.document.service.OleRequestorServicee#getRequestorTypeList(String) 069 */ 070 public List<OleRequestorType> getRequestorTypeList(String requestorType) { 071 if (LOG.isDebugEnabled()) 072 LOG.debug("Entering getRequestorTypeList for requestorType:" + requestorType); 073 Map criteria = new HashMap(); 074 criteria.put("requestorType", requestorType); 075 List<OleRequestorType> requestorTypeList = (List) businessObjectService.findMatching(OleRequestorType.class, criteria); 076 LOG.debug("Exiting getRequestorTypeList."); 077 return requestorTypeList; 078 } 079 080 public BusinessObjectService getBusinessObjectService() { 081 return businessObjectService; 082 } 083 084 public void setBusinessObjectService(BusinessObjectService businessObjectService) { 085 this.businessObjectService = businessObjectService; 086 } 087}