/src/main/java/com/google/ie/business/service/UserService.java

http://thoughtsite.googlecode.com/ · Java · 97 lines · 13 code · 12 blank · 72 comment · 0 complexity · 75109cde32837436af209b697a49340c MD5 · raw file

  1. /* Copyright 2010 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS.
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License
  14. */
  15. package com.google.ie.business.service;
  16. import com.google.ie.business.domain.User;
  17. import com.google.ie.dto.RetrievalInfo;
  18. import java.util.List;
  19. /**
  20. * A service specification for User entity.
  21. *
  22. * @author Charanjeet singh
  23. */
  24. public interface UserService {
  25. /**
  26. * Saves a user in to data store.
  27. *
  28. * @param user User to be saved.
  29. * @return Returns the saved User.
  30. */
  31. User saveUser(User user);
  32. /**
  33. * Retrieves a user object corresponding to a id in user object.
  34. *
  35. * @param id id of the user to be fetched.
  36. * @return Returns the User object.
  37. */
  38. User getUserById(String id);
  39. /**
  40. * Retrieves the user object from datastore corresponding to a specific user
  41. * id.If the user does not exist in the datastore then saves the object
  42. * received as parameter.
  43. *
  44. * @param user the user object containing the details fetched from friend
  45. * connect.
  46. * @return the {@link User} object corresponding to the specific id.
  47. */
  48. User addOrUpdateUser(User user);
  49. /**
  50. * Retrieves a user object corresponding to a primary key
  51. *
  52. * @param key primary key of the user to be fetched.
  53. * @return Returns the User object.
  54. */
  55. User getUserByPrimaryKey(String key);
  56. /**
  57. *
  58. * Retrieves the user object from datastore corresponding to a specific user
  59. * id.If the user does not exist in the datastore then saves the object
  60. * received as parameter.
  61. *
  62. * @param user the user to be banned
  63. * @return the updated {@link User} object
  64. */
  65. User banUser(User user);
  66. /**
  67. *
  68. * Retrieves the user object from datastore corresponding to a specific user
  69. * id.If the user does not exist in the datastore then saves the object
  70. * received as parameter.
  71. *
  72. * @param user user to be activated
  73. * @return the updated {@link User} object
  74. */
  75. User activate(User user);
  76. /**
  77. * Get all users based on the given role.
  78. *
  79. * @param retrievalInfo the {@link RetrievalInfo} object containing
  80. * parameters for the query
  81. * @param role the role name
  82. * @return list of users with the specific role
  83. */
  84. List<User> getUsers(RetrievalInfo retrievalInfo, String role);
  85. }