List of usage examples for org.apache.commons.lang ArrayUtils isNotEmpty
public static boolean isNotEmpty(boolean[] array)
Checks if an array of primitive booleans is not empty or not null
.
From source file:com.wantscart.jade.provider.Definition.java
public Definition(Class<?> clazz) { this.clazz = clazz; Type[] genTypes = clazz.getGenericInterfaces(); if (ArrayUtils.isNotEmpty(genTypes)) { Type[] params = ((ParameterizedType) genTypes[0]).getActualTypeArguments(); if (params.length > 0) { this.genericsClazz = (Class<?>) params[0]; } else {//from www .j av a 2 s . c o m this.genericsClazz = null; } } else { this.genericsClazz = null; } this.constants = Collections.unmodifiableMap( // NL GenericUtils.getConstantFrom(clazz, true, true)); }
From source file:gr.abiss.calipso.fs.FilePersistenceService.java
public static void validateContentType(String contentType, FilePersistence config) { if (ArrayUtils.isNotEmpty(config.mimeTypeIncludes()) && !ArrayUtils.contains(config.mimeTypeIncludes(), contentType.toLowerCase())) { throw new IllegalArgumentException("Unacceptable MIME type: " + contentType); }//from w ww. j av a2s . c om }
From source file:bigbluej.DocumentCommand.java
private DocumentCommand(String url, String name, byte[] content) { if (StringUtils.isNotBlank(url)) { Validate.isTrue(ArrayUtils.isEmpty(content), "when set url, don't set content too!"); Validate.isTrue(StringUtils.isBlank(name), "when set url, don't set name too!"); } else if (StringUtils.isNotBlank(name)) { Validate.isTrue(ArrayUtils.isNotEmpty(content), "when set name, set content too!"); Validate.isTrue(StringUtils.isBlank(url), "when set name, don't set url too!"); } else {/*w w w . ja v a 2 s. c o m*/ throw new IllegalArgumentException("set either name or url!"); } this.url = url; this.name = name; this.content = content; }
From source file:com.vmware.bdd.service.resmgmt.sync.filter.VcResourceFilters.java
public <T extends VcObject> VcResourceFilters addNameFilter(VC_RESOURCE_TYPE resourceClass, String[] resourceNames, boolean isReg) { if (ArrayUtils.isNotEmpty(resourceNames)) { List<IVcResourceFilter> vcResourceFilterList = getFilterList(resourceClass); if (isReg) { vcResourceFilterList.add(new VcResourceNameRegxFilter<T>(resourceNames)); } else {/*from w ww. j a v a 2s . c o m*/ vcResourceFilterList.add(new VcResourceNameFilter<T>(resourceNames)); } } else { LOGGER.warn("can't create an empty vc resource filter!"); } return this; }
From source file:de.pawlidi.openaletheia.utils.exec.ProcessExecutor.java
/** * Execute given system command with arguments. * /*from ww w . j a v a 2 s. c o m*/ * @param command * to execute * @param args * as command arguments * @return command output as String, null otherwise */ public static String executeCommand(final String command, String... args) { if (StringUtils.isNotEmpty(command)) { // create string output for executor ProcessStringOutput processOutput = new ProcessStringOutput(PROCESS_OUTPUT_LEVEL); // create external process Executor executor = createExecutor(processOutput); // create command line without any arguments final CommandLine commandLine = new CommandLine(command); if (ArrayUtils.isNotEmpty(args)) { // add command arguments commandLine.addArguments(args); } int exitValue = -1; try { // execute command exitValue = executor.execute(commandLine); } catch (IOException e) { // ignore exception } if (!executor.isFailure(exitValue)) { return processOutput.getOutput(); } } return null; }
From source file:com.mirth.connect.server.util.javascript.MirthContextFactory.java
public ClassLoader getIsolatedClassLoader() { if (isolatedClassLoader == null && ArrayUtils.isNotEmpty(urls)) { synchronized (this) { if (isolatedClassLoader == null) { isolatedClassLoader = new URLClassLoader(urls, null); }//from w ww . j a v a2 s. co m } } return isolatedClassLoader; }
From source file:com.vmware.bdd.service.resmgmt.sync.filter.VcResourceFilters.java
public VcResourceFilters addHostFilterByDatastore(String[] vcDsNameRegxs) { if (ArrayUtils.isNotEmpty(vcDsNameRegxs)) { getFilterList(VC_RESOURCE_TYPE.HOST).add(new HostFilterByDsNameRegx(vcDsNameRegxs)); } else {//from w w w. j av a2 s . c om LOGGER.warn("can't create an empty host by datastore filter!"); } return this; }
From source file:info.archinnov.achilles.internal.statement.wrapper.AbstractStatementWrapper.java
protected void writeDMLStatementLog(String queryType, String queryString, String consistencyLevel, Object... values) {// w w w.j a v a2 s. co m dmlLogger.debug("{} : [{}] with CONSISTENCY LEVEL [{}]", queryType, queryString, consistencyLevel); if (ArrayUtils.isNotEmpty(values)) { dmlLogger.debug("\t bound values : {}", Arrays.asList(values)); } }
From source file:azkaban.project.FlowLoaderFactory.java
private boolean checkForValidProjectYamlFile(final File projectDir) throws ProjectManagerException { final File[] projectFileList = projectDir.listFiles(new SuffixFilter(Constants.PROJECT_FILE_SUFFIX)); if (projectFileList == null) { throw new ProjectManagerException( "Error reading project directory. Input is not a " + "directory or IO error happens."); }/* ww w. ja v a 2 s . c o m*/ if (ArrayUtils.isNotEmpty(projectFileList)) { if (projectFileList.length > 1) { throw new ProjectManagerException( "Duplicate project YAML files found in the project " + "directory. Only one is allowed."); } final Map<String, Object> azkabanProject; try (FileInputStream fis = new FileInputStream(projectFileList[0])) { azkabanProject = (Map<String, Object>) new Yaml().load(fis); } catch (final IOException e) { throw new ProjectManagerException("Error reading project YAML file.", e); } if (azkabanProject == null || !azkabanProject.containsKey(Constants.ConfigurationKeys.AZKABAN_FLOW_VERSION)) { throw new ProjectManagerException( "azkaban-flow-version is not specified in the project " + "YAML file."); } if (azkabanProject.get(Constants.ConfigurationKeys.AZKABAN_FLOW_VERSION) .equals(Constants.AZKABAN_FLOW_VERSION_2_0)) { return true; } else { throw new ProjectManagerException("Invalid azkaban-flow-version in the project YAML file."); } } else { for (final File file : projectDir.listFiles(new DirFilter())) { if (checkForValidProjectYamlFile(file)) { return true; } } return false; } }
From source file:de.pawlidi.openaletheia.utils.CipherUtils.java
/** * Compute signature/*from w ww . j av a2s .c om*/ * * @param data * @return */ public static byte[] computeSignature(byte[] data) { if (ArrayUtils.isNotEmpty(data)) { try { MessageDigest messageDigest = MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM); messageDigest.update(data, 0, data.length); return messageDigest.digest(); } catch (Exception e) { throw new RuntimeException( "Cannot compute signature for " + MESSAGE_DIGEST_ALGORITHM + " message digest algorithm", e); } } return null; }