/** @return value */ public boolean hasCollection( String containerType, String collectionName ) { return getCollection( containerType, collectionName ) != null; }
/** @return value */ public boolean isDictionaryIndexedInCollection( String containerType, String collectionName, String dictionaryName ) { CollectionInfo collection = getCollection( containerType, collectionName ); return collection != null && collection.isDictionaryIndexed(dictionaryName); }
/** @return value */ public CollectionInfo getContainerCollectionLinkedToCollection( String containerType, String collectionName ) { CollectionInfo collection = getCollection( containerType, collectionName ); if ( collection == null ) { return null; } String linkedCollection = collection.getLinkedCollection(); if ( linkedCollection == null ) { return null; } return getCollection( collection.getType(), linkedCollection ); }
public boolean isCollectionReversed( String containerType, String collectionName ) { CollectionInfo collection = getCollection( containerType, collectionName ); return collection != null && collection.isReversed(); }
/** @return value */ public boolean isPropertyIndexedInCollection( String containerType, String collectionName, String propertyName ) { CollectionInfo collection = getCollection( containerType, collectionName ); return collection != null && collection.isPropertyIndexed(propertyName); }
public String getCollectionSort( String containerType, String collectionName ) { CollectionInfo collection = getCollection( containerType, collectionName ); if ( collection == null ) { return null; } return collection.getSort(); }
private Map<String, Set<CollectionInfo>> addDynamicApplicationCollectionAsContainer( Map<String, Set<CollectionInfo>> containers, String entityType ) { Map<String, Set<CollectionInfo>> copy = new TreeMap<String, Set<CollectionInfo>>( String.CASE_INSENSITIVE_ORDER ); if ( containers != null ) { copy.putAll( containers ); } containers = copy; if ( !containers.containsKey( Application.ENTITY_TYPE ) ) { MapUtils.addMapSet( containers, true, Application.ENTITY_TYPE, getCollection( Application.ENTITY_TYPE, defaultCollectionName( entityType ) ) ); } return containers; }
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 boolean isCollectionPathBased( String containerType, String collectionName ) { CollectionInfo collection = getCollection( containerType, collectionName ); if ( collection == null ) { return false; } EntityInfo item = getEntityInfo( collection.getType() ); if ( item == null ) { return false; } PropertyInfo property = item.getAliasPropertyObject(); return property != null && property.isPathBasedName(); }
CollectionInfo collection = getDefaultSchema().getCollection( headEntity.getType(), collectionName ); if ( ( collection != null ) && !collection.getType().equals( itemType ) ) { return null;
@Override public void copyRelationships( String srcRelationName, EntityRef dstEntityRef, String dstRelationName ) throws Exception { headEntity = em.validate( headEntity ); dstEntityRef = em.validate( dstEntityRef ); CollectionInfo srcCollection = getDefaultSchema().getCollection( headEntity.getType(), srcRelationName ); CollectionInfo dstCollection = getDefaultSchema().getCollection( dstEntityRef.getType(), dstRelationName ); Results results = null; do { if ( srcCollection != null ) { results = em.getCollection( headEntity, srcRelationName, null, 5000, Level.REFS, false ); } else { results = em.getTargetEntities( headEntity, srcRelationName, null, Level.REFS ); } if ( ( results != null ) && ( results.size() > 0 ) ) { List<EntityRef> refs = results.getRefs(); for ( EntityRef ref : refs ) { if ( dstCollection != null ) { em.addToCollection( dstEntityRef, dstRelationName, ref ); } else { em.createConnection( dstEntityRef, dstRelationName, ref ); } } } } while ( ( results != null ) && ( results.hasMoreResults() ) ); }
@Override public void removeItemFromCollection( String collectionName, EntityRef itemRef ) throws Exception { Id entityId = new SimpleId( itemRef.getUuid(), itemRef.getType() ); // remove edge from collection to item GraphManager gm = managerCache.getGraphManager( applicationScope ); // mark the edge versions and take the first for later delete edge queue event ( load is descending ) final Edge markedSourceEdge = gm.loadEdgeVersions( CpNamingUtils.createEdgeFromCollectionName( cpHeadEntity.getId(), collectionName, entityId ) ) .flatMap(edge -> gm.markEdge(edge)).toBlocking().firstOrDefault(null); Edge markedReversedEdge = null; CollectionInfo collection = getDefaultSchema().getCollection( headEntity.getType(), collectionName ); if (collection != null && collection.getLinkedCollection() != null) { // delete reverse edges final String pluralType = InflectionUtils.pluralize( cpHeadEntity.getId().getType() ); markedReversedEdge = gm.loadEdgeVersions( CpNamingUtils.createEdgeFromCollectionName( entityId, pluralType, cpHeadEntity.getId() ) ) .flatMap(reverseEdge -> gm.markEdge(reverseEdge)).toBlocking().firstOrDefault(null); } /** * Remove from the index. This will call gm.deleteEdge which also deletes the reverse edge(s) and de-indexes * older versions of the edge(s). * */ if( markedSourceEdge != null ) { indexService.queueDeleteEdge(applicationScope, markedSourceEdge); } if( markedReversedEdge != null ){ indexService.queueDeleteEdge(applicationScope, markedReversedEdge); } }
CollectionInfo collection = getDefaultSchema().getCollection( headEntity.getType(), collectionName ); if ( ( collection != null && collection.getType() != null ) && !collection.getType() .equals( itemRef.getType() ) ) {
CollectionInfo collection = getDefaultSchema().getCollection( headEntity.getType(), collectionName );
assertNull( cat ); CollectionInfo info = Schema.getDefaultSchema().getCollection( TYPE_APPLICATION, "cats" );