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.haulmont.cuba.core.jmx.ObjectsCacheManager.java

@Override
public String printStatsByName(String cacheName) {
    if (StringUtils.isNotEmpty(cacheName)) {
        ObjectsCacheInstance cache = manager.getCache(cacheName);
        if (cache != null) {
            return cache.getStatistics().toString();
        } else/*from w ww.ja  va2s.  c o m*/
            return String.format("Couldn't find cache %s", cacheName);
    } else
        return "Empty name is not permitted";
}

From source file:com.clican.pluto.dataprocess.engine.processes.BeanExecProcessor.java

private void realProcess(ProcessorContext context) throws Exception {
    Object result = bean.processContext(context);
    if (result != null && StringUtils.isNotEmpty(resultName)) {
        context.setAttribute(resultName, result);
    }/*from w  w  w .j  a v a 2s  .c om*/
}

From source file:com.haulmont.cuba.gui.app.security.ds.UiPermissionsDatasource.java

@Override
protected void loadData(Map<String, Object> params) {
    if (permissionDs == null)
        return;/*w w w.j a va2 s .c  om*/

    if (!data.isEmpty())
        return;

    clear();

    for (Permission p : permissionDs.getItems()) {
        String permissionTarget = p.getTarget();
        if (StringUtils.isNotEmpty(permissionTarget)) {
            int delimeterIndex = permissionTarget.lastIndexOf(Permission.TARGET_PATH_DELIMETER);
            if (delimeterIndex >= 0) {
                String component = permissionTarget.substring(delimeterIndex + 1);
                String screen = permissionTarget.substring(0, delimeterIndex);
                UiPermissionVariant permissionVariant = getPermissionVariant(p);
                String permissionValue = screen + Permission.TARGET_PATH_DELIMETER + component;
                UiPermissionTarget target = new UiPermissionTarget("ui:" + permissionValue, permissionValue,
                        permissionValue);

                target.setPermissionVariant(permissionVariant);
                target.setComponent(component);
                target.setScreen(screen);

                includeItem(target);
            }
        }
    }
}

From source file:mitm.common.security.SecurityFactoryFactory.java

/**
 * Returns the system wide SecurityFactory
 *//*from  w  w  w .  j  a  v a  2s  .  co  m*/
public static synchronized SecurityFactory getSecurityFactory() throws SecurityFactoryFactoryException {
    if (factory == null) {
        try {
            /*
             * Check if a SecurityFactoryBuilder is specified in the system settings
             */
            String builderClazz = System.getProperty(SECURITY_FACTORY_BUILDER_SYSTEM_PROPERTY);

            if (StringUtils.isNotEmpty(builderClazz)) {
                Class<?> builderClass = Class.forName(builderClazz);

                if (!SecurityFactoryBuilder.class.isAssignableFrom(builderClass)) {
                    throw new SecurityFactoryFactoryException(
                            builderClazz + " is-not-a SecurityFactoryBuilder.");
                }

                SecurityFactoryBuilder builder = (SecurityFactoryBuilder) builderClass.newInstance();

                factory = builder.createSecurityFactory();
            } else {
                /*
                 * Use the default security factory
                 */
                factory = new DefaultSecurityFactory();
            }

            logger.info("SecurityFactory instance created. Class: {}", factory.getClass());
        } catch (InstantiationException e) {
            throw new SecurityFactoryFactoryException(e);
        } catch (IllegalAccessException e) {
            throw new SecurityFactoryFactoryException(e);
        } catch (ClassNotFoundException e) {
            throw new SecurityFactoryFactoryException(e);
        }
    }

    return factory;
}

From source file:gov.nih.nci.cabig.caaers.web.search.SearchUserController.java

@Override
protected Object formBackingObject(HttpServletRequest request) throws Exception {

    SearchUserCommand command = new SearchUserCommand();

    String popupRequest = request.getParameter("popupRequest");
    if (StringUtils.isNotEmpty(popupRequest)) {
        command.setPopupRequest(Boolean.valueOf(popupRequest));
    }/*from w w w . jav a2s .c om*/

    String popupRequestType = request.getParameter("popupRequestType");
    if (StringUtils.isNotEmpty(popupRequestType)) {
        command.setPopupRequestType(popupRequestType);
    }

    return command;
}

From source file:com.haulmont.cuba.core.entity.LocaleHelper.java

public static String getLocalizedEnumeration(String enumerationValues, String localeBundle) {
    String result = null;/*from w w w  .j a  v  a 2 s.c o m*/
    if (StringUtils.isNotEmpty(localeBundle)) {
        Properties localeProperties = loadProperties(localeBundle);
        if (localeProperties != null) {

            Locale locale = AppBeans.get(UserSessionSource.class).getLocale();
            String key = locale.getLanguage();
            if (StringUtils.isNotEmpty(locale.getCountry())) {
                key += "_" + locale.getCountry();
            }

            List<String> enumValues = new ArrayList<>();

            String[] enumerationValuesArray = enumerationValues.split(",");
            Map<String, String> localizedValuesMap = LocaleHelper.getLocalizedValuesMap(localeBundle);
            for (String value : enumerationValuesArray) {
                String resultValue = localizedValuesMap.getOrDefault(key + "/" + value, value);
                enumValues.add(resultValue);
            }
            result = Joiner.on(",").join(enumValues);
        }
    }
    return result;
}

From source file:com.nec.harvest.userdetails.AuthenticatedUserDetails.java

public static void removeUserPrincipal() {
    final Object principal = ContextAwareContainer.getInstance().getPrincipal();
    if (principal != null && principal instanceof User) {
        String username = ((User) principal).getUsername();
        if (StringUtils.isNotEmpty(username)) {
            cacheService.remove(username);
        }//from  w  ww. ja  va2s .co m
    }
}

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

protected void loadMaxLength(TextInputField.MaxLengthLimited component, Element element) {
    final String maxLength = element.attributeValue("maxLength");
    if (StringUtils.isNotEmpty(maxLength)) {
        component.setMaxLength(Integer.parseInt(maxLength));
    }//from  w w w  .  j  a  va 2s .co m
}

From source file:com.photon.phresco.framework.param.impl.Html5DefaultThemesListImpl.java

@Override
public PossibleValues getValues(Map<String, Object> paramMap) throws PhrescoException {
    try {/*from  ww w  .j ava  2s  . co  m*/
        PossibleValues possibleValues = new PossibleValues();
        String csvParam = (String) paramMap.get("themes");
        List<String> selectedThemes = new ArrayList<String>();
        if (StringUtils.isNotEmpty(csvParam)) {
            selectedThemes = Arrays.asList(csvParam.split(","));
        }
        if (CollectionUtils.isNotEmpty(selectedThemes)) {
            for (String selectedTheme : selectedThemes) {
                Value value = new Value();
                value.setValue(selectedTheme);
                possibleValues.getValue().add(value);
            }
        }
        return possibleValues;
    } catch (Exception e) {
        throw new PhrescoException(e);
    }
}

From source file:com.adobe.acs.commons.version.model.EvolutionModel.java

public EvolutionContext getEvolution() {
    if (StringUtils.isNotEmpty(path)) {
        Resource resource = resolver.resolve(path);
        if (resource != null && !ResourceUtil.isNonExistingResource(resource)) {
            return analyser.getEvolutionContext(resource);
        }//from w  ww  .j  a  v  a  2  s  . c o  m
        log.warn("Could not resolve resource at path={}", path);
    }
    log.warn("No path provided");
    return null;
}