if (size > 0) { suggestions = relationshipManager.getSuggestions(identity, 20, 50, 10); if (suggestions.size() == 1 && suggestions.keySet().iterator().next().getRemoteId().equals(userACL.getSuperUser())) { suggestions = new LinkedHashMap<Identity, Integer>(); for (Identity id : identities) { if (identity.equals(id) || relationshipManager.get(identity, id) != null) continue; suggestions.put(id, new Integer(0)); Identity id = suggestion.getKey(); if (id.getRemoteId().equals(userACL.getSuperUser())) continue; JSONObject json = new JSONObject(); Profile socialProfile = id.getProfile(); String avatar = socialProfile.getAvatarUrl(); if (avatar == null) { position = ""; json.put("username", id.getRemoteId()); json.put("suggestionName", socialProfile.getFullName()); json.put("suggestionId", id.getId()); json.put("avatar", avatar); json.put("profile", socialProfile.getUrl());
@GET @Path("contacts/pending") public Response getPending(@Context SecurityContext sc, @Context UriInfo uriInfo) { try { String userId = getUserId(sc, uriInfo); if (userId == null) { return Response.status(HTTPStatus.INTERNAL_ERROR).cacheControl(cacheControl).build(); } Identity identity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, userId); List<Relationship> relations = relationshipManager.getPending(identity); JSONArray jsonArray = new JSONArray(); for (Relationship relation : relations) { Identity senderId = relation.getSender(); Profile senderProfile = senderId.getProfile(); Identity receiverId = relation.getReceiver(); Profile receiverProfile = receiverId.getProfile(); JSONObject json = new JSONObject(); json.put("senderName", senderProfile.getFullName()); json.put("senderId", senderId.getId()); json.put("receiverName", receiverProfile.getFullName()); json.put("receiverId", receiverId.getId()); json.put("status", relation.getStatus()); jsonArray.put(json); } return Response.ok(jsonArray.toString(), MediaType.APPLICATION_JSON).cacheControl(cacheControl).build(); } catch (Exception e) { log.error("Error in people pending rest service: " + e.getMessage(), e); return Response.ok("error").cacheControl(cacheControl).build(); } }
JSONObject json = new JSONObject(); Identity userIdentity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, user,false); Profile userProfile = userIdentity.getProfile(); json.put("id", userProfile.getId()); json.put("profileUrl", LinkProvider.getUserProfileUri(userIdentity.getRemoteId())); json.put("avatar", userProfile.getAvatarImageSource() != null ? userProfile.getAvatarImageSource() : LinkProvider.PROFILE_DEFAULT_AVATAR_URL); jsonArray.put(json);
@GET @Path("contacts/incoming") public Response getIncoming(@Context SecurityContext sc, @Context UriInfo uriInfo) { try { String userId = getUserId(sc, uriInfo); if (userId == null) { return Response.status(HTTPStatus.INTERNAL_ERROR).cacheControl(cacheControl).build(); } Identity identity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, userId); List<Relationship> relations = relationshipManager.getIncoming(identity); JSONArray jsonArray = new JSONArray(); for (Relationship relation : relations) { Identity senderId = relation.getSender(); String avatar = senderId.getProfile().getAvatarImageSource(); if (avatar == null) { avatar = "/eXoSkin/skin/images/system/Avatar.gif"; } JSONObject json = new JSONObject(); json.put("senderName", senderId.getProfile().getFullName()); json.put("relationId", relation.getId()); json.put("avatar", avatar); json.put("profile", senderId.getProfile().getUrl()); jsonArray.put(json); } return Response.ok(jsonArray.toString(), MediaType.APPLICATION_JSON).cacheControl(cacheControl).build(); } catch (Exception e) { log.error("Error in people incoming rest service: " + e.getMessage(), e); return Response.status(HTTPStatus.INTERNAL_ERROR).cacheControl(cacheControl).build(); } }
if(spaceService.isMember(space, identity.getRemoteId())) { continue; if (Space.CLOSE.equals(space.getRegistration())) continue; if (!spaceService.isMember(space, connector.getRemoteId())) continue; if (!spaceService.isIgnored(space, connector.getRemoteId())) continue; Integer value = spacesWithMemberNum.get(space); if (Space.CLOSE.equals(space.getRegistration())) continue; if (spaceService.isMember(space, identity.getRemoteId())) continue; if (spaceService.isPendingUser(space, identity.getRemoteId())) continue; if (spaceService.isInvitedUser(space, identity.getRemoteId())) continue; if (spaceService.isIgnored(space, identity.getRemoteId())) continue; JSONObject json = buildJSONObject(space, 0);
@GET @Path("contacts/{identityId}/pending") public Response contactsPendingRequests(@PathParam("identityId") String identityId) { IdentityManager identityManager = (IdentityManager) ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(IdentityManager.class); Identity identity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, identityId); if (identity == null){ return Response.ok("identity null for "+identityId, MediaType.APPLICATION_JSON).cacheControl(cacheControl).build(); } RelationshipManager relationshipManager = (RelationshipManager) ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(RelationshipManager.class); List<Relationship> relations = relationshipManager.getIncoming(identity); ArrayList<Object> liste = new ArrayList<Object>(); for (Relationship relation : relations) { Relation rel = new Relation(); Identity contactIdentity = relation.getSender(); Profile profile = contactIdentity.getProfile(); rel.setRelationshipId(contactIdentity.getRemoteId()); rel.setRequesterName(profile.getFullName()); rel.setPosition(profile.getPosition()); rel.setAvatarUrl(profile.getAvatarUrl()); liste.add(rel); } return renderJSON(liste); }
String avatar = sender.getProfile().getAvatarImageSource(); JSONObject json = new JSONObject(); json.put(INVITATION_TYPE, PEOPLE_INVITATION_TYPE); json.put(SENDER_NAME, sender.getProfile().getFullName()); json.put(RELATION_ID, relationshipManager.get(identity, sender).getId()); json.put(SENDER_AVATAR_URL, avatar); json.put(SENDER_POSITION, sender.getProfile().getPosition()); json.put(SENDER_PROFILE_URL, sender.getProfile().getUrl()); jsonArray.put(json);
Profile profile = identity.getProfile(); ListAccess<Identity> confirmedContacts = relationshipManager.getConnections(identity); for(Identity contact : myConnections){ profile = contact.getProfile(); contactBean.setId(contact.getRemoteId()); contactBean.setFullName(profile.getFullName()); contactBean.setAvatarUrl(profile.getAvatarUrl()); ExoSocialActivity[] latestAct = activities.load(0, 1); contactBean.setLatestActivity((latestAct.length == 0) ? null : latestAct[0].getTitle()); String profileLink = LinkProvider.getProfileLink(contact.getRemoteId()); contactBean.setProfileLink(profileLink);
@SuppressWarnings("deprecation") private boolean hasAvatar(String userId) { try { IdentityManager identityManager = (IdentityManager) ExoContainerContext.getCurrentContainer() .getComponentInstanceOfType(IdentityManager.class); Identity identity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, userId); Profile profile = identity.getProfile(); if (profile.getAvatarUrl() != null) return true; else return false; } catch (Exception e) { LOG.debug("Error in gettingStarted REST service: " + e.getMessage(), e); return false; } }
@SuppressWarnings("deprecation") public boolean hasAvatar(String userId) { try { IdentityManager identityManager = (IdentityManager) ExoContainerContext.getCurrentContainer() .getComponentInstanceOfType(IdentityManager.class); Identity identity = identityManager.getOrCreateIdentity(OrganizationIdentityProvider.NAME, userId); Profile profile = identity.getProfile(); if (profile.getAvatarUrl() != null) return true; else return false; } catch (Exception e) { LOG.debug("Error in gettingStarted REST service: " + e.getMessage(), e); return false; } }
IdentityManager iManager = (IdentityManager) portalContainer.getComponentInstanceOfType(IdentityManager.class); Identity spaceIdentity = iManager.getOrCreateIdentity(SpaceIdentityProvider.NAME, spaceNode.getProperty("soc:name").getString(), true); Profile profile = spaceIdentity.getProfile(); avartarUrl =profile.getAvatarUrl(); space.setAvatarURL(avartarUrl);
Profile p = identity.getProfile();