public class UsersService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.HashMap<com.mambu.core.shared.data.DataViewType,com.mambu.api.server.handler.customviews.model.ApiViewType> |
supportedDataViewTypes
Map to convert custom view's DataViewType to the ApiViewType (required by Custom View API)
|
Constructor and Description |
---|
UsersService(MambuAPIService mambuAPIService)
Create a new users service
|
Modifier and Type | Method and Description |
---|---|
com.mambu.core.shared.model.User |
createUser(com.mambu.core.shared.model.User user)
Creates a new user
i.e.
|
static com.mambu.api.server.handler.customviews.model.ApiViewType |
getApiViewType(com.mambu.core.shared.data.DataViewType dataViewType)
Helper to get ApiViewType for a DataViewType
|
java.util.List<com.mambu.core.shared.model.CustomView> |
getCustomViews(java.lang.String userName)
Convenience method to get all Custom Views for the user by user's userName.
|
java.util.List<com.mambu.core.shared.model.CustomView> |
getCustomViews(java.lang.String username,
com.mambu.api.server.handler.customviews.model.ApiViewType apiViewType)
Get Custom Views for the user by user's userName and apiViewType.
|
com.mambu.core.shared.model.User |
getUserById(java.lang.String userId)
Get User by its userID
|
com.mambu.core.shared.model.User |
getUserByUsername(java.lang.String userName)
Get User by it's userName.
|
com.mambu.core.shared.model.Role |
getUserRole(java.lang.String roleKey)
Get user role by a role key
|
java.util.List<com.mambu.core.shared.model.Role> |
getUserRoles()
Get user roles
|
java.util.List<com.mambu.core.shared.model.User> |
getUsers()
Get users (first 50 per default)
|
java.util.List<com.mambu.core.shared.model.User> |
getUsers(java.lang.String branchId,
APIData.UserBranchAssignmentType userBranchAssignmentType,
java.lang.String offset,
java.lang.String limit)
Get a paginated list of users.
|
java.util.List<com.mambu.core.shared.model.User> |
getUsers(java.lang.String offset,
java.lang.String limit)
Get all the users with offset and limit
|
java.util.List<com.mambu.core.shared.model.User> |
getUsers(java.lang.String branchId,
java.lang.String offset,
java.lang.String limit)
Convenience method to Get a paginated list of users assigned to a branch, filtered by branch
|
public static java.util.HashMap<com.mambu.core.shared.data.DataViewType,com.mambu.api.server.handler.customviews.model.ApiViewType> supportedDataViewTypes
@Inject public UsersService(MambuAPIService mambuAPIService)
mambuAPIService
- the service responsible with the connection to the serverpublic java.util.List<com.mambu.core.shared.model.User> getUsers(java.lang.String offset, java.lang.String limit) throws MambuApiException
offset
- the offset of the response. If not set a value of 0 is used by defaultlimit
- the maximum number of response entries. If not set a value of 50 is used by defaultMambuApiException
public java.util.List<com.mambu.core.shared.model.User> getUsers() throws MambuApiException
MambuApiException
public java.util.List<com.mambu.core.shared.model.User> getUsers(java.lang.String branchId, APIData.UserBranchAssignmentType userBranchAssignmentType, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- the id of the branch. If null, users for all branches are returneduserBranchAssignmentType
- user's branch assignment type. This parameter is ignored if the branchId parameter is null. If
userBranchAssignmentType is ASSIGNED then only users assigned to the specified branch are returned. If
its value is MANAGE then all users who are either assigned or who can manage the branch are returned.
If null, the default is ASSIGNED.offset
- the offset of the response. If not set a value of 0 is used by defaultlimit
- the maximum number of response entries. If not set a value of 50 is used by defaultMambuApiException
public java.util.List<com.mambu.core.shared.model.User> getUsers(java.lang.String branchId, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- the id of the branch to filter with. If null, all users are returnedoffset
- the offset of the response. If not set a value of 0 is used by defaultlimit
- the maximum number of response entries. If not set a value of 50 is used by defaultMambuApiException
public com.mambu.core.shared.model.User getUserById(java.lang.String userId) throws MambuApiException
userId
- the id of the user to filter.MambuApiException
public com.mambu.core.shared.model.User getUserByUsername(java.lang.String userName) throws MambuApiException
userName
- the username of the user to filterMambuApiException
public java.util.List<com.mambu.core.shared.model.CustomView> getCustomViews(java.lang.String username, com.mambu.api.server.handler.customviews.model.ApiViewType apiViewType) throws MambuApiException
username
- the user name of the user. Mandatory fieldapiViewType
- view filter type. If null, all custom views are returnedMambuApiException
public java.util.List<com.mambu.core.shared.model.CustomView> getCustomViews(java.lang.String userName) throws MambuApiException
userName
- the username of the userMambuApiException
public static com.mambu.api.server.handler.customviews.model.ApiViewType getApiViewType(com.mambu.core.shared.data.DataViewType dataViewType)
dataViewType
- data view typepublic java.util.List<com.mambu.core.shared.model.Role> getUserRoles() throws MambuApiException
MambuApiException
public com.mambu.core.shared.model.Role getUserRole(java.lang.String roleKey) throws MambuApiException
roleKey
- the encoded key of the user roleMambuApiException
public com.mambu.core.shared.model.User createUser(com.mambu.core.shared.model.User user) throws MambuApiException
user
- The user to be created. Must be not be null. Also, take into account that the user must have a role
assigned.MambuApiException