com.arangodb.entity.CollectionType Java Examples
The following examples show how to use
com.arangodb.entity.CollectionType.
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: DefaultArangoPersistentEntity.java From spring-data with Apache License 2.0 | 6 votes |
public DefaultArangoPersistentEntity(final TypeInformation<T> information) { super(information); collection = StringUtils.uncapitalize(information.getType().getSimpleName()); context = new StandardEvaluationContext(); hashIndexedProperties = new ArrayList<>(); skiplistIndexedProperties = new ArrayList<>(); persistentIndexedProperties = new ArrayList<>(); geoIndexedProperties = new ArrayList<>(); fulltextIndexedProperties = new ArrayList<>(); repeatableAnnotationCache = new HashMap<>(); final Document document = findAnnotation(Document.class); final Edge edge = findAnnotation(Edge.class); if (edge != null) { collection = StringUtils.hasText(edge.value()) ? edge.value() : collection; collectionOptions = createCollectionOptions(edge); } else if (document != null) { collection = StringUtils.hasText(document.value()) ? document.value() : collection; collectionOptions = createCollectionOptions(document); } else { collectionOptions = new CollectionCreateOptions().type(CollectionType.DOCUMENT); } expression = PARSER.parseExpression(collection, ParserContext.TEMPLATE_EXPRESSION); }
Example #2
Source File: DefaultArangoPersistentEntity.java From spring-data with Apache License 2.0 | 5 votes |
private static CollectionCreateOptions createCollectionOptions(final Document annotation) { final CollectionCreateOptions options = new CollectionCreateOptions().type(CollectionType.DOCUMENT) .waitForSync(annotation.waitForSync()).doCompact(annotation.doCompact()) .isVolatile(annotation.isVolatile()).isSystem(annotation.isSystem()); if (annotation.journalSize() > -1) { options.journalSize(annotation.journalSize()); } if (annotation.replicationFactor() > -1) { options.replicationFactor(annotation.replicationFactor()); } if (annotation.satellite()) { options.satellite(annotation.satellite()); } final String[] shardKeys = annotation.shardKeys(); if (shardKeys.length > 1 || (shardKeys.length > 0 && StringUtils.hasText(shardKeys[0]))) { options.shardKeys(shardKeys); } if (annotation.numberOfShards() > -1) { options.numberOfShards(annotation.numberOfShards()); } if (annotation.indexBuckets() > -1) { options.indexBuckets(annotation.indexBuckets()); } if (annotation.allowUserKeys()) { options.keyOptions(annotation.allowUserKeys(), annotation.keyType(), annotation.keyIncrement() > -1 ? annotation.keyIncrement() : null, annotation.keyOffset() > -1 ? annotation.keyOffset() : null); } return options; }
Example #3
Source File: DefaultArangoPersistentEntity.java From spring-data with Apache License 2.0 | 5 votes |
private static CollectionCreateOptions createCollectionOptions(final Edge annotation) { final CollectionCreateOptions options = new CollectionCreateOptions().type(CollectionType.EDGES) .waitForSync(annotation.waitForSync()).doCompact(annotation.doCompact()) .isVolatile(annotation.isVolatile()).isSystem(annotation.isSystem()); if (annotation.journalSize() > -1) { options.journalSize(annotation.journalSize()); } if (annotation.replicationFactor() > -1) { options.replicationFactor(annotation.replicationFactor()); } final String[] shardKeys = annotation.shardKeys(); if (shardKeys.length > 0) { options.shardKeys(shardKeys); } if (annotation.numberOfShards() > -1) { options.numberOfShards(annotation.numberOfShards()); } if (annotation.indexBuckets() > -1) { options.indexBuckets(annotation.indexBuckets()); } if (annotation.allowUserKeys()) { options.keyOptions(annotation.allowUserKeys(), annotation.keyType(), annotation.keyIncrement() > -1 ? annotation.keyIncrement() : null, annotation.keyOffset() > -1 ? annotation.keyOffset() : null); } return options; }
Example #4
Source File: ArangoEdgeCollectionTest.java From arangodb-java-driver-async with Apache License 2.0 | 5 votes |
@BeforeClass public static void setup() throws InterruptedException, ExecutionException { if (!db.collection(VERTEX_COLLECTION_NAME).exists().get()) { db.createCollection(VERTEX_COLLECTION_NAME, null).get(); } if (!db.collection(EDGE_COLLECTION_NAME).exists().get()) { db.createCollection(EDGE_COLLECTION_NAME, new CollectionCreateOptions().type(CollectionType.EDGES)).get(); } final Collection<EdgeDefinition> edgeDefinitions = new ArrayList<>(); edgeDefinitions.add(new EdgeDefinition().collection(EDGE_COLLECTION_NAME).from(VERTEX_COLLECTION_NAME) .to(VERTEX_COLLECTION_NAME)); db.createGraph(GRAPH_NAME, edgeDefinitions, null).get(); }