com.atlassian.crowd.plugin.rest.util
Class EntityTranslator

java.lang.Object
  extended by com.atlassian.crowd.plugin.rest.util.EntityTranslator

public class EntityTranslator
extends java.lang.Object

Translates between REST entities and com.atlassian.crowd.model classes.

Since:
v2.1

Method Summary
static UserWithAttributes fromUserEntity(UserEntity userEntity)
          Translates a UserEntity to a UserWithAttributes.
static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> toAttributes(MultiValuedAttributeEntityList attributeEntityList)
          Translates MultiValuedAttributeEntityList to Attributes.
static MultiValuedAttributeEntityList toDeletedAttributeEntityList(java.util.Set<java.lang.String> attributes)
           
static EventEntityList toEventEntities(Events events, java.net.URI baseUri)
           
static AbstractEventEntity toEventEntity(OperationEvent event, java.net.URI baseUri)
           
static GroupTemplate toGroup(GroupEntity groupEntity)
           
static GroupEntityList toGroupEntities(java.util.List<Group> groups, java.net.URI baseURI)
          Translates a list of Groups to a list of GroupEntities.
static GroupEntity toGroupEntity(Group group, Attributes attributes, com.atlassian.plugins.rest.common.Link groupLink)
          Translates a Group with Attributes to a GroupEntity.
static GroupEntity toGroupEntity(Group group, com.atlassian.plugins.rest.common.Link groupLink)
          Translates a Group to a GroupEntity.
static GroupEntity toGroupEntity(Group group, java.net.URI baseURI)
          Translates a Group to a GroupEntity.
static GroupEntityList toMinimalGroupEntities(java.util.Collection<java.lang.String> groupNames, java.net.URI baseUri)
          Translates a list of group names to a GroupEntityList.
static UserEntityList toMinimalUserEntities(java.util.List<java.lang.String> usernames, java.net.URI baseUri)
          Translates a list of usernames to a UserEntityList.
static MultiValuedAttributeEntityList toMultiValuedAttributeEntityList(Attributes attributes, com.atlassian.plugins.rest.common.Link link)
          Translates Attributes to MultiValuedAttributeEntityList.
static MultiValuedAttributeEntityList toMultiValuedAttributeEntityList(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes, com.atlassian.plugins.rest.common.Link link)
          Translates Attributes to MultiValuedAttributeEntityList.
static UserEntityList toUserEntities(java.util.List<User> users, java.net.URI baseUri)
          Translates a list of users to a list of UserEntities.
static UserEntity toUserEntity(User user, Attributes attributes, com.atlassian.plugins.rest.common.Link userLink)
          Translates a User with Attributes to a UserEntity.
static UserEntity toUserEntity(User user, com.atlassian.plugins.rest.common.Link userLink)
          Translates a User to a UserEntity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toUserEntity

public static UserEntity toUserEntity(User user,
                                      com.atlassian.plugins.rest.common.Link userLink)
Translates a User to a UserEntity.

Parameters:
user - User to convert
userLink - Link to user resource
Returns:
UserEntity if user is not null, otherwise null

toUserEntities

public static UserEntityList toUserEntities(java.util.List<User> users,
                                            java.net.URI baseUri)
Translates a list of users to a list of UserEntities.

Parameters:
users - list of users to convert
baseUri - base URI
Returns:
list of UserEntities

toMinimalUserEntities

public static UserEntityList toMinimalUserEntities(java.util.List<java.lang.String> usernames,
                                                   java.net.URI baseUri)
Translates a list of usernames to a UserEntityList.

Parameters:
usernames - usernames to translate
baseUri - base URI
Returns:
list of UserEntities

fromUserEntity

public static UserWithAttributes fromUserEntity(UserEntity userEntity)
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.common.Link userLink)
Translates a User with Attributes to a UserEntity.

Parameters:
user - User
attributes - attributes of the user.
userLink - link to the user.
Returns:
UserEntity if user is not null, otherwise null

toGroupEntity

public static GroupEntity toGroupEntity(Group group,
                                        java.net.URI baseURI)
Translates a Group to a GroupEntity.

Parameters:
group - Group to convert
baseURI - base URI
Returns:
GroupEntity

toGroupEntities

public static GroupEntityList toGroupEntities(java.util.List<Group> groups,
                                              java.net.URI baseURI)
Translates a list of Groups to a list of GroupEntities.

Parameters:
groups - List of groups to convert
baseURI - base URI
Returns:
list of GroupEntities

toMinimalGroupEntities

public static GroupEntityList toMinimalGroupEntities(java.util.Collection<java.lang.String> groupNames,
                                                     java.net.URI baseUri)
Translates a list of group names to a GroupEntityList.

Parameters:
groupNames - group names to translate
baseUri - base URI
Returns:
group names as a GroupEntityList

toGroupEntity

public static GroupEntity toGroupEntity(Group group,
                                        com.atlassian.plugins.rest.common.Link groupLink)
Translates a Group to a GroupEntity.

Parameters:
group - Group to convert
groupLink - Link to group resource
Returns:
GroupEntity

toGroupEntity

public static GroupEntity toGroupEntity(Group group,
                                        Attributes attributes,
                                        com.atlassian.plugins.rest.common.Link groupLink)
Translates a Group with Attributes to a GroupEntity.

Parameters:
group - Group
attributes - attributes of the group.
groupLink - link to the group.
Returns:
GroupEntity

toGroup

public static GroupTemplate toGroup(GroupEntity groupEntity)

toMultiValuedAttributeEntityList

public static MultiValuedAttributeEntityList toMultiValuedAttributeEntityList(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> attributes,
                                                                              com.atlassian.plugins.rest.common.Link link)
Translates Attributes to MultiValuedAttributeEntityList.

Parameters:
attributes - attributes of an entity
link - link to the attributes
Returns:
MultiValuedAttributeEntityList if attributes is not null, otherwise null

toMultiValuedAttributeEntityList

public static MultiValuedAttributeEntityList toMultiValuedAttributeEntityList(Attributes attributes,
                                                                              com.atlassian.plugins.rest.common.Link link)
Translates Attributes to MultiValuedAttributeEntityList.

Parameters:
attributes - attributes of an entity
link - link to the attributes
Returns:
MultiValuedAttributeEntityList if attributes is not null, otherwise null

toDeletedAttributeEntityList

public static MultiValuedAttributeEntityList toDeletedAttributeEntityList(java.util.Set<java.lang.String> attributes)

toAttributes

public static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> toAttributes(MultiValuedAttributeEntityList attributeEntityList)
Translates MultiValuedAttributeEntityList to Attributes.

Parameters:
attributeEntityList - attributes of an entity
Returns:
attributes

toEventEntities

public static EventEntityList toEventEntities(Events events,
                                              java.net.URI baseUri)

toEventEntity

public static AbstractEventEntity toEventEntity(OperationEvent event,
                                                java.net.URI baseUri)


Copyright © 2011 Atlassian. All Rights Reserved.