List of usage examples for java.util SortedSet addAll
boolean addAll(Collection<? extends E> c);
From source file:org.etudes.component.app.melete.ModuleDB.java
protected List getAllMeleteResourcesOfCourse(String toDelCourseId) { List allres = meleteCHService .getListofMediaFromCollection("/private/meleteDocs/" + toDelCourseId + "/uploads/"); ArrayList<String> allresNames = new ArrayList(); if (allres == null) return null; for (Iterator iter = allres.listIterator(); iter.hasNext();) { ContentResource cr = (ContentResource) iter.next(); allresNames.add(cr.getId());/*from w ww . j a v a 2 s .co m*/ } SortedSet s = new TreeSet(); s.addAll(allresNames); allresNames.clear(); allresNames.addAll(s); return allresNames; }
From source file:org.wso2.carbon.appmgt.impl.utils.AppManagerUtil.java
public static Set<AppStore> getExternalAPIStores() throws AppManagementException { SortedSet<AppStore> apistoreSet = new TreeSet<AppStore>(new APIStoreNameComparator()); AppManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); apistoreSet.addAll(config.getExternalAPIStores()); if (apistoreSet.size() != 0) { return apistoreSet; } else {/*from www .j a v a 2 s .c om*/ return null; } }
From source file:org.etudes.component.app.melete.ModuleDB.java
protected List getActiveResourcesFromList(List activenArchModules) { List<String> secEmbed = new ArrayList(); try {//from ww w . ja v a 2 s .com Iterator<Module> i = activenArchModules.iterator(); while (i.hasNext()) { Module mod = i.next(); Map sectionMap = mod.getSections(); Iterator it = sectionMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry) it.next(); Section sec = (Section) pairs.getValue(); if (sec == null || sec.getContentType() == null || sec.getContentType().equals("notype") || sec.getSectionResource() == null || sec.getSectionResource().getResource() == null) continue; if (sec.getContentType().equals("typeEditor")) { secEmbed.add(sec.getSectionResource().getResource().getResourceId()); List l = meleteCHService .findAllEmbeddedImages(sec.getSectionResource().getResource().getResourceId()); if (l != null) secEmbed.addAll(l); } else secEmbed.add(sec.getSectionResource().getResource().getResourceId()); } } // logger.debug("before sorting and removing dups" + secEmbed.size()); //sort list and remove duplicates SortedSet s = new TreeSet(); s.addAll(secEmbed); secEmbed.clear(); secEmbed.addAll(s); } catch (Exception e) { e.printStackTrace(); return null; } return secEmbed; }
From source file:org.wso2.carbon.appmgt.impl.utils.AppManagerUtil.java
public static Set<AppStore> getExternalAPIStores(Set<AppStore> inputStores) throws AppManagementException { SortedSet<AppStore> apiStores = new TreeSet<AppStore>(new APIStoreNameComparator()); AppManagerConfiguration config = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService() .getAPIManagerConfiguration(); apiStores.addAll(config.getExternalAPIStores()); boolean exists = false; if (apiStores.size() != 0) { for (AppStore store : apiStores) { for (AppStore inputStore : inputStores) { if (inputStore.getName().equals(store.getName())) { // If // the // configured // appstore // already // stored // in // db,ignore // adding // it // again exists = true;// w w w . j a v a 2s .com } } if (!exists) { inputStores.add(store); } exists = false; } } return inputStores; }
From source file:org.geoserver.security.GeoServerSecurityManager.java
/** * Calculates the union of roles from all role services and * adds {@link GeoServerRole#ANONYMOUS_ROLE} and {@link GeoServerRole#AUTHENTICATED_ROLE} * //from w w w .j ava2s. co m * @throws IOException */ public SortedSet<GeoServerRole> getRolesForAccessControl() throws IOException { SortedSet<GeoServerRole> allRoles = new TreeSet<GeoServerRole>(); for (String serviceName : listRoleServices()) { // catch the IOException for each role service. // As an example, it does not make sense to throw an IOException if // a jdbc connection cannot be established. try { allRoles.addAll(loadRoleService(serviceName).getRoles()); } catch (IOException ex) { LOGGER.log(Level.WARNING, ex.getMessage(), ex); } } allRoles.add(GeoServerRole.AUTHENTICATED_ROLE); allRoles.add(GeoServerRole.ANONYMOUS_ROLE); return allRoles; }
From source file:net.sourceforge.fenixedu.domain.StudentCurricularPlan.java
final public CurriculumLine getLastApprovement() { final SortedSet<CurriculumLine> curriculumLines = new TreeSet<CurriculumLine>( CurriculumLine.COMPARATOR_BY_APPROVEMENT_DATE_AND_ID); if (getRoot() != null) { for (final CurriculumModule module : getRoot().getCurriculumModulesSet()) { if (!module.isNoCourseGroupCurriculumGroup()) { module.addApprovedCurriculumLines(curriculumLines); }/*from w w w. j a v a 2s .c o m*/ } } else { curriculumLines.addAll(getAprovedEnrolments()); } return curriculumLines.isEmpty() ? null : curriculumLines.last(); }
From source file:org.wso2.carbon.appmgt.impl.APIConsumerImpl.java
/** * Get the recently added APIs set//from w w w. ja v a2s .c o m * * @param limit no limit. Return everything else, limit the return list to specified value. * @return Set<WebApp> * @throws org.wso2.carbon.appmgt.api.AppManagementException */ public Set<WebApp> getRecentlyAddedAPIs(int limit, String tenantDomain) throws AppManagementException { SortedSet<WebApp> recentlyAddedAPIs = new TreeSet<WebApp>(new APINameComparator()); SortedSet<WebApp> recentlyAddedAPIsWithMultipleVersions = new TreeSet<WebApp>(new APIVersionComparator()); Registry userRegistry = null; String latestAPIQueryPath = null; try { boolean isTenantMode = (tenantDomain != null); if ((isTenantMode && this.tenantDomain == null) || (isTenantMode && isTenantDomainNotMatching(tenantDomain))) {//Tenant based store anonymous mode int tenantId = ServiceReferenceHolder.getInstance().getRealmService().getTenantManager() .getTenantId(tenantDomain); userRegistry = ServiceReferenceHolder.getInstance().getRegistryService() .getGovernanceUserRegistry(CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME, tenantId); } else { userRegistry = registry; } latestAPIQueryPath = RegistryConstants.QUERIES_COLLECTION_PATH + "/latest-apis"; Map<String, String> params = new HashMap<String, String>(); params.put(RegistryConstants.RESULT_TYPE_PROPERTY_NAME, RegistryConstants.RESOURCES_RESULT_TYPE); if (userRegistry != null) { Collection collection = userRegistry.executeQuery(latestAPIQueryPath, params); int resultSetSize = Math.min(limit, collection.getChildCount()); String[] recentlyAddedAPIPaths = new String[resultSetSize]; for (int i = 0; i < resultSetSize; i++) { recentlyAddedAPIPaths[i] = collection.getChildren()[i]; } Set<WebApp> apisSet = getAPIs(userRegistry, limit, recentlyAddedAPIPaths); if (!isAllowDisplayMultipleVersions()) { recentlyAddedAPIs.addAll(apisSet); return recentlyAddedAPIs; } else { recentlyAddedAPIsWithMultipleVersions.addAll(apisSet); return recentlyAddedAPIsWithMultipleVersions; } } return recentlyAddedAPIs; } catch (RegistryException e) { try { //Before a tenant login to the store or publisher at least one time, //a registry exception is thrown when the tenant store is accessed the store in anonymous mode. //This fix checks whether query resource available in the registry. If not // give a warn. if (!userRegistry.resourceExists(latestAPIQueryPath)) { log.warn("Failed to retrieve recently added WebApp query resource at " + latestAPIQueryPath); return recentlyAddedAPIs; } } catch (RegistryException e1) { //ignore } handleException("Failed to get recently added APIs", e); return null; } catch (org.wso2.carbon.user.api.UserStoreException e) { handleException("Failed to get recently added APIs", e); return null; } }
From source file:org.sakaiproject.content.tool.ListItem.java
protected void captureAccess(ParameterParser params, String index) { String access_mode = params.getString("access_mode" + index); if (access_mode == null || AccessMode.GROUPED.toString().equals(access_mode)) { // we inherit more than one group and must check whether group access changes at this item String[] access_groups = params.getStrings("access_groups" + index); SortedSet<String> new_groups = new TreeSet<String>(); if (access_groups != null) { new_groups.addAll(Arrays.asList(access_groups)); }/*from w w w .j ava 2 s .co m*/ SortedSet<String> new_group_refs = convertToRefs(new_groups); Collection inh_grps = getInheritedGroupRefs(); boolean groups_are_inherited = (new_group_refs.size() == inh_grps.size()) && inh_grps.containsAll(new_group_refs); if (groups_are_inherited) { new_groups.clear(); setGroupsById(new_groups); setAccessMode(AccessMode.INHERITED); } else { setGroupsById(new_groups); setAccessMode(AccessMode.GROUPED); } setPubview(false); } else if (ResourcesAction.PUBLIC_ACCESS.equals(access_mode)) { if (!isPubviewInherited()) { setPubview(true); setAccessMode(AccessMode.INHERITED); } } else if (AccessMode.INHERITED.toString().equals(access_mode)) { captureAccessRoles(params, index); setAccessMode(AccessMode.INHERITED); this.groups.clear(); } }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
final public SortedSet<ExecutionYear> getSortedEnrolmentsExecutionYears() { final SortedSet<ExecutionYear> result = new TreeSet<ExecutionYear>(ExecutionYear.COMPARATOR_BY_YEAR); result.addAll(getEnrolmentsExecutionYears()); return result; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
public SortedSet<ExecutionYear> getSortedCurriculumLinesExecutionYears() { final SortedSet<ExecutionYear> result = new TreeSet<ExecutionYear>(ExecutionYear.COMPARATOR_BY_YEAR); result.addAll(getCurriculumLinesExecutionYears()); return result; }