@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; } }
@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; } }
JSONObject json = new JSONObject(); Profile socialProfile = id.getProfile(); String avatar = socialProfile.getAvatarUrl(); if (avatar == null) { avatar = DEFAULT_AVATAR;
Identity spaceIdentity = iManager.getOrCreateIdentity(SpaceIdentityProvider.NAME, spaceNode.getProperty("soc:name").getString(), true); Profile profile = spaceIdentity.getProfile(); avartarUrl =profile.getAvatarUrl(); space.setAvatarURL(avartarUrl);
@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); }
contactBean.setId(contact.getRemoteId()); contactBean.setFullName(profile.getFullName()); contactBean.setAvatarUrl(profile.getAvatarUrl()); Object position = profile.getProperty("position"); contactBean.setPosition(position == null ? null : position.toString());