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  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
24  
25  import java.util.HashMap;
26  import java.util.List;
27  import java.util.Map;
28  
29  public class OleRequestorServiceImpl implements OleRequestorService {
30      private static Logger LOG = Logger.getLogger(OleRequestorServiceImpl.class);
31  
32      private BusinessObjectService businessObjectService;
33  
34  
35      /**
36       * @see org.kuali.ole.select.document.service.OleRequestorService#saveRequestor(org.kuali.ole.select.businessobject.OleRequestor)
37       */
38      public void saveRequestor(OleRequestor oleRequestor) {
39          oleRequestor.setActive(true);
40          KRADServiceLocatorWeb.getLegacyDataAdapter().save(oleRequestor);
41      }
42  
43      /**
44       * @see org.kuali.ole.select.document.service.OleRequestorService#saveRequestorType(org.kuali.ole.select.businessobject.OleRequestorType)
45       */
46      public void saveRequestorType(OleRequestorType oleRequestorType) {
47          KRADServiceLocatorWeb.getLegacyDataAdapter().save(oleRequestorType);
48      }
49  
50      /**
51       * @see org.kuali.ole.select.document.service.OleRequestorService#getRequestorDetails(String)
52       */
53      public OleRequestor getRequestorDetails(String requestorId) {
54          Map keys = new HashMap();
55          keys.put("requestorId", requestorId);
56          return (OleRequestor) KRADServiceLocatorWeb.getLegacyDataAdapter().findByPrimaryKey(OleRequestor.class, keys);
57      }
58  
59      /**
60       * @see org.kuali.ole.select.document.service.OleRequestorService#getRequestorTypeDetails(String)
61       */
62      public OleRequestorType getRequestorTypeDetails(String requestorType) {
63          Map keys = new HashMap();
64          keys.put("requestorType", requestorType);
65          return (OleRequestorType) KRADServiceLocatorWeb.getLegacyDataAdapter().findByPrimaryKey(OleRequestorType.class, keys);
66      }
67  
68      /**
69       * @see org.kuali.ole.select.document.service.OleRequestorServicee#getRequestorTypeList(String)
70       */
71      public List<OleRequestorType> getRequestorTypeList(String requestorType) {
72          if (LOG.isDebugEnabled())
73              LOG.debug("Entering getRequestorTypeList for requestorType:" + requestorType);
74          Map criteria = new HashMap();
75          criteria.put("requestorType", requestorType);
76          List<OleRequestorType> requestorTypeList = (List) KRADServiceLocatorWeb.getLegacyDataAdapter().findMatching(OleRequestorType.class, criteria);
77          LOG.debug("Exiting getRequestorTypeList.");
78          return requestorTypeList;
79      }
80  
81      public BusinessObjectService getBusinessObjectService() {
82          return businessObjectService;
83      }
84  
85      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
86          this.businessObjectService = businessObjectService;
87      }
88  }