private boolean hasJoinRequest(Site site) { List<JoinSiteRequestImpl> requestedSites = getJoinSiteRequests(); for (JoinSiteRequestImpl joinSiteRequest : requestedSites) { if (site.getIdentifier().equals(joinSiteRequest.getSiteShortName())) { return true; } } return false; }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") protected List<JoinSiteRequestImpl> getJoinSiteRequests() { List<JoinSiteRequestImpl> requestList = new ArrayList<JoinSiteRequestImpl>(); try { // build URL String link = OnPremiseUrlRegistry.getJoinRequestSiteUrl(session, session.getPersonIdentifier()); UrlBuilder url = new UrlBuilder(link); // send and parse HttpUtils.Response resp = read(url, ErrorCodeRegistry.SITE_GENERIC); Map<String, Object> json = JsonUtils.parseObject(resp.getStream(), resp.getCharset()); List<Object> jo = (List<Object>) json.get(OnPremiseConstant.DATA_VALUE); for (Object obj : jo) { requestList.add(JoinSiteRequestImpl.parseJson((Map<String, Object>) obj)); } } catch (Exception e) { convertException(e); } return requestList; }
/** {@inheritDoc} */ protected String getCancelJoinSiteRequestUrl(JoinSiteRequestImpl joinSiteRequest) { return OnPremiseUrlRegistry.getCancelJoinSiteRequestUrl( session, joinSiteRequest.getSiteShortName(), joinSiteRequest.getIdentifier()); }