Java Code Examples for org.apache.commons.lang.ArrayUtils#isEmpty()
The following examples show how to use
org.apache.commons.lang.ArrayUtils#isEmpty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XadesHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
public void after() throws TechnicalConnectorException { if (!ArrayUtils.isEmpty(this.specs)) { this.xadesQualProperties.setAttribute("Target", ref(this.sig.getId())); String xadesUnsignedId = IdGeneratorFactory.getIdGenerator("uuid").generateId(); UnsignedPropertiesBuilder unsignedProperties = new UnsignedPropertiesBuilder(); unsignedProperties.setId(xadesUnsignedId); XadesSpecification[] arr$ = this.specs; int len$ = arr$.length; for(int i$ = 0; i$ < len$; ++i$) { XadesSpecification spec = arr$[i$]; spec.addOptionalAfterSignatureParts(unsignedProperties, this.sig, xadesUnsignedId, this.options); } Document xadesUnsignedPropertiesDoc = unsignedProperties.buildAsDocument(); if (xadesUnsignedPropertiesDoc != null) { Element xadesUnsignedProperties = (Element)this.sig.getDocument().importNode(unsignedProperties.buildAsDocument().getDocumentElement(), true); this.xadesQualProperties.appendChild(xadesUnsignedProperties); } } }
Example 2
Source File: DynamicDBUtil.java From jeecg with Apache License 2.0 | 6 votes |
public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz,Object... param) { List<T> list; JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey); if (ArrayUtils.isEmpty(param)) { list = jdbcTemplate.queryForList(sql,clazz); } else { list = jdbcTemplate.queryForList(sql,clazz,param); } return list; }
Example 3
Source File: ClassesExportAction.java From patcher with Apache License 2.0 | 6 votes |
private void getVirtualFile(String sourceName, VirtualFile virtualFile[], String compileRoot) throws Exception { if (!ArrayUtils.isEmpty(virtualFile)) { VirtualFile arr$[] = virtualFile; int len$ = arr$.length; for (int i$ = 0; i$ < len$; i$++) { VirtualFile vf = arr$[i$]; String srcName; if (StringUtils.indexOf(vf.toString(), "$") != -1) srcName = StringUtils.substring(vf.toString(), StringUtils.lastIndexOf(vf.toString(), "/") + 1, StringUtils.indexOf(vf.toString(), "$")); else srcName = StringUtils.substring(vf.toString(), StringUtils.lastIndexOf(vf.toString(), "/") + 1, StringUtils.length(vf.toString()) - 6); String dstName = StringUtils.substring(sourceName, 0, StringUtils.length(sourceName) - 5); if (StringUtils.equals(srcName, dstName)) { String outRoot = (new StringBuilder()).append(StringUtils.substring(compileRoot, 0, StringUtils.lastIndexOf(compileRoot, "/"))).append("/out").toString(); String packagePath = StringUtils.substring(vf.getPath(), StringUtils.length(compileRoot), StringUtils.length(vf.getPath())); File s = new File(vf.getPath()); File t = new File((new StringBuilder()).append(outRoot).append(packagePath).toString()); FileUtil.copy(s, t); } if (!ArrayUtils.isEmpty(virtualFile)) getVirtualFile(sourceName, vf.getChildren(), compileRoot); } } }
Example 4
Source File: CryptoImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private SigningCredential retrieveSigningCredential(String alias, KeyStore keyStore) { try { Certificate[] c = keyStore.getCertificateChain(alias); if (ArrayUtils.isEmpty(c)) { throw new IllegalArgumentException("The KeyStore doesn't contain the required key with alias [" + alias + "]"); } else { X509Certificate[] certificateChain = (X509Certificate[])Arrays.copyOf(c, c.length, X509Certificate[].class); PrivateKey privateKey = (PrivateKey)keyStore.getKey(alias, (char[])null); return SigningCredential.create(privateKey, Iterables.newList(certificateChain)); } } catch (KeyStoreException var6) { throw new IllegalArgumentException("Given keystore hasn't been initialized", var6); } catch (NoSuchAlgorithmException var7) { throw new IllegalStateException("There is a problem with the Security configuration... Check if all the required security providers are correctly registered", var7); } catch (UnrecoverableKeyException var8) { throw new IllegalStateException("The private key with alias [" + alias + "] could not be recovered from the given keystore", var8); } }
Example 5
Source File: ConfigValidatorImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private boolean validate() { this.unfoundProps = new Object[0]; Iterator i$ = this.expectedProps.iterator(); while(i$.hasNext()) { String prop = (String)i$.next(); boolean validProp = this.config.containsKey(prop); boolean validMatchProp = this.config.containsKey(prop + ".1"); if (validProp || validMatchProp) { validProp = true; } if (!validProp) { LOG.warn("Could not find property:" + prop); this.unfoundProps = ArrayUtils.add(this.unfoundProps, prop); } } return ArrayUtils.isEmpty(this.unfoundProps); }
Example 6
Source File: ConsultationFullMessageBuilder.java From freehealth-connector with GNU Affero General Public License v3.0 | 6 votes |
private <T> byte[] base64decoding(DataHandler dataHandler, boolean encrypted, AbstractConsultationBuilder.ExceptionContainer<GetFullMessageResponse> container) throws TechnicalConnectorException, EhboxBusinessConnectorException { InputStream is = null; Object var6; try { is = dataHandler.getInputStream(); byte[] byteVal = ConnectorIOUtils.getBytes(is); if (!ArrayUtils.isEmpty(byteVal)) { byte[] var12 = this.handleAndDecryptIfNeeded(byteVal, encrypted, container); return var12; } var6 = null; } catch (IOException var10) { throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_GENERAL, var10, new Object[]{"Unable to decode datahandler"}); } finally { ConnectorIOUtils.closeQuietly((Object)is); } return (byte[])var6; }
Example 7
Source File: DefaultStepBasedSequenceHandler.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private void handleRoleMapping(AuthenticationContext context, SequenceConfig sequenceConfig, Map<String, String> mappedAttrs) throws FrameworkException { String spRoleUri = getSpRoleClaimUri(sequenceConfig.getApplicationConfig()); String[] roles = DefaultSequenceHandlerUtils.getRolesFromSPMappedClaims(context, sequenceConfig, mappedAttrs, spRoleUri); if (!ArrayUtils.isEmpty(roles)) { mappedAttrs.put(spRoleUri, getServiceProviderMappedUserRoles(sequenceConfig, Arrays.asList(roles))); } }
Example 8
Source File: DynamicDBUtil.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * Executes the SQL statement in this <code>PreparedStatement</code> object, * which must be an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or * <code>DELETE</code>; or an SQL statement that returns nothing, * such as a DDL statement. */ public static int update(final String dbKey, String sql, Object... param) { int effectCount; JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey); if (ArrayUtils.isEmpty(param)) { effectCount = jdbcTemplate.update(sql); } else { effectCount = jdbcTemplate.update(sql, param); } return effectCount; }
Example 9
Source File: RangerPathResourceMatcher.java From ranger with Apache License 2.0 | 5 votes |
static boolean isRecursiveWildCardMatch(String pathToCheck, String wildcardPath, char pathSeparatorChar, IOCase caseSensitivity) { boolean ret = false; if (! StringUtils.isEmpty(pathToCheck)) { String[] pathElements = StringUtils.split(pathToCheck, pathSeparatorChar); if(! ArrayUtils.isEmpty(pathElements)) { StringBuilder sb = new StringBuilder(); if(pathToCheck.charAt(0) == pathSeparatorChar) { sb.append(pathSeparatorChar); // preserve the initial pathSeparatorChar } for(String p : pathElements) { sb.append(p); ret = FilenameUtils.wildcardMatch(sb.toString(), wildcardPath, caseSensitivity); if (ret) { break; } sb.append(pathSeparatorChar); } sb = null; } else { // pathToCheck consists of only pathSeparatorChar ret = FilenameUtils.wildcardMatch(pathToCheck, wildcardPath, caseSensitivity); } } return ret; }
Example 10
Source File: DynamicDBUtil.java From jeecg-cloud with Apache License 2.0 | 5 votes |
public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz, Object... param) { List<T> list; JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey); if (ArrayUtils.isEmpty(param)) { list = jdbcTemplate.queryForList(sql, clazz); } else { list = jdbcTemplate.queryForList(sql, clazz, param); } return list; }
Example 11
Source File: ServerIdpManagementService.java From identity-api-server with Apache License 2.0 | 5 votes |
/** * Create external OutboundConnector from Provisioning Config. * * @param connectorId Outbound provisioning connector resource ID. * @param identityProvider Identity Provider information. * @return External outbound connector. */ private OutboundConnector createOutboundConnector(String connectorId, IdentityProvider identityProvider) { ProvisioningConnectorConfig[] connectorConfigs = identityProvider.getProvisioningConnectorConfigs(); if (ArrayUtils.isEmpty(connectorConfigs)) { return null; } ProvisioningConnectorConfig config = null; boolean isDefaultConnector = false; String connectorName = base64URLDecode(connectorId); for (ProvisioningConnectorConfig connectorConfig : connectorConfigs) { if (StringUtils.equals(connectorConfig.getName(), connectorName)) { config = connectorConfig; } } if (identityProvider.getDefaultProvisioningConnectorConfig() != null && StringUtils.equals(identityProvider .getDefaultProvisioningConnectorConfig().getName(), connectorName)) { isDefaultConnector = true; } OutboundConnector outboundConnector = null; if (config != null) { outboundConnector = new OutboundConnector(); outboundConnector.setConnectorId(connectorId); outboundConnector.setName(config.getName()); outboundConnector.setIsEnabled(config.isEnabled()); outboundConnector.setIsDefault(isDefaultConnector); outboundConnector.setBlockingEnabled(config.isBlocking()); outboundConnector.setRulesEnabled(config.isRulesEnabled()); List<org.wso2.carbon.identity.api.server.idp.v1.model.Property> properties = Arrays.stream(config .getProvisioningProperties()).map(propertyToExternal) .collect(Collectors.toList()); outboundConnector.setProperties(properties); } return outboundConnector; }
Example 12
Source File: Hive.java From pxf with Apache License 2.0 | 5 votes |
/** * Loads data to given partition in Hive table. * * @param table hive table * @param filePath data to load * @param isLocal true if data is local * @param partitions partition(s) to load to * @throws Exception */ public void loadDataToPartition(HiveTable table, String filePath, boolean isLocal, String[] partitions) throws Exception { if (ArrayUtils.isEmpty(partitions)) { throw new IllegalArgumentException("No partitions to load data to"); } else { String query = createLoadDataStmt(table, filePath, isLocal); query += " PARTITION(" + StringUtils.join(partitions, ", ") + ")"; runQuery(query); } }
Example 13
Source File: ResponseObjectBuilderImpl.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
private SignatureVerificationResult validateXadesT(Object value, byte[] xadesT, boolean followNestedManifest) throws GenAsyncBusinessConnectorException { if (!ArrayUtils.isEmpty(xadesT)) { byte[] signedByteArray = ConnectorXmlUtils.toByteArray(value); Map<String, Object> options = new HashMap(); options.put("followNestedManifest", followNestedManifest); try { return SignatureBuilderFactory.getSignatureBuilder(AdvancedElectronicSignatureEnumeration.XAdES_T).verify(signedByteArray, xadesT, options); } catch (TechnicalConnectorException var7) { throw new GenAsyncBusinessConnectorException(GenAsyncBusinessConnectorExceptionValues.SIGNATURE_VALIDATION_ERROR, var7, new Object[]{var7.getMessage()}); } } else { return null; } }
Example 14
Source File: StepMeta.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void setDeprecationAndSuggestedStep() { PluginRegistry registry = PluginRegistry.getInstance(); final List<PluginInterface> deprecatedSteps = registry.getPluginsByCategory( StepPluginType.class, BaseMessages.getString( PKG, "BaseStep.Category.Deprecated" ) ); for ( PluginInterface p : deprecatedSteps ) { String[] ids = p.getIds(); if ( !ArrayUtils.isEmpty( ids ) && ids[0].equals( this.stepid ) ) { this.isDeprecated = true; this.suggestion = registry.findPluginWithId( StepPluginType.class, this.stepid ) != null ? registry.findPluginWithId( StepPluginType.class, this.stepid ).getSuggestion() : ""; break; } } }
Example 15
Source File: BlobUtil.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public static Base64Binary generateXades(BlobType inValue, Credential credential, byte[] furnishedXades, String projectName) throws TechnicalConnectorException { if (projectName == null) { throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_INPUT_PARAMETER_NULL, new Object[]{"project name"}); } else { ConfigValidator props = ConfigFactory.getConfigValidator(); Boolean defaultValue = props.getBooleanProperty("${mycarenet.default.request.needxades}", false); if (props.getBooleanProperty("mycarenet." + projectName + ".request.needxades", defaultValue)) { return ArrayUtils.isEmpty(furnishedXades) ? generateXades(inValue, credential, projectName) : convertXadesToBinary(furnishedXades); } else { return null; } } }
Example 16
Source File: StringUtils.java From FATE-Serving with Apache License 2.0 | 5 votes |
/** * join string like javascript. * * @param array String array. * @param split split * @return String. */ public static String join(String[] array, String split) { if (ArrayUtils.isEmpty(array)) { return EMPTY; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i > 0) { sb.append(split); } sb.append(array[i]); } return sb.toString(); }
Example 17
Source File: BlobUtil.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public static Base64Binary generateXades(BlobType inValue, byte[] furnishedXades, String projectName) throws TechnicalConnectorException { if (projectName == null) { throw new TechnicalConnectorException(TechnicalConnectorExceptionValues.ERROR_INPUT_PARAMETER_NULL, new Object[]{"project name"}); } else { ConfigValidator props = ConfigFactory.getConfigValidator(); Boolean defaultValue = props.getBooleanProperty("${mycarenet.default.request.needxades}", false); if (props.getBooleanProperty("mycarenet." + projectName + ".request.needxades", defaultValue)) { return ArrayUtils.isEmpty(furnishedXades) ? generateXades(inValue, projectName) : convertXadesToBinary(furnishedXades); } else { return null; } } }
Example 18
Source File: ArrayUtil.java From smart-framework with Apache License 2.0 | 4 votes |
/** * 判断数组是否非空 */ public static boolean isNotEmpty(Object[] array) { return !ArrayUtils.isEmpty(array); }
Example 19
Source File: SelectionAdapterFileDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Remove "blank" items such as empty, null or whitespace items in <code>filters</code> * @param filters * @return non "blank" array. */ String[] cleanFilters( String[] filters ) { return !ArrayUtils.isEmpty( filters ) ? Arrays.asList( filters ).stream().filter( f -> !StringUtils.isBlank( f ) ).toArray( String[]::new ) : null; }
Example 20
Source File: IdentityValidationUtil.java From carbon-identity-framework with Apache License 2.0 | 3 votes |
/** * Validates the provided input against the given white list and black list patterns. * Precedence was give to the white list patterns. Thus, if the input is both white listed and blacklisted it * will be considered as valid. * * @param input input * @param whiteListPatterns a String array of white list pattern keys * @param blackListPatterns a String array of black list pattern keys * @return isWhiteListed || isNotBlackListed */ public static boolean isValid(String input, String[] whiteListPatterns, String[] blackListPatterns) { if (ArrayUtils.isEmpty(whiteListPatterns) || ArrayUtils.isEmpty(blackListPatterns)) { throw new IllegalArgumentException("Should provide at least one white list pattern and black list pattern"); } return isValidOverWhiteListPatterns(input, whiteListPatterns) || isValidOverBlackListPatterns(input, blackListPatterns); }