Example usage for org.apache.commons.lang3 StringUtils isNotEmpty

List of usage examples for org.apache.commons.lang3 StringUtils isNotEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isNotEmpty.

Prototype

public static boolean isNotEmpty(final CharSequence cs) 

Source Link

Document

Checks if a CharSequence is not empty ("") and not null.

 StringUtils.isNotEmpty(null)      = false StringUtils.isNotEmpty("")        = false StringUtils.isNotEmpty(" ")       = true StringUtils.isNotEmpty("bob")     = true StringUtils.isNotEmpty("  bob  ") = true 

Usage

From source file:com.omertron.slackbot.model.HelpInfo.java

/**
 * Create a HelpInfo object with a single parameter
 *
 * @param command/*from  w  w  w .j a v  a  2 s.co  m*/
 * @param param
 * @param message
 * @param admin
 */
public HelpInfo(String command, String param, String message, boolean admin) {
    this.command = command;
    if (StringUtils.isNotEmpty(param)) {
        this.params.add(param);
    }
    this.message = message;
    this.admin = admin;
}

From source file:com.bna.ezrxlookup.domain.DrugLabel.java

/**
 * @param brandName the brandName to set
 *//*from w w  w .ja  v  a 2 s  .co  m*/
public void setBrandName(String brandName) {
    if (StringUtils.isNotEmpty(brandName))
        this.brandName = brandName.toUpperCase();
}

From source file:com.glaf.jbpm.assignment.AssignableHelper.java

public void setActors(Assignable assignable, String actorId) {
    if (StringUtils.isEmpty(actorId)) {
        throw new RuntimeException(" actorId is null ");
    }//from   w  w w.  java  2s  . com
    if (actorId.indexOf(",") > 0) {
        Set<String> actorIds = new HashSet<String>();
        StringTokenizer token = new StringTokenizer(actorId, ",");
        while (token.hasMoreTokens()) {
            String elem = token.nextToken();
            if (StringUtils.isNotEmpty(elem)) {
                actorIds.add(elem);
            }
        }
        if (actorIds.size() > 0) {
            int i = 0;
            String[] users = new String[actorIds.size()];
            Iterator<String> iterator = actorIds.iterator();
            while (iterator.hasNext()) {
                users[i++] = iterator.next();
            }
            assignable.setPooledActors(users);
        }
    } else {
        assignable.setActorId(actorId);
    }
}

From source file:io.wcm.config.core.impl.combined.SampleConfigurationFinderStrategy.java

private void addAbsoluteParent(List<String> configurationIds, Resource resource, int absoluteParent) {
    String configurationId = Text.getAbsoluteParent(resource.getPath(), absoluteParent);
    if (StringUtils.isNotEmpty(configurationId)) {
        configurationIds.add(configurationId);
    }/*from ww w. j  a  v a 2 s . c o m*/
}

From source file:com.inkubator.hrm.web.loan.LoanNewSchemaFormController.java

@PostConstruct
@Override// ww w .j  ava  2 s .  c  om
public void initialization() {
    super.initialization();
    try {
        model = new LoanNewSchemaModel();
        isUpdate = Boolean.FALSE;
        String loanNewSchemaId = FacesUtil.getRequestParameter("loanNewSchemaId");
        if (StringUtils.isNotEmpty(loanNewSchemaId)) {
            LoanNewSchema savingType = loanNewSchemaService.getEntiyByPK(Long.parseLong(loanNewSchemaId));
            if (loanNewSchemaId != null) {
                model = getModelFromEntity(savingType);
                isUpdate = Boolean.TRUE;
            }
        }
    } catch (Exception e) {
        LOGGER.error("Error", e);
    }
}

From source file:com.cognifide.aet.executor.common.ProgressMessageProcessor.java

@Override
public SuiteStatusResult process() {
    String message = null;/*from   w ww .  j  a v  a 2s .  co m*/
    if (progressMessage != null && StringUtils.isNotEmpty(progressMessage.getData())) {
        message = String.format("[%s]: %s", DATE_FORMATTER.get().format(new Date()), progressMessage.getData());
    }
    return new SuiteStatusResult(ProcessingStatus.PROGRESS, message);
}

