Esempio n. 1
0
 /**
  * Constructor to initialize iterator.
  *
  * @throws Exception
  */
 public UIInvitations() throws Exception {
   uiProfileUserSearch = createUIComponent(UIProfileUserSearch.class, null, "UIProfileUserSearch");
   uiProfileUserSearch.setTypeOfRelation(INCOMING_STATUS);
   setHasPeopleTab(true);
   uiProfileUserSearch.setHasConnectionLink(false);
   uiProfileUserSearch.setLoadFromSearch(false);
   addChild(uiProfileUserSearch);
   init();
 }
Esempio n. 2
0
  /**
   * constructor
   *
   * @throws Exception
   */
  public UIMembersPortlet() throws Exception {
    uiSearchMemberOfSpace =
        createUIComponent(UIProfileUserSearch.class, null, "UIProfileUserSearch");
    uiSearchMemberOfSpace.setTypeOfRelation(SPACE_MEMBER);
    uiSearchMemberOfSpace.setSpaceURL(getSpace().getUrl());
    uiSearchMemberOfSpace.setHasPeopleTab(false);
    addChild(uiSearchMemberOfSpace);

    initMember();
    initManager();
  }
Esempio n. 3
0
  /**
   * Gets list of all type of people.
   *
   * @return the peopleList
   * @throws Exception
   * @since 1.2.2
   */
  public List<Identity> getPeopleList() throws Exception {
    if (!uiProfileUserSearch.isLoadFromSearch()) {
      this.peopleList = loadPeople(0, currentLoadIndex + loadingCapacity);
    }
    uiProfileUserSearch.setLoadFromSearch(false);

    int realPeopleListSize = this.peopleList.size();

    setEnableLoadNext(
        (realPeopleListSize >= RECEIVED_INVITATION_PER_PAGE)
            && (realPeopleListSize < getPeopleNum()));

    return this.peopleList;
  }
Esempio n. 4
0
  private List<Identity> loadPeople(int index, int length, Type type) throws Exception {
    Identity[] result = null;
    Space space = getSpace();
    if (Type.MEMBER.equals(type)) {
      ProfileFilter filter = uiSearchMemberOfSpace.getProfileFilter();
      setMemberListAccess(
          Utils.getIdentityManager().getSpaceIdentityByProfileFilter(space, filter, type, true));

      setMemberNum(getMemberListAccess().getSize());
      uiSearchMemberOfSpace.setPeopleNum(getMemberNum());
      result = getMemberListAccess().load(index, length);
    } else if (Type.MANAGER.equals(type)) {
      ProfileFilter filter = uiSearchMemberOfSpace.getProfileFilter();
      setManagerListAccess(
          Utils.getIdentityManager().getSpaceIdentityByProfileFilter(space, filter, type, true));
      result = getManagerListAccess().load(index, length);
    }
    return Arrays.asList(result);
  }
Esempio n. 5
0
  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);
  }
Esempio n. 6
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);
   }
 }
Esempio n. 7
0
 /**
  * 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);
   }
 }
Esempio n. 8
0
    @Override
    public void execute(Event<UIInvitations> event) throws Exception {
      UIInvitations uiInvitations = event.getSource();

      WebuiRequestContext ctx = event.getRequestContext();
      UIProfileUserSearch uiSearch = uiInvitations.uiProfileUserSearch;

      String charSearch = ctx.getRequestParameter(OBJECTID);
      ProfileFilter filter = uiInvitations.uiProfileUserSearch.getProfileFilter();

      try {
        uiInvitations.setSelectedChar(charSearch);
        if (charSearch != null) { // search by alphabet
          filter.setName(charSearch);
          filter.setPosition("");
          filter.setSkills("");
          filter.setFirstCharacterOfName(charSearch.toCharArray()[0]);
          if (UIProfileUserSearch.ALL_FILTER.equals(charSearch)) {
            filter.setFirstCharacterOfName(UIProfileUserSearch.EMPTY_CHARACTER);
            filter.setName("");
          }
          uiSearch.setRawSearchConditional("");
        } else if (UIProfileUserSearch.ALL_FILTER.equals(uiSearch.getRawSearchConditional())) {
          uiInvitations.setSelectedChar(UIProfileUserSearch.ALL_FILTER);
        }

        uiSearch.setProfileFilter(filter);
        uiSearch.setNewSearch(true);
        uiInvitations.uiProfileUserSearch.setLoadFromSearch(true);
      } catch (Exception e) {
        uiSearch.setIdentityList(new ArrayList<Identity>());
      }

      uiInvitations.loadSearch();
      uiInvitations.setLoadAtEnd(false);
    }
Esempio n. 9
0
    @Override
    public void execute(Event<UIMembersPortlet> event) throws Exception {
      WebuiRequestContext ctx = event.getRequestContext();
      UIMembersPortlet uiMembersPortlet = event.getSource();

      UIProfileUserSearch uiSearch = uiMembersPortlet.uiSearchMemberOfSpace;

      String charSearch = ctx.getRequestParameter(OBJECTID);

      ResourceBundle resApp = ctx.getApplicationResourceBundle();

      String defaultNameVal = resApp.getString(uiSearch.getId() + ".label.name");
      String defaultPosVal = resApp.getString(uiSearch.getId() + ".label.position");
      String defaultSkillsVal = resApp.getString(uiSearch.getId() + ".label.skills");

      ProfileFilter filter = uiSearch.getProfileFilter();

      try {
        uiMembersPortlet.setSelectedChar(charSearch);
        if (charSearch != null) { // search by alphabet
          ((UIFormStringInput) uiSearch.getChildById(SEARCH)).setValue(defaultNameVal);
          ((UIFormStringInput) uiSearch.getChildById(Profile.POSITION)).setValue(defaultPosVal);
          ((UIFormStringInput) uiSearch.getChildById(Profile.EXPERIENCES_SKILLS))
              .setValue(defaultSkillsVal);
          filter.setName(charSearch);
          filter.setPosition("");
          filter.setSkills("");
          filter.setFirstCharacterOfName(charSearch.toCharArray()[0]);
          if (ALL_FILTER.equals(charSearch)) {
            filter.setFirstCharacterOfName(EMPTY_CHARACTER);
            filter.setName("");
          }
          uiSearch.setRawSearchConditional("");
        }

        uiSearch.setProfileFilter(filter);
        uiSearch.setNewSearch(true);
      } catch (Exception e) {
        uiSearch.setIdentityList(new ArrayList<Identity>());
      }

      uiMembersPortlet.loadSearch();
      uiMembersPortlet.setLoadAtEnd(false);
    }