public static String normalizeEntityType( String entityType ) { return normalizeEntityType( entityType, false ); }
/** @return value */ public Map<String, Set<CollectionInfo>> getContainersIndexingDictionaries( String entityType ) { entityType = normalizeEntityType( entityType ); // Application does index any sets by default return entityContainerCollectionsIndexingDictionaries.get( entityType ); }
/** @return value */ public Map<String, Set<CollectionInfo>> getContainersIndexingDynamicSetInfos( String entityType ) { entityType = normalizeEntityType( entityType ); // Application does index dynamic sets by default return entityContainerCollectionsIndexingDynamicDictionaries.get( entityType ); }
/** @return value */ public Map<String, Set<CollectionInfo>> getContainersIndexingDictionary( String entityType, String dictionaryName ) { entityType = normalizeEntityType( entityType ); /* * if (entityType == null) { return null; } */ Map<String, Map<String, Set<CollectionInfo>>> dictionaryContainerCollectionsIndexingDictionary = entityDictionaryContainerCollectionsIndexingDictionary.get( entityType ); if ( dictionaryContainerCollectionsIndexingDictionary == null ) { return null; } // Application does index any set by default return dictionaryContainerCollectionsIndexingDictionary.get( dictionaryName ); }
private static String _defaultCollectionName( String entityType ) { entityType = normalizeEntityType( entityType ); return pluralize( entityType ); }
/** @return value */ public Map<String, Set<CollectionInfo>> getContainers( String entityType ) { entityType = normalizeEntityType( entityType ); // Add the application as a container to all entities return addDynamicApplicationCollectionAsContainer( entityContainerCollections.get( entityType ), entityType ); }
public static String getAssociatedEntityType( String entityType ) { if ( entityType == null ) { return null; } entityType = stringOrSubstringAfterLast( entityType, ':' ); return normalizeEntityType( entityType, false ); }
public String getCollectionType( String containerType, String collectionName ) { containerType = normalizeEntityType( containerType ); CollectionInfo collection = getCollection( containerType, collectionName ); if ( collection == null ) { if ( Application.ENTITY_TYPE.equalsIgnoreCase( containerType ) ) { return normalizeEntityType( collectionName ); } return null; } return collection.getType(); }
public java.util.List<String> getCollectionNamesAsList( String entityType ) { Set<String> set = getCollectionNames( normalizeEntityType( entityType, true ) ); if ( set != null ) { return new ArrayList<String>( set ); } return null; }
/** @return value */ public Map<String, Set<CollectionInfo>> getContainersIndexingProperties( String entityType ) { entityType = normalizeEntityType( entityType ); // Add the application as a container indexing some properties by // default return addDynamicApplicationCollectionAsContainer( entityContainerCollectionsIndexingProperties.get( entityType ), entityType ); }
/** @return value */ public EntityInfo getEntityInfo( String entityType ) { if ( entityType == null ) { return null; } entityType = normalizeEntityType( entityType ); if ( "dynamicentity".equalsIgnoreCase( entityType ) ) { throw new IllegalArgumentException( entityType + " is not a valid entity type" ); } EntityInfo entity = entityMap.get( entityType ); if ( entity == null ) { return getDynamicEntityInfo( entityType ); } return entity; }
/** @return value */ public Map<String, Set<CollectionInfo>> getContainersIndexingProperty( String entityType, String propertyName ) { entityType = normalizeEntityType( entityType ); Map<String, Map<String, Set<CollectionInfo>>> propertyContainerCollectionsIndexingPropertyInfo = entityPropertyContainerCollectionsIndexingProperty.get( entityType ); // Application indexes name property by default if ( propertyName.equalsIgnoreCase( PROPERTY_NAME ) || propertyName.equalsIgnoreCase( PROPERTY_CREATED ) || propertyName.equalsIgnoreCase( PROPERTY_MODIFIED ) ) { return addDynamicApplicationCollectionAsContainer( propertyContainerCollectionsIndexingPropertyInfo != null ? propertyContainerCollectionsIndexingPropertyInfo.get( propertyName ) : null, entityType ); } if ( propertyContainerCollectionsIndexingPropertyInfo == null ) { return null; } return propertyContainerCollectionsIndexingPropertyInfo.get( propertyName ); }
public Set<String> getCollectionNames( String entityType ) { EntityInfo entity = getEntityInfo( normalizeEntityType( entityType, true ) ); if ( entity == null ) { return null; } Map<String, CollectionInfo> map = entity.getCollections(); if ( map != null ) { return map.keySet(); } return null; }
public Object validateEntitySetValue( String entityType, String dictionaryName, Object elementValue ) { entityType = normalizeEntityType( entityType ); if ( ( elementValue instanceof String ) && elementValue.equals("") ) { elementValue = null; } if ( !hasDictionary( entityType, dictionaryName ) ) { return elementValue; } Class<?> type = getDictionaryKeyType( entityType, dictionaryName ); if ( type != null ) { // elementValue = coerce(type, elementValue); elementValue = mapper.convertValue( elementValue, type ); } return elementValue; }
/** @return value */ public Map<String, CollectionInfo> getCollections( String entityType ) { EntityInfo entity = getEntityInfo( normalizeEntityType( entityType, true ) ); if ( entity == null ) { return null; } return entity.getCollections(); }
public Map<String, Object> cleanUpdatedProperties( String entityType, Map<String, Object> properties, boolean create ) { if ( properties == null ) { return null; } entityType = normalizeEntityType( entityType ); properties.remove( PROPERTY_UUID ); properties.remove( PROPERTY_TYPE ); properties.remove( PROPERTY_METADATA ); properties.remove( PROPERTY_MEMBERSHIP ); properties.remove( PROPERTY_CONNECTION ); Iterator<Entry<String, Object>> iterator = properties.entrySet().iterator(); while ( iterator.hasNext() ) { Entry<String, Object> entry = iterator.next(); if ( hasProperty( entityType, entry.getKey() ) ) { if ( !create && !isPropertyMutable( entityType, entry.getKey() ) ) { iterator.remove(); continue; } Object propertyValue = entry.getValue(); if ( ( propertyValue instanceof String ) && (propertyValue.equals("")) ) { propertyValue = null; } if ( ( propertyValue == null ) && isRequiredProperty( entityType, entry.getKey() ) ) { iterator.remove(); } } } return properties; }
/** @return value */ public CollectionInfo getCollection( String containerType, String collectionName ) { containerType = normalizeEntityType( containerType, true ); EntityInfo entity = getEntityInfo( containerType ); if ( entity == null ) { return null; } CollectionInfo collection = entity.getCollection( collectionName ); if ( ( collection == null ) && ( Application.ENTITY_TYPE.equalsIgnoreCase( containerType ) ) ) { collection = getDynamicApplicationCollection( collectionName ); } return collection; }
public Object validateEntityPropertyValue( String entityType, String propertyName, Object propertyValue ) throws PropertyTypeConversionException { entityType = normalizeEntityType( entityType ); if ( ( propertyValue instanceof String ) && propertyValue.equals("") ) { propertyValue = null; } if ( !hasProperty( entityType, propertyName ) ) { return propertyValue; } /* * if (PROPERTY_TYPE.equals(propertyName)) { return * string(propertyValue); } else if (PROPERTY_ID.equals(propertyName)) { * return uuid(propertyValue); } */ Class<?> type = getPropertyType( entityType, propertyName ); if ( type != null ) { // propertyValue = coerce(type, propertyValue); try { propertyValue = mapper.convertValue( propertyValue, type ); } catch ( Exception e ) { throw new PropertyTypeConversionException( entityType, propertyName, propertyValue, type, e ); } } return propertyValue; }
private CollectionInfo getDynamicApplicationCollection( String collectionName ) { EntityInfo entity = getEntityInfo( Application.ENTITY_TYPE ); if ( entity == null ) { return null; } CollectionInfo collection = entity.getCollection( collectionName ); if ( collection != null ) { return collection; } collection = new CollectionInfo(); collection.setName( collectionName ); collection.setContainer( entity ); collection.setType( normalizeEntityType( collectionName ) ); Set<String> properties = new LinkedHashSet<String>(); properties.add( PROPERTY_NAME ); properties.add( PROPERTY_CREATED ); properties.add( PROPERTY_MODIFIED ); collection.setPropertiesIndexed( properties ); // entity.getCollections().put(collectionName, collection); // mapCollector(collection.getType(), Application.ENTITY_TYPE, // collectionName, collection); return collection; }
eType = Schema.normalizeEntityType( s ); first_parameter = dequeue( parameters ); if ( first_parameter instanceof QueryParameter ) {