Example usage for org.apache.commons.lang ArrayUtils isEmpty

List of usage examples for org.apache.commons.lang ArrayUtils isEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils isEmpty.

Prototype

public static boolean isEmpty(boolean[] array) 

Source Link

Document

Checks if an array of primitive booleans is empty or null.

Usage

From source file:com.kcs.action.GenerateXmlFlaAction.java

public String generateXml() throws Exception {
    logger.debug("generateXml : begin...");
    logger.debug("dataSetDate : " + tmpDataSetDate);

    byte[] xmlBytes = generateXmlService.generateXmlFla(tmpDataSetDate, tmpTcb);

    if (ArrayUtils.isEmpty(xmlBytes)) {
        throw new RuntimeException("Can't generate xml.");
    } else {//ww w . j  av a2  s.co m
        inputStream = new ByteArrayInputStream(xmlBytes);
    }
    setCookieDownloadStatus("complete");
    fileName = Utility.createXmlFileName("FLA", tmpDataSetDate);

    logger.debug("generateXml : end...");
    return XML;
}

From source file:com.kcs.action.GenerateXmlDfFxpAction.java

public String generateXml() throws Exception {
    logger.debug("generateXml : begin...");
    logger.debug("dataSetDate : " + tmpDataSetDate);

    byte[] xmlBytes = generateXmlService.generateXmlFxp(tmpDataSetDate, tmpTcb);

    if (ArrayUtils.isEmpty(xmlBytes)) {
        throw new RuntimeException("Can't generate xml.");
    } else {// ww w  . j a  v a 2s  .c  o  m
        inputStream = new ByteArrayInputStream(xmlBytes);
    }
    setCookieDownloadStatus("complete");
    fileName = Utility.createXmlFileName("DF_FXP", tmpDataSetDate);

    logger.debug("generateXml : end...");
    return XML;
}

From source file:com.kcs.action.GenerateXmlIpiAction.java

public String generateXml() throws Exception {
    logger.debug("generateXml : begin...");
    logger.debug("dataSetDate : " + tmpDataSetDate);

    byte[] xmlBytes = generateXmlService.generateXmlIpi(tmpDataSetDate, tmpTcb);

    if (ArrayUtils.isEmpty(xmlBytes)) {
        throw new RuntimeException("Can't generate xml.");
    } else {/*w ww.  ja v  a 2s  . com*/
        inputStream = new ByteArrayInputStream(xmlBytes);
    }
    setCookieDownloadStatus("complete");
    fileName = Utility.createXmlFileName("IPI", tmpDataSetDate);

    logger.debug("generateXml : end...");
    return XML;
}

From source file:net.jforum.core.hibernate.PostReportDAO.java

private int countTotalReportsByStatus(PostReportStatus status, int... forumIds) {
    Criteria criteria = this.session().createCriteria(PostReport.class).add(Restrictions.eq("status", status))
            .setProjection(Projections.rowCount());

    if (!ArrayUtils.isEmpty(forumIds)) {
        criteria.createAlias("post", "post")
                .add(Restrictions.in("post.forum.id", this.primitiveToWrapper(forumIds)));
    }/*from   w  w w.j  a  v a2s.c  o  m*/

    return ((Number) criteria.uniqueResult()).intValue();
}

From source file:com.kcs.action.GenerateXmlFtuAction.java

public String generateXml() throws Exception {
    logger.debug("generateXml : begin...");
    logger.debug("dataSetDate : " + tmpDataSetDate);

    byte[] xmlBytes = generateXmlService.generateXmlFtu(tmpDataSetDate, tmpTcb);

    if (ArrayUtils.isEmpty(xmlBytes)) {
        throw new RuntimeException("Can't generate xml.");
    } else {/*from  w  w  w.j  a v  a 2s . c  o m*/
        inputStream = new ByteArrayInputStream(xmlBytes);
    }
    setCookieDownloadStatus("complete");
    fileName = Utility.createXmlFileName("FTU", tmpDataSetDate);

    logger.debug("generateXml : end...");
    return XML;
}

From source file:com.kcs.action.GenerateXmlFtxAction.java

