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.xhsoft.framework.common.interceptor.AccessInterceptor.java

/**
 * <p>Description:??????</p>
 * @param entRegNO   /*from   w w w. j a  va  2  s. c  om*/
 * @param proptity   
 * @return String
 * @author wenzhi
 * @version 1.0
 * @exception Exception
 */
public String intercept(ActionInvocation invocation) throws Exception {
    logger.debug("start access privilege check...");
    HttpServletRequest request = ServletActionContext.getRequest();
    String uri = request.getServletPath();
    String url = uri;
    String queryString = request.getQueryString();

    if (StringUtils.isNotEmpty(queryString)) {
        url = uri + "?" + queryString;
    }
    logger.debug(url);
    if (url.startsWith("/admin/purview/userinfo/login.action")
            || url.startsWith("/admin/purview/userinfo/logout.action")) {
        logger.debug("login/logout request,pass request");
        return invocation.invoke();
    } else {
        /*if (!LoginUtil.isLogin(request,"login")) {//?   
           logger.debug("not login request uri=" + url);
           logger.debug("not login access,take to login tip page");
           return "invalidLogin";
        }else {
           *//**???*//*
                                                                logger.debug("have login access,pass request");
                                                                return invocation.invoke();
                                                                }*/

        return invocation.invoke();
    }
}

From source file:com.bstek.dorado.view.widget.SubViewPropertyOutputter.java

public void output(Object object, String property, OutputContext context) throws Exception {
    SubViewHolder subViewHolder = (SubViewHolder) object;
    String viewName = subViewHolder.getSubView();
    Map<String, Object> subContext = subViewHolder.getContext();

    if (StringUtils.isNotEmpty(viewName)) {
        if (subContext != null && !subContext.isEmpty()) {
            Context doradoContext = Context.getCurrent();
            for (Map.Entry<String, Object> entry : subContext.entrySet()) {
                doradoContext.setAttribute(entry.getKey(), entry.getValue());
            }// ww w  . j av  a2 s  .c  om
        }

        ViewConfig viewConfig = viewConfigManager.getViewConfig(viewName);
        View view = null;
        JsonBuilder jsonBuilder = context.getJsonBuilder();
        jsonBuilder.key(property);
        jsonBuilder.beginValue();
        if (viewConfig != null) {
            view = viewConfig.getView();
            if (view != null) {
                super.outputObject(view, context);
            }
        }
        jsonBuilder.endValue();

        if (view != null && StringUtils.isNotEmpty(view.getPageTemplate())) {
            String calloutId = "subview_" + context.getCalloutId();
            context.addCalloutHtml(view, calloutId);

            StringBuffer script = new StringBuffer();
            script.append("self.assignDom(document.getElementById(\"").append(calloutId).append("\"));");

            view.addClientEventListener("onCreate", new DefaultClientEvent(script.toString()));
        }
    }
}

From source file:com.haulmont.cuba.gui.xml.layout.loaders.DateFieldLoader.java

@Override
public void loadComponent() {
    super.loadComponent();

    loadTabIndex(resultComponent, element);

    final String resolution = element.attributeValue("resolution");
    String dateFormat = element.attributeValue("dateFormat");
    String mainDateFormat = null;
    if (StringUtils.isNotEmpty(resolution)) {
        DateField.Resolution res = DateField.Resolution.valueOf(resolution);
        resultComponent.setResolution(res);
        if (dateFormat == null) {
            switch (res) {
            case YEAR:
            case MONTH:
            case DAY:
                mainDateFormat = "dateFormat";
                break;
            case HOUR:
            case MIN:
            case SEC:
                mainDateFormat = "dateTimeFormat";
                break;
            }/*from   www . j a v a2s.c om*/
        }
    }

    String formatStr = null;
    if (StringUtils.isNotEmpty(dateFormat)) {
        formatStr = loadResourceString(dateFormat);
    } else if (StringUtils.isNotEmpty(mainDateFormat)) {
        formatStr = messages.getMainMessage(mainDateFormat);
    }
    if (StringUtils.isNotEmpty(formatStr)) {
        resultComponent.setDateFormat(formatStr);
    }

    loadBuffered(resultComponent, element);

    loadRangeStart(resultComponent, element);
    loadRangeEnd(resultComponent, element);
}

From source file:com.lm.lic.manager.controller.IsvManWithdrawLicHandler.java

/**
 * @see com.lm.lic.manager.controller.WithdrawLicHandler#handleWithdrawal(javax.servlet.http.HttpServletRequest,
 *      com.lm.lic.manager.form.WithdrawLicForm)
 *//*from w ww .  ja v a2  s.  com*/
