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:cherry.example.web.basic.ex30.BasicEx31ServiceImpl.java

@Transactional
@Override// w  ww  . j av a 2 s .co m
public long update(long id, BasicEx31Form form) {
    SQLUpdateClause update = qf.update(et1).where(et1.id.eq(id));
    update.where(et1.lockVersion.eq(form.getLockVersion())).set(et1.lockVersion, et1.lockVersion.add(1));
    if (StringUtils.isNotEmpty(form.getText10())) {
        update.set(et1.text10, form.getText10());
    }
    if (StringUtils.isNotEmpty(form.getText100())) {
        update.set(et1.text100, form.getText100());
    }
    update.set(et1.int64, form.getInt64());
    update.set(et1.decimal1, form.getDecimal1());
    update.set(et1.decimal3, form.getDecimal3());
    update.set(et1.dt, form.getDt());
    update.set(et1.tm, form.getTm());
    update.set(et1.dtm, form.getDtm());
    return update.execute();
}

From source file:cherry.example.web.basic.ex40.BasicEx41ServiceImpl.java

@Transactional
@Override/*from w  w w  .j a v a2  s  .  c o  m*/
public long update(long id, BasicEx41Form form) {
    SQLUpdateClause update = qf.update(et1).where(et1.id.eq(id));
    update.where(et1.lockVersion.eq(form.getLockVersion())).set(et1.lockVersion, et1.lockVersion.add(1));
    if (StringUtils.isNotEmpty(form.getText10())) {
        update.set(et1.text10, form.getText10());
    }
    if (StringUtils.isNotEmpty(form.getText100())) {
        update.set(et1.text100, form.getText100());
    }
    update.set(et1.int64, form.getInt64());
    update.set(et1.decimal1, form.getDecimal1());
    update.set(et1.decimal3, form.getDecimal3());
    update.set(et1.dt, form.getDt());
    update.set(et1.tm, form.getTm());
    update.set(et1.dtm, form.getDtm());
    return update.execute();
}

From source file:glluch.com.ontotaxoseeker.IO.java

/**
 * Builds a the OntModel for <a href="https://jena.apache.org/">apache jena</a>
 * @return The OntModel form the filename.
 * @throws IOException Reading files//w  ww.  j a va2s  .  co  m
 */
public OntModel read() throws IOException {
    OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
    if (StringUtils.isNotEmpty(filename)) {

        InputStream in = FileManager.get().open(this.filename);
        if (in == null) {
            throw new IllegalArgumentException("File: " + this.filename + " not found");
        }

        m.read(in, null);
    }
    return m;
}

From source file:com.nagopy.android.xposed.utilities.ModBrightness.java

@InitZygote(summary = "?")
public static void initZygote(StartupParam startupParam, ModBrightnessSettingsGen mBrightnessSettings)
        throws Throwable {
    // ?/*from   w ww. j a  va  2s . c  o m*/
    if (StringUtils.isNotEmpty(mBrightnessSettings.configAutoBrightnessLevels)
            && StringUtils.isNotEmpty(mBrightnessSettings.configAutoBrightnessLcdBacklightValues)) {
        int[] autoBrightnessLevels = makeIntArray(mBrightnessSettings.configAutoBrightnessLevels);
        int[] autoBrightnessLcdBacklightValues = makeIntArray(
                mBrightnessSettings.configAutoBrightnessLcdBacklightValues);
        if ((autoBrightnessLevels.length + 1) != autoBrightnessLcdBacklightValues.length) {
            throw new IllegalArgumentException("");
        }
        XResources.setSystemWideReplacement("android", "array", "config_autoBrightnessLevels",
                autoBrightnessLevels);
        XResources.setSystemWideReplacement("android", "array", "config_autoBrightnessLcdBacklightValues",
                autoBrightnessLcdBacklightValues);

        XResources.setSystemWideReplacement("android", "bool", "config_automatic_brightness_available", true);
    }
}

From source file:com.xpn.xwiki.internal.skin.InternalSkinConfiguration.java

public String getDefaultSkinId(String def) {
    String skin = this.xwikicfg.getProperty("xwiki.defaultskin", def);

    return StringUtils.isNotEmpty(skin) ? skin : null;
}

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

/**
 * @param manufactureName the manufactureName to set
 *///  ww  w .java 2  s. c o m
public void setManufactureName(String manufactureName) {
    if (StringUtils.isNotEmpty(manufactureName))
        this.manufactureName = manufactureName.toUpperCase();
}

From source file:io.wcm.dam.assetservice.impl.AssetRequestParser.java

private static List<AssetRequest> getAssetRequestsFromSuffix(String assetPath,
        SlingHttpServletRequest request) {
    List<AssetRequest> requests = new ArrayList<>();

    String suffixWithoutExtension = StringUtils.substringBefore(request.getRequestPathInfo().getSuffix(), ".");
    String[] suffixParts = StringUtils.split(suffixWithoutExtension, "/");
    if (suffixParts != null) {
        for (String suffixPart : suffixParts) {
            Map<String, String> params = parseSuffixPart(suffixPart);
            String mediaFormat = params.get(RP_MEDIAFORMAT);
            long width = NumberUtils.toLong(params.get(RP_WIDTH));
            long height = NumberUtils.toLong(params.get(RP_HEIGHT));
            if (StringUtils.isNotEmpty(mediaFormat) || width > 0 || height > 0) {
                requests.add(new AssetRequest(assetPath, mediaFormat, width, height));
            }//www .  j a v  a  2 s.  co m
        }
    }

    return requests;
}

From source file:com.edp.admin.rest.ModelEditorJsonRestResource.java

@RequestMapping(value = "xxx/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) {
    ObjectNode modelNode = null;//from w ww.  ja v a2 s . c  o m

    Model model = repositoryService.getModel(modelId);

    if (model != null) {
        try {
            if (StringUtils.isNotEmpty(model.getMetaInfo())) {
                modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
            } else {
                modelNode = objectMapper.createObjectNode();
                modelNode.put(MODEL_NAME, model.getName());
            }
            modelNode.put(MODEL_ID, model.getId());
            ObjectNode editorJsonNode = (ObjectNode) objectMapper
                    .readTree(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
            modelNode.put("model", editorJsonNode);

        } catch (Exception e) {
            LOGGER.error("Error creating model JSON", e);
            throw new ActivitiException("Error creating model JSON", e);
        }
    }
    return modelNode;
}

From source file:com.ayovel.nian.servlet.UserBaseServlet.java

/**
 * ??//  w w  w .j  a  va  2  s .  c  o m
 */
@Override
protected void doPut(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String action = request.getParameter(RestConstants.ACTION_PARAM);
    String userid = request.getParameter(RestConstants.USER_ID);

    JSONObject json;
    if (action.equals(RestConstants.USER_LOGIN)) {
        json = userLogin(request, response);
        userid = (String) json.get("userid");
        response.sendRedirect("mainpage");//?
        if (StringUtils.isNotEmpty(userid)) {
            response.sendRedirect("mainpage");//?
        }
    } else if (action.equals(RestConstants.USER_REG)) {
        json = getUserReg(request, response);
        userid = (String) json.get("userid");
        if (StringUtils.isNotEmpty(userid)) {
            response.sendRedirect("mainpage");//?
        }

    } else {//userid?
        if (StringUtils.isEmpty(userid)) {
            response.sendRedirect("userlogin");//?
        }
    }

    if (action.equals(RestConstants.USER_HOME)) {
        json = getUserHome(request, response);
    } else if (action.equals(RestConstants.USER_INFO)) {
        json = getUserInfo(request, response);
    } else {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0303,
                RestConstants.ACTION_PARAM, action);
    }

    if (json != null) {
        sendJsonResponse(response, HttpServletResponse.SC_OK, json);
    } else {
        response.setStatus(HttpServletResponse.SC_OK);
    }
}

From source file:com.arvato.thoroughly.util.security.impl.AES128AttributeEncryptionStrategy.java

public String decrypt(final String c) throws Exception {
    if (StringUtils.isNotEmpty(c)) {
        final Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM);
        final SecretKeySpec keySpec = getKeySpec();

        cipher.init(2, keySpec);//from w w w.ja v a  2  s.c o  m

        final byte[] decoded = new Hex().decode(c.getBytes());
        final byte[] decrypted = cipher.doFinal(decoded);
        return new String(decrypted);
    }
    return c;
}