List of usage examples for org.springframework.util StringUtils isEmpty
public static boolean isEmpty(@Nullable Object str)
From source file:org.ensembl.gti.seqstore.GeneHashTest.java
@Test public void testModelToHash() { String hashG = SeqStoreHashUtils.hashGeneModel(gene); String hashTr = SeqStoreHashUtils.hashTranscriptModel(gene.getTranscripts().get(0)); String hashE = SeqStoreHashUtils.hashExonModel(gene.getTranscripts().get(0).getExons().get(0)); assertFalse("hashG is empty or null", StringUtils.isEmpty(hashG)); assertFalse("hashTr is empty or null", StringUtils.isEmpty(hashTr)); assertFalse("hashE is empty or null", StringUtils.isEmpty(hashE)); String hashG2 = SeqStoreHashUtils.hashGeneModel(gene2); String hashTr2 = SeqStoreHashUtils.hashTranscriptModel(gene2.getTranscripts().get(0)); String hashE2 = SeqStoreHashUtils.hashExonModel(gene2.getTranscripts().get(0).getExons().get(0)); assertEquals("Gene hashes not equal", hashG, hashG2); assertEquals("Transcript hashes not equal", hashTr, hashTr2); assertEquals("Exon hashes not equal", hashE, hashE2); }
From source file:com.abuabdul.knodex.service.KxDocumentServiceImpl.java
public SortedMap<String, List<KnodexDoc>> listAllSentences() { log.debug("Entered KxDocumentServiceImpl.listAllSentences method"); String indexKey = ""; List<KnodexDoc> indexKnodexList = null; SortedMap<String, List<KnodexDoc>> fullListOfSentences = null; List<KnodexDoc> listAllKnodex = knodexDAO.findAll(); if (listAllKnodex != null && !listAllKnodex.isEmpty()) { log.debug("The size of the overall key with sentences " + listAllKnodex.size()); fullListOfSentences = new TreeMap<String, List<KnodexDoc>>(); for (KnodexDoc knodexDoc : listAllKnodex) { if (knodexDoc != null && !StringUtils.isEmpty(knodexDoc.getKey())) { indexKey = knodexDoc.getKey(); log.debug("Index key to get the list of sentences for each indexBy value " + indexKey); if (!fullListOfSentences.isEmpty() && fullListOfSentences.containsKey(indexKey)) { indexKnodexList = fullListOfSentences.get(indexKey); if (indexKnodexList == null) { // Ideally this code will not execute indexKnodexList = new ArrayList<KnodexDoc>(); }/*from w w w. java 2 s. co m*/ indexKnodexList.add(knodexDoc); } else { indexKnodexList = new ArrayList<KnodexDoc>(); indexKnodexList.add(knodexDoc); fullListOfSentences.put(indexKey, indexKnodexList); } } } } return fullListOfSentences; }
From source file:de.dlopes.stocks.facilitator.data.StockInfo.java
public void setExtID(StockID.PROVIDER provider, String value) throws IllegalArgumentException { // guard: we can only accept non-null providers if (provider == null) { throw new IllegalArgumentException("provider must not be null"); }/*from ww w . j a va 2s . co m*/ // guard: we can only accept non-empty values if (StringUtils.isEmpty(value)) { throw new IllegalArgumentException("external ID value must not be empty"); } // if the list of StockIDs does not exist yet, then we have to create it in order to // avoid a NPE in the next step if (extIDs == null) { extIDs = new ArrayList<StockID>(); } // guard: avoid updates to an external ID for (StockID sid : extIDs) { if (provider.equals(sid.getProvider())) { throw new IllegalArgumentException("external ID must not be overwritten with a new value"); } } // add the new external ID extIDs.add(new StockID(provider, value, this)); }
From source file:io.pivotal.pde.demo.tracker.gemfire.TrackerUI.java
private void refillGrid(String text) { BeanItemContainer<CheckIn> bic = (BeanItemContainer<CheckIn>) grid.getContainerDataSource(); bic.removeAllItems();//from w ww . j av a 2 s . c o m if (StringUtils.isEmpty(text)) { for (CheckIn c : repo.findAll()) { bic.addBean(c); } } else { for (CheckIn c : repo.findByPlateStartsWithIgnoreCase(text)) { bic.addBean(c); } } grid.sort("timestamp", SortDirection.DESCENDING); }
From source file:uk.gov.nationalarchives.discovery.taxonomy.common.repository.lucene.tools.LuceneTaxonomyMapper.java
public static Document getLuceneDocumentFromTrainingDocument(TrainingDocument trainingDocument) { Document doc = new Document(); doc.add(new StringField(InformationAssetViewFields.DOCREFERENCE.toString(), trainingDocument.getDocReference(), Field.Store.YES)); doc.add(new TextField(InformationAssetViewFields.DESCRIPTION.toString(), trainingDocument.getDescription(), Field.Store.YES));/*from ww w. ja v a 2s. c o m*/ doc.add(new StringField(InformationAssetViewFields.TAXONOMY.toString(), trainingDocument.getCategory(), Field.Store.YES)); if (!StringUtils.isEmpty(trainingDocument.getCatDocRef())) { doc.add(new StringField(InformationAssetViewFields.CATDOCREF.toString(), trainingDocument.getCatDocRef(), Field.Store.YES)); } if (!StringUtils.isEmpty(trainingDocument.getTitle())) { doc.add(new TextField(InformationAssetViewFields.TITLE.toString(), trainingDocument.getTitle(), Field.Store.YES)); } if (!StringUtils.isEmpty(trainingDocument.getContextDescription())) { doc.add(new TextField(InformationAssetViewFields.CONTEXTDESCRIPTION.toString(), trainingDocument.getContextDescription(), Field.Store.YES)); } if (trainingDocument.getCorpBodys() != null) { doc.add(new TextField(InformationAssetViewFields.CORPBODYS.toString(), Arrays.toString(trainingDocument.getCorpBodys()), Field.Store.YES)); } if (trainingDocument.getPersonFullName() != null) { doc.add(new TextField(InformationAssetViewFields.PERSON_FULLNAME.toString(), Arrays.toString(trainingDocument.getPersonFullName()), Field.Store.YES)); } if (trainingDocument.getPlaceName() != null) { doc.add(new TextField(InformationAssetViewFields.PLACE_NAME.toString(), Arrays.toString(trainingDocument.getPlaceName()), Field.Store.YES)); } if (trainingDocument.getSubjects() != null) { doc.add(new TextField(InformationAssetViewFields.SUBJECTS.toString(), Arrays.toString(trainingDocument.getSubjects()), Field.Store.YES)); } return doc; }
From source file:com.graphaware.importer.data.access.BaseDataReader.java
/** * Read a String that is intended to be converted to another type. * * @param columnName column name.//from w w w . j a v a 2 s .c om * @return the String, or <code>null</code> if the value was <code>null</code>, or an empty String. */ protected final String readStringForConversion(String columnName) { String value = doReadString(columnName); if (value == null) { return null; } if (StringUtils.isEmpty(value.trim())) { return null; } return value.trim(); }
From source file:org.psikeds.resolutionengine.interfaces.pojos.POJO.java
protected static String composeId(final POJO... pojos) { final StringBuilder sb = new StringBuilder(); for (final POJO p : pojos) { final String pid = (p == null ? null : p.getId()); if (!StringUtils.isEmpty(pid)) { if (sb.length() > 0) { sb.append(COMPOSE_ID_SEPARATOR); }//from w w w . j a v a 2 s . c o m sb.append(pid); } } return sb.toString(); }
From source file:org.psikeds.queryagent.interfaces.presenter.pojos.POJO.java
public static String composeId(final POJO... pojos) { final StringBuilder sb = new StringBuilder(); for (final POJO p : pojos) { final String pid = (p == null ? null : p.getId()); if (!StringUtils.isEmpty(pid)) { if (sb.length() > 0) { sb.append(COMPOSE_ID_SEPARATOR); }// www.j a va 2s .com sb.append(pid); } } return sb.toString(); }
From source file:com.biz.report.service.impl.RepReportServiceImpl.java
public List<Report3DataSet> readDataForBarChart(String reps, String year, String months) { if (!StringUtils.isEmpty(reps) && reps.contains("[")) { reps = reps.substring(1, reps.length() - 1); }//from w ww .j ava 2s . co m if (!StringUtils.isEmpty(months) && months.contains("[")) { months = months.substring(1, months.length() - 1); } List list = repReportDao.readByMonth(reps, months, year); List<Report2> reportList = new MappingEngine().getPieChartReport(list); List<Report3DataSet> dataSets = new ArrayList<Report3DataSet>(); for (Report2 r : reportList) { dataSets.add(new Report3DataSet(r.getTypeName(), r.getAmount())); } return dataSets; }
From source file:com.javaetmoi.core.mvc.tag.Html5InputTag.java
protected void writeMaxLengthAttribute(TagWriter tagWriter) throws JspException { if (annotations.containsKey(Size.class)) { Size size = getAnnotation(Size.class); if ((size.max() != Integer.MAX_VALUE) && StringUtils.isEmpty(getMaxlength())) { writeOptionalAttribute(tagWriter, MAXLENGTH_ATTRIBUTE, String.valueOf(size.max())); }//w ww . ja v a 2 s . c om } }