Class EntityTranslator
java.lang.Object
com.atlassian.crowd.plugin.rest.util.EntityTranslator
Translates between REST entities and
com.atlassian.crowd.model classes.- Since:
- v2.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic UserWithAttributesfromUserEntity(UserEntity userEntity) Translates a UserEntity to a UserWithAttributes.toAttributes(MultiValuedAttributeEntityList attributeEntityList) Translates MultiValuedAttributeEntityList to Attributes.toDeletedAttributeEntityList(Set<String> attributes) static EventEntityListtoEventEntities(Events events, URI baseUri) static AbstractEventEntitytoEventEntity(OperationEvent event, URI baseUri) static GroupTemplatetoGroup(GroupEntity groupEntity) Translates a GroupEntity to a GroupTemplate.static GroupEntityListtoGroupEntities(List<? extends Group> groups, URI baseURI) Translates a list of Groups to a list of GroupEntities.static GroupEntitytoGroupEntity(Group group, Attributes attributes, com.atlassian.plugins.rest.api.model.Link groupLink) Translates a Group with Attributes to a GroupEntity.static GroupEntitytoGroupEntity(Group group, com.atlassian.plugins.rest.api.model.Link groupLink) Translates a Group to a GroupEntity.static GroupEntitytoGroupEntity(Group group, URI baseURI) Translates a Group to a GroupEntity.static GroupEntityListtoMinimalGroupEntities(Collection<String> groupNames, URI baseUri) Translates a list of group names to a GroupEntityList.static UserEntityListtoMinimalUserEntities(List<String> usernames, URI baseUri) Translates a list of usernames to a UserEntityList.toMultiValuedAttributeEntityList(Attributes attributes, com.atlassian.plugins.rest.api.model.Link link) Translates Attributes to MultiValuedAttributeEntityList.toMultiValuedAttributeEntityList(Map<String, Set<String>> attributes, com.atlassian.plugins.rest.api.model.Link link) Translates Attributes to MultiValuedAttributeEntityList.static UserEntityListtoUserEntities(List<? extends User> users, URI baseUri) Translates a list of users to a list of UserEntities.static UserEntitytoUserEntity(User user, Attributes attributes, com.atlassian.plugins.rest.api.model.Link userLink) Translates a User with Attributes to a UserEntity.static UserEntitytoUserEntity(User user, com.atlassian.plugins.rest.api.model.Link userLink) Translates a User to a UserEntity.
-
Method Details
-
toUserEntity
public static UserEntity toUserEntity(User user, com.atlassian.plugins.rest.api.model.Link userLink) Translates a User to a UserEntity.- Parameters:
user- User to convertuserLink- Link to user resource- Returns:
- UserEntity if user is not null, otherwise null
-
toUserEntities
Translates a list of users to a list of UserEntities.- Parameters:
users- list of users to convertbaseUri- base URI- Returns:
- list of UserEntities
-
toMinimalUserEntities
Translates a list of usernames to a UserEntityList.- Parameters:
usernames- usernames to translatebaseUri- base URI- Returns:
- list of UserEntities
-
fromUserEntity
Translates a UserEntity to a UserWithAttributes.- Parameters:
userEntity- UserEntity to convert- Returns:
- UserWithAttributes if user is not null, otherwise null
-
toUserEntity
public static UserEntity toUserEntity(User user, Attributes attributes, com.atlassian.plugins.rest.api.model.Link userLink) Translates a User with Attributes to a UserEntity.- Parameters:
user- Userattributes- attributes of the user.userLink- link to the user.- Returns:
- UserEntity if user is not null, otherwise null
-
toGroupEntity
Translates a Group to a GroupEntity.- Parameters:
group- Group to convertbaseURI- base URI- Returns:
- GroupEntity
-
toGroupEntities
Translates a list of Groups to a list of GroupEntities.- Parameters:
groups- List of groups to convertbaseURI- base URI- Returns:
- list of GroupEntities
-
toMinimalGroupEntities
Translates a list of group names to a GroupEntityList.- Parameters:
groupNames- group names to translatebaseUri- base URI- Returns:
- group names as a GroupEntityList
-
toGroupEntity
public static GroupEntity toGroupEntity(Group group, com.atlassian.plugins.rest.api.model.Link groupLink) Translates a Group to a GroupEntity.- Parameters:
group- Group to convertgroupLink- Link to group resource- Returns:
- GroupEntity
-
toGroupEntity
public static GroupEntity toGroupEntity(Group group, Attributes attributes, com.atlassian.plugins.rest.api.model.Link groupLink) Translates a Group with Attributes to a GroupEntity.- Parameters:
group- Groupattributes- attributes of the group.groupLink- link to the group.- Returns:
- GroupEntity
-
toGroup
Translates a GroupEntity to a GroupTemplate.- Parameters:
groupEntity- GroupEntity to convert- Returns:
- GroupTemplate
-
toMultiValuedAttributeEntityList
public static MultiValuedAttributeEntityList toMultiValuedAttributeEntityList(Map<String, Set<String>> attributes, com.atlassian.plugins.rest.api.model.Link link) Translates Attributes to MultiValuedAttributeEntityList. Sorts the attributes in ascending order.- Parameters:
attributes- attributes of an entitylink- link to the attributes- Returns:
- MultiValuedAttributeEntityList sorted in ascending order if attributes is not null, otherwise null
-
toMultiValuedAttributeEntityList
public static MultiValuedAttributeEntityList toMultiValuedAttributeEntityList(Attributes attributes, com.atlassian.plugins.rest.api.model.Link link) Translates Attributes to MultiValuedAttributeEntityList. Sorts the attributes in ascending order.- Parameters:
attributes- attributes of an entitylink- link to the attributes- Returns:
- MultiValuedAttributeEntityList sorted in ascending order if attributes is not null, otherwise null
-
toDeletedAttributeEntityList
-
toAttributes
public static Map<String,Set<String>> toAttributes(MultiValuedAttributeEntityList attributeEntityList) Translates MultiValuedAttributeEntityList to Attributes.- Parameters:
attributeEntityList- attributes of an entity- Returns:
- attributes
-
toEventEntities
-
toEventEntity
-