List of usage examples for java.util SortedSet addAll
boolean addAll(Collection<? extends E> c);
From source file:org.alfresco.repo.web.scripts.facet.FacetablePropertiesGet.java
@Override protected Map<String, Object> unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache) { // We use any provided locale to localise some elements of the webscript response, but not all. final String userLocaleString = req.getParameter(QUERY_PARAM_LOCALE); final Locale userLocale = (userLocaleString == null) ? Locale.getDefault() : new Locale(userLocaleString); // There are multiple defined URIs for this REST endpoint. Some define a "classname" template var. final Map<String, String> templateVars = req.getServiceMatch().getTemplateVars(); final String contentClassName = templateVars.get(TEMPLATE_VAR_CLASSNAME); final QName contentClassQName; try {//from w w w . jav a 2 s . c o m contentClassQName = contentClassName == null ? null : QName.createQName(contentClassName, namespaceService); } catch (NamespaceException e) { throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unrecognised classname: " + contentClassName, e); } // Build an FTL model of facetable properties - this includes normal Alfresco properties and also // 'synthetic' properties like size and mimetype. See below for more details. final Map<String, Object> model = new HashMap<>(); final SortedSet<FacetablePropertyFTL<?>> facetableProperties; if (contentClassQName == null) { facetableProperties = toFacetablePropertyModel(facetService.getFacetableProperties(), userLocale); final List<SyntheticPropertyDefinition> facetableSyntheticProperties = facetService .getFacetableSyntheticProperties(); facetableProperties.addAll(toFacetablePropertyModel_(facetableSyntheticProperties, userLocale)); } else { facetableProperties = toFacetablePropertyModel(facetService.getFacetableProperties(contentClassQName), userLocale); final List<SyntheticPropertyDefinition> facetableSyntheticProperties = facetService .getFacetableSyntheticProperties(contentClassQName); facetableProperties.addAll(toFacetablePropertyModel_(facetableSyntheticProperties, userLocale)); } // Always add some hard-coded facetable "properties" facetableProperties.add(new SpecialFacetablePropertyFTL("TAG", "Tag")); facetableProperties.add(new SpecialFacetablePropertyFTL("SITE", "Site", SiteModel.TYPE_SITE)); // The webscript allows for some further filtering of results: List<ResultFilter> filters = new ArrayList<>(); // Filter by property QName namespace: final String namespaceFilter = req.getParameter(QUERY_PARAM_NAMESPACE); if (namespaceFilter != null) { filters.add(new ResultFilter() { @Override public boolean filter(FacetablePropertyFTL<?> facetableProperty) { final QName propQName = facetableProperty.getQname(); Collection<String> prefixes = namespaceService.getPrefixes(propQName.getNamespaceURI()); return prefixes.contains(namespaceFilter); } }); } List<FacetablePropertyFTL<?>> filteredFacetableProperties = filter(facetableProperties, filters); if (logger.isDebugEnabled()) { logger.debug("Retrieved " + facetableProperties.size() + " available facets; filtered to " + filteredFacetableProperties.size()); } // Create paging ScriptPagingDetails paging = new ScriptPagingDetails( getNonNegativeIntParameter(req, QUERY_PARAM_MAX_ITEMS, DEFAULT_MAX_ITEMS_PER_PAGE), getNonNegativeIntParameter(req, QUERY_PARAM_SKIP_COUNT, 0)); model.put(PROPERTIES_KEY, ModelUtil.page(filteredFacetableProperties, paging)); model.put("paging", ModelUtil.buildPaging(paging)); return model; }
From source file:gr.abiss.calipso.wicket.SpaceFieldListPanel.java
public SpaceFieldListPanel(String id, IBreadCrumbModel breadCrumbModel, final Space space, String selectedFieldName) { super(id, breadCrumbModel); setupVisuals(space);/*from w w w .ja v a 2 s .c o m*/ // FIELD GROUPS List<IGridColumn> cols = (List) Arrays.asList(new CheckBoxColumn("selected"), new PropertyColumn(new Model("Id"), "id"), new PropertyColumn(new Model("Name"), "name"), new PropertyColumn(new Model("Priority"), "priority")); final ListDataProvider listDataProvider = new ListDataProvider(space.getMetadata().getFieldGroups()); final WebMarkupContainer gridContainer = new WebMarkupContainer("gridContainer"); gridContainer.setOutputMarkupId(true); final DataGrid grid = new DefaultDataGrid("fieldGroupGrid", new DataProviderAdapter(listDataProvider), cols); grid.setSelectToEdit(false); grid.setClickRowToSelect(true); grid.setAllowSelectMultiple(false); gridContainer.add(grid); add(gridContainer); // add "new" link final ModalWindow fieldGroupModal = new ModalWindow("fieldGroupModal"); gridContainer.add(fieldGroupModal); gridContainer.add(grid); add(gridContainer); add(new AjaxLink("newFieldGroupLink") { public void onClick(AjaxRequestTarget target) { // TODO: add row to grid? final FieldGroup tpl; if (CollectionUtils.isNotEmpty(grid.getSelectedItems())) { tpl = (FieldGroup) ((IModel) grid.getSelectedItems().iterator().next()).getObject(); } else { tpl = new FieldGroup("", ""); } fieldGroupModal.setContent(new EditFieldGroupPanel("content", fieldGroupModal, tpl) { @Override protected void persist(AjaxRequestTarget target, Form form) { if (!space.getMetadata().getFieldGroups().contains(tpl)) { space.getMetadata().getFieldGroups().add(tpl); //logger.info("added new fieldgroup to space"); } SortedSet<FieldGroup> fieldGroups = new TreeSet<FieldGroup>(); fieldGroups.addAll(space.getMetadata().getFieldGroups()); space.getMetadata().getFieldGroups().clear(); space.getMetadata().getFieldGroups().addAll(fieldGroups); //update grid if (target != null) { target.addComponent(gridContainer); } } }); fieldGroupModal.setTitle(this.getLocalizer().getString("fieldGroups", this)); fieldGroupModal.show(target); } }); // FIELDS SpaceFieldsForm form = new SpaceFieldsForm("form", space, selectedFieldName); add(form); }
From source file:org.jahia.services.render.RenderService.java
public SortedSet<View> getViewsSet(ExtendedNodeType nt, JCRSiteNode site, String templateType) { SortedSet<View> set = new TreeSet<View>(); for (ScriptResolver scriptResolver : scriptResolvers) { set.addAll(scriptResolver.getViewsSet(nt, site, templateType)); }/*from w w w.ja v a 2 s .c o m*/ return set; }
From source file:org.traccar.web.CsvBuilder.java
private SortedSet<Method> getSortedMethods(Object object) { Method[] methodArray = object.getClass().getMethods(); SortedSet<Method> methods = new TreeSet<Method>(new Comparator<Method>() { @Override/*from w ww . java2s. co m*/ public int compare(Method m1, Method m2) { if (m1.getName().equals("getAttributes") && !m1.getName().equals(m2.getName())) { return 1; } if (m2.getName().equals("getAttributes") && !m1.getName().equals(m2.getName())) { return -1; } return m1.getName().compareTo(m2.getName()); } }); methods.addAll(Arrays.asList(methodArray)); return methods; }
From source file:org.artifactory.repo.index.MavenIndexerServiceImpl.java
private IndexerDescriptor getAndCheckDescriptor() { IndexerDescriptor descriptor = centralConfig.getDescriptor().getIndexer(); if (descriptor != null) { SortedSet<RepoBaseDescriptor> set = new TreeSet<RepoBaseDescriptor>(); if (descriptor.getExcludedRepositories() == null) { //Auto exclude all remote and virtual repos set.addAll(repositoryService.getRemoteRepoDescriptors()); set.addAll(getAllVirtualReposExceptGlobal()); } else {//from w w w . j a va 2 s. co m set.addAll(descriptor.getExcludedRepositories()); // Always remove globalVirtual one VirtualRepoDescriptor dummyGlobal = new VirtualRepoDescriptor(); dummyGlobal.setKey(VirtualRepoDescriptor.GLOBAL_VIRTUAL_REPO_KEY); set.remove(dummyGlobal); } descriptor.setExcludedRepositories(set); } return descriptor; }
From source file:org.apache.ctakes.ytex.kernel.evaluator.CorpusKernelEvaluatorImpl.java
public void evaluateKernelOnCorpus(final Map<Long, Node> instanceIDMap, int nMod, int nSlice, boolean evalTest) { KernelEvaluation kernelEvaluationTmp = new KernelEvaluation(); kernelEvaluationTmp.setExperiment(this.getExperiment()); kernelEvaluationTmp.setFoldId(this.getFoldId()); kernelEvaluationTmp.setLabel(this.getLabel()); kernelEvaluationTmp.setCorpusName(this.getName()); kernelEvaluationTmp.setParam1(getParam1()); kernelEvaluationTmp.setParam2(getParam2()); final KernelEvaluation kernelEvaluation = this.kernelEvaluationDao.storeKernelEval(kernelEvaluationTmp); final List<Long> documentIds = new ArrayList<Long>(); final List<Long> testDocumentIds = new ArrayList<Long>(); loadDocumentIds(documentIds, testDocumentIds, instanceIDQuery); if (!evalTest) { // throw away the test ids if we're not going to evaluate them testDocumentIds.clear();// ww w . j av a 2 s . c o m } int nStart = 0; int nEnd = documentIds.size(); int total = documentIds.size(); if (nMod > 0) { nMod = Math.min(total, nMod); } if (nMod > 0 && nSlice > nMod) { log.info("more slices than documents, skipping slice: " + nSlice); return; } if (nMod > 0) { int sliceSize = total / nMod; nStart = sliceSize * (nSlice - 1); if (nSlice != nMod) nEnd = nStart + sliceSize; } for (int i = nStart; i < nEnd; i++) { // left hand side of kernel evaluation final long instanceId1 = documentIds.get(i); if (log.isInfoEnabled()) log.info("evaluating kernel for instance_id1 = " + instanceId1); // list of instance ids right hand side of kernel evaluation final SortedSet<Long> rightDocumentIDs = new TreeSet<Long>(testDocumentIds); if (i < documentIds.size()) { // rightDocumentIDs.addAll(documentIds.subList(i + 1, // documentIds.size() - 1)); rightDocumentIDs.addAll(documentIds.subList(i, documentIds.size())); } // remove instances already evaluated for (KernelEvaluationInstance kEval : this.kernelEvaluationDao .getAllKernelEvaluationsForInstance(kernelEvaluation, instanceId1)) { rightDocumentIDs.remove( instanceId1 == kEval.getInstanceId1() ? kEval.getInstanceId2() : kEval.getInstanceId1()); } // kernel evaluations for this instance are done in a single tx // hibernate can batch insert these txTemplate.execute(new TransactionCallback<Object>() { @Override public Object doInTransaction(TransactionStatus arg0) { evalInstance(instanceIDMap, kernelEvaluation, instanceId1, rightDocumentIDs); return null; } }); } }
From source file:edu.harvard.med.screensaver.model.screenresults.ScreenResult.java
private Set<AssayPlate> findOrCreateAssayPlatesDataLoaded( Map<Integer, Integer> plateNumbersLoadedWithMaxReplicates) { SortedSet<AssayPlate> assayPlatesDataLoaded = Sets.newTreeSet(); for (Map.Entry<Integer, Integer> entry : plateNumbersLoadedWithMaxReplicates.entrySet()) { assayPlatesDataLoaded.addAll(findOrCreateAssayPlatesDataLoaded(entry.getKey(), entry.getValue())); }//w w w .jav a2 s .c o m return assayPlatesDataLoaded; }
From source file:no.abmu.abmstatistikk.web.AbstractReportController.java
protected Map<String, Object> financeHalfYearReport(OrgUnitFinderSpecificationBean finderBean, Comparator<OrgUnitReport> comparator, int financeReportingYear) { SchemaTypeNameAndVersion schemaTypeNameAndVersion = SchemaTypeNameAndVersion .newInstance(SchemaName.KUD_FINANCE_HALFYEAR_REPORT, financeReportingYear); KkdReportFinderSpecification finderSpecification = new KkdReportFinderSpecification(finderBean); Collection<OrgUnitReport> orgUnitReports = reportService.getOrganisationReport(finderSpecification); SortedSet<OrgUnitReport> reports = new TreeSet<OrgUnitReport>(comparator); reports.addAll(orgUnitReports); SortedSet<OrgUnitReport> financehalfYearSortedSet = new TreeSet<OrgUnitReport>(reports); SchemaList halfYearReport = reportService.getReportDataForOrganisationUnits(financehalfYearSortedSet, schemaTypeNameAndVersion);/*from ww w.j a v a 2 s .c o m*/ Map<String, Object> model = new HashMap<String, Object>(); model.put(SchemaListReportNameConst.FINANCE_HALFYEAR_REPORT, halfYearReport); // Special treatment of halfyear reports from 2009 and later. if (financeReportingYear >= 2009) { SchemaTypeNameAndVersion financeSchemaTypeNameAndVersion = SchemaTypeNameAndVersion .newInstance(SchemaName.KUD_FINANCE_APPLICATION, financeReportingYear + 1); SortedSet<OrgUnitReport> financeSortedSet = new TreeSet<OrgUnitReport>(reports); SchemaList financeApplication = reportService.getReportDataForOrganisationUnits(financeSortedSet, financeSchemaTypeNameAndVersion); model.put(SchemaListReportNameConst.FINANCE_APPLICATION, financeApplication); } return model; }
From source file:no.abmu.abmstatistikk.web.AbstractReportController.java
protected Map<String, Object> financeApplicationReport(OrgUnitFinderSpecificationBean finderBean, Comparator<OrgUnitReport> comparator, SchemaTypeNameAndVersion financeSchemaAndVersion, SchemaTypeNameAndVersion statisticOrReportingSchemaAndVersion) { final SubSchemaName financeApplicationInitiatives = SubSchemaName.KUD_FINANCE_INITIATIVE; KkdReportFinderSpecification finderSpecification = new KkdReportFinderSpecification(finderBean); Collection<OrgUnitReport> orgUnitReports = reportService.getOrganisationReport(finderSpecification); SortedSet<OrgUnitReport> reports = new TreeSet<OrgUnitReport>(comparator); reports.addAll(orgUnitReports); SortedSet<OrgUnitReport> financeSortedSet = new TreeSet<OrgUnitReport>(reports); SchemaList financeApplication = reportService.getReportDataForOrganisationUnits(financeSortedSet, financeSchemaAndVersion);/*w w w. j a va 2s. co m*/ SubSchemaTypeNameAndVersion subSchemaTypeNameAndVersion = new SubSchemaTypeNameAndVersion( financeSchemaAndVersion, financeApplicationInitiatives); SortedSet<OrgUnitReport> iniativesSortedSet = new TreeSet<OrgUnitReport>(reports); SchemaList initiatives = reportService.getSubReportDataForOrganisationUnits(iniativesSortedSet, subSchemaTypeNameAndVersion); SchemaList statisticReport = reportService.getReportDataForOrganisationUnits(reports, statisticOrReportingSchemaAndVersion); Map<String, Object> model = new HashMap<String, Object>(); model.put(SchemaListReportNameConst.FINANCE_APPLICATION, financeApplication); model.put(SchemaListReportNameConst.INITIATIVES, initiatives); model.put(SchemaListReportNameConst.STATISTIC_REPORT, statisticReport); return model; }
From source file:org.orekit.frames.BulletinBFilesLoader.java
/** {@inheritDoc} */ public void fillHistory(final IERSConventions.NutationCorrectionConverter converter, final SortedSet<EOPEntry> history) throws OrekitException { final Parser parser = new Parser(converter); DataProvidersManager.getInstance().feed(supportedNames, parser); history.addAll(parser.history); }