示例#1
0
    public void execute(Event<UIMembersPortlet> event) throws Exception {
      UIMembersPortlet uiAllPeople = event.getSource();
      String userId = event.getRequestContext().getRequestParameter(OBJECTID);
      Identity inviIdentityIdentity = Utils.getIdentityManager().getIdentity(userId, true);
      Identity invitingIdentity = Utils.getViewerIdentity();

      Relationship relationship =
          Utils.getRelationshipManager().get(invitingIdentity, inviIdentityIdentity);

      uiAllPeople.setLoadAtEnd(false);
      if (relationship != null && relationship.getStatus() == Relationship.Type.CONFIRMED) {
        Utils.getRelationshipManager().delete(relationship);
        return;
      }

      if (relationship == null) {
        UIApplication uiApplication = event.getRequestContext().getUIApplication();
        uiApplication.addMessage(
            new ApplicationMessage(INVITATION_REVOKED_INFO, null, ApplicationMessage.INFO));
        return;
      }

      Utils.clearCacheOnUserPopup();
      Utils.getRelationshipManager().deny(inviIdentityIdentity, invitingIdentity);
    }
    @Override
    public void execute(Event<UIInvitations> event) throws Exception {
      UIInvitations uiInvitations = event.getSource();
      String identityId = event.getRequestContext().getRequestParameter(OBJECTID);
      Identity invitedIdentity = Utils.getIdentityManager().getIdentity(identityId, true);
      Identity invitingIdentity = Utils.getViewerIdentity();

      Relationship relationship =
          Utils.getRelationshipManager().get(invitingIdentity, invitedIdentity);
      uiInvitations.setLoadAtEnd(false);
      if (relationship == null || relationship.getStatus() != Relationship.Type.PENDING) {
        UIApplication uiApplication = event.getRequestContext().getUIApplication();
        uiApplication.addMessage(
            new ApplicationMessage(INVITATION_REVOKED_INFO, null, ApplicationMessage.INFO));
        return;
      }

      Utils.getRelationshipManager().deny(invitedIdentity, invitingIdentity);
      Utils.clearCacheOnUserPopup();
      event.getRequestContext().addUIComponentToUpdateByAjax(uiInvitations);
    }
示例#3
0
    public void execute(Event<UIMembersPortlet> event) throws Exception {
      UIMembersPortlet uiAllPeople = event.getSource();
      String userId = event.getRequestContext().getRequestParameter(OBJECTID);
      Identity invitedIdentity = Utils.getIdentityManager().getIdentity(userId, true);
      Identity invitingIdentity = Utils.getViewerIdentity();

      Relationship relationship =
          Utils.getRelationshipManager().get(invitingIdentity, invitedIdentity);
      uiAllPeople.setLoadAtEnd(false);

      if (relationship != null) {
        UIApplication uiApplication = event.getRequestContext().getUIApplication();
        uiApplication.addMessage(
            new ApplicationMessage(INVITATION_ESTABLISHED_INFO, null, ApplicationMessage.INFO));
        return;
      }

      Utils.getRelationshipManager().inviteToConnect(invitingIdentity, invitedIdentity);
      Utils.clearCacheOnUserPopup();
      event.getRequestContext().addUIComponentToUpdateByAjax(uiAllPeople);
    }
  private List<Identity> loadPeople(int index, int length) throws Exception {

    lastOwner = Utils.getOwnerIdentity();

    ProfileFilter filter = uiProfileUserSearch.getProfileFilter();

    ListAccess<Identity> listAccess =
        Utils.getRelationshipManager().getIncomingByFilter(lastOwner, filter);
    Identity[] identities = listAccess.load(index, length);

    setPeopleNum(
        identities.length < RECEIVED_INVITATION_PER_PAGE
            ? identities.length
            : listAccess.getSize());

    setPeopleListAccess(listAccess);
    uiProfileUserSearch.setPeopleNum(getPeopleNum());

    return Arrays.asList(identities);
  }