View Javadoc

1   /**
2    * 
3    */
4   package org.appfuse.webapp.server.locators;
5   
6   import org.appfuse.model.Role;
7   import org.appfuse.service.RoleManager;
8   import org.springframework.beans.factory.annotation.Autowired;
9   import org.springframework.stereotype.Component;
10  
11  import com.google.web.bindery.requestfactory.shared.Locator;
12  
13  /**
14   * @author ivangsa
15   *
16   */
17  @Component
18  public class RoleLocator extends Locator<Role, Long> {
19  
20      @Autowired
21      private RoleManager roleManager;
22  
23      public Role create(Class<? extends Role> clazz) {
24          return new Role();
25      }
26  
27      public Role find(Class<? extends Role> clazz, Long id) {
28          return roleManager.get(id);
29      }
30  
31      public Class<Role> getDomainType() {
32          return Role.class;
33      }
34  
35      public Long getId(Role role) {
36          return role.getId();
37      }
38  
39      public Class<Long> getIdType() {
40          return Long.class;
41      }
42  
43      public Object getVersion(Role role) {
44          return 0;
45      }
46  
47      @Override
48      public boolean isLive(Role domainObject) {
49          return true;
50      }
51  }