From source file:com.twosigma.beaker.chart.serializer.GraphicsSerializer.java

@Override
public void serialize(T graphics, JsonGenerator jgen, SerializerProvider sp)
        throws IOException, JsonProcessingException {
    jgen.writeObjectField("type", graphics.getClass().getSimpleName());
    jgen.writeObjectField("uid", graphics.getUid());
    jgen.writeObjectField("visible", graphics.getVisible());
    jgen.writeObjectField("yAxis", graphics.getYAxis());
    jgen.writeObjectField("hasClickAction", graphics.hasClickAction());
    if (StringUtils.isNotEmpty(graphics.getClickTag())) {
        jgen.writeObjectField("clickTag", graphics.getClickTag());
    }/*w ww .j  a  va  2 s  .co  m*/
    Map<String, String> keyTags = graphics.getKeyTags();
    if (keyTags != null && !keyTags.isEmpty()) {
        jgen.writeObjectField("keyTags", keyTags);
    }
    Object[] keys = graphics.getKeys();
    if (ArrayUtils.isNotEmpty(keys)) {
        jgen.writeObjectField("keys", keys);
    }
}

From source file:com.inkubator.hrm.web.personalia.OhsaCategoryFormController.java

@PostConstruct
@Override/*from w w  w.  j ava2s. c  o m*/
public void initialization() {
    super.initialization();
    try {
        String ohsaCategoryId = FacesUtil.getRequestParameter("ohsaCategoryId");
        model = new OhsaCategoryModel();
        isUpdate = Boolean.FALSE;
        if (StringUtils.isNotEmpty(ohsaCategoryId)) {
            OhsaCategory ohsaCategory = service.getEntiyByPK(Long.parseLong(ohsaCategoryId));
            if (ohsaCategoryId != null) {
                model = getModelFromEntity(ohsaCategory);
                isUpdate = Boolean.TRUE;
            }
        }
    } catch (Exception e) {
        LOGGER.error("Error", e);
    }
}

From source file:com.fusionx.lightirc.util.SharedPreferencesUtils.java

public static void migrateToDatabase(final List<File> array, final Context context) {
    final BuilderDatabaseSource source = new BuilderDatabaseSource(context);
    source.open();//from w w w.j a  v a 2  s  .co m
    for (final File file : array) {
        final String prefsName = file.getName().replace(".xml", "");
        // Get builder to transfer
        final ServerConfiguration.Builder builder = convertPrefsToBuilder(context, prefsName);
        // Only transfer if the builder is not broken
        if (StringUtils.isNotEmpty(builder.getTitle()) && StringUtils.isNotEmpty(builder.getUrl())) {
            // Also transfer over ignore list
            final List<String> ignoreList = getIgnoreList(context, prefsName);
            source.addServer(builder, ignoreList);
        }
        file.delete();
    }
    source.close();
}

From source file:com.intuit.tank.rest.BaseRestClient.java

/**
 * /*from   w ww .  j  av  a 2s .co m*/
 * @param serviceUrl
 */
public BaseRestClient(String serviceUrl, final String proxyServer, final Integer proxyPort) {
    setBaseUrl(serviceUrl);
    if (StringUtils.isNotEmpty(proxyServer)) {
        ConnectorProvider connectorprovider = new HttpUrlConnectorProvider() {
            private Proxy proxy;

            private void initializeProxy() {
                int port = proxyPort != null ? proxyPort : 80;
                proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyServer, port));
            }

            public HttpURLConnection getHttpURLConnection(URL url) throws IOException {
                initializeProxy();
                return (HttpURLConnection) url.openConnection(proxy);
            }
        };
        client = ClientBuilder.newBuilder().register(connectorprovider).build();
    } else {
        client = ClientBuilder.newClient();
    }
    //        client.setConnectTimeout(5000);
    //        client.setFollowRedirects(true);
    LOG.info("client for url " + baseUrl + ": proxy="
            + (proxyServer != null ? proxyServer + ":" + proxyPort : "none"));
}