List of usage examples for com.google.common.base Strings nullToEmpty
public static String nullToEmpty(@Nullable String string)
From source file:com.b2international.snowowl.snomed.datastore.internal.rf2.SnomedExportClientRequest.java
@Override protected void requesting(final ExtendedDataOutputStream out, final OMMonitor monitor) throws Exception { final ExecutorService executorService = getCancelationExecutorService(); if (executorService != null) { executorService.execute(new RequestCancelationRunnable(monitor, getCancelationPollInterval(), this)); }/* ww w .ja v a2 s.c om*/ out.writeUTF(model.getUserId()); out.writeUTF(model.getClientBranch().path()); out.writeUTF(Strings.nullToEmpty(convertToString(model.getStartEffectiveTime()))); out.writeUTF(Strings.nullToEmpty(convertToString(model.getEndEffectiveTime()))); out.writeInt(model.getReleaseType().getValue()); out.writeUTF(model.getUnsetEffectiveTimeLabel()); out.writeBoolean(model.includeUnpublised()); out.writeBoolean(model.isExportToRf1()); out.writeBoolean(model.isExtendedDescriptionTypesForRf1()); out.writeBoolean(model.isCoreComponentsToExport()); out.writeInt(model.getRefSetIds().size()); for (final String refsetIdentifierConcept : model.getRefSetIds()) { out.writeUTF(refsetIdentifierConcept); } final Set<SnomedMapSetSetting> settings = model.getSettings(); out.writeInt(settings.size()); for (final SnomedMapSetSetting setting : settings) { SnomedMapSetSetting.write(setting, out); } final Set<String> modulesToExport = model.getModulesToExport(); out.writeInt(modulesToExport.size()); for (final String moduleToExport : modulesToExport) { out.writeUTF(moduleToExport); } out.writeUTF(model.getNamespace()); out.writeUTF(model.getCodeSystemShortName()); out.writeBoolean(model.isExtensionOnly()); out.writeBoolean(model.isConceptsAndRelationshipsOnly()); out.writeBoolean(model.isLanguageAware()); }
From source file:io.druid.query.dimension.ListFilteredDimensionSpec.java
@Override public DimensionSelector decorate(final DimensionSelector selector) { if (selector == null) { return selector; }/*w ww . j a v a 2 s.com*/ final int selectorCardinality = selector.getValueCardinality(); if (selectorCardinality < 0) { throw new UnsupportedOperationException("Cannot decorate a selector with no dictionary"); } // Upper bound on cardinality of the filtered spec. final int cardinality = isWhitelist ? values.size() : selectorCardinality; int count = 0; final Map<Integer, Integer> forwardMapping = new HashMap<>(cardinality); final int[] reverseMapping = new int[cardinality]; if (isWhitelist) { for (String value : values) { int i = selector.lookupId(value); if (i >= 0) { forwardMapping.put(i, count); reverseMapping[count++] = i; } } } else { for (int i = 0; i < selectorCardinality; i++) { if (!values.contains(Strings.nullToEmpty(selector.lookupName(i)))) { forwardMapping.put(i, count); reverseMapping[count++] = i; } } } return BaseFilteredDimensionSpec.decorate(selector, forwardMapping, reverseMapping); }
From source file:br.edu.utfpr.cm.JGitMinerWeb.services.metric.social.NumberOfLinksMetric.java
private Integer calculateNumberOfLinks(EntityIssue issue) throws Exception { Integer numberOfLinks = 0;/* w ww . j ava 2 s . c om*/ numberOfLinks += UrlValidator.urlInString(Strings.nullToEmpty(issue.getBody())); for (EntityComment entityComment : issue.getComments()) { numberOfLinks += UrlValidator.urlInString(Strings.nullToEmpty(entityComment.getBody())); } return numberOfLinks; }
From source file:org.obm.push.mail.MailErrorsMessages.java
public String mailTooLargeHeaderFormat(String messageId, String subject, String to, String cc, String bcc) { return getString("MailTooLargeHeaderFormat", messageId, subject, Strings.nullToEmpty(to), Strings.nullToEmpty(cc), Strings.nullToEmpty(bcc)); }
From source file:fr.xebia.cocktail.MailService.java
public void sendCocktail(Cocktail cocktail, String recipient, String cocktailPageUrl) throws MessagingException { Message msg = new MimeMessage(mailSession); msg.setFrom(fromAddress);/*from w ww . ja va2 s . co m*/ msg.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient)); msg.setSubject("[Cocktail] " + cocktail.getName()); String message = cocktail.getName() + "\n" // + "--------------------\n" // + "\n" // + Strings.nullToEmpty(cocktail.getInstructions()) + "\n" // + "\n" // + cocktailPageUrl; msg.setContent(message, "text/plain"); Transport.send(msg); auditLogger.info("Sent to {} cocktail '{}'", recipient, cocktail.getName()); sentEmailCounter.incrementAndGet(); }
From source file:org.obm.service.contact.VCFtoContactConverter.java
public List<Contact> convert(String vcf) { return FluentIterable.from(Ezvcard.parse(Strings.nullToEmpty(vcf)).all()).filter(HAS_AT_LEAST_ONE_PROPERTY) .transform(new Function<VCard, Contact>() { @Override/* w w w . ja va 2s .c om*/ public Contact apply(VCard vCard) { return vCardToContact(vCard); } }).toList(); }
From source file:ec.tss.TsCollection.java
TsCollection(@Nullable String name, @Nonnull TsMoniker moniker, @Nullable MetaData md, @Nullable Iterable<Ts> ts) { m_name = Strings.nullToEmpty(name); m_moniker = moniker;// w w w . ja v a 2 s .c o m m_metadata = md; m_ts = ts != null ? Lists.newArrayList(ts) : new ArrayList<>(); m_info = TsInformationType.UserDefined; m_set = null; m_invalidDataCause = null; }
From source file:org.isisaddons.wicket.svg.cpt.applib.InteractiveMap.java
public String parse() { Document doc = Jsoup.parse(getSvg(), "", Parser.xmlParser()); OutputSettings settings = new OutputSettings(); settings.prettyPrint(false);//from ww w . j a v a2 s. c om doc.outputSettings(settings); for (InteractiveMapElement element : getElements()) { Element domElement = doc.getElementById(element.getId()); if (domElement != null) { for (InteractiveMapAttribute attribute : element.getAttributes()) { String attributeName = attribute.getName(); if ("fill".equals(attributeName)) { final String cssAttributes = Strings.nullToEmpty(domElement.attr("style")); domElement.attr("style", replaceCssAttribute(cssAttributes, attributeName, attribute.getValue())); } else if ("xlink:href".equals(attributeName)) { final String cssAttributes = Strings.nullToEmpty(domElement.attr("style")); domElement.attr("style", replaceCssAttribute(cssAttributes, "cursor", "pointer")); domElement.attr("onclick", "document.location.href='" + attribute.getValue() + "';"); } else if ("class".equals(attributeName)) { domElement.addClass(attribute.getValue()); } else { domElement.attr(attributeName, attribute.getValue()); } } int i = 0; for (String value : element.getValues()) { final Elements tspans = domElement.getElementsByTag("tspan"); if (tspans.size() > i) { tspans.get(i).text(value); } i++; } } } return doc.outerHtml(); }
From source file:uk.ac.stfc.isis.ibex.configserver.displaying.DisplayConfiguration.java
/** * Returns the description of the configuration. * * @return the description */ public String description() { return Strings.nullToEmpty(description); }
From source file:org.apache.oodt.cas.pushpull.filerestrictions.parsers.GenericEmailParser.java
public GenericEmailParser(String filePattern, String checkForPattern, String pathToRoot) { this.filePattern = filePattern; this.checkForPattern = checkForPattern; this.pathToRoot = Strings.nullToEmpty(pathToRoot); }