List of usage examples for org.apache.commons.lang StringUtils defaultIfEmpty
public static String defaultIfEmpty(String str, String defaultStr)
Returns either the passed in String, or if the String is empty or null
, the value of defaultStr
.
From source file:nl.tricode.magnolia.blogs.templates.BlogRenderableDefinition.java
public String buildQuery(String path, boolean useFilters, String customFilters, String contentType) { String filters = StringUtils.EMPTY; if (useFilters) { filters = customFilters;//from www. j a v a 2s . com } return "SELECT p.* FROM [" + contentType + "] AS p " + "WHERE ISDESCENDANTNODE(p, '" + StringUtils.defaultIfEmpty(path, "/") + "') " + filters + "ORDER BY p.[mgnl:created] desc"; }
From source file:nl.tricode.magnolia.blogs.templates.BlogRenderableDefinition.java
public String buildQuery(String path, String contentType) { return "SELECT p.* FROM [" + contentType + "] AS p " + "WHERE ISDESCENDANTNODE(p, '" + StringUtils.defaultIfEmpty(path, "/") + "') " + "ORDER BY p.[mgnl:created] desc"; }
From source file:nl.tricode.magnolia.blogs.templates.BlogSearchRenderableDefinition.java
protected String buildQuery(String path, Boolean useFilters) { log.debug("buildQuery path[" + path + "], useFilters [" + useFilters + "]."); String filters = StringUtils.EMPTY; if (useFilters) { filters = getPredicate();/* www . jav a 2 s . co m*/ } String query = "SELECT p.* FROM [nt:base] AS p " + "WHERE ISDESCENDANTNODE(p, '" + StringUtils.defaultIfEmpty(path, "/") + "') " + filters + "ORDER BY " + getOrderString(); return query; }
From source file:nl.tricode.magnolia.events.templates.EventsRenderableDefinition.java
public static String buildQuery(String path, boolean useFilters, String customFilters, String contentType) { String filters = StringUtils.EMPTY; if (useFilters) { filters = customFilters;// w w w. j a va 2 s .c om } return "SELECT p.* FROM [" + contentType + "] AS p " + "WHERE ISDESCENDANTNODE(p, '" + StringUtils.defaultIfEmpty(path, "/") + "') " + filters + "ORDER BY p.[mgnl:created] desc"; }
From source file:nl.tricode.magnolia.events.templates.EventsRenderableDefinition.java
public static String buildQuery(String path, String contentType) { return "SELECT p.* FROM [" + contentType + "] AS p " + "WHERE ISDESCENDANTNODE(p, '" + StringUtils.defaultIfEmpty(path, "/") + "') " + "ORDER BY p.[mgnl:created] desc"; }
From source file:no.freecode.translator.business.MessageImporter.java
/** * @param basename/*w ww . j a v a2 s .c o m*/ * e.g. "messages_nb_NO.properties", "messages_nb.properties" or * "messages.properties" (default/base locale). * @return */ private static MessageLocale getLocale(String filename) { String basename = FilenameUtils.getBaseName(filename); String localeString = StringUtils.substringAfter(basename, "_"); // --> e.g "nb" or "nb_NO" String name = StringUtils.defaultIfEmpty(localeString, ""); MessageLocale locale = MessageLocale.findMessageLocaleByName(name); if (locale == null) { locale = new MessageLocale(); locale.setName(name); } // MessageLocale locale = new MessageLocale(); // locale.setName(StringUtils.defaultIfEmpty(localeString, "")); return locale; }
From source file:org.apache.ctakes.jdl.data.base.JdlConnection.java
/** * @param jdbc/*from ww w.jav a 2 s.c o m*/ * the jdbc */ public JdlConnection(final JdbcType jdbc) { driver = StringUtils.defaultIfEmpty(jdbc.getDriver(), driver); url = StringUtils.defaultIfEmpty(jdbc.getUrl(), url); user = StringUtils.defaultIfEmpty(jdbc.getUsername(), user); password = StringUtils.defaultIfEmpty(jdbc.getPassword(), password); }
From source file:org.apache.fineract.accounting.journalentry.domain.JournalEntry.java
public JournalEntry(final Office office, final PaymentDetail paymentDetail, final GLAccount glAccount, final String currencyCode, final String transactionId, final boolean manualEntry, final Date transactionDate, final Integer type, final BigDecimal amount, final String description, final Integer entityType, final Long entityId, final String referenceNumber, final LoanTransaction loanTransaction, final SavingsAccountTransaction savingsTransaction, final ClientTransaction clientTransaction) { this.office = office; this.glAccount = glAccount; this.reversalJournalEntry = null; this.transactionId = transactionId; this.reversed = false; this.manualEntry = manualEntry; this.transactionDate = transactionDate; this.type = type; this.amount = amount; this.description = StringUtils.defaultIfEmpty(description, null); this.entityType = entityType; this.entityId = entityId; this.referenceNumber = referenceNumber; this.currencyCode = currencyCode; this.loanTransaction = loanTransaction; this.savingsTransaction = savingsTransaction; this.clientTransaction = clientTransaction; this.paymentDetail = paymentDetail; }
From source file:org.apache.fineract.infrastructure.codes.domain.CodeValue.java
private CodeValue(final Code code, final String label, final int position, final String description, final boolean isActive) { this.code = code; this.label = StringUtils.defaultIfEmpty(label, null); this.position = position; this.description = description; this.isActive = isActive; }
From source file:org.apache.fineract.infrastructure.dataqueries.domain.RegisteredTableMetaData.java
public Map<String, Object> update(final JsonCommand command) { final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(3); final String fieldName = "name"; if (command.isChangeInStringParameterNamed(fieldName, this.fieldName)) { final String newValue = command.stringValueOfParameterNamed(fieldName); actualChanges.put(fieldName, newValue); this.fieldName = StringUtils.defaultIfEmpty(newValue, null); }/* w w w . j av a 2s.c o m*/ final String labelName = " labelName"; if (command.isChangeInStringParameterNamed(labelName, this.labelName)) { final String newValue = command.stringValueOfParameterNamed(labelName); actualChanges.put(labelName, newValue); this.labelName = StringUtils.defaultIfEmpty(newValue, null); } if (command.parameterExists("order")) { if (command.isChangeInIntegerParameterNamed("order", this.order)) { final Integer newValue = command.integerValueOfParameterNamed("order"); actualChanges.put("order", newValue); } } if (command.parameterExists("displayCondition")) { if (command.isChangeInStringParameterNamed("displayCondition", this.displayCondition)) { final String newValue = command.stringValueOfParameterNamed("displayCondition"); actualChanges.put("displayCondition", newValue); } } if (command.parameterExists("formulaExpression")) { if (command.isChangeInStringParameterNamed("formulaExpression", this.formulaExpression)) { final String newValue = command.stringValueOfParameterNamed("formulaExpression"); actualChanges.put("formulaExpression", newValue); } } return actualChanges; }