public String generateXml() throws Exception {
    logger.debug("generateXml : begin...");
    logger.debug("dataSetDate : " + tmpDataSetDate);

    byte[] xmlBytes = generateXmlService.generateXmlFtx(tmpDataSetDate, tmpTcb);

    if (ArrayUtils.isEmpty(xmlBytes)) {
        throw new RuntimeException("Can't generate xml.");
    } else {//from  w w  w .j a  v a 2 s .  c  o m
        inputStream = new ByteArrayInputStream(xmlBytes);
    }
    setCookieDownloadStatus("complete");
    fileName = Utility.createXmlFileName("FTX", tmpDataSetDate);

    logger.debug("generateXml : end...");
    return XML;
}

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

@Override
public PossibleValues getValues(Map<String, Object> paramMap) throws PhrescoException {
    String rootModulePath = "";
    String subModuleName = "";
    PossibleValues possibleValues = new PossibleValues();
    ApplicationInfo applicationInfo = (ApplicationInfo) paramMap.get(KEY_APP_INFO);
    String rootModule = (String) paramMap.get(KEY_ROOT_MODULE);
    if (StringUtils.isNotEmpty(rootModule)) {
        rootModulePath = Utility.getProjectHome() + rootModule;
        subModuleName = applicationInfo.getAppDirName();
    } else {/*from w w w.j a  v  a 2s .  co  m*/
        rootModulePath = Utility.getProjectHome() + applicationInfo.getAppDirName();
    }

    File file = new File(getResourcesPath(rootModulePath, subModuleName).toString());
    if (file.exists()) {
        File[] listFiles = file.listFiles(new BundleFileNameFilter(".bundle"));
        if (!ArrayUtils.isEmpty(listFiles)) {
            for (File listFile : listFiles) {
                Value value = new Value();
                value.setValue(listFile.getName());
                possibleValues.getValue().add(value);
            }
        }
    }

    return possibleValues;
}

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

@Override
public PossibleValues getValues(Map<String, Object> paramMap) throws PhrescoException {
    try {/*from  w w w.  j  av  a  2s.  c o m*/
        String rootModulePath = "";
        String subModuleName = "";
        PossibleValues possibleValues = new PossibleValues();
        ApplicationInfo applicationInfo = (ApplicationInfo) paramMap.get(KEY_APP_INFO);
        String rootModule = (String) paramMap.get(KEY_ROOT_MODULE);
        if (StringUtils.isNotEmpty(rootModule)) {
            rootModulePath = Utility.getProjectHome() + rootModule;
            subModuleName = applicationInfo.getAppDirName();
        } else {
            rootModulePath = Utility.getProjectHome() + applicationInfo.getAppDirName();
        }
        File file = new File(getResourcesPath(rootModulePath, subModuleName).toString());
        if (file.exists()) {
            File[] listFiles = file.listFiles();
            if (!ArrayUtils.isEmpty(listFiles)) {
                for (File listFile : listFiles) {
                    if (!listFile.getName().startsWith(".")) {
                        Value value = new Value();
                        value.setValue(listFile.getName());
                        value.setDependency("defaultTheme");
                        possibleValues.getValue().add(value);
                    }
                }
            }
        }

        return possibleValues;
    } catch (Exception e) {
        throw new PhrescoException(e);
    }
}

From source file:edu.mayo.cts2.framework.webapp.rest.controller.MultipleFiltersAspect.java

@Before("execution(public *"
        + " edu.mayo.cts2.framework.webapp.rest.controller.*.*(..,javax.servlet.http.HttpServletRequest,..,edu.mayo.cts2.framework.webapp.rest.command.RestFilters,..))")
