Example usage for org.apache.commons.lang StringUtils stripToNull

List of usage examples for org.apache.commons.lang StringUtils stripToNull

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils stripToNull.

Prototype

public static String stripToNull(String str) 

Source Link

Document

Strips whitespace from the start and end of a String returning null if the String is empty ("") after the strip.

Usage

From source file:gov.nih.nci.calims2.taglib.form.NumberTag.java

/**
 * @param numberType the numberType to set
 */
public void setNumberType(String numberType) {
    this.numberType = StringUtils.stripToNull(numberType);
}

From source file:com.amediamanager.domain.Video.java

public void setTitle(String title) {
    this.title = StringUtils.stripToNull(title);
}

From source file:gov.nih.nci.calims2.taglib.form.FormWidgetTag.java

/**
 * @param name the name to set
 */
public void setName(String name) {
    this.name = StringUtils.stripToNull(name);
}

From source file:com.adobe.acs.commons.oak.impl.EnsureOakIndexServlet.java

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {

    String forceParam = StringUtils.defaultIfEmpty(request.getParameter(PARAM_FORCE), "false");
    boolean force = Boolean.parseBoolean(forceParam);

    String path = StringUtils.stripToNull(request.getParameter(PARAM_PATH));
    try {/*from   w ww  . jav  a 2  s. co  m*/

        int count = 0;
        if (StringUtils.isBlank(path)) {
            count = ensureOakIndexManager.ensureAll(force);
        } else {
            count = ensureOakIndexManager.ensure(force, path);
        }

        response.setContentType("text/plain; charset=utf-8");
        response.getWriter().println("Initiated the ensuring of " + count + " oak indexes");
        response.setStatus(HttpServletResponse.SC_OK);
    } catch (IOException e) {
        log.warn("Caught IOException while handling doPost() in the Ensure Oak Index Servlet", e);
        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:com.amediamanager.domain.Video.java

public void setDescription(String description) {
    this.description = StringUtils.stripToNull(description);
}

From source file:gov.nih.nci.calims2.ui.generic.crud.CRUDForm.java

/**
 * Gets the notes input as a Set<Notes> to put in the submittedEntity.
 * @return The notes input as a Set<Notes> to put in the submittedEntity
 *///  w  w w.  j a v a2  s  .co m
public Set<Notes> getNotesCollection() {
    String content = StringUtils.stripToNull(newNote);
    if (content != null) {
        Set<Notes> notes = new HashSet<Notes>();
        Notes note = new Notes();
        note.setContent(content);
        note.setStatus(I18nEnumerationHelper.getByName(NotesStatus.class, newNoteStatus));
        notes.add(note);
        return notes;
    }
    return null;
}

From source file:ips1ap101.lib.core.db.util.InterpreteSqlOracle.java

@Override
public String getComandoExecute(String comando, int argumentos, EnumTipoResultadoSQL tipoResultado) {
    String command = StringUtils.stripToNull(comando);
    if (command != null) {
        String prefix;//from w  w  w  .  j  a v a  2 s . c  om
        String suffix;
        switch (tipoResultado) {
        case COMPOUND:
            prefix = COMANDO_EXECUTE_COMPUESTO;
            suffix = FIN_COMANDO_EXECUTE_COMPUESTO;
            break;
        case SIMPLE:
            prefix = COMANDO_EXECUTE_SIMPLE;
            suffix = FIN_COMANDO_EXECUTE_SIMPLE;
            break;
        default:
            prefix = COMANDO_EXECUTE;
            suffix = FIN_COMANDO_EXECUTE;
            break;
        }
        if (!StringUtils.startsWithIgnoreCase(command, prefix)) {
            command = prefix + " " + command;
        }
        String parametros = "";
        if (argumentos > 0) {
            for (int i = 0; i < argumentos; i++, parametros += ",?") {
            }
            parametros = "(" + parametros.substring(1) + ")";
        }
        if (!command.endsWith(";")) {
            if (!command.endsWith(parametros)) {
                command += parametros;
            }
            if (!command.endsWith(suffix)) {
                command += " " + suffix;
            }
        }
        command = StringUtils.removeEnd(command, ";");
        //          command = "{" + command + "}";
    }
    return command;
}

From source file:gov.nih.nci.calims2.taglib.form.FormTag.java

/**
 * @param action the action to set
 */
public void setAction(String action) {
    this.action = StringUtils.stripToNull(action);
}

From source file:com.egt.core.db.util.InterpreteSqlOracle.java

@Override
public String getComandoExecute(String comando, int argumentos, EnumTipoResultadoSQL tipoResultado) {
    String command = StringUtils.stripToNull(comando);
    if (command != null) {
        String prefix;//  w w w  .  ja  va2 s. c o m
        String suffix;
        switch (tipoResultado) {
        case COMPUESTO:
            prefix = COMANDO_EXECUTE_COMPUESTO;
            suffix = FIN_COMANDO_EXECUTE_COMPUESTO;
            break;
        case SIMPLE:
            prefix = COMANDO_EXECUTE_SIMPLE;
            suffix = FIN_COMANDO_EXECUTE_SIMPLE;
            break;
        default:
            prefix = COMANDO_EXECUTE;
            suffix = FIN_COMANDO_EXECUTE;
            break;
        }
        if (!StringUtils.startsWithIgnoreCase(command, prefix)) {
            command = prefix + " " + command;
        }
        String parametros = "";
        if (argumentos > 0) {
            for (int i = 0; i < argumentos; i++, parametros += ",?") {
            }
            parametros = "(" + parametros.substring(1) + ")";
        }
        if (!command.endsWith(";")) {
            if (!command.endsWith(parametros)) {
                command += parametros;
            }
            if (!command.endsWith(suffix)) {
                command += " " + suffix;
            }
        }
        command = StringUtils.removeEnd(command, ";");
        //          command = "{" + command + "}";
    }
    return command;
}

From source file:gov.nih.nci.calims2.taglib.form.ValidationTextBoxTag.java

/**
 * @param constraints the constraints to set
 *//*from ww  w  .j av a2s.  co m*/
public void setConstraints(String constraints) {
    this.constraints = StringUtils.stripToNull(constraints);
}