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.ephesoft.dcma.workflows.aspects.DCMAPreProcessAspect.java

/**
 * Executes pre-process annotation methods in a service for a batch.
 * /* w w w  .j a  va 2 s  .c  o  m*/
 * @param joinPoint {@link JoinPoint}
 * @throws DCMAException {@link DCMAException}
 */
@Before("execution(* com.ephesoft.dcma.*.service.*.*(..)) " + "&& !within(com.ephesoft.dcma.da.service.*) "
        + "&& !within(com.ephesoft.dcma.workflows.service.*)")
public void preprocess(JoinPoint joinPoint) throws DCMAException {
    try {
        Object target = joinPoint.getTarget();
        if (null != target) {
            Class<?> clazz = ClassUtils.getUserClass(target);
            Method[] methods = clazz.getMethods();
            if (!ArrayUtils.isEmpty(methods)) {
                findAspectMethodsToExecute(joinPoint, target, methods);
            }
        }
    } catch (Exception exception) {
        LOGGER.error("Exception in Pre-processing", exception);
        throw new DCMAException("Exception in Pre-processing", exception);
    }
}

From source file:com.vmware.bdd.cli.config.CliProperties.java

public String[] getSupportedCipherSuites() {
    String[] values = properties.getStringArray(SUPPORTED_CIPHERSUITES);
    return ArrayUtils.isEmpty(values) ? getSupportedCipherSuitesByGroup() : values;
}

From source file:com.ephesoft.dcma.workflows.aspects.DCMAPostProcessAspect.java

/**
 * Executes post-process annotation methods in a service for a batch.
 * //from  www.  j  a v  a2 s. c  o m
 * @param joinPoint {@link JoinPoint}
 * @throws DCMAException
 */
@AfterReturning("execution(* com.ephesoft.dcma.*.service.*.*(..)) "
        + "&& !within(com.ephesoft.dcma.da.service.*) " + "&& !within(com.ephesoft.dcma.workflows.service.*)")
public void postProcess(final JoinPoint joinPoint) throws DCMAException {
    try {
        final Object target = joinPoint.getTarget();
        if (null != target) {
            Class<?> clazz = ClassUtils.getUserClass(target);
            Method[] methods = clazz.getMethods();
            if (!ArrayUtils.isEmpty(methods)) {
                findAspectMethodsToExecute(joinPoint, target, methods);
            }
        }
    } catch (final Exception exception) {
        LOGGER.error("Exception in Post-processing", exception);
        throw new DCMAException("Exception in Post-processing", exception);
    }
}

From source file:com.jaeksoft.searchlib.index.IndexDirectory.java

public boolean isEmpty() throws IOException {
    rwl.r.lock();//  ww w  . j ava  2  s. c o m
    try {
        return ArrayUtils.isEmpty(directory.listAll());
    } catch (NoSuchDirectoryException e) {
        return true;
    } finally {
        rwl.r.unlock();
    }
}

From source file:edu.cornell.med.icb.goby.R.TestFisherExact.java

/**
 * An an example of an R x C table from Agresti (2002, p. 57) Job Satisfaction.
 *//*from   ww w . j ava  2s  .  c  om*/
@Test
public void agrestiJobSatisfaction() {
    final int[] inputTable = {
            /*                           income
            /* satisfaction    <15k    15-25k    25-40k   >40k */
            /*  VeryD */ 1, 2, 1, 0, /*  LittleD */ 3, 3, 6, 1, /*  ModerateS */ 10, 10, 14, 9, /*  VeryS */ 6,
            7, 12, 11 };

    final FisherExact.Result result = FisherExact.fexact(inputTable, 4, 4);
    assertEquals("pValue does not match", 0.7826849389656096, result.getPValue(), EPSILON);

    // everything else should be invalid since the input was not a 2x2 matrix
    assertNotNull("Confidence interval should not be null", result.getConfidenceInterval());
    assertTrue("Confidence interval should be an empty array",
            ArrayUtils.isEmpty(result.getConfidenceInterval()));
    assertTrue("Estimate should be NaN", Double.isNaN(result.getEstimate()));
    assertTrue("Odds ratio should be NaN", Double.isNaN(result.getOddsRatio()));
    assertEquals("Wrong Hypothesis for result", FisherExact.AlternativeHypothesis.twosided,
            result.getAlternativeHypothesis());

}

From source file:com.jaeksoft.searchlib.util.FileUtils.java

public static final boolean containsFile(final File directory, final boolean ignoreHidden) {
    if (!directory.exists())
        return false;
    if (!directory.isDirectory())
        return false;
    final FileFilter fileFilter = ignoreHidden ? FileNotHiddenFileFilter.FILE : FileFileFilter.FILE;
    return !ArrayUtils.isEmpty(directory.listFiles(fileFilter));
}

From source file:de.codesourcery.eve.skills.ui.components.impl.PasswordComponent.java

