List of usage examples for org.apache.commons.lang ArrayUtils isEmpty
public static boolean isEmpty(boolean[] array)
Checks if an array of primitive booleans is empty or null
.
From source file:com.etcc.csc.datatype.PaymentDetailUtil.java
public static OLC_UNINVOICED_VIOLS_REC[] violationsToOLC_UNINVOICED_VIOLS_RECs(Violation[] violations) throws Exception { if (ArrayUtils.isEmpty(violations)) { return null; }//from w w w. j a v a 2s.c om OLC_UNINVOICED_VIOLS_REC[] OLC_UNINVOICED_VIOLS_RECs = new OLC_UNINVOICED_VIOLS_REC[violations.length]; for (int i = 0; i < violations.length; i++) { OLC_UNINVOICED_VIOLS_REC rec = violationToOLC_UNINVOICED_VIOLS_REC(violations[i]); //rec.setARR_INDEX(new BigDecimal(i + 1)); OLC_UNINVOICED_VIOLS_RECs[i] = rec; } return OLC_UNINVOICED_VIOLS_RECs; }
From source file:at.ac.tuwien.infosys.jcloudscale.utility.ReflectionUtil.java
/** * Returns the full-qualified class names for the given classes.<br/> * This method is the inverse of {@link #getClassesFromNames(String[], ClassLoader)}. * * @param classes the classes/* ww w. ja va2 s. co m*/ * @return a non-null array of the full-qualified class names */ public static String[] getNamesFromClasses(Class<?>... classes) { if (ArrayUtils.isEmpty(classes)) { return ArrayUtils.EMPTY_STRING_ARRAY; } String[] names = new String[classes.length]; for (int i = 0; i < classes.length; i++) { if (classes[i] != null) { names[i] = classes[i].getName(); } } return names; }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getFirstInvTotalTollDue() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { amount = amount.add(firstInvs[i].getAmount()).subtract(firstInvs[i].getInvoiceAdminFee()) .subtract(firstInvs[i].getAdjustedTxnFees()) .subtract(firstInvs[i].getInvSecondNoticeAdminFee()); }/*from w ww. j ava 2 s . c o m*/ } } return amount; }
From source file:com.vmware.aurora.global.Configuration.java
/** * Get all of values in a property as a String[] type. * * @param key//from ww w .j av a2s. co m * The key of property. * @param defautValue * The default value. * @return The property value. */ public static String[] getStringArray(String key, String[] defautValue) { String[] values = getStringArray(key); if (!ArrayUtils.isEmpty(values)) return values; return defautValue; }
From source file:edu.northwestern.bioinformatics.studycalendar.grid.PSCStudyConsumer.java
/** * Populates study site and returns it.//from ww w.j a v a 2 s . c om * * @param study * @param studyOrganizationTypes * @throws InvalidStudyException */ private void populateStudySite(final Study study, final gov.nih.nci.cabig.ccts.domain.StudyOrganizationType[] studyOrganizationTypes, SuiteRoleMembership suiteRoleMembership) throws StudyCreationException, InvalidStudyException { List<StudySite> studySites = new ArrayList<StudySite>(); if (studyOrganizationTypes != null) { for (StudyOrganizationType studyOrganizationType : studyOrganizationTypes) { StudySite studySite = null; if (studyOrganizationType instanceof StudySiteType) { studySite = new StudySite(); studySite.setSite(fetchSite(studyOrganizationType, suiteRoleMembership)); studySite.setStudy(study); studySite.setGridId(studyOrganizationType.getGridId()); studySites.add(studySite); } } } if (studySites.size() == 0 || ArrayUtils.isEmpty(studyOrganizationTypes)) { String message = "No sites is associated to this study" + study.getLongTitle(); throw getStudyCreationException(message); } study.setStudySites(studySites); }
From source file:com.fiveamsolutions.nci.commons.search.SearchCallback.java
private void dispatchCollectionNestedField(String baseParamName, Method m, Object result) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { String fieldName = StringUtils.uncapitalize(m.getName().substring("get".length())); String paramName = baseParamName + "_" + fieldName; SearchOptions searchOptions = new SearchOptions(m); validateSettings(searchOptions, result); if (result != null) { if (result instanceof Collection<?>) { processCollectionField((Collection<?>) result, fieldName, baseParamName, searchOptions); } else if (!ArrayUtils.isEmpty(searchOptions.getFields())) { if (!searchOptions.isHibernateComponent()) { nestedJoinClauses.add(String.format("%s.%s %s", baseParamName, fieldName, paramName)); } else { paramName = String.format("%s.%s", baseParamName, fieldName); }//from w w w. j a v a 2 s. c o m processFieldWithSubProp(result, fieldName, paramName, searchOptions, true); } else if (searchOptions.isNested()) { handleNestedCollectionNestedField(baseParamName, result, fieldName, paramName, searchOptions); } else { // just a simple field handleNestedFieldInCollection(paramName, baseParamName, fieldName, searchOptions, result); } } }
From source file:io.fabric8.kubernetes.api.KubernetesFactory.java
private void configureClientCert(WebClient webClient) { try (InputStream certInputStream = getInputStreamFromDataOrFile(clientCertData, clientCertFile)) { CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate cert = (X509Certificate) certFactory.generateCertificate(certInputStream); InputStream keyInputStream = getInputStreamFromDataOrFile(clientKeyData, clientKeyFile); PEMReader reader = new PEMReader(keyInputStream); RSAPrivateCrtKeySpec keySpec = new PKCS1EncodedKeySpec(reader.getDerBytes()).getKeySpec(); KeyFactory kf = KeyFactory.getInstance(clientKeyAlgo); RSAPrivateKey privKey = (RSAPrivateKey) kf.generatePrivate(keySpec); KeyStore keyStore = KeyStore.getInstance("JKS"); keyStore.load(null);/*from w w w . j av a2 s. c o m*/ String alias = cert.getSubjectX500Principal().getName(); keyStore.setKeyEntry(alias, privKey, clientKeyPassword, new Certificate[] { cert }); KeyManagerFactory keyManagerFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStore, clientKeyPassword); HTTPConduit conduit = WebClient.getConfig(webClient).getHttpConduit(); TLSClientParameters params = conduit.getTlsClientParameters(); if (params == null) { params = new TLSClientParameters(); conduit.setTlsClientParameters(params); } KeyManager[] existingKeyManagers = params.getKeyManagers(); KeyManager[] keyManagers; if (existingKeyManagers == null || ArrayUtils.isEmpty(existingKeyManagers)) { keyManagers = keyManagerFactory.getKeyManagers(); } else { keyManagers = (KeyManager[]) ArrayUtils.addAll(existingKeyManagers, keyManagerFactory.getKeyManagers()); } params.setKeyManagers(keyManagers); } catch (Exception e) { log.error("Could not create key manager for " + clientCertFile + " (" + clientKeyFile + ")", e); } }
From source file:com.etcc.csc.presentation.datatype.PaymentContext.java
public BigDecimal getFirstInvTotalTXNAdminFee() { BigDecimal amount = BigDecimal.ZERO; if (!ArrayUtils.isEmpty(firstInvs)) { for (int i = 0; i < firstInvs.length; i++) { if ("N".equals(firstInvs[i].getPaidIndicator())) { amount = amount.add(BigDecimalUtil.nullSafe(firstInvs[i].getAdjustedTxnFees())); }// www . j a va 2 s . c o m } } return amount; }
From source file:com.taobao.itest.listener.ITestDataSetListener.java
private String[] determineLocations(TestContext testContext, ITestDataSet annotation) { Class<?> testClass = testContext.getTestInstance().getClass(); String fileType = annotation.fileType(); String[] value = annotation.value(); String[] locations = annotation.locations(); if (!ArrayUtils.isEmpty(value) && !ArrayUtils.isEmpty(locations)) { String msg = String.format( "Test class [%s] has been configured with @ITestDataSetListener' 'value' [%s] and 'locations' [%s] attributes. Use one or the other, but not both.", testClass, ArrayUtils.toString(value), ArrayUtils.toString(locations)); throw new RuntimeException(msg); } else if (!ArrayUtils.isEmpty(value)) { locations = value;/*from w w w . j a v a 2 s . c o m*/ } if (ArrayUtils.isEmpty(locations)) {// user undefined,using default // location locations = ResourceLocationProcessingUtil.generateDefaultLocations(testClass, "." + fileType); } else {// process to standard resource locations = ResourceLocationProcessingUtil.modifyLocations(testClass, locations); } return locations; }
From source file:com.photon.phresco.framework.impl.ProjectManagerImpl.java
@Override public ProjectInfo getProject(String projectId, String customerId, String appId) throws PhrescoException { File[] appDirs = new File(Utility.getProjectHome()).listFiles(); for (File appDir : appDirs) { File[] split_phresco = null; File[] split_src = null;//from www . j a v a 2 s . c o m File[] dotPhrescoFolders = null; ProjectInfo projectInfo = null; dotPhrescoFolders = appDir.listFiles(new PhrescoFileNameFilter(FOLDER_DOT_PHRESCO)); if (ArrayUtils.isEmpty(dotPhrescoFolders)) { File dotAppDir = new File(appDir + File.separator + appDir.getName() + SUFFIX_PHRESCO); split_phresco = dotAppDir.listFiles(new PhrescoFileNameFilter(FOLDER_DOT_PHRESCO)); if (ArrayUtils.isEmpty(split_phresco)) { File srcAppDir = new File(appDir + File.separator + appDir.getName()); split_src = srcAppDir.listFiles(new PhrescoFileNameFilter(FOLDER_DOT_PHRESCO)); if (ArrayUtils.isEmpty(split_src)) { continue; } } } if (!ArrayUtils.isEmpty(dotPhrescoFolders)) { File[] dotProjectFiles = dotPhrescoFolders[0] .listFiles(new PhrescoFileNameFilter(PROJECT_INFO_FILE)); if (!ArrayUtils.isEmpty(dotProjectFiles)) { projectInfo = getProjectInfo(dotProjectFiles[0], projectId, customerId, appId); } } if (!ArrayUtils.isEmpty(split_phresco)) { File[] splitDotProjectFiles = split_phresco[0] .listFiles(new PhrescoFileNameFilter(PROJECT_INFO_FILE)); if (!ArrayUtils.isEmpty(splitDotProjectFiles)) { projectInfo = getProjectInfo(splitDotProjectFiles[0], projectId, customerId, appId); } } if (!ArrayUtils.isEmpty(split_src)) { File[] splitSrcDotProjectFiles = split_src[0] .listFiles(new PhrescoFileNameFilter(PROJECT_INFO_FILE)); if (!ArrayUtils.isEmpty(splitSrcDotProjectFiles)) { projectInfo = getProjectInfo(splitSrcDotProjectFiles[0], projectId, customerId, appId); } } if (projectInfo != null) { return projectInfo; } } return null; }