@SuppressWarnings("deprecation")
@Override
public ModelAndView handleWithdrawal(HttpServletRequest request, HttpServletResponse response,
        WithdrawLicForm wlf) {
    logger.info("Start ISV Handling of License Withdrawal Request");
    boolean valid = verifyIsvRequest(request);

    logger.info("ISV_MANUAL_REQUEST_VALID? : " + valid);

    Product product = null;
    String productKey = wlf.getProductKey();
    int numLics = wlf.getQty();
    String isvId = wlf.getIsvId();

    if (StringUtils.isNotEmpty(isvId))
        product = productService.findProductByProductKey(isvId, productKey);

    if (product != null)
        logger.info("ISV_MANUAL License Withdrawal for product: " + product.getName() + " "
                + product.getVersion() + " ISV: " + product.getIsv().getName());

    RequestForLicense prevRfl = findExistingLicWithdrawalRecord(product, wlf, request);

    String prodId = product.getId() + EMPTY;
    isvId = product.getIsv().getId() + EMPTY;

    int numOverdraft = 0;
    LicenseBlock licenseBlock = licenseBlockService.findByIsvIdProdId(isvId, prodId);
    String localeLang = extractLocaleLang(request);
    if (licenseBlock == null) {
        numOverdraft = numLics;
        logger.info("Found 0 " + "Lics to withdraw for ISV - Going OVERDRAFT");
        licenseAvailabilityAdvisor.generateLicenses(wlf.getDeviceId(), localeLang, product, numLics,
                numOverdraft, LicensePaymentStatus.OVERDRAFT);
        licenseBlock = licenseBlockService.findByIsvIdProdId(isvId, prodId);
    }

    List<License> licenses = findDecentLicenses(wlf.getLicKey(), numLics, product, wlf.getDeviceId());
    if (licenses == null || licenses.size() < numLics) {
        numOverdraft = numLics - licenses.size();
        licenseAvailabilityAdvisor.generateLicenses(wlf.getDeviceId(), localeLang, product, numOverdraft,
                numOverdraft, LicensePaymentStatus.OVERDRAFT);
        licenses = findDecentLicenses(wlf.getLicKey(), numLics, product, wlf.getDeviceId());
    }

    RequestForLicense currRfl = findRequestForLicenseTrace(request, wlf);
    if (licenses != null) {
        adjustDrawnLicenses(wlf, licenses, prevRfl, currRfl);
        licenseService.update(licenses);

        adjustLicenseBlock(licenseBlock, numLics, numOverdraft);
        licenseBlockService.update(licenseBlock);
        logger.info("Found " + licenses.size() + " Lics for ISV");
    } else
        licenses = generateOverDraftLicenses(prevRfl, currRfl);

    for (License l : licenses)
        logger.info("Generated license for ISV_MANUAL request: " + l.getLicKey() + " for product: "
                + l.getProduct().getName() + " " + l.getProduct().getVersion());

    if (currRfl != null)
        adjustRequestForLicenseTransaction(product, currRfl, prevRfl, licenses, numOverdraft);

    String successView = getSuccessView();
    ModelAndView modelAndView = new ModelAndView(successView);
    modelAndView.addObject("isvId", isvId);
    modelAndView.addObject("prodId", prodId);
    modelAndView.addObject("licenses", licenses);
    modelAndView.addObject("rfl", currRfl);
    modelAndView.addObject("product", product);
    return modelAndView;
}

From source file:cec.easyshop.storefront.security.impl.DefaultBruteForceAttackCounter.java

@Override
public void registerLoginFailure(final String userUid) {
    if (StringUtils.isNotEmpty(userUid)) {
        final 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);
    }/* ww w  .ja v  a2 s . c  om*/
}

From source file:jp.co.nemuzuka.controller.bts.ticket.ajax.TicketEditInfoController.java

@Override
@ProjectMember/*from   w w  w . ja  v  a  2  s . c  o m*/
protected Object execute() throws Exception {

    JsonResult result = new JsonResult();
    //Form?
    String keyToString = asString("keyToString");
    TicketForm form = ticketService.get(keyToString, getUserInfo().selectedProject);

    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.nagarro.core.security.impl.DefaultBruteForceAttackCounter.java

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

From source file:com.clican.pluto.fsm.dao.hibernate.TaskDaoHibernateImpl.java

@SuppressWarnings("unchecked")

public List<Task> findTasksByParams(String userId, String sessionName, String stateName, boolean completed) {
    StringBuffer hql = new StringBuffer("from Task where");
    if (completed) {
        hql.append(" completeTime is not null");
    } else {/*from   w ww  .  j  a va2 s.co  m*/
        hql.append(" completeTime is null");
    }
    if (StringUtils.isNotEmpty(sessionName)) {
        hql.append(" and state.session.name = :sessionName");
    }
    if (StringUtils.isNotEmpty(userId)) {
        hql.append(" and assignee= :userId");
    }
    if (StringUtils.isNotEmpty(stateName)) {
        hql.append(" and state.name = :stateName");
    }
    Query query = this.getSession().createQuery(hql.toString());
    if (StringUtils.isNotEmpty(sessionName)) {
        query.setParameter("sessionName", sessionName);
    }
    if (StringUtils.isNotEmpty(userId)) {
        query.setParameter("userId", userId);
    }
    if (StringUtils.isNotEmpty(stateName)) {
        query.setParameter("stateName", stateName);
    }
    return query.list();
}

From source file:com.haulmont.cuba.web.gui.icons.IconResolverImpl.java

@Override
public Resource getIconResource(String iconPath) {
    if (StringUtils.isEmpty(iconPath)) {
        return null;
    }// w ww  . jav  a2  s. com

    String themeIcon = getThemeIcon(processPath(iconPath));
    if (StringUtils.isNotEmpty(themeIcon)) {
        return getResource(themeIcon);
    }

    return getResource(iconPath);
}

From source file:com.baifendian.swordfish.common.job.struct.node.storm.StormParam.java

@Override
public boolean checkValid() {
    return type != null && StringUtils.isNotEmpty(topologyName) && stormParam != null
            && stormParam.checkValid();
}