View Javadoc
1   /*
2    * Copyright 2011 The Kuali Foundation.
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.select.document.service.impl;
17  
18  import org.apache.log4j.Logger;
19  import org.kuali.ole.select.businessobject.OleRequestor;
20  import org.kuali.ole.select.businessobject.OleRequestorType;
21  import org.kuali.ole.select.document.service.OleRequestorService;
22  import org.kuali.rice.krad.service.BusinessObjectService;
23  
24  import java.util.HashMap;
25  import java.util.List;
26  import java.util.Map;
27  
28  public class OleRequestorServiceImpl implements OleRequestorService {
29      private static Logger LOG = Logger.getLogger(OleRequestorServiceImpl.class);
30  
31      private BusinessObjectService businessObjectService;
32  
33  
34      /**
35       * @see org.kuali.ole.select.document.service.OleRequestorService#saveRequestor(org.kuali.ole.select.businessobject.OleRequestor)
36       */
37      public void saveRequestor(OleRequestor oleRequestor) {
38          oleRequestor.setActive(true);
39          businessObjectService.save(oleRequestor);
40      }
41  
42      /**
43       * @see org.kuali.ole.select.document.service.OleRequestorService#saveRequestorType(org.kuali.ole.select.businessobject.OleRequestorType)
44       */
45      public void saveRequestorType(OleRequestorType oleRequestorType) {
46          businessObjectService.save(oleRequestorType);
47      }
48  
49      /**
50       * @see org.kuali.ole.select.document.service.OleRequestorService#getRequestorDetails(String)
51       */
52      public OleRequestor getRequestorDetails(String requestorId) {
53          Map keys = new HashMap();
54          keys.put("requestorId", requestorId);
55          return (OleRequestor) businessObjectService.findByPrimaryKey(OleRequestor.class, keys);
56      }
57  
58      /**
59       * @see org.kuali.ole.select.document.service.OleRequestorService#getRequestorTypeDetails(String)
60       */
61      public OleRequestorType getRequestorTypeDetails(String requestorType) {
62          Map keys = new HashMap();
63          keys.put("requestorType", requestorType);
64          return (OleRequestorType) businessObjectService.findByPrimaryKey(OleRequestorType.class, keys);
65      }
66  
67      /**
68       * @see org.kuali.ole.select.document.service.OleRequestorServicee#getRequestorTypeList(String)
69       */
70      public List<OleRequestorType> getRequestorTypeList(String requestorType) {
71          if (LOG.isDebugEnabled())
72              LOG.debug("Entering getRequestorTypeList for requestorType:" + requestorType);
73          Map criteria = new HashMap();
74          criteria.put("requestorType", requestorType);
75          List<OleRequestorType> requestorTypeList = (List) businessObjectService.findMatching(OleRequestorType.class, criteria);
76          LOG.debug("Exiting getRequestorTypeList.");
77          return requestorTypeList;
78      }
79  
80      public BusinessObjectService getBusinessObjectService() {
81          return businessObjectService;
82      }
83  
84      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
85          this.businessObjectService = businessObjectService;
86      }
87  }