@Override public boolean apply(@Nullable CubingJob cubeJob) { if (cubeJob == null) { return false; } if (Strings.isEmpty(jobName)) { return true; } if (nameExactMatch) { return cubeJob.getName().equalsIgnoreCase(jobName); } else { return cubeJob.getName().toLowerCase(Locale.ROOT) .contains(jobName.toLowerCase(Locale.ROOT)); } } })));
@Override public boolean apply(@Nullable CubingJob cubeJob) { if (cubeJob == null) { return false; } if (Strings.isEmpty(jobName)) { return true; } if (nameExactMatch) { return cubeJob.getName().equalsIgnoreCase(jobName); } else { return cubeJob.getName().toLowerCase(Locale.ROOT) .contains(jobName.toLowerCase(Locale.ROOT)); } } })));
@Override public boolean apply(@Nullable CheckpointExecutable checkpointExecutable) { if (checkpointExecutable == null) { return false; } if (Strings.isEmpty(jobName)) { return true; } if (nameExactMatch) { return checkpointExecutable.getName().equalsIgnoreCase(jobName); } else { return checkpointExecutable.getName().toLowerCase(Locale.ROOT) .contains(jobName.toLowerCase(Locale.ROOT)); } } })));
@Override public boolean apply(@Nullable CheckpointExecutable checkpointExecutable) { if (checkpointExecutable == null) { return false; } if (Strings.isEmpty(jobName)) { return true; } if (nameExactMatch) { return checkpointExecutable.getName().equalsIgnoreCase(jobName); } else { return checkpointExecutable.getName().toLowerCase(Locale.ROOT) .contains(jobName.toLowerCase(Locale.ROOT)); } } })));
if (!Strings.isEmpty(projectName)) { readableProjects = Lists .newArrayList(Iterators.filter(readableProjects.iterator(), new Predicate<ProjectInstance>() {
private boolean originsEquivalent(ScimUser scimUserFromRequest, ScimUser scimUserFromDb) { return scimUserFromDb.getOrigin().equals(scimUserFromRequest.getOrigin()) || (scimUserFromDb.getOrigin().equals(OriginKeys.UAA) && Strings.isEmpty(scimUserFromRequest.getOrigin())); }
public EncryptionKeyService(String activeKeyLabel, List<EncryptionKey> encryptionKeys) { if (Strings.isEmpty(activeKeyLabel)) { throw new NoActiveEncryptionKeyProvided( "UAA cannot be started without encryption key value uaa.encryption.active_key_label" List<EncryptionKey> keysWithoutPassphrase = encryptionKeys.stream().filter(encryptionKey -> Strings.isEmpty(encryptionKey.getPassphrase())).collect(Collectors.toList()); if (!keysWithoutPassphrase.isEmpty()) { throw new NoActiveEncryptionKeyProvided(
@Override public GrokValidation validateGrokStatement(GrokValidation grokValidation) throws RestException { Map<String, Object> results; try { if (grokValidation.getPatternLabel() == null) { throw new RestException("Pattern label is required"); } if (Strings.isEmpty(grokValidation.getStatement())) { throw new RestException("Grok statement is required"); } Grok grok = new Grok(); grok.addPatternFromReader(new InputStreamReader(getClass().getResourceAsStream( "/patterns/common"))); grok.addPatternFromReader(new StringReader(grokValidation.getStatement())); String grokPattern = "%{" + grokValidation.getPatternLabel() + "}"; grok.compile(grokPattern); Match gm = grok.match(grokValidation.getSampleData()); gm.captures(); results = gm.toMap(); results.remove(grokValidation.getPatternLabel()); } catch (Exception e) { throw new RestException(e); } grokValidation.setResults(results); return grokValidation; }
/** * Copy a byte array into a new byte array * * @param value the byte array to copy * @return The copied byte array */ public static byte[] copy( byte[] value ) { if ( isEmpty( value ) ) { return EMPTY_BYTES; } byte[] copy = new byte[value.length]; System.arraycopy( value, 0, copy, 0, value.length ); return copy; }
/** * {@inheritDoc} */ public String toString( String tabs ) { StringBuilder sb = new StringBuilder(); sb.append( toString( tabs, "enabled", enabled ) ); if ( !Strings.isEmpty( description ) ) { sb.append( tabs ).append( "description : '" ).append( description ).append( "'\n" ); } if ( dn != null ) { sb.append( tabs ).append( "DN: " ).append( dn ).append( "'\n" ); } return sb.toString(); }
private void encodeDomainName( IoBuffer byteBuffer, String domainName ) { if ( !Strings.isEmpty( domainName ) ) { String[] labels = domainName.split( "\\." ); for ( String label : labels ) { byteBuffer.put( ( byte ) label.length() ); char[] characters = label.toCharArray(); for ( char c : characters ) { byteBuffer.put( ( byte ) c ); } } } byteBuffer.put( ( byte ) 0x00 ); }
/** * Transform a value in a String, accordingly to RFC 2253 * * @param attrValue The attribute value to be escaped * @return The escaped string value. */ public static String escapeValue( byte[] attrValue ) { if ( Strings.isEmpty( attrValue ) ) { return ""; } String value = Strings.utf8ToString( attrValue ); return escapeValue( value ); }
/** * Transform a value in a String, accordingly to RFC 2253 * * @param attrValue The attribute value to be escaped * @return The escaped string value. */ public static String escapeValue( byte[] attrValue ) { if ( Strings.isEmpty( attrValue ) ) { return ""; } String value = Strings.utf8ToString( attrValue ); return escapeValue( value ); }
/** * Returns the attributeType from an Attribute ID. * * @param upId The ID we are looking for * @return The found attributeType * @throws LdapException If the lookup failed */ protected AttributeType getAttributeType( String upId ) throws LdapException { if ( Strings.isEmpty( Strings.trim( upId ) ) ) { String message = I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ); LOG.error( message ); throw new IllegalArgumentException( message ); } return schemaManager.lookupAttributeTypeRegistry( upId ); }
/** * Transform a value in a String, accordingly to RFC 2253 * * @param attrValue The attribute value to be escaped * @return The escaped string value. */ public static String escapeValue( byte[] attrValue ) { if ( Strings.isEmpty( attrValue ) ) { return ""; } String value = Strings.utf8ToString( attrValue ); return escapeValue( value ); }
/** * {@inheritDoc} */ @Override public void setUpId( String upId, AttributeType attributeType ) { String trimmed = Strings.trim( upId ); if ( Strings.isEmpty( trimmed ) && ( attributeType == null ) ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13235_NULL_ID_WITH_NULL_AT_NOT_ALLOWED ) ); } String newId = Strings.toLowerCaseAscii( trimmed ); setUpIdInternal( upId, newId, attributeType ); }
/** * {@inheritDoc} */ @Override public void setUpId( String upId, AttributeType attributeType ) { String trimmed = Strings.trim( upId ); if ( Strings.isEmpty( trimmed ) && ( attributeType == null ) ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13235_NULL_ID_WITH_NULL_AT_NOT_ALLOWED ) ); } String newId = Strings.toLowerCaseAscii( trimmed ); setUpIdInternal( upId, newId, attributeType ); }
/** * {@inheritDoc} */ @Override public void setUpId( String upId, AttributeType attributeType ) { String trimmed = Strings.trim( upId ); if ( Strings.isEmpty( trimmed ) && ( attributeType == null ) ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13235_NULL_ID_WITH_NULL_AT_NOT_ALLOWED ) ); } String newId = Strings.toLowerCaseAscii( trimmed ); setUpIdInternal( upId, newId, attributeType ); }
/** * Sets the User Provided ID as a byte[] * * @param upId The User Provided ID * @param attributeType The asscoiated AttributeType */ public void setUpId( byte[] upId, AttributeType attributeType ) { byte[] trimmed = Strings.trim( upId ); if ( Strings.isEmpty( trimmed ) && ( attributeType == null ) ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_13235_NULL_ID_WITH_NULL_AT_NOT_ALLOWED ) ); } String newId = Strings.toLowerCase( trimmed ); setUpIdInternal( Strings.utf8ToString( upId ), newId, attributeType ); }
/** * @see javax.naming.Context#lookup(java.lang.String) */ public Object lookup( String name ) throws NamingException { if ( Strings.isEmpty( name ) ) { return lookup( new LdapName( "" ) ); } else { return lookup( new LdapName( name ) ); } }