View Javadoc

1   /*
2    * Copyright 2007-2008 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.rice.core.util;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  import org.kuali.rice.kew.actionlist.service.ActionListService;
22  import org.kuali.rice.kew.actionrequest.service.ActionRequestService;
23  import org.kuali.rice.kew.mail.service.ActionListEmailService;
24  import org.springframework.beans.factory.BeanNameAware;
25  
26  
27  /**
28   * This is an object that is defined as a bean in the TestKewSpringBeans.xml (the test "client") and
29   * uses RiceService annotations to have Rice services from the Rice context injected into it instead
30   * of Spring wiring.  
31   * 
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public class RiceServiceInjectedObject implements BeanNameAware {
35      // hack for testing purposes
36      public static Map<String, RiceServiceInjectedObject> beans = new HashMap<String, RiceServiceInjectedObject>();
37      
38      public void setBeanName(String name) {
39          beans.put(name, this);
40      }
41  
42      @RiceService(name="enActionListService")
43      public ActionListService als;
44      
45      @RiceService(name="enActionListEmailService")
46      public ActionListEmailService ales;
47      
48      @RiceService(name="enActionRequestService")
49      public ActionRequestService ars;
50      
51      @RiceService(name="enApplicationConstantsService")
52      public Object wireMeInSpring;
53  
54      // DON'T WIRE THIS IN SPRING
55      @RiceService(resourceLoader="KEW_SPRING+PLUGIN_REGISTRY_CONTAINER_RESOURCE_LOADER", name="enActionListEmailService") // specify the resource loader by name here
56      public void setActionListEmailService(ActionListEmailService ales) {
57          this.ales = ales;
58      }
59  
60      public ActionRequestService getActionRequestService() {
61          return ars;
62      }
63      
64      public void setActionRequestService(ActionRequestService ars) {
65          this.ars = ars;
66      }
67      
68      public void setWireMeInSpring(Object o) {
69          this.wireMeInSpring = o;
70      }
71  
72  }