Package org.exoplatform.social.rest.api
Class EntityBuilder
java.lang.Object
org.exoplatform.social.rest.api.EntityBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final StringGroup Space Bindingstatic final StringGroup Space Bindingstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final javax.ws.rs.core.CacheControlstatic final StringChild Groups of group rootstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 objectbuildEntityFromGroupSpaceBindingOperationReport(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 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 ProfilePropertySettingEntitybuildEntityProfilePropertySetting(org.exoplatform.social.core.profileproperty.model.ProfilePropertySetting profilePropertySetting, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, String objectType) Build rest ProfilePropertySettingEntity from ProfilePropertySetting objectstatic List<ProfilePropertySettingEntity> buildEntityProfilePropertySettingList(List<org.exoplatform.social.core.profileproperty.model.ProfilePropertySetting> profilePropertySettingList, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, String objectType, long userIdentityId) Build rest ProfilePropertySettingEntity list from ProfilePropertySetting objects liststatic 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 org.exoplatform.social.core.profileproperty.model.ProfilePropertySettingbuildProfilePropertySettingFromEntity(ProfilePropertySettingEntity profilePropertySettingEntity, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService) Build ProfilePropertySetting from ProfilePropertySettingEntity objectstatic List<ProfilePropertySettingEntity> buildProperties(org.exoplatform.social.core.identity.model.Profile profile, List<Long> hiddenProfileProperties) static List<DataEntity> buildRelationshipEntities(List<org.exoplatform.social.core.relationship.model.Relationship> relationships, javax.ws.rs.core.UriInfo uriInfo) static List<SiteEntity> buildSiteEntities(List<org.exoplatform.portal.config.model.PortalConfig> sites, jakarta.servlet.http.HttpServletRequest request, boolean expandNavigations, List<String> visibilityNames, boolean excludeEmptyNavigationSites, boolean temporalCheck, boolean excludeGroupNodesWithoutPageChildNodes, boolean filterByPermission, boolean sortByDisplayOrder, Locale locale) static SiteEntitybuildSiteEntity(org.exoplatform.portal.config.model.PortalConfig site, jakarta.servlet.http.HttpServletRequest request, boolean expandNavigations, List<String> visibilityNames, boolean excludeEmptyNavigationSites, boolean temporalCheck, boolean excludeGroupNodesWithoutPageChildNodes, Locale locale) 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 final <T> TfromJsonString(String value, Class<T> resultClass) static org.exoplatform.social.core.manager.ActivityManagerstatic StringgetCommentsActivityRestUrl(String activityId, String restPath) Get the rest url in order to load all comments of an activitystatic org.exoplatform.social.core.manager.IdentityManagerstatic StringgetLikesActivityRestUrl(String activityId, String restPath) Get the rest url in order to load all likes of an activitystatic org.exoplatform.services.organization.OrganizationServicestatic org.exoplatform.social.core.manager.RelationshipManagerstatic 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.SpaceServicestatic StringgetTranslatedLabel(String fieldName, long siteId, Locale locale) static Map<String, List<MetadataItemEntity>> retrieveMetadataItems(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUser) static StringtoJsonString(Object object)
-
Field Details
-
GROUP_SPACE_BINDING_REPORT_OPERATIONS_TYPE
Group Space Binding- See Also:
-
USERS_TYPE
- See Also:
-
USERS_RELATIONSHIP_TYPE
- See Also:
-
USER_ACTIVITY_TYPE
- See Also:
-
IDENTITIES_TYPE
- See Also:
-
SPACES_TYPE
- See Also:
-
SPACES_MEMBERSHIP_TYPE
- See Also:
-
SPACE_ACTIVITY_TYPE
- See Also:
-
ACTIVITIES_TYPE
- See Also:
-
ACTIVITY_IDS_TYPE
- See Also:
-
COMMENTS_TYPE
- See Also:
-
COMMENTS_PREVIEW_TYPE
- See Also:
-
COMMENTS_PREVIEW_LIMIT
public static final int COMMENTS_PREVIEW_LIMIT- See Also:
-
LIKES_TYPE
- See Also:
-
LIKES_COUNT_TYPE
- See Also:
-
COMMENTS_COUNT_TYPE
- See Also:
-
KEY
- See Also:
-
VALUE
- See Also:
-
GROUP_SPACE_BINDING_TYPE
Group Space Binding- See Also:
-
ORGANIZATION_GROUP_TYPE
Child Groups of group root- See Also:
-
MANAGER
- See Also:
-
REDACTOR_MEMBERSHIP
- See Also:
-
PUBLISHER_MEMBERSHIP
- See Also:
-
NO_CACHE_CC
public static final javax.ws.rs.core.CacheControl NO_CACHE_CC -
GROUP
- See Also:
-
SETTINGS
- See Also:
-
USER_CARD_SETTINGS
- See Also:
-
-
Method Details
-
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
-
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 expand) -
buildEntityProfile
public static ProfileEntity buildEntityProfile(org.exoplatform.social.core.identity.model.Profile profile, String restPath, String expand) -
buildProperties
public static List<ProfilePropertySettingEntity> buildProperties(org.exoplatform.social.core.identity.model.Profile profile, List<Long> hiddenProfileProperties) -
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
-
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) -
retrieveMetadataItems
public static Map<String,List<MetadataItemEntity>> retrieveMetadataItems(org.exoplatform.social.core.activity.model.ExoSocialActivity activity, org.exoplatform.social.core.identity.model.Identity authentiatedUser) -
buildActivityFromEntity
public static void buildActivityFromEntity(ActivityEntity model, org.exoplatform.social.core.activity.model.ExoSocialActivity activity) -
buildActivityParamsFromEntity
-
expandSubComments
-
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
-
getCommentsActivityRestUrl
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
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
"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
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
-
buildEntityProfilePropertySetting
public static ProfilePropertySettingEntity buildEntityProfilePropertySetting(org.exoplatform.social.core.profileproperty.model.ProfilePropertySetting profilePropertySetting, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, String objectType) Build rest ProfilePropertySettingEntity from ProfilePropertySetting object- Parameters:
profilePropertySetting- the ProfilePropertySetting object- Returns:
- the ProfilePropertySettingEntity rest object
-
buildEntityProfilePropertySettingList
public static List<ProfilePropertySettingEntity> buildEntityProfilePropertySettingList(List<org.exoplatform.social.core.profileproperty.model.ProfilePropertySetting> profilePropertySettingList, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService, String objectType, long userIdentityId) Build rest ProfilePropertySettingEntity list from ProfilePropertySetting objects list- Parameters:
profilePropertySettingList- the ProfilePropertySetting objects listuserIdentityId- user identity id- Returns:
- the ProfilePropertySettingEntity rest objects list
-
buildProfilePropertySettingFromEntity
public static org.exoplatform.social.core.profileproperty.model.ProfilePropertySetting buildProfilePropertySettingFromEntity(ProfilePropertySettingEntity profilePropertySettingEntity, org.exoplatform.social.core.profileproperty.ProfilePropertyService profilePropertyService) Build ProfilePropertySetting from ProfilePropertySettingEntity object- Parameters:
profilePropertySettingEntity- the ProfilePropertySettingEntity object- Returns:
- the ProfilePropertySetting object
-
fromJsonString
-
toJsonString
-
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() -
buildSiteEntities
public static List<SiteEntity> buildSiteEntities(List<org.exoplatform.portal.config.model.PortalConfig> sites, jakarta.servlet.http.HttpServletRequest request, boolean expandNavigations, List<String> visibilityNames, boolean excludeEmptyNavigationSites, boolean temporalCheck, boolean excludeGroupNodesWithoutPageChildNodes, boolean filterByPermission, boolean sortByDisplayOrder, Locale locale) throws Exception - Throws:
Exception
-
buildSiteEntity
public static SiteEntity buildSiteEntity(org.exoplatform.portal.config.model.PortalConfig site, jakarta.servlet.http.HttpServletRequest request, boolean expandNavigations, List<String> visibilityNames, boolean excludeEmptyNavigationSites, boolean temporalCheck, boolean excludeGroupNodesWithoutPageChildNodes, Locale locale) throws Exception - Throws:
Exception
-
getTranslatedLabel
-