View Javadoc

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