Package org.exoplatform.social.rest.api
Class EntityBuilder
- java.lang.Object
-
- org.exoplatform.social.rest.api.EntityBuilder
-
public class EntityBuilder extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTIVITIES_TYPEstatic StringACTIVITY_IDS_TYPEstatic StringCOMMENTS_COUNT_TYPEstatic intCOMMENTS_PREVIEW_LIMITstatic StringCOMMENTS_PREVIEW_TYPEstatic StringCOMMENTS_TYPEstatic StringGROUP_SPACE_BINDING_REPORT_OPERATIONS_TYPEGroup Space Bindingstatic StringGROUP_SPACE_BINDING_TYPEGroup Space Bindingstatic StringIDENTITIES_TYPEstatic StringKEYstatic StringLIKES_COUNT_TYPEstatic StringLIKES_TYPEstatic javax.ws.rs.core.CacheControlNO_CACHE_CCstatic StringORGANIZATION_GROUP_TYPEChild Groups of group rootstatic StringREDACTOR_MEMBERSHIPstatic StringSPACE_ACTIVITY_TYPEstatic StringSPACES_MEMBERSHIP_TYPEstatic StringSPACES_TYPEstatic StringUSER_ACTIVITY_TYPEstatic StringUSERS_RELATIONSHIP_TYPEstatic StringUSERS_TYPEstatic StringVALUE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbuildActivityFromEntity(ActivityEntity model, org.exoplatform.social.core.activity.model.ExoSocialActivity activity)static voidbuildActivityParamsFromEntity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, Map<String,?> templateParams)static ActivityEntitybuildEntityFromActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUser, String restPath, String expand)static CommentEntitybuildEntityFromComment(org.exoplatform.social.core.activity.model.ExoSocialActivity comment, org.exoplatform.social.core.identity.model.Identity authentiatedUser, String restPath, String expand, boolean isBuildList)static List<DataEntity>buildEntityFromComment(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUser, String restPath, String expand, boolean sortDescending, int offset, int limit)static GroupNodeEntitybuildEntityFromGroup(org.exoplatform.services.organization.Group group)Build rest group entity from group objectstatic GroupNodeEntitybuildEntityFromGroupId(String group)Build rest group entity from group namestatic GroupSpaceBindingEntitybuildEntityFromGroupSpaceBinding(org.exoplatform.social.core.binding.model.GroupSpaceBinding binding)Build rest binding entity from GroupSpaceBinding objectstatic GroupSpaceBindingOperationReportEntitybuildEntityFromGroupSpaceBindingOperationReport(org.exoplatform.social.core.binding.model.GroupSpaceBindingOperationReport bindingOperationReport)Build rest bindingOperationReport entity from bindingOperationReport objectstatic List<DataEntity>buildEntityFromLike(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String restPath, String expand, int offset, int limit)static SpaceEntitybuildEntityFromSpace(org.exoplatform.social.core.space.model.Space space, String userId, String restPath, String expand)Get a hash map from a space in order to build a json object for the rest servicestatic SpaceMembershipEntitybuildEntityFromSpaceMembership(org.exoplatform.social.core.space.model.Space space, String userId, String type, String restPath, String expand)Get a hash map from a space in order to build a json object for the rest servicestatic IdentityEntitybuildEntityIdentity(String userName, String restPath, String expand)static IdentityEntitybuildEntityIdentity(org.exoplatform.social.core.identity.model.Identity identity, String restPath, String expand)Get a IdentityEntity from an identity in order to build a json object for the rest servicestatic ProfileEntitybuildEntityProfile(String userName, String restPath, String expand)static ProfileEntitybuildEntityProfile(org.exoplatform.social.core.identity.model.Profile profile, String restPath, String expand)static ProfileEntitybuildEntityProfile(org.exoplatform.social.core.space.model.Space space, org.exoplatform.social.core.identity.model.Profile profile, String path, String expand)static List<DataEntity>buildEntityProfiles(String[] userNames, String restPath, String expand)static RelationshipEntitybuildEntityRelationship(org.exoplatform.social.core.relationship.model.Relationship relationship, String restPath, String expand, boolean isSymetric)Get a RelationshipEntity from a relationship in order to build a json object for the rest servicestatic voidbuildExperienceEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)static voidbuildImEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)static ObjectbuildLinkForHeader(Object entity, String requestPath)"https://localhost:8080/rest/users?offset=50&limit=25" Link: <https://localhost:8080/rest/users?offset=25&limit=25>; rel="previous", <https://localhost:8080/rest/users?offset=75&limit=25>; rel="next"static voidbuildPhoneEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)static List<DataEntity>buildRelationshipEntities(List<org.exoplatform.social.core.relationship.model.Relationship> relationships, javax.ws.rs.core.UriInfo uriInfo)static voidbuildUrlEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)static SpaceMembershipEntitycreateSpaceMembershipForIgnoredStatus(org.exoplatform.social.core.space.model.Space space, String userId, String type, String restPath, String expand)update the SpaceMemberShip between the user and the space as ignored and then update also the MemberShipType used in SpaceMembershipRestResourcesV1.javastatic booleanexpandSubComments(String expand)static <T> TfromJsonString(String value, Class<T> resultClass)static org.exoplatform.social.core.manager.ActivityManagergetActivityManager()static StringgetCommentsActivityRestUrl(String activityId, String restPath)Get the rest url in order to load all comments of an activitystatic org.exoplatform.social.core.manager.IdentityManagergetIdentityManager()static StringgetLikesActivityRestUrl(String activityId, String restPath)Get the rest url in order to load all likes of an activitystatic StringgetMembersSpaceRestUrl(String id, boolean returnManager, String restPath)Get the rest url to load all members or managers of a spacestatic org.exoplatform.services.organization.OrganizationServicegetOrganizationService()static org.exoplatform.social.core.manager.RelationshipManagergetRelationshipManager()static javax.ws.rs.core.ResponsegetResponse(Object entity, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.Response.Status status)Gets the response object constructed from the provided params.static javax.ws.rs.core.Response.ResponseBuildergetResponseBuilder(Object entity, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.Response.Status status)Gets the response builder object constructed from the provided params.static org.exoplatform.social.core.space.spi.SpaceServicegetSpaceService()static StringtoJsonString(Object object)
-
-
-
Field Detail
-
GROUP_SPACE_BINDING_REPORT_OPERATIONS_TYPE
public static final String GROUP_SPACE_BINDING_REPORT_OPERATIONS_TYPE
Group Space Binding- See Also:
- Constant Field Values
-
USERS_TYPE
public static final String USERS_TYPE
- See Also:
- Constant Field Values
-
USERS_RELATIONSHIP_TYPE
public static final String USERS_RELATIONSHIP_TYPE
- See Also:
- Constant Field Values
-
USER_ACTIVITY_TYPE
public static final String USER_ACTIVITY_TYPE
- See Also:
- Constant Field Values
-
IDENTITIES_TYPE
public static final String IDENTITIES_TYPE
- See Also:
- Constant Field Values
-
SPACES_TYPE
public static final String SPACES_TYPE
- See Also:
- Constant Field Values
-
SPACES_MEMBERSHIP_TYPE
public static final String SPACES_MEMBERSHIP_TYPE
- See Also:
- Constant Field Values
-
SPACE_ACTIVITY_TYPE
public static final String SPACE_ACTIVITY_TYPE
- See Also:
- Constant Field Values
-
ACTIVITIES_TYPE
public static final String ACTIVITIES_TYPE
- See Also:
- Constant Field Values
-
ACTIVITY_IDS_TYPE
public static final String ACTIVITY_IDS_TYPE
- See Also:
- Constant Field Values
-
COMMENTS_TYPE
public static final String COMMENTS_TYPE
- See Also:
- Constant Field Values
-
COMMENTS_PREVIEW_TYPE
public static final String COMMENTS_PREVIEW_TYPE
- See Also:
- Constant Field Values
-
COMMENTS_PREVIEW_LIMIT
public static final int COMMENTS_PREVIEW_LIMIT
- See Also:
- Constant Field Values
-
LIKES_TYPE
public static final String LIKES_TYPE
- See Also:
- Constant Field Values
-
LIKES_COUNT_TYPE
public static final String LIKES_COUNT_TYPE
- See Also:
- Constant Field Values
-
COMMENTS_COUNT_TYPE
public static final String COMMENTS_COUNT_TYPE
- See Also:
- Constant Field Values
-
KEY
public static final String KEY
- See Also:
- Constant Field Values
-
VALUE
public static final String VALUE
- See Also:
- Constant Field Values
-
GROUP_SPACE_BINDING_TYPE
public static final String GROUP_SPACE_BINDING_TYPE
Group Space Binding- See Also:
- Constant Field Values
-
ORGANIZATION_GROUP_TYPE
public static final String ORGANIZATION_GROUP_TYPE
Child Groups of group root- See Also:
- Constant Field Values
-
REDACTOR_MEMBERSHIP
public static final String REDACTOR_MEMBERSHIP
- See Also:
- Constant Field Values
-
NO_CACHE_CC
public static final javax.ws.rs.core.CacheControl NO_CACHE_CC
-
-
Method Detail
-
buildEntityIdentity
public static IdentityEntity buildEntityIdentity(org.exoplatform.social.core.identity.model.Identity identity, String restPath, String expand)
Get a IdentityEntity from an identity in order to build a json object for the rest service- Parameters:
identity- the provided identityrestPath- base REST pathexpand- which fields to expand from profile or space- Returns:
- a hash map
-
buildEntityIdentity
public static IdentityEntity buildEntityIdentity(String userName, String restPath, String expand)
-
buildEntityProfile
public static ProfileEntity buildEntityProfile(org.exoplatform.social.core.space.model.Space space, org.exoplatform.social.core.identity.model.Profile profile, String path, String expand)
-
buildEntityProfile
public static ProfileEntity buildEntityProfile(org.exoplatform.social.core.identity.model.Profile profile, String restPath, String expand)
-
buildPhoneEntities
public static void buildPhoneEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)
-
buildImEntities
public static void buildImEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)
-
buildUrlEntities
public static void buildUrlEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)
-
buildExperienceEntities
public static void buildExperienceEntities(org.exoplatform.social.core.identity.model.Profile profile, ProfileEntity userEntity)
-
buildEntityProfile
public static ProfileEntity buildEntityProfile(String userName, String restPath, String expand)
-
buildEntityProfiles
public static List<DataEntity> buildEntityProfiles(String[] userNames, String restPath, String expand)
-
buildEntityFromSpace
public static SpaceEntity buildEntityFromSpace(org.exoplatform.social.core.space.model.Space space, String userId, String restPath, String expand)
Get a hash map from a space in order to build a json object for the rest service- Parameters:
space- the provided spaceuserId- the user's remote idrestPath- base REST pathexpand- which fields to expand from space- Returns:
- a hash map
-
buildEntityFromSpaceMembership
public static SpaceMembershipEntity buildEntityFromSpaceMembership(org.exoplatform.social.core.space.model.Space space, String userId, String type, String restPath, String expand)
Get a hash map from a space in order to build a json object for the rest service- Parameters:
space- the provided spaceuserId- the user's remote idtype- membership typerestPath- base REST pathexpand- which fields to expand from space- Returns:
- a hash map
-
buildEntityFromActivity
public static ActivityEntity buildEntityFromActivity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUser, String restPath, String expand)
-
buildActivityFromEntity
public static void buildActivityFromEntity(ActivityEntity model, org.exoplatform.social.core.activity.model.ExoSocialActivity activity)
-
buildActivityParamsFromEntity
public static void buildActivityParamsFromEntity(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, Map<String,?> templateParams)
-
expandSubComments
public static boolean expandSubComments(String expand)
-
buildEntityFromComment
public static CommentEntity buildEntityFromComment(org.exoplatform.social.core.activity.model.ExoSocialActivity comment, org.exoplatform.social.core.identity.model.Identity authentiatedUser, String restPath, String expand, boolean isBuildList)
-
buildEntityFromComment
public static List<DataEntity> buildEntityFromComment(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUser, String restPath, String expand, boolean sortDescending, int offset, int limit)
-
buildEntityFromLike
public static List<DataEntity> buildEntityFromLike(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, String restPath, String expand, int offset, int limit)
-
buildEntityRelationship
public static RelationshipEntity buildEntityRelationship(org.exoplatform.social.core.relationship.model.Relationship relationship, String restPath, String expand, boolean isSymetric)
Get a RelationshipEntity from a relationship in order to build a json object for the rest service- Parameters:
relationship- the provided relationshiprestPath- base REST pathexpand- which fields to expand from relationship and identitiesisSymetric- whether the relationship is semetric or not- Returns:
- a RelationshipEntity
-
buildRelationshipEntities
public static List<DataEntity> buildRelationshipEntities(List<org.exoplatform.social.core.relationship.model.Relationship> relationships, javax.ws.rs.core.UriInfo uriInfo)
-
createSpaceMembershipForIgnoredStatus
public static SpaceMembershipEntity createSpaceMembershipForIgnoredStatus(org.exoplatform.social.core.space.model.Space space, String userId, String type, String restPath, String expand)
update the SpaceMemberShip between the user and the space as ignored and then update also the MemberShipType used in SpaceMembershipRestResourcesV1.java- Parameters:
space- suggested space to ignoreuserId- user ignoring suggested spacetype- role to use for space membershiprestPath- base REST pathexpand- which fields to expand from relationship and identities- Returns:
- built
SpaceMembershipEntity
-
getMembersSpaceRestUrl
public static String getMembersSpaceRestUrl(String id, boolean returnManager, String restPath)
Get the rest url to load all members or managers of a space- Parameters:
id- the id of spacereturnManager- return managers or membersrestPath- base REST path- Returns:
- rest url to load all members or managers of a space
-
getCommentsActivityRestUrl
public static String getCommentsActivityRestUrl(String activityId, String restPath)
Get the rest url in order to load all comments of an activity- Parameters:
activityId- activity's idrestPath- base REST path- Returns:
- path to access comments of the activity
-
getLikesActivityRestUrl
public static String getLikesActivityRestUrl(String activityId, String restPath)
Get the rest url in order to load all likes of an activity- Parameters:
activityId- activity's idrestPath- base REST path- Returns:
- path to access likes of the activity
-
getResponseBuilder
public static javax.ws.rs.core.Response.ResponseBuilder getResponseBuilder(Object entity, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.Response.Status status)
Gets the response builder object constructed from the provided params.- Parameters:
entity- the identityuriInfo- the uri request infomediaType- the media type to be returnedstatus- the status code- Returns:
- responseBuilder the response builder object
-
getResponse
public static javax.ws.rs.core.Response getResponse(Object entity, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.Response.Status status)
Gets the response object constructed from the provided params.- Parameters:
entity- the identityuriInfo- the uri request infomediaType- the media type to be returnedstatus- the status code- Returns:
- response the response object
-
buildLinkForHeader
public static Object buildLinkForHeader(Object entity, String requestPath)
"https://localhost:8080/rest/users?offset=50&limit=25" Link: <https://localhost:8080/rest/users?offset=25&limit=25>; rel="previous", <https://localhost:8080/rest/users?offset=75&limit=25>; rel="next"- Parameters:
entity- entity to compute its linkrequestPath- Request base path- Returns:
- Content of 'Link' header
-
buildEntityFromGroupSpaceBinding
public static GroupSpaceBindingEntity buildEntityFromGroupSpaceBinding(org.exoplatform.social.core.binding.model.GroupSpaceBinding binding)
Build rest binding entity from GroupSpaceBinding object- Parameters:
binding- the GroupSpaceBinding object- Returns:
- the GroupSpaceBindingEntity rest object
-
buildEntityFromGroup
public static GroupNodeEntity buildEntityFromGroup(org.exoplatform.services.organization.Group group)
Build rest group entity from group object- Parameters:
group- the group object- Returns:
- the groupNodeEntity rest object
-
buildEntityFromGroupId
public static GroupNodeEntity buildEntityFromGroupId(String group)
Build rest group entity from group name- Parameters:
group- the group name- Returns:
- the groupNodeEntity rest object
-
buildEntityFromGroupSpaceBindingOperationReport
public static GroupSpaceBindingOperationReportEntity buildEntityFromGroupSpaceBindingOperationReport(org.exoplatform.social.core.binding.model.GroupSpaceBindingOperationReport bindingOperationReport)
Build rest bindingOperationReport entity from bindingOperationReport object- Parameters:
bindingOperationReport- the bindingOperationReport object- Returns:
- the bindingOperationReport rest object
-
getActivityManager
public static org.exoplatform.social.core.manager.ActivityManager getActivityManager()
-
getIdentityManager
public static org.exoplatform.social.core.manager.IdentityManager getIdentityManager()
-
getSpaceService
public static org.exoplatform.social.core.space.spi.SpaceService getSpaceService()
-
getOrganizationService
public static org.exoplatform.services.organization.OrganizationService getOrganizationService()
-
getRelationshipManager
public static org.exoplatform.social.core.manager.RelationshipManager getRelationshipManager()
-
-