@Override
protected void okButtonClickedHook() {

    if (ArrayUtils.isEmpty(getPassword1())) {
        displayError("You need to enter a password)");
        return;/*w ww  .  j  av a  2  s.  com*/
    }

    if (mode == Mode.SET_PASSWORD) {
        if (ArrayUtils.isEmpty(getPassword1()) || getPassword1().length < 4) {
            displayError("You need to enter a password that is at least 4 characters long");
            return;
        }

        if (!ArrayUtils.isEquals(getPassword1(), getPassword2())) {
            displayError("Password mismatch - you need to enter the same password twice");
            return;
        }
    }

}

From source file:com.taobao.itest.listener.ITestSpringContextListener.java

private String[] retrieveLocations(Class<?> clazz) {
    Class<ITestSpringContext> annotationType = ITestSpringContext.class;
    @SuppressWarnings("rawtypes")
    List<Class> classesAnnotationDeclared = AnnotationUtil.findClassesAnnotationDeclaredWith(clazz,
            annotationType);//w w w.j a  v  a2  s  .  c o  m
    List<String> locationsList = new ArrayList<String>();
    for (Class<?> classAnnotationDeclared : classesAnnotationDeclared) {
        ITestSpringContext iTestSpringContext = classAnnotationDeclared.getAnnotation(annotationType);
        String[] value = iTestSpringContext.value();
        String[] locations = iTestSpringContext.locations();
        if (!ArrayUtils.isEmpty(value) && !ArrayUtils.isEmpty(locations)) {
            String msg = String.format(
                    "Test class [%s] has been configured with @ITestSpringContext' 'value' [%s] and 'locations' [%s] attributes. Use one or the other, but not both.",
                    classAnnotationDeclared, ArrayUtils.toString(value), ArrayUtils.toString(locations));
            throw new RuntimeException(msg);
        } else if (!ArrayUtils.isEmpty(value)) {
            locations = value;
        }

        if (locations != null) {
            locationsList.addAll(0, Arrays.<String>asList(locations));
        }
        if (!iTestSpringContext.inheritLocations()) {
            break;
        }
    }
    return locationsList.toArray(new String[locationsList.size()]);
}

From source file:com.github.lucapino.confluence.AddPageConfluenceMojo.java

private void createPageObject(PageDescriptor parent, String content) throws Exception {
    Log log = getLog();/*w  w w  .  ja va  2  s  .  c om*/
    // Run only at the execution root
    if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
        log.info("Skipping the announcement mail in this project because it's not the Execution Root");
    } else {
        try {
            // configure page
            ContentResultList contentResult = getClient().getContentBySpaceKeyAndTitle(parent.getSpace(),
                    parent.getTitle());
            Content parentContent = contentResult.getContents()[0];
            Parent parentPage = new Parent();
            parentPage.setId(parentContent.getId());
            Content newPage = new Content();
            newPage.setType(Type.PAGE);
            newPage.setSpace(new Space(parent.getSpace()));
            newPage.setTitle(pageTitle);
            newPage.setAncestors(new Parent[] { parentPage });
            Storage newStorage;
            if (wikiFormat) {
                Storage contentStorage = new Storage(content, Storage.Representation.WIKI.toString());
                newStorage = getClient().convertContent(contentStorage, Storage.Representation.STORAGE);
            } else {
                newStorage = new Storage(content, Storage.Representation.STORAGE.toString());
            }
            newPage.setBody(new Body(newStorage));
            getClient().postContent(newPage);

            PageDescriptor newPageDescriptor = new PageDescriptor();

            if (!ArrayUtils.isEmpty(attachments)) {
                new AddAttachmentConfluenceMojo(this, newPageDescriptor, attachments).execute();
            }
        } catch (Exception e) {
            throw fail("Unable to upload page", e);
        }
    }
}

From source file:com.emental.mindraider.core.rest.resource.FolderResource.java

/**
 * Get notebook names.// ww w . j a va 2 s. c o  m
 * 
 * @return array of notebook uri.
 */
@SuppressWarnings("unchecked")
public String[] getNotebookUris() {
    // presuming that there exist exactly one notebooks group
    ResourcePropertyGroup[] notebooks;
    try {
        notebooks = resource.getData().getPropertyGroup(new URI(PROPERTY_GROUP_URI_NOTEBOOKS));
    } catch (URISyntaxException e) {
        logger.error("getNotebookUris()", e);
        return null;
    }

    if (notebooks != null) {
        NotebookProperty[] properties = (NotebookProperty[]) notebooks[0].getProperties()
                .toArray(new NotebookProperty[0]);
        if (!ArrayUtils.isEmpty(properties)) {
            String[] result = new String[properties.length];
            for (int i = 0; i < properties.length; i++) {
                result[i] = properties[i].getUri().toASCIIString();
            }
            return result;
        }
    }
    return null;
}