List of usage examples for java.util SortedSet addAll
boolean addAll(Collection<? extends E> c);
From source file:org.eclipse.skalli.core.project.ProjectComponent.java
/** * Validates the given project.// www .j av a 2 s .c o m * Checks basic data like project ID, template, project lead etc. * Furthermore, validates the project with the default property/extension validators provided by * <code>ExtensionServiceCore</code> and the extension services of the assigned extensions and * with the custom validators provided by the {@link ProjectTemplate project template}. */ @Override protected SortedSet<Issue> validateEntity(Project project, Severity minSeverity) { SortedSet<Issue> issues = new TreeSet<Issue>(); issues.addAll(validateProjectId(project)); issues.addAll(validateProjectName(project)); issues.addAll(validatePeopleExtension(project)); // ensure that the entity service exists UUID projectUUID = project.getUuid(); ExtensionService<?> extensionService = validateExtensionService(projectUUID, project, issues); // ensure that the project template exists ProjectTemplate projectTemplate = validateProjectTemplate(project, issues); if (extensionService != null && projectTemplate != null) { // use the validators provided by the project template/extension services to validate the project validateExtension(projectUUID, project, extensionService, projectTemplate, issues, minSeverity); // check that all extensions are compatible with the template and vice versa if (minSeverity.compareTo(Severity.ERROR) >= 0) { validateCompatibility(project, projectTemplate, extensionService, issues); } } return issues; }
From source file:net.sourceforge.fenixedu.presentationTier.Action.administrativeOffice.serviceRequests.AcademicServiceRequestsManagementDispatchAction.java
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {/*from w w w. ja v a 2s . c om*/ final AcademicServiceRequestBean bean = getOrCreateAcademicServiceRequestBean(request); request.setAttribute("bean", bean); final Collection<AcademicServiceRequest> remainingRequests = bean.searchAcademicServiceRequests(); final Collection<AcademicServiceRequest> specificRequests = getAndRemoveSpecificRequests(bean, remainingRequests); final SortedSet<AcademicServiceRequest> sorted = new TreeSet<AcademicServiceRequest>( getComparator(request)); sorted.addAll(remainingRequests); request.setAttribute("remainingRequests", remainingRequests); request.setAttribute("specificRequests", specificRequests); final CollectionPager<AcademicServiceRequest> pager = new CollectionPager<AcademicServiceRequest>(sorted, REQUESTS_PER_PAGE); request.setAttribute("collectionPager", pager); request.setAttribute("numberOfPages", Integer.valueOf(pager.getNumberOfPages())); final String pageParameter = request.getParameter("pageNumber"); final Integer page = StringUtils.isEmpty(pageParameter) ? Integer.valueOf(1) : Integer.valueOf(pageParameter); request.setAttribute("pageNumber", page); request.setAttribute("resultPage", pager.getPage(page)); return mapping.findForward("searchResults"); }
From source file:dk.statsbiblioteket.doms.domsutil.surveyable.SurveyableCombiner.java
/** * Get the combined list of all status messages newer than the given time. * An application should use the newest timestamp in the given messages * from the last call as input to this method next time it calls it, to * ensure not losing messages.// ww w .ja va2 s . c o m * * Note, the name in the returned status is the name from the first * surveyable in the list of combined status objects. * * @param time Only get messages strictly newer than this timestamp. The * timestamp is measured in milliseconds since * 1970-01-01 00:00:00.000Z. * @return List of status messages. May be empty, but never null. If no * surveyables are in the list to combine, will return a list of * just one message, which is a message about not being properly * initialised. */ public Status getStatusSince(long time) { log.trace("Enter getStatusSince(" + time + ")"); try { Status status = new Status(); SortedSet<StatusMessage> messages = new TreeSet<StatusMessage>(new StatusMessageComparator()); initializeSurveyables(); synchronized (surveyables) { if (surveyables == null || surveyables.size() == 0) { return getConfigurationErrorStatus(""); } for (Surveyable surveyable : surveyables) { Status result = surveyable.getStatusSince(time); messages.addAll(result.getMessages()); if (status.getName() == null) { if (result.getName() != null) { status.setName(result.getName()); } } } if (status.getName() == null) { status.setName("Unnamed"); } } status.getMessages().addAll(messages); return status; } catch (Exception e) { log.trace("Survey Configuration error", e); return getConfigurationErrorStatus(": " + e); } }
From source file:org.apache.felix.webconsole.plugins.scriptconsole.internal.ScriptEngineManager.java
@SuppressWarnings("unchecked") private Collection<?> registerFactories(final EngineManagerState mgr, final Bundle bundle) { URL url = bundle.getEntry(ENGINE_FACTORY_SERVICE); InputStream ins = null;/* ww w . ja va2s .co m*/ final SortedSet<String> extensions = new TreeSet<String>(); try { ins = url.openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(ins)); for (String className : getClassNames(reader)) { try { Class<ScriptEngineFactory> clazz = bundle.loadClass(className); ScriptEngineFactory spi = clazz.newInstance(); registerFactory(mgr, spi, null); extensions.addAll(spi.getExtensions()); } catch (Throwable t) { log.log(LogService.LOG_ERROR, "Cannot register ScriptEngineFactory " + className, t); } } } catch (IOException ioe) { // ignore } finally { IOUtils.closeQuietly(ins); } return extensions; }
From source file:pt.ist.fenix.ui.struts.action.research.ViewCurriculumDispatchAction.java
private void putInformationOnRequestForGivenExecutionYear(ExecutionYear firstExecutionYear, ExecutionYear finaltExecutionYear, Person person, HttpServletRequest request) { SortedSet<ExecutionCourse> lectures = new TreeSet<ExecutionCourse>( new ReverseComparator(ExecutionCourse.EXECUTION_COURSE_COMPARATOR_BY_EXECUTION_PERIOD_AND_NAME)); Set<Thesis> orientedThesis = new HashSet<Thesis>(); Set<PersonFunction> functions = new HashSet<PersonFunction>(); ExecutionYear stoppageYear = finaltExecutionYear.getNextExecutionYear(); ExecutionYear iteratorYear = firstExecutionYear; Teacher teacher = person.getTeacher(); while (iteratorYear != stoppageYear) { if (teacher != null) { lectures.addAll(teacher.getLecturedExecutionCoursesByExecutionYear(iteratorYear)); }/* ww w .ja v a 2 s . c om*/ orientedThesis.addAll(getOrientedOrCoorientedThesis(iteratorYear, person)); functions.addAll(PersonFunction.getPersonFuntions(person, iteratorYear.getBeginDateYearMonthDay(), iteratorYear.getEndDateYearMonthDay())); iteratorYear = iteratorYear.getNextExecutionYear(); } List<PersonFunction> functionsList = new ArrayList<PersonFunction>(functions); Collections.sort(functionsList, new ReverseComparator(new BeanComparator("beginDateInDateType"))); request.setAttribute("functions", functionsList); request.setAttribute("lectures", lectures); request.setAttribute("orientedThesis", orientedThesis); if (!(orientedThesis.isEmpty())) { request.setAttribute("secondCycleThesis", true); } }
From source file:org.wso2.carbon.bpel.core.ode.integration.store.repository.BPELPackageRepository.java
private List<BPELPackageInfo> sortByPackageName(List<BPELPackageInfo> packageList) { List<BPELPackageInfo> sortedPackageList = new ArrayList<BPELPackageInfo>(); Map<String, BPELPackageInfo> packageInfoMap = new HashMap<String, BPELPackageInfo>(); for (BPELPackageInfo packageInfo : packageList) { packageInfoMap.put(packageInfo.getName(), packageInfo); }// w ww.ja v a 2s. c o m SortedSet<String> sortedPackageNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER); sortedPackageNames.addAll(packageInfoMap.keySet()); for (String packageName : sortedPackageNames) { sortedPackageList.add(packageInfoMap.get(packageName)); } return sortedPackageList; }
From source file:org.springframework.integration.print.core.PrintServiceExecutor.java
public String getPrinterInfo() { StringBuilder sb = new StringBuilder(); final SortedSet<DocFlavor> docFlavors = this.getDocFlavors(); final AttributeSet attributes = this.printService.getAttributes(); sb.append("\nPrinter Information\n"); sb.append("==========================================================\n"); sb.append("Name: " + this.printService.getName() + "\n"); sb.append("Supported DocFlavors:\n"); for (DocFlavor docFlavor : docFlavors) { sb.append(" " + docFlavor + "\n"); }/*from w ww . j a v a 2 s. com*/ @SuppressWarnings("unchecked") Class<? extends Attribute>[] categories = (Class<? extends Attribute>[]) this.printService .getSupportedAttributeCategories(); sb.append("Supported Categories:\n"); for (Class<?> clazz : categories) { sb.append(" " + clazz.getName() + "\n"); } final SortedSet<Attribute> supportedAttributes = new TreeSet<Attribute>(new AttributeComparator()); for (Class<? extends Attribute> clazz : categories) { for (DocFlavor docFlavor : docFlavors) { Object value = this.printService.getSupportedAttributeValues(clazz, docFlavor, attributes); if (value != null) { if (value instanceof Attribute) { supportedAttributes.add((Attribute) value); } else if (value instanceof Attribute[]) { supportedAttributes.addAll(Arrays.asList((Attribute[]) value)); } } } } sb.append("Supported Attributes:\n"); for (Attribute attribute : supportedAttributes) { sb.append(" " + attribute + "(" + attribute.getCategory().getSimpleName() + ")\n"); } return sb.toString(); }
From source file:org.drugis.addis.presentation.wizard.NetworkMetaAnalysisWizardPM.java
private void updateOutcomes() { SortedSet<OutcomeMeasure> outcomeSet = new TreeSet<OutcomeMeasure>(); if (d_indicationHolder.getValue() != null) { for (Study s : d_domain.getStudies(d_indicationHolder.getValue())) { outcomeSet.addAll(Study.extractVariables(s.getEndpoints())); outcomeSet.addAll(Study.extractVariables(s.getAdverseEvents())); }/*from w ww . j av a2 s. c o m*/ } d_outcomes.clear(); d_outcomes.addAll(outcomeSet); }
From source file:com.thoughtworks.go.server.service.UserService.java
public Set<String> usersThatCanOperateOnStage(CruiseConfig cruiseConfig, PipelineConfig pipelineConfig) { SortedSet<String> users = new TreeSet<>(); PipelineConfigs group = cruiseConfig.findGroupOfPipeline(pipelineConfig); if (group.hasAuthorizationDefined()) { if (group.hasOperationPermissionDefined()) { users.addAll(group.getOperateUserNames()); List<String> roles = group.getOperateRoleNames(); for (Role role : cruiseConfig.server().security().getRoles()) { if (roles.contains(CaseInsensitiveString.str(role.getName()))) { users.addAll(role.usersOfRole()); }//from www. ja va 2 s .c o m } } } else { users.addAll(allUsernames()); } return users; }