PageRenderTime 102ms CodeModel.GetById 40ms app.highlight 10ms RepoModel.GetById 31ms app.codeStats 0ms

/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
16package com.google.ie.business.service;
17
18import com.google.ie.business.domain.User;
19import com.google.ie.dto.RetrievalInfo;
20
21import java.util.List;
22
23/**
24 * A service specification for User entity.
25 * 
26 * @author Charanjeet singh
27 */
28public interface UserService {
29    /**
30     * Saves a user in to data store.
31     * 
32     * @param user User to be saved.
33     * @return Returns the saved User.
34     */
35    User saveUser(User user);
36
37    /**
38     * Retrieves a user object corresponding to a id in user object.
39     * 
40     * @param id id of the user to be fetched.
41     * @return Returns the User object.
42     */
43    User getUserById(String id);
44
45    /**
46     * Retrieves the user object from datastore corresponding to a specific user
47     * id.If the user does not exist in the datastore then saves the object
48     * received as parameter.
49     * 
50     * @param user the user object containing the details fetched from friend
51     *        connect.
52     * @return the {@link User} object corresponding to the specific id.
53     */
54    User addOrUpdateUser(User user);
55
56    /**
57     * Retrieves a user object corresponding to a primary key
58     * 
59     * @param key primary key of the user to be fetched.
60     * @return Returns the User object.
61     */
62    User getUserByPrimaryKey(String key);
63
64    /**
65     * 
66     * Retrieves the user object from datastore corresponding to a specific user
67     * id.If the user does not exist in the datastore then saves the object
68     * received as parameter.
69     * 
70     * @param user the user to be banned
71     * @return the updated {@link User} object
72     */
73    User banUser(User user);
74
75    /**
76     * 
77     * Retrieves the user object from datastore corresponding to a specific user
78     * id.If the user does not exist in the datastore then saves the object
79     * received as parameter.
80     * 
81     * @param user user to be activated
82     * @return the updated {@link User} object
83     */
84    User activate(User user);
85
86    /**
87     * Get all users based on the given role.
88     * 
89     * @param retrievalInfo the {@link RetrievalInfo} object containing
90     *        parameters for the query
91     * @param role the role name
92     * @return list of users with the specific role
93     */
94    List<User> getUsers(RetrievalInfo retrievalInfo, String role);
95
96}
97