List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:com.ge.predix.acs.privilege.management.PrivilegeManagementServiceImplTest.java
@SuppressWarnings("unchecked") @Test(expectedExceptions = PrivilegeManagementException.class) public void testAppendEmptySubjects() { this.service.appendSubjects(Collections.EMPTY_LIST); }
From source file:com.glaf.core.parse.CsvTextParser.java
@SuppressWarnings("unchecked") public List<String> split(String text, String delimiter) { if (delimiter == null) { throw new RuntimeException("delimiter is null"); }/* w w w . j ava2 s . co m*/ if (text == null) { return Collections.EMPTY_LIST; } List<String> pieces = new java.util.ArrayList<String>(); int start = 0; int end = text.indexOf(delimiter); while (end != -1) { pieces.add(text.substring(start, end)); start = end + delimiter.length(); end = text.indexOf(delimiter, start); } if (start < text.length()) { String temp = text.substring(start); if (temp != null && temp.length() > 0) { pieces.add(temp); } } return pieces; }
From source file:org.openmrs.module.patientaccesscontrol.api.impl.PatientAccessControlServiceImpl.java
/** * @see PatientAccessControlService#getPatients(String, Integer, Integer) *//*ww w . j a va 2 s .c o m*/ @SuppressWarnings("unchecked") @Override public List<PatientProgramModel> getPatientPrograms(String query, Integer start, Integer length) throws APIException { PatientAccess patientAccess = getPatientAccess(); if (query.matches(".*\\d+.*")) { return dao.getPatientPrograms(null, query, Collections.EMPTY_LIST, false, start, length, patientAccess.getIncludedPatients(), patientAccess.getExcludedPatients(), getIncludePrograms()); } else { // there is no number in the string, search on name return dao.getPatientPrograms(query, null, Collections.EMPTY_LIST, false, start, length, patientAccess.getIncludedPatients(), patientAccess.getExcludedPatients(), getIncludePrograms()); } }
From source file:de.micromata.genome.test.web.SimHttpServletRequest.java
@SuppressWarnings({ "unchecked", "rawtypes" }) public Enumeration getHeaders(String name) { List<String> hl = headers.get(name); if (hl == null) { return new IteratorEnumeration(Collections.EMPTY_LIST.iterator()); }// www . j a va2 s . c o m return new IteratorEnumeration(hl.iterator()); }
From source file:com.github.nethad.clustermeister.provisioning.ec2.AmazonConfigurationLoader.java
public Map<String, AWSInstanceProfile> getConfiguredProfiles() { List<Object> profilesList = configuration.getList(PROFILES, Collections.EMPTY_LIST); Map<String, Map<String, String>> profileSpecifications = ConfigurationUtil.reduceObjectList(profilesList, "Profiles must be specified as a list of objects."); SortedMap<String, AWSInstanceProfile> profiles = Maps.newTreeMap(); for (Map.Entry<String, Map<String, String>> entry : profileSpecifications.entrySet()) { String profileName = entry.getKey(); Map<String, String> profileValues = entry.getValue(); AWSInstanceProfile profile = AWSInstanceProfile.newBuilder().profileName(profileName) .region(profileValues.get(REGION)).zone(profileValues.get(ZONE)).type(profileValues.get(TYPE)) .amiId(profileValues.get(AMI_ID)).keypairName(profileValues.get(KEYPAIR)) .shutdownState(profileValues.get(SHUTDOWN_STATE)).group(profileValues.get(GROUP)) .spotPrice(profileValues.get(SPOT_PRICE)).spotRequestType(profileValues.get(SPOT_REQUEST_TYPE)) .spotRequestValidFrom(profileValues.get(SPOT_REQUEST_VALID_FROM)) .spotRequestValidTo(profileValues.get(SPOT_REQUEST_VALID_TO)) .placementGroup(profileValues.get(PLACEMENT_GROUP)).build(); profiles.put(profileName, profile); }//from w w w . j a v a 2s . co m return profiles; }
From source file:uk.ac.ebi.intact.editor.services.curate.organism.BioSourceService.java
@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED) public List<IntactOrganism> searchBioSources(String query) { if (log.isTraceEnabled()) log.trace("Searching with query: " + query); if (query == null) { return Collections.EMPTY_LIST; }/*from w ww . j av a 2 s . c o m*/ Query jpaQuery = getIntactDao().getEntityManager().createQuery( "select b from IntactOrganism b " + "where lower(b.commonName) like lower(:commonName) or " + "lower(b.scientificName) like lower(:scientificName) or " + "b.dbTaxid = :taxId"); jpaQuery.setParameter("commonName", query + "%"); jpaQuery.setParameter("scientificName", query + "%"); jpaQuery.setParameter("taxId", query); return jpaQuery.getResultList(); }
From source file:com.agimatec.validation.jsr303.AgimatecValidatorFactory.java
public <T> List<MetaConstraint<T, ? extends Annotation>> getMetaConstraints(Class<T> beanClass) { List<MetaConstraint<?, ? extends Annotation>> slot = constraintMap.get(beanClass); if (slot != null) { //noinspection RedundantCast return (List) slot; } else {//from w ww.j ava 2s. c o m return Collections.EMPTY_LIST; } }
From source file:de.tudarmstadt.ukp.clarin.webanno.brat.controller.ChainAdapter.java
/** * Add annotations from the CAS, which is controlled by the window size, to the brat response * {@link GetDocumentResponse}/*ww w . j a v a2 s .c o m*/ * * @param aJcas * The JCAS object containing annotations * @param aResponse * A brat response containing annotations in brat protocol * @param aBratAnnotatorModel * Data model for brat annotations * @param aColoringStrategy * the coloring strategy to render this layer (ignored) */ @Override public void render(JCas aJcas, List<AnnotationFeature> aFeatures, GetDocumentResponse aResponse, BratAnnotatorModel aBratAnnotatorModel, ColoringStrategy aColoringStrategy) { // Get begin and end offsets of window content int windowBegin = BratAjaxCasUtil .selectByAddr(aJcas, Sentence.class, aBratAnnotatorModel.getSentenceAddress()).getBegin(); int windowEnd = BratAjaxCasUtil.selectByAddr(aJcas, Sentence.class, BratAjaxCasUtil.getLastSentenceAddressInDisplayWindow(aJcas, aBratAnnotatorModel.getSentenceAddress(), aBratAnnotatorModel.getPreferences().getWindowSize())) .getEnd(); // Find the features for the arc and span labels - it is possible that we do not find a // feature for arc/span labels because they may have been disabled. AnnotationFeature spanLabelFeature = null; AnnotationFeature arcLabelFeature = null; for (AnnotationFeature f : aFeatures) { if (WebAnnoConst.COREFERENCE_TYPE_FEATURE.equals(f.getName())) { spanLabelFeature = f; } if (WebAnnoConst.COREFERENCE_RELATION_FEATURE.equals(f.getName())) { arcLabelFeature = f; } } // At this point arc and span feature labels must have been found! If not, the later code // will crash. Type chainType = getAnnotationType(aJcas.getCas()); Feature chainFirst = chainType.getFeatureByBaseName(chainFirstFeatureName); int colorIndex = 0; // Iterate over the chains for (FeatureStructure chainFs : selectFS(aJcas.getCas(), chainType)) { AnnotationFS linkFs = (AnnotationFS) chainFs.getFeatureValue(chainFirst); AnnotationFS prevLinkFs = null; // Every chain is supposed to have a different color String color = ColoringStrategy.PALETTE_NORMAL_FILTERED[colorIndex % ColoringStrategy.PALETTE_NORMAL_FILTERED.length]; // The color index is updated even for chains that have no visible links in the current // window because we would like the chain color to be independent of visibility. In // particular the color of a chain should not change when switching pages/scrolling. colorIndex++; // Iterate over the links of the chain while (linkFs != null) { Feature linkNext = linkFs.getType().getFeatureByBaseName(linkNextFeatureName); AnnotationFS nextLinkFs = (AnnotationFS) linkFs.getFeatureValue(linkNext); // Is link after window? If yes, we can skip the rest of the chain if (linkFs.getBegin() >= windowEnd) { break; // Go to next chain } // Is link before window? We only need links that being within the window and that // end within the window if (!(linkFs.getBegin() >= windowBegin) && (linkFs.getEnd() <= windowEnd)) { // prevLinkFs remains null until we enter the window linkFs = nextLinkFs; continue; // Go to next link } String bratTypeName = TypeUtil.getBratTypeName(this); // Render span { String bratLabelText = TypeUtil.getBratLabelText(this, linkFs, (spanLabelFeature != null) ? asList(spanLabelFeature) : Collections.EMPTY_LIST); Offsets offsets = new Offsets(linkFs.getBegin() - windowBegin, linkFs.getEnd() - windowBegin); aResponse.addEntity(new Entity(BratAjaxCasUtil.getAddr(linkFs), bratTypeName, offsets, bratLabelText, color)); } // Render arc (we do this on prevLinkFs because then we easily know that the current // and last link are within the window ;) if (prevLinkFs != null) { String bratLabelText = null; if (linkedListBehavior && arcLabelFeature != null) { // Render arc label bratLabelText = TypeUtil.getBratLabelText(this, prevLinkFs, asList(arcLabelFeature)); } else { // Render only chain type bratLabelText = TypeUtil.getBratLabelText(this, prevLinkFs, Collections.EMPTY_LIST); } List<Argument> argumentList = asList(new Argument("Arg1", BratAjaxCasUtil.getAddr(prevLinkFs)), new Argument("Arg2", BratAjaxCasUtil.getAddr(linkFs))); aResponse.addRelation(new Relation(BratAjaxCasUtil.getAddr(prevLinkFs), bratTypeName, argumentList, bratLabelText, color)); } // if (BratAjaxCasUtil.isSame(linkFs, nextLinkFs)) { // log.error("Loop in CAS detected, aborting rendering of chains"); // break; // } prevLinkFs = linkFs; linkFs = nextLinkFs; } } }
From source file:com.cloudbees.jenkins.plugins.gogs.server.client.GogsServerAPIClient.java
@Override public List<GogsRepositoryHook> getWebHooks() { try {/*from w ww. j a v a 2 s .c o m*/ String url = String.format(API_REPOSITORY_PATH, getOwner(), repositoryName) + "/hooks"; LOGGER.info("getWebHooks url: " + url); String response = getRequest(url); List<GogsRepositoryHook> repositoryHooks = parseCollection(response, GogsRepositoryHook.class); return repositoryHooks; } catch (IOException e) { LOGGER.log(Level.SEVERE, "invalid hooks response", e); } return Collections.EMPTY_LIST; }