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); }
/** * 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<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); }
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); }