Beispiel #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);
    }
Beispiel #2
0
 /**
  * initialize members, called from {@link #getMembers()}
  *
  * @throws Exception
  */
 public void initMember() throws Exception {
   try {
     setLoadAtEnd(false);
     enableLoadNext = false;
     currentLoadIndex = 0;
     setSelectedChar(ALL_FILTER);
     memberProfileFilter = new ProfileFilter();
     memberProfileFilter.getExcludedIdentityList().add(Utils.getViewerIdentity());
     uiSearchMemberOfSpace.setProfileFilter(memberProfileFilter);
   } catch (Exception e) {
     LOG.error(e.getMessage(), e);
   }
 }
 /**
  * Inits at the first loading.
  *
  * @since 1.2.2
  */
 public void init() {
   try {
     setLoadAtEnd(false);
     enableLoadNext = false;
     currentLoadIndex = 0;
     loadingCapacity = RECEIVED_INVITATION_PER_PAGE;
     peopleList = new ArrayList<Identity>();
     List<Identity> excludedIdentityList = new ArrayList<Identity>();
     excludedIdentityList.add(Utils.getViewerIdentity());
     uiProfileUserSearch.getProfileFilter().setExcludedIdentityList(excludedIdentityList);
     // setPeopleList(loadPeople(currentLoadIndex, loadingCapacity));
   } catch (Exception e) {
     LOG.error(e.getMessage(), e);
   }
 }
    @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);
    }
Beispiel #5
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);
    }