public void addRestFilter(final JoinPoint jp) throws Throwable {

    RestFilters restFilters = null;/*w  w  w.j  a  v  a2 s  .c  o  m*/
    HttpServletRequest httpServletRequest = null;

    //this should never happen
    if (ArrayUtils.isEmpty(jp.getArgs())) {
        throw new IllegalStateException("Pointcut failure!");
    }

    boolean foundRestFilters = false;
    boolean foundHttpServletRequest = false;
    for (Object arg : jp.getArgs()) {
        if (arg instanceof RestFilters) {
            restFilters = (RestFilters) arg;
            foundRestFilters = true;
        }
        if (arg instanceof HttpServletRequest) {
            httpServletRequest = (HttpServletRequest) arg;
            foundHttpServletRequest = true;
        }
        if (foundRestFilters && foundHttpServletRequest) {
            break;
        }
    }

    //this also should never happen
    if (restFilters == null || httpServletRequest == null) {
        throw new IllegalStateException("Pointcut failure!");
    }

    Map<String, FilterTuple> filters = new HashMap<String, FilterTuple>();

    @SuppressWarnings("unchecked")
    Enumeration<String> params = httpServletRequest.getParameterNames();
    while (params.hasMoreElements()) {
        String param = params.nextElement();
        if (this.isGroupedParam(param, URIHelperInterface.PARAM_FILTERCOMPONENT)) {
            String groupId = this.getGroupId(param, URIHelperInterface.PARAM_FILTERCOMPONENT);
            FilterTuple tuple = this.getFilterTuple(groupId, filters);
            tuple.filterComponent = httpServletRequest.getParameter(param);
        }
        if (this.isGroupedParam(param, URIHelperInterface.PARAM_MATCHALGORITHM)) {
            String groupId = this.getGroupId(param, URIHelperInterface.PARAM_MATCHALGORITHM);
            FilterTuple tuple = this.getFilterTuple(groupId, filters);
            tuple.matchAlgorithm = httpServletRequest.getParameter(param);
        }
        if (this.isGroupedParam(param, URIHelperInterface.PARAM_MATCHVALUE)) {
            String groupId = this.getGroupId(param, URIHelperInterface.PARAM_MATCHVALUE);
            FilterTuple tuple = this.getFilterTuple(groupId, filters);
            tuple.matchValue = httpServletRequest.getParameter(param);
        }
    }

    for (FilterTuple tuple : filters.values()) {
        restFilters.getRestFilters().add(this.toRestFilter(tuple));
    }
}

From source file:com.taobao.itest.core.TestContextManager.java

private TestListener[] retrieveTestListeners(Class<?> clazz) {
    Class<TestListeners> annotationType = TestListeners.class;
    @SuppressWarnings("rawtypes")
    List<Class> classesAnnotationDeclared = AnnotationUtil.findClassesAnnotationDeclaredWith(clazz,
            annotationType);/*from  w w w . j a v  a 2s  .  c  o  m*/
    List<Class<? extends TestListener>> classesList = new ArrayList<Class<? extends TestListener>>();
    for (Class<?> classAnnotationDeclared : classesAnnotationDeclared) {
        TestListeners testListeners = classAnnotationDeclared.getAnnotation(annotationType);
        Class<? extends TestListener>[] valueListenerClasses = testListeners.value();
        Class<? extends TestListener>[] listenerClasses = testListeners.listeners();
        if (!ArrayUtils.isEmpty(valueListenerClasses) && !ArrayUtils.isEmpty(listenerClasses)) {
            String msg = String.format(
                    "Test class [%s] has been configured with @TestListeners' 'value' [%s] and 'listeners' [%s] attributes. Use one or the other, but not both.",
                    classAnnotationDeclared, ArrayUtils.toString(valueListenerClasses),
                    ArrayUtils.toString(listenerClasses));
            throw new RuntimeException(msg);
        } else if (!ArrayUtils.isEmpty(valueListenerClasses)) {
            listenerClasses = valueListenerClasses;
        }

        if (listenerClasses != null) {
            classesList.addAll(0, Arrays.<Class<? extends TestListener>>asList(listenerClasses));
        }
        if (!testListeners.inheritListeners()) {
            break;
        }
    }

    List<TestListener> listeners = new ArrayList<TestListener>(classesList.size());
    for (Class<? extends TestListener> listenerClass : classesList) {
        listeners.add((TestListener) BeanUtils.instantiateClass(listenerClass));
    }
    return listeners.toArray(new TestListener[listeners.size()]);
}