Example usage for org.apache.commons.lang3 StringUtils isNoneEmpty

List of usage examples for org.apache.commons.lang3 StringUtils isNoneEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils isNoneEmpty.

Prototype

public static boolean isNoneEmpty(final CharSequence... css) 

Source Link

Document

Checks if none of the CharSequences are empty ("") or null.

 StringUtils.isNoneEmpty(null)             = false StringUtils.isNoneEmpty(null, "foo")      = false StringUtils.isNoneEmpty("", "bar")        = false StringUtils.isNoneEmpty("bob", "")        = false StringUtils.isNoneEmpty("  bob  ", null)  = false StringUtils.isNoneEmpty(" ", "bar")       = true StringUtils.isNoneEmpty("foo", "bar")     = true 

Usage

From source file:com.taobao.android.builder.tools.proguard.BundleProguarder.java

private static void cacheProguard(AppVariantContext appVariantContext, Input input, Result result)
        throws FileCacheException, IOException {

    AwbBundle awbBundle = input.getAwbBundles().get(0).getAwbBundle();
    File tmpDir = new File(appVariantContext.getScope().getGlobalScope().getIntermediatesDir(),
            "progurad-cache/" + awbBundle.getName());
    tmpDir.mkdirs();//from w ww .ja v  a 2s .c om

    for (AwbTransform awbTransform : input.getAwbBundles()) {
        for (File file : awbTransform.getInputFiles()) {
            if (file.exists()) {
                String md5 = input.proguardJarMap.get(file);
                if (StringUtils.isNoneEmpty(md5)) {
                    FileUtils.copyFile(file, new File(tmpDir, md5 + ".jar"));
                } else {
                    FileUtils.copyFileToDirectory(file, tmpDir);
                }
            } else {
                new File(tmpDir, file.getName()).createNewFile();
            }
        }
    }

    //Keep cache. Json
    File keepFile = awbBundle.getKeepProguardFile();
    if (null != keepFile && keepFile.exists()) {
        FileUtils.copyFileToDirectory(keepFile, tmpDir);
    }

    File proguardCfg = new File(null != input.proguardOutputDir ? input.proguardOutputDir
            : appVariantContext.getAwbProguardDir(awbBundle), "proguard.cfg");
    if (!proguardCfg.exists()) {
        proguardCfg = input.printConfiguration;
    }
    if (null != proguardCfg && proguardCfg.exists()) {
        FileUtils.copyFileToDirectory(proguardCfg, tmpDir);
    }

    File usageCfg = new File(null != input.proguardOutputDir ? input.proguardOutputDir
            : appVariantContext.getAwbProguardDir(awbBundle), "usage.cfg");
    if (!usageCfg.exists()) {
        usageCfg = input.printUsage;
    }
    if (null != usageCfg && usageCfg.exists()) {
        FileUtils.copyFileToDirectory(usageCfg, tmpDir);
    }

    FileCacheCenter.cacheFile(CACHE_TYPE, result.key, tmpDir,
            AtlasBuildContext.sBuilderAdapter.pushCacheToNetwork && isRemoteCacheEnabled(appVariantContext));

}

From source file:au.com.ogsoft.yahaml4j.Haml.java

private boolean _lineHasElement(String identifier, String id, List<String> classes) {
    return StringUtils.isNoneEmpty(identifier) || StringUtils.isNoneEmpty(id) || !classes.isEmpty();
}

From source file:at.fh.swenga.firefighters.controller.FireFighterController.java

@RequestMapping(value = { "report" })
public String report(Model model, @RequestParam(required = false) String excel) {

    List<FireEngineModel> fireEngines = fireEngineRepository.findAll();

    // Store the fireEngines in the model, so the reports can access them
    model.addAttribute("fireEngines", fireEngines);

    // Which submit button was pressed? -> call the right report view
    if (StringUtils.isNoneEmpty(excel)) {
        return "excelReport";
    } else {//from w  w  w  . j a  va  2s. c  om
        return "forward:list";
    }
}

From source file:at.fh.swenga.firefighters.controller.FireFighterController.java

@RequestMapping(value = { "reportFireFighters" })
public String reportFireFighters(Model model, @RequestParam(required = false) String excel) {

    List<FireFighterModel> fireFighters = fireFighterRepository.findAll();

    // Store the fireEngines in the model, so the reports can access them
    model.addAttribute("fireFighters", fireFighters);

    // Which submit button was pressed? -> call the right report view
    if (StringUtils.isNoneEmpty(excel)) {
        return "excelReportFireFighter";
    } else {/*from   w w  w. j  av  a2s.c o  m*/
        return "forward:list";
    }
}

From source file:org.apache.atlas.web.rest.DiscoveryREST.java

/**
 * Retrieve data for the specified DSL/*w ww .j a  v  a 2s.c  o  m*/
 * @param query DSL query
 * @param typeName limit the result to only entities of specified type or its sub-types
 * @param classification limit the result to only entities tagged with the given classification or or its sub-types
 * @param limit limit the result set to only include the specified number of entries
 * @param offset start offset of the result set (useful for pagination)
 * @return Search results
 * @throws AtlasBaseException
 * @HTTP 200 On successful DSL execution with some results, might return an empty list if execution succeeded
 * without any results
 * @HTTP 400 Invalid DSL or query parameters
 */
@GET
@Path("/dsl")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasSearchResult searchUsingDSL(@QueryParam("query") String query,
        @QueryParam("typeName") String typeName, @QueryParam("classification") String classification,
        @QueryParam("limit") int limit, @QueryParam("offset") int offset) throws AtlasBaseException {
    AtlasPerfTracer perf = null;

    try {
        if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
            perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.searchUsingDSL(" + query + ","
                    + typeName + "," + classification + "," + limit + "," + offset + ")");
        }

        String queryStr = query == null ? "" : query;

        if (StringUtils.isNoneEmpty(typeName)) {
            queryStr = escapeTypeName(typeName) + " " + queryStr;
        }

        if (StringUtils.isNoneEmpty(classification)) {
            // isa works with a type name only - like hive_column isa PII; it doesn't work with more complex query
            if (StringUtils.isEmpty(query)) {
                queryStr += (" isa " + classification);
            }
        }

        return atlasDiscoveryService.searchUsingDslQuery(queryStr, limit, offset);
    } finally {
        AtlasPerfTracer.log(perf);
    }
}

From source file:org.apache.atlas.web.util.Servlets.java

public static String getDoAsUser(HttpServletRequest request) {
    if (StringUtils.isNoneEmpty(request.getQueryString())) {
        List<NameValuePair> list = URLEncodedUtils.parse(request.getQueryString(), UTF8_CHARSET);
        if (list != null) {
            for (NameValuePair nv : list) {
                if (DO_AS.equals(nv.getName())) {
                    return nv.getValue();
                }/*ww w  . ja va2 s.  c o  m*/
            }
        }
    }
    return null;
}

From source file:org.apache.beam.runners.samza.translation.ConfigBuilder.java

private static Map<String, String> createUserConfig(SamzaPipelineOptions options) throws Exception {
    final String configFilePath = options.getConfigFilePath();
    final Map<String, String> config = new HashMap<>();

    // If user provides a config file, use it as base configs.
    if (StringUtils.isNoneEmpty(configFilePath)) {
        final File configFile = new File(configFilePath);
        final URI configUri = configFile.toURI();
        final ConfigFactory configFactory = options.getConfigFactory().getDeclaredConstructor().newInstance();

        // Config file must exist for default properties config
        // TODO: add check to all non-empty files once we don't need to
        // pass the command-line args through the containers
        if (configFactory instanceof PropertiesConfigFactory) {
            checkArgument(configFile.exists(), "Config file %s does not exist", configFilePath);
        }/* w w  w .j  a  v  a2  s.  co  m*/

        config.putAll(configFactory.getConfig(configUri));
    }

    // Apply override on top
    if (options.getConfigOverride() != null) {
        config.putAll(options.getConfigOverride());
    }

    // If the config is empty, use the default local running mode
    if (config.isEmpty()) {
        config.putAll(localRunConfig());
    }

    return config;
}

From source file:org.apache.carbondata.core.constants.CarbondataVersionUnitTest.java

@Test
public void testCarbonVersionNotNull() {
    assertTrue(StringUtils.isNoneEmpty(CarbonVersionConstants.CARBONDATA_VERSION));
    assertTrue(StringUtils.isNoneEmpty(CarbonVersionConstants.CARBONDATA_BRANCH));
    assertTrue(StringUtils.isNoneEmpty(CarbonVersionConstants.CARBONDATA_REVISION));
    assertTrue(StringUtils.isNoneEmpty(CarbonVersionConstants.CARBONDATA_BUILD_DATE));
}

From source file:org.apache.fineract.commands.provider.CommandHandlerProvider.java

/**
 * Returns a handler for the given entity and action.<br/>
 * <br/>//from   w  ww .j a  v a2s.c  o m
 * Throws an {@link UnsupportedCommandException} if no handler
 * for the given entity, action combination can be found.
 * @param entity the entity to lookup the handler, must be given.
 * @param action the action to lookup the handler, must be given.
 */
@Nonnull
public NewCommandSourceHandler getHandler(@Nonnull final String entity, @Nonnull final String action) {
    Preconditions.checkArgument(StringUtils.isNoneEmpty(entity), "An entity must be given!");
    Preconditions.checkArgument(StringUtils.isNoneEmpty(action), "An action must be given!");

    final String key = entity + "|" + action;
    if (!this.registeredHandlers.containsKey(key)) {
        throw new UnsupportedCommandException(key);
    }
    return (NewCommandSourceHandler) this.applicationContext.getBean(this.registeredHandlers.get(key));
}

From source file:org.apache.metron.common.stellar.StellarTest.java

@Test
public void ensureDocumentation() {
    ClassLoader classLoader = getClass().getClassLoader();
    int numFound = 0;
    for (Class<?> clazz : new ClasspathFunctionResolver().resolvables()) {
        if (clazz.isAnnotationPresent(Stellar.class)) {
            numFound++;/*  ww w .  j a v  a 2s .c om*/
            Stellar annotation = clazz.getAnnotation(Stellar.class);
            Assert.assertFalse("Must specify a name for " + clazz.getName(),
                    StringUtils.isEmpty(annotation.name()));
            Assert.assertFalse("Must specify a description annotation for " + clazz.getName(),
                    StringUtils.isEmpty(annotation.description()));
            Assert.assertTrue("Must specify a non-empty params for " + clazz.getName(),
                    annotation.params().length > 0);
            Assert.assertTrue("Must specify a non-empty params for " + clazz.getName(),
                    StringUtils.isNoneEmpty(annotation.params()));
            Assert.assertFalse("Must specify a returns annotation for " + clazz.getName(),
                    StringUtils.isEmpty(annotation.returns()));
        }
    }
    Assert.assertTrue(numFound > 0);
}