private boolean getBooleanProperty(String key) { String obj = getProperty(key); return !StringUtils.isEmpty(obj) && Boolean.parseBoolean(obj); }
return "generic.GenericConnectionsService"; String container = stringOrSubstringAfterLast( collections[0], ':' ); String collectionName = stringOrSubstringBeforeFirst( collections[1], ':' ); if ( Schema.getDefaultSchema().hasCollection( container, collectionName ) ) { return "generic.GenericCollectionService"; packages = stringOrSubstringBeforeLast( stringOrSubstringBeforeFirst( collections[0], ':' ), '.' ) + "."; packages = stringOrSubstringBeforeFirst( collections[i], ':' ) + "."; packages += stringOrSubstringBeforeLast( stringOrSubstringBeforeFirst( collections[i], ':' ), '.' ) + "."; stringOrSubstringAfterLast( stringOrSubstringAfterLast( collections[i], ':' ), '.' ) ); stringOrSubstringAfterLast( stringOrSubstringBeforeFirst( collections[collections.length - 1], ':' ), '.' ) ) + "Service";
public ReIndexStatus( final String jobId, final Status status, final long numberProcessed, final long lastUpdated, final String collectionName ) { if(StringUtils.isNotEmpty(jobId)){ this.jobId = jobId; }else { this.jobId = ""; } this.status = status; this.numberProcessed = numberProcessed; this.lastUpdated = lastUpdated; if(StringUtils.isNotEmpty(collectionName)){ this.collectionName = collectionName; }else { this.collectionName = ""; } }
protected void grant( UsergridAuthorizationInfo info, UUID applicationId, Set<String> permissions ) { if ( permissions != null ) { for ( String permission : permissions ) { if ( isNotBlank( permission ) ) { String operations = "*"; if ( permission.indexOf( ':' ) != -1 ) { operations = stringOrSubstringBeforeFirst( permission, ':' ); } if ( isBlank( operations ) ) { operations = "*"; } permission = stringOrSubstringAfterFirst( permission, ':' ); permission = "applications:" + operations + ":" + applicationId + ":" + permission; grant( info, permission ); } } } }
public static String getAssociatedEntityType( String entityType ) { if ( entityType == null ) { return null; } entityType = stringOrSubstringAfterLast( entityType, ':' ); return normalizeEntityType( entityType, false ); }
private static String determineType( String[] collections, int first, int last ) { if ( last < first ) { return null; } if ( first == last ) { return singularize( stringOrSubstringAfterLast( collections[0], ':' ) ); } int i = first + 1; String containerType = singularize( collections[first] ); while ( i <= last ) { String collectionName = stringOrSubstringBeforeFirst( collections[i], ':' ); String nextType = Schema.getDefaultSchema().getCollectionType( containerType, collectionName ); if ( nextType == null ) { if ( collections[i].indexOf( ':' ) >= 0 ) { nextType = stringOrSubstringAfterLast( collections[i], ':' ); } else if ( ( i < last ) && ( collections[last].indexOf( ':' ) >= 0 ) ) { nextType = stringOrSubstringAfterLast( collections[last], ':' ); } else { return "entity"; } } containerType = nextType; i++; } return containerType; }
private static String removeTypeSpecifiers( String[] collections ) { String s = ""; boolean first = true; for ( String collection : collections ) { if ( !first ) { s += "/*"; } first = false; s += "/" + stringOrSubstringBeforeFirst( collection, ':' ); } return s; }
Preconditions.checkArgument( StringUtils.isNotBlank( htmlText ) || StringUtils.isNotBlank( plainText ), "htmlText and plainText were both blank" ); if ( StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){ transport.connect( host, null, null ); }else{
if (StringUtils.isNumeric( maxSizeMbString )) { maxSizeBytes = Long.parseLong( maxSizeMbString ) * FileUtils.ONE_MB;
@Override public String toString() { return "ActivityObject [" + toStringFormat( attachments, "attachments=%s, " ) + toStringFormat( author, "author=%s, " ) + toStringFormat( content, "content=%s, " ) + toStringFormat( displayName, "displayName=%s, " ) + toStringFormat( downstreamDuplicates, "downstreamDuplicates=%s, " ) + toStringFormat( id, "id=%s, " ) + toStringFormat( image, "image=%s, " ) + toStringFormat( objectType, "objectType=%s, " ) + toStringFormat( published, "published=%s, " ) + toStringFormat( summary, "summary=%s, " ) + toStringFormat( updated, "updated=%s, " ) + toStringFormat( upstreamDuplicates, "upstreamDuplicates=%s, " ) + toStringFormat( url, "url=%s, " ) + toStringFormat( uuid, "uuid=%s, " ) + toStringFormat( entityType, "entityType=%s, " ) + toStringFormat( dynamic_properties, "dynamic_properties=%s" ) + "]"; } }
protected String buildUserAppUrl(UUID applicationId, String url, User user, String token) throws Exception { ApplicationInfo ai = getApplicationInfo(applicationId); OrganizationInfo oi = getOrganizationForApplication(applicationId); return String.format( url, oi.getName(), StringUtils.stringOrSubstringAfterFirst( ai.getName(), '/' ), user.getUuid().toString() ) + "?token=" + token; }
ids = ids.subList( 0, count ); if ( metadata != null ) { cursor = StringUtils.toString( MapUtils.getMapMap( metadata, nextResult, "cursor" ) );
@Override public Entity createRole( String roleName, String roleTitle, long inactivity ) throws Exception { if ( roleName == null || roleName.isEmpty() ) { throw new RequiredPropertyNotFoundException( "role", roleTitle ); } String propertyName = roleName; UUID ownerId = applicationId; String batchRoleName = StringUtils.stringOrSubstringAfterLast( roleName.toLowerCase(), ':' ); return batchCreateRole( batchRoleName, roleTitle, inactivity, propertyName, ownerId, null ); }
public static List<ColumnDefinition> getIndexMetadata( String indexes ) { if ( indexes == null ) { return null; } String[] index_entries = split( indexes, ',' ); List<ColumnDef> columns = new ArrayList<ColumnDef>(); for ( String index_entry : index_entries ) { String column_name = stringOrSubstringBeforeFirst( index_entry, ':' ).trim(); String comparer = substringAfterLast( index_entry, ":" ).trim(); if ( StringUtils.isBlank( comparer ) ) { comparer = "UUIDType"; } if ( StringUtils.isNotBlank( column_name ) ) { ColumnDef cd = new ColumnDef( bytebuffer( column_name ), comparer ); cd.setIndex_name( column_name ); cd.setIndex_type( IndexType.KEYS ); columns.add( cd ); } } return ThriftColumnDef.fromThriftList( columns ); }
if (StringUtils.isNumeric( maxSizeMbString )) { maxSizeBytes = Long.parseLong( maxSizeMbString ) * FileUtils.ONE_MB;
/** uncached - use normalizeEntityType() */ private static String createNormalizedEntityType( String entityType, boolean baseType ) { if ( baseType ) { int i = entityType.indexOf( ':' ); if ( i >= 0 ) { entityType = entityType.substring( 0, i ); } } entityType = entityType.toLowerCase(); if ( entityType.startsWith( "org.apache.usergrid.persistence" ) ) { entityType = stringOrSubstringAfterLast( entityType, '.' ); } entityType = singularize( entityType ); if ( "dynamicentity".equalsIgnoreCase( entityType ) ) { throw new IllegalArgumentException( entityType + " is not a valid entity type" ); } // entityType = capitalizeDelimiter(entityType, '.', '_'); return entityType; }
String segment = stringOrSubstringBeforeFirst( path, '.' ); String remaining = substringAfter( path, "." );
private String getProperty(String key) { String obj = properties.getProperty(key); if(StringUtils.isEmpty(obj)) return null; else return obj; }
if ( StringUtils.isNumeric( maxSizeMbString )) { maxSizeBytes = Long.parseLong( maxSizeMbString ) * FileUtils.ONE_MB;
@Override public Entity createGroupRole( UUID groupId, String roleName, long inactivity ) throws Exception { String batchRoleName = StringUtils.stringOrSubstringAfterLast( roleName.toLowerCase(), ':' ); String roleTitle = batchRoleName; String propertyName = groupId + ":" + batchRoleName; Map<String, Object> properties = new TreeMap<String, Object>( CASE_INSENSITIVE_ORDER ); properties.put( "group", groupId ); Entity entity = batchCreateRole( roleName, roleTitle, inactivity, propertyName, groupId, properties ); getRelationManager( new SimpleEntityRef( Group.ENTITY_TYPE, groupId ) ) .addToCollection( COLLECTION_ROLES, entity ); logger.info( "Created role {} with id {} in group {}", roleName, entity.getUuid().toString(), groupId.toString() ); return entity; }