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

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

Introduction

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

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

Checks if a String is not empty (""), not null and not whitespace only.

Usage

From source file:com.smartitengineering.util.rest.client.ClientUtil.java

public static <T> T readEntity(final URI uri, HttpClient client, String acceptType, Class<? extends T> clazz) {
    if (uri != null && client != null && clazz != null) {
        try {/*  w  w  w .j av  a 2  s.  c  o m*/
            UniformInterface uniformInterface;
            WebResource resource = client.getWebResource(uri);
            uniformInterface = resource;
            if (StringUtils.isNotBlank(acceptType)) {
                Builder builder = resource.accept(acceptType);
                uniformInterface = builder;
            }
            T newEntity = uniformInterface.get(clazz);
            return newEntity;
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    return null;
}

From source file:fi.koku.portlet.filter.userinfo.service.impl.UserInfoServiceLooraImpl.java

public UserInfo getUserInfoById(String uid) {

    UserInfo ret = null;//from   ww  w .  j  av  a 2s  . c o  m

    if (StringUtils.isNotBlank(uid)) {
        PersonService ps = new PersonService();
        List<String> user = new ArrayList<String>(1);
        user.add(uid);//Add current user

        try {
            List<Person> persons = ps.getPersonsByUids(user, PersonConstants.PERSON_SERVICE_DOMAIN_OFFICER, uid,
                    UserInfoConstants.COMPONENT_USER_INFO_FILTER);
            Person p = persons.get(0);//Get the first one (actually should there should be only 0 or 1 persons in list)
            ret = UserInfoFactory.instance().createUserInfo(uid, p.getPic(), p.getFname(), p.getSname());
        } catch (Exception e) {
            LOG.error("Person not found with with uid=" + uid);
        }
    }
    return ret;
}

From source file:cd.go.contrib.elasticagents.dockerswarm.elasticagent.model.reports.agent.TaskStatus.java

public TaskStatus(Task task) {
    id = task.id();//from  w w w.ja  va  2s .c om
    state = task.status().state();
    if ("failed".equals(state)) {
        message = task.status().err();
    } else {
        message = task.status().message();
    }

    if (task.status().containerStatus() != null) {
        if (StringUtils.isNotBlank(task.status().containerStatus().containerId())) {
            containerId = task.status().containerStatus().containerId().substring(0, 12);
        }
        exitCode = task.status().containerStatus().exitCode();

        if (task.status().containerStatus().pid() == null) {
            pid = "-";
        } else {
            pid = task.status().containerStatus().pid().toString();
        }
    }
}

From source file:fi.koku.portlet.filter.userinfo.service.impl.UserInfoServiceSAMLLooraImpl.java

public UserInfo getUserInfoById(String pic) {

    UserInfo ret = null;//from w  w w.  jav a  2  s  .c o  m

    if (StringUtils.isNotBlank(pic)) {
        PersonService ps = new PersonService();
        List<String> user = new ArrayList<String>(1);
        user.add(pic);//Add current user

        try {
            List<Person> persons = ps.getPersonsByPics(user, PersonConstants.PERSON_SERVICE_DOMAIN_OFFICER, pic,
                    UserInfoConstants.COMPONENT_USER_INFO_FILTER);
            Person p = persons.get(0);//Get the first one (actually should there should be only 0 or 1 persons in list)

            if (p != null && p.getPic() != null && !"".equals(p.getPic())) {
                ret = UserInfoFactory.instance().createUserInfo(pic, p.getPic(), p.getFname(), p.getSname());
            }
        } catch (Exception e) {
            LOG.error("Person not found with with uid=" + pic);
        }
    }
    return ret;
}

From source file:com.ultrapower.eoms.common.plugin.ecside.core.bean.ColumnDefaults.java

static String getFilterCell(TableModel model, String filterCell) {
    String result;//from   ww  w  . j  av  a2 s.  c  om

    if (StringUtils.isNotBlank(filterCell)) {
        result = model.getPreferences().getPreference(PreferencesConstants.COLUMN_FILTER_CELL + filterCell);
        if (StringUtils.isBlank(result)) {
            result = filterCell;
        }
    } else {
        result = model.getPreferences().getPreference(PreferencesConstants.COLUMN_FILTER_CELL + TableConstants.CELL_FILTER);
    }

    return result;
}

From source file:com.timesheet.utils.Utils.java

public Date dateModification(Date date, String time) {

    Date modifiedDate = null;//from  w ww  .  ja v a 2s .  c om

    if (date != null && StringUtils.isNotBlank(time)) {
        String hhStr = time.split(":")[0];
        String mmStr = time.split(":")[1];

        Calendar calendar = Calendar.getInstance();

        calendar.setTime(date);

        calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + Integer.parseInt(hhStr));

        calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE) + Integer.parseInt(mmStr));

        modifiedDate = calendar.getTime();
    }

    return modifiedDate;
}

From source file:cn.com.gps169.bos.resource.VehicleController.java

/**
 * ?/* ww w. ja v  a 2 s  .c o m*/
 * @return
 */
@RequestMapping("page")
@ResponseBody
public String vehiclePage(HttpServletRequest request) {
    int pageNum = Integer.parseInt(request.getParameter("page"));
    int pageRows = Integer.parseInt(request.getParameter("rows"));
    String sStatus = request.getParameter("status");
    int status = StringUtils.isNotBlank(sStatus) ? Integer.parseInt(sStatus) : 0;
    String licensePlate = request.getParameter("licensePlate");
    JSONObject result = vehicleService.queryVehicle((pageNum - 1) * pageRows, pageRows, status, licensePlate);

    return result.toString();
}

From source file:com.playonlinux.library.LibraryFilter.java

@Override
public boolean test(InstalledApplicationEntity item) {
    // We want to return the whole list for EMPTY search string. Otherwise compare strings.
    return !StringUtils.isNotBlank(name) || item.getName().toLowerCase().contains(name);
}

From source file:adalid.core.wrappers.EntityWrapper.java

public String getValidDefaultShortLabel(EntityReference reference) {
    String string = reference == null ? null : _entity.getDefaultShortLabel(reference);
    return StringUtils.isNotBlank(string) ? string : getValidDefaultShortLabel();
}

From source file:com.townsfolkdesigns.jfugue.JFuguePlugin.java

public static void playBuffer(View view) {
    JEditTextArea currentTextArea = view.getTextArea();
    String bufferText = currentTextArea.getText();
    if (StringUtils.isNotBlank(bufferText)) {
        playMusicString(bufferText);//from   w w w  . j a  v  a 2  s .  c  o m
    }
}