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.inkubator.hrm.dao.impl.OhsaIncidentDaoImpl.java

private void doSearchByParam(OhsaIncidentSearchParameter parameter, Criteria criteria) {

    criteria.createAlias("ohsaCategory", "ohsaCategory", JoinType.INNER_JOIN);
    if (StringUtils.isNotEmpty(parameter.getKategori())) {
        criteria.add(Restrictions.like("ohsaCategory.name", parameter.getKategori(), MatchMode.ANYWHERE));
    }//from w  ww .j a  v  a  2s .  c  o m
    if (StringUtils.isNotEmpty(parameter.getSubjek())) {
        criteria.add(Restrictions.like("subject", parameter.getSubjek(), MatchMode.ANYWHERE));
    }
    if (StringUtils.isNotEmpty(parameter.getLokasi())) {
        criteria.add(Restrictions.like("location", parameter.getLokasi(), MatchMode.ANYWHERE));
    }
    criteria.add(Restrictions.isNotNull("id"));
}

From source file:com.glaf.base.utils.ParamUtil.java

public static int getInt(Map<String, Object> dataMap, String key) {
    int result = 0;
    Object value = dataMap.get(key);
    if (value != null && StringUtils.isNotEmpty(value.toString())) {
        if (value instanceof String) {
            String tmp = (String) value;
            result = Integer.valueOf(tmp);
        } else if (value instanceof Integer) {
            Integer x = (Integer) value;
            result = x.intValue();/*from ww w .  ja  v  a2s  . co  m*/
        } else if (value instanceof Long) {
            Long x = (Long) value;
            result = x.intValue();
        } else if (value instanceof Double) {
            Double x = (Double) value;
            result = x.intValue();
        }
    }
    return result;
}

From source file:com.properned.application.LocaleListCell.java

@Override
protected void updateItem(Locale locale, boolean empty) {
    super.updateItem(locale, empty);
    setGraphic(null);/*from ww  w .j  av  a  2s .  co m*/
    setText(null);
    if (locale != null) {
        String localeToString = locale.toString();
        if (localeToString.isEmpty()) {
            localeToString = MessageReader.getInstance().getMessage("locale.default");
        }
        if (StringUtils.isNotEmpty(locale.getDisplayName())) {
            localeToString += " (" + locale.getDisplayName() + ")";
        }

        setText(localeToString);

        MenuItem deleteMenu = getDeleteMenu(locale);
        this.setContextMenu(new ContextMenu(deleteMenu));

    }
}

From source file:com.inkubator.hrm.web.organisation.KlasifikasiKerjaLevelFormController.java

@PostConstruct
@Override//w w w .  jav  a  2  s.  c o  m
public void initialization() {
    super.initialization();
    try {
        String klasifikasiKerjaLevelId = FacesUtil.getRequestParameter("klasifikasiKerjaLevelId");
        model = new KlasifikasiKerjaLevelModel();
        klasifikasiKerjaList = klasifikasiKerjaService.getAllData();
        isUpdate = Boolean.FALSE;
        if (StringUtils.isNotEmpty(klasifikasiKerjaLevelId)) {
            KlasifikasiKerjaLevel klasifikasiKerjaLevel = service
                    .getEntiyByPK(Long.parseLong(klasifikasiKerjaLevelId));
            if (klasifikasiKerjaLevelId != null) {
                model = getModelFromEntity(klasifikasiKerjaLevel);
                isUpdate = Boolean.TRUE;
            }
        }
        //            doSelectOneMenuKlasifikasiKerja();
    } catch (Exception e) {
        LOGGER.error("error", e);
    }
}

From source file:com.alogic.ik.dic.Dictionary.java

public void disableWord(String word) {
    if (StringUtils.isNotEmpty(word)) {
        _MainDict.disableSegment(word.trim().toLowerCase().toCharArray());
    }
}

From source file:com.nridge.core.base.std.XMLUtl.java

public static void setAttrBoolValue(Element anElement, String aName, boolean aFlag) {
    if (StringUtils.isNotEmpty(aName)) {
        if (aFlag)
            anElement.setAttribute(aName, XML_UPPER_YES);
        else//w  w  w.  j  a  v  a2  s  .  com
            anElement.setAttribute(aName, XML_UPPER_NO);
    }
}

From source file:com.liveneo.plat.web.action.DownloadAction.java

public String getDownloadFileName() {
    String fileName = this.getRequest().getParameter("fileName");
    String filewav = this.getRequest().getParameter("filewav");
    String downFileName = "";
    if (StringUtils.equalsIgnoreCase(loadflag, "restore")) {
        downFileName = fileName + ".zip";
    }/*from  w  w w. ja  v  a 2 s.c o m*/
    if (StringUtils.equalsIgnoreCase(loadflag, "excel")) {
        downFileName = fileName;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "recording")) {
        if (StringUtils.isNotEmpty(fileName)) {
            downFileName = StringUtils.substringAfter(fileName, "/noneccrecord/ivrvoice/");
        } else {
            downFileName = "empty.wav";
        }
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "license")) {
        downFileName = filewav;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "wo")) {
        downFileName = fileName;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "report")) {
        downFileName = fileName;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "commonexcel")) {
        downFileName = fileName;
    }
    try {
        downFileName = new String(downFileName.getBytes(), "ISO8859-1");
    } catch (Exception e) {
        e.printStackTrace();
    }
    return downFileName;
}

From source file:com.aestheticsw.jobkeywords.service.termextractor.impl.indeed.IndeedClientTest.java

@Test
public void getIndeedJobDetails() {
    QueryKey key = new QueryKey("java spring", Locale.US, null);
    SearchParameters params = new SearchParameters(key, 10, 0, 0, null);
    List<JobSummary> jobSummaryList = indeedClient.getIndeedJobSummaryList(params);
    assertNotNull(jobSummaryList);// ww w. jav a2s .co m
    //        assertEquals(1, jobSummaryList.size());
    JobSummary jobSummary = jobSummaryList.get(2);
    String jobDetailsUrl = jobSummary.getUrl();
    assertNotNull(jobDetailsUrl);

    String details = indeedClient.getIndeedJobDetails(jobDetailsUrl);
    assertNotNull(details);
    assertTrue(StringUtils.isNotEmpty(details));
}

From source file:de.micromata.genome.gwiki.model.GWikiRoleConfig.java

public void addRight(GWikiRight right) {
    if (roles.containsKey(right.getName()) == true) {
        return;/* w  ww .j  ava 2 s .  com*/
    }
    if (StringUtils.isNotEmpty(right.getDefinition()) == true && right.getDefinitionRule() == null) {
        BooleanListRulesFactory<String> fac = new BooleanListRulesFactory<String>();
        right.setDefinitionRule(fac.createMatcher(right.getDefinition()));
    }
    roles.put(right.getName(), right);
    rights.add(right);
}

From source file:net.eledge.android.toolkit.db.abstracts.Dao.java

public E findOne(String rawQuery, String... params) {
    if (StringUtils.isNotEmpty(rawQuery)) {
        Cursor cursor = db.rawQuery(rawQuery, params);
        if ((cursor != null) && (cursor.getCount() == 1)) {
            E entity = mapToEntities(cursor).get(0);
            cursor.close();/*from   www . j  a va 2 s .  c  o  m*/
            return entity;
        }
    }
    return null;
}