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:com.jnj.b2b.storefront.security.impl.DefaultBruteForceAttackCounter.java

@Override
public void registerLoginFailure(final String userUid) {
    if (StringUtils.isNotEmpty(userUid)) {
        LoginFailure count = get(prepareUserUid(userUid), Integer.valueOf(0));
        count.setCounter(Math.min(count.getCounter() + 1, maxFailedLogins + 1));
        count.setDate(new Date());
        bruteForceAttackCache.put(prepareUserUid(userUid), count);
    }/*from   w w  w  . ja  v a 2  s. c  o  m*/
}

From source file:jp.co.nemuzuka.controller.management.ajax.MemberEditInfoController.java

@Override
@SystemManager/*from   w  w  w . ja va  2  s .  c om*/
protected Object execute() throws Exception {

    JsonResult result = new JsonResult();
    //Form?
    String keyToString = asString("keyToString");
    MemberForm form = memberService.get(keyToString);

    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.sailing.hrm.web.workflow.FreeFlowController.java

@RequestMapping(value = "all", method = RequestMethod.GET)
public String all(Model model, String processId, String orderId, String taskId) {
    model.addAttribute("processId", processId);
    if (StringUtils.isNotEmpty(orderId) && StringUtils.isNotEmpty(taskId)) {
        model.addAttribute("orderId", orderId);
        model.addAttribute("taskId", taskId);
    }// w ww  .ja  va2  s. c om
    return "flow/free/all";
}

From source file:com.dlshouwen.wzgl.reload.controller.ReloadCacheController.java

/**
 * ?/*from  www.  ja  v a2  s .  co m*/
 *
 * @param request 
  */
@RequestMapping(value = "", method = RequestMethod.POST)
@ResponseBody
public AjaxResponse reload(HttpServletRequest request) {
    JSONObject jobj = null;
    AjaxResponse ajaxResp = new AjaxResponse();
    String urls = AttributeUtils.getAttributeContent(request.getServletContext(), "wzgl_reload_interface");
    boolean reloadFlag = true;
    String errorUrl = "";
    if (StringUtils.isNotEmpty(urls)) {
        try {
            String url[] = urls.split(",");
            for (int i = 0; i < url.length; i++) {
                HttpRespons resps = requester.sendPost(url[i]);
                resps.getContent();
                if (StringUtils.isNotEmpty(resps.getContent())) {
                    try {
                        jobj = JSONObject.fromObject(resps.getContent());
                        if (StringUtils.isEmpty(jobj.getString("reloadOK"))
                                || !jobj.getString("reloadOK").equals("true")) {
                            errorUrl += "??" + (i + 1) + "" + url[i] + "<br/>";
                            errorUrl += "?" + jobj.getString("reloadErrorMsg") + "<br/>";
                            reloadFlag = false;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        errorUrl += "??" + (i + 1) + "" + url[i] + "<br/>";
                        reloadFlag = false;
                    }
                } else {
                    errorUrl += "??" + (i + 1) + "" + url[i] + "<br/>";
                    reloadFlag = false;
                }
            }
            if (reloadFlag) {
                ajaxResp.setSuccess(true);
                ajaxResp.setSuccessMessage("??");
            } else {
                ajaxResp.setError(true);
                ajaxResp.setErrorMessage("???<br/>" + errorUrl);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            ajaxResp.setError(true);
            ajaxResp.setErrorMessage("???");
        }
    } else {
        ajaxResp.setError(true);
        ajaxResp.setErrorMessage("???");
    }
    return ajaxResp;
}

From source file:net.sourceforge.fenixedu.dataTransferObject.documents.DocumentSearchBean.java

public boolean hasAddressee() {
    return StringUtils.isNotEmpty(getAddressee().getUsername())
            || StringUtils.isNotEmpty(getAddressee().getName())
            || StringUtils.isNotEmpty(getAddressee().getDocumentIdNumber());
}

From source file:com.thistech.spotlink.model.Ad.java

public Ad addTrackingEventUrl(String event, String url) {
    if (StringUtils.isNotEmpty(event) && StringUtils.isNotEmpty(url)) {
        getTrackingEvents().getEventUrls().put(StringUtils.trimToNull(event), StringUtils.trimToNull(url));
    }/*from   ww  w .  ja v a 2s  .  com*/
    return this;
}

From source file:jp.co.nemuzuka.controller.management.ajax.ProjectEditInfoController.java

@Override
@SystemManager/*from ww w .  ja va2  s .  c  om*/
protected Object execute() throws Exception {

    JsonResult result = new JsonResult();
    //Form?
    String keyToString = asString("keyToString");
    ProjectForm form = projectService.get(keyToString);

    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.qcloud.project.macaovehicle.service.impl.CarOwnerHousersServiceImpl.java

@Override
public boolean update(CarOwnerHousers carOwnerHousers) {

    if (StringUtils.isNotEmpty(carOwnerHousers.getLicenseUrl())) {
        carOwnerHousers.setLicenseUrl(fileSDKClient.uidToUrl(carOwnerHousers.getLicenseUrl()));
    }//  w  w w . j  a  v a2  s .c o  m
    return carOwnerHousersDao.update(carOwnerHousers);
}

From source file:com.bstek.dorado.data.config.xml.DataElementParser.java

@Override
protected Object internalParse(Node node, DataParseContext context) throws Exception {
    Object data = null;//from w w w .  j  a v a  2 s .  c om
    if (node instanceof Element) {
        boolean duringParsingDataElement = context.isDuringParsingDataElement();
        if (!duringParsingDataElement) {
            context.setDuringParsingDataElement(true);
        }

        Element element = (Element) node;
        if (element.getChildNodes().getLength() == 0) {
            String valueText = element.getAttribute(XmlConstants.ATTRIBUTE_VALUE);
            if (StringUtils.isNotEmpty(valueText)) {
                data = parseValueFromText(valueText, context);
            }
        } else {
            List<Element> elements = DomUtils.getChildElements(element);
            int size = elements.size();
            if (size == 0) {
                XmlParser parser = findSubParser(XmlConstants.VALUE);
                if (parser != null) {
                    data = parser.parse(element, context);
                } else {
                    data = ConfigUtils.IGNORE_VALUE;
                }
            } else if (size == 1) {
                data = dispatchElement(null, elements.get(0), context);
            } else if (size > 1) {
                throw new XmlParseException("Can not contains more than one data elements.", element, context);
            }
        }

        if (!duringParsingDataElement) {
            context.setDuringParsingDataElement(false);
        }
    } else {
        data = node.getNodeValue();
        Expression expression = getExpressionHandler().compile((String) data);
        if (expression != null) {
            data = expression;
        }
    }
    return data;
}

From source file:com.bstek.dorado.idesupport.parse.PropertyParser.java

@SuppressWarnings("unchecked")
@Override//from  w  ww .j  ava 2 s. co m
protected Object doParse(Node node, ParseContext context) throws Exception {
    Element element = (Element) node;
    ConfigRuleParseContext parserContext = (ConfigRuleParseContext) context;

    PropertyTemplate propertyTemplate = new PropertyTemplate();
    Map<String, Object> properties = this.parseProperties(element, context);

    String reference = (String) properties.remove("reference");
    if (StringUtils.isNotEmpty(reference)) {
        String ruleName, prop;
        int i = reference.indexOf(':');
        if (i > 0) {
            ruleName = reference.substring(0, i);
            prop = reference.substring(i + 1);
        } else {
            ruleName = reference;
            prop = "id";
        }
        propertyTemplate.setReference(
                new LazyReferenceTemplate(parserContext.getRuleTemplateManager(), ruleName, prop));
    }

    String clientTypesText = (String) properties.remove("clientTypes");
    int clientTypes = ClientType.parseClientTypes(clientTypesText);
    if (clientTypes > 0) {
        propertyTemplate.setClientTypes(clientTypes);
    }

    String compositeTypeConfig = (String) properties.remove("compositeType");
    if (StringUtils.isNotEmpty(compositeTypeConfig)) {
        CompositeType compositeType = CompositeType.valueOf(compositeTypeConfig);
        propertyTemplate.setCompositeType(compositeType);
    }

    BeanUtils.copyProperties(propertyTemplate, properties);

    if (propertyTemplate.getCompositeType() == CompositeType.Fixed
            || propertyTemplate.getCompositeType() == CompositeType.Open) {
        propertyTemplate
                .addProperties((Collection<PropertyTemplate>) dispatchChildElements(element, parserContext));
    }
    return propertyTemplate;
}