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

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

Introduction

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

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

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

Usage

From source file:jp.co.nemuzuka.controller.bts.todo.ajax.TodoEditInfoController.java

@Override
protected Object execute() throws Exception {

    JsonResult result = new JsonResult();
    //Form?/*from w w w  . java2  s.  c  om*/
    String keyToString = asString("keyToString");
    TodoForm form = todoService.get(keyToString, userService.getCurrentUser().getEmail());

    if (StringUtils.isNotEmpty(keyToString) && StringUtils.isEmpty(form.keyToString)) {
        //??????????????
        result.setStatus(JsonResult.NO_DATA);
        result.getErrorMsg().add(ApplicationMessage.get("info.empty"));
    } else {
        result.setToken(this.setToken());
        result.setResult(form);
    }
    return result;
}

From source file:com.photon.phresco.ldap.model.UserAttributesMapper.java

@Override
protected Object doMapFromContext(DirContextOperations context) {
    User user = new User();
    user.setId(context.getStringAttribute(LDAP_UID_ATTRIBUTE));
    user.setName(context.getStringAttribute(LDAP_UID_ATTRIBUTE));
    user.setEmail(context.getStringAttribute(LDAP_MAIL_ATTRIBUTE));
    user.setDisplayName(context.getStringAttribute(LDAP_DISPLAY_NAME_ATTRIBUTE));
    String phrescoEnabled = "true";
    String stringAttribute = context.getStringAttribute(LDAP_PHRESCO_ENABLED);
    if (StringUtils.isNotEmpty(stringAttribute)) {
        phrescoEnabled = "true";
    }//from   w  ww. j  av a 2 s  .c  o  m
    user.setPhrescoEnabled(Boolean.parseBoolean(phrescoEnabled));
    user.setAuthType(AuthType.AUTHSERVICE);
    user.setValidLogin(true);
    return user;
}

From source file:jp.co.nemuzuka.controller.bts.dashboard.ajax.DashboardListController.java

@Override
protected Object execute() throws Exception {

    String selectedProject = getUserInfo().selectedProject;
    String[] openStatus = new String[0];
    if (StringUtils.isNotEmpty(selectedProject)) {
        openStatus = ticketMstService.getTicketMst(selectedProject).openStatus;
    }/*w w  w . j  a v  a2  s  .c  om*/

    JsonResult result = new JsonResult();
    result.setToken(this.setToken());
    result.setResult(dashboardService.getDashboardInfo(userService.getCurrentUser().getEmail(), selectedProject,
            openStatus, getUserInfo().dashboardLimitCnt));
    return result;
}

From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.TimeDataConverter.java

@Override
public Time stringToValue(String rawData) throws ParseException {
    return StringUtils.isNotEmpty(rawData) ? new Time(getFormatter().parse(rawData).getTime()) : null;
}

From source file:com.github.gekoh.yagen.util.MappingUtils.java

public static String getJpaEntityName(Class entityClass) {
    Entity entity = (Entity) entityClass.getAnnotation(Entity.class);
    if (entity == null) {
        return null;
    }//from w  ww. j  ava2 s. c  om
    return StringUtils.isNotEmpty(entity.name()) ? entity.name() : entityClass.getSimpleName();
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopLink.java

public DesktopLink() {
    impl = new JXHyperlink();
    impl.setAction(new AbstractAction() {
        @Override/*  w  w w .  ja  va2s .co  m*/
        public void actionPerformed(ActionEvent e) {
            String targetUrl = DesktopLink.this.url;
            if (StringUtils.isNotEmpty(targetUrl)) {
                DesktopWindowManager wm = App.getInstance().getMainFrame().getWindowManager();
                wm.showWebPage(targetUrl, Collections.<String, Object>emptyMap());
            }
        }
    });
}

From source file:com.openshift.internal.restclient.model.Port.java

public Port(ModelNode node, IPort port) {
    this(node);/*  w  ww.  ja v  a 2 s  .c o  m*/
    if (StringUtils.isNotEmpty(port.getName())) {
        setName(port.getName());
    }
    setProtocol(port.getProtocol());
    setContainerPort(port.getContainerPort());
}

From source file:com.cyclopsgroup.waterview.web.ProcessFormValve.java

/**
 * Overwrite or implement method invoke()
 *
 * @see com.cyclopsgroup.waterview.spi.Valve#invoke(com.cyclopsgroup.waterview.RuntimeData, com.cyclopsgroup.waterview.spi.PipelineContext)
 *//*from   w  ww  .  j  a  v a2 s  . c  o  m*/
public void invoke(RuntimeData data, PipelineContext pc) throws Exception {
    Parameters params = data.getParameters();
    String formId = params.getString("form_id");
    Form form = null;
    if (StringUtils.isNotEmpty(formId)) {
        form = (Form) data.getSessionContext().get(formId);
    }

    if (form == null) {
        pc.invokeNextValve(data);
        return;
    }

    boolean hasError = false;
    Field[] fields = form.getFields();
    for (int i = 0; i < fields.length; i++) {
        Field field = fields[i];
        field.setValue(params.getString(field.getName()));
        field.validate();
        if (field.isPassword()) {
            field.setValue(StringUtils.EMPTY);
        }
        if (!hasError && field.isInvalid()) {
            hasError = true;
        }
    }
    if (hasError) {
        if (params.getBoolean("force_validation")) {
            fail(data, pc);
            return;
        }
    }
    pc.invokeNextValve(data);
    Boolean formInvalid = (Boolean) data.getRequestContext().get("formInvalid");
    if (formInvalid != null && formInvalid.booleanValue()) {
        Properties formErrors = (Properties) data.getRequestContext().get("formErrors");
        for (Iterator i = formErrors.keySet().iterator(); i.hasNext();) {
            String fieldName = (String) i.next();
            String errorMessage = formErrors.getProperty(fieldName);
            Field field = form.getField(fieldName);
            if (field != null) {
                field.setInvalid(true);
                if (StringUtils.isEmpty(errorMessage)) {
                    field.setErrorMessage("Invalid field value ");
                } else {
                    field.setErrorMessage(errorMessage);
                }
            }
        }
        if (params.getBoolean("force_validation")) {
            fail(data, pc);
        }
    }
}

From source file:com.haulmont.timesheets.entity.ExtUser.java

@Override
public String getCaption() {
    if (StringUtils.isNotEmpty(firstName) || StringUtils.isNotEmpty(lastName)) {
        String pattern = "{0} {1}";
        MessageFormat fmt = new MessageFormat(pattern);
        return StringUtils.trimToEmpty(fmt.format(
                new Object[] { StringUtils.trimToEmpty(firstName), StringUtils.trimToEmpty(lastName) }));
    }/*from ww w . j a v a 2s .  c  om*/
    return super.getCaption();
}

From source file:com.groupon.jenkins.notifications.PusherEmailNotifier.java

@Override
public boolean needsEmail(DynamicBuild build, BuildListener listener) {
    return StringUtils.isNotEmpty(getPusherEmail(build));
}