/** * Insert a record in the database. Any field/value pairs in the specified * values HashMap will be written into the record with the specified record * key. * * @param table * The name of the table * @param key * The record key of the record to insert. * @param values * A HashMap of field/value pairs to insert in the record * @return Zero on success, a non-zero error code on error. See the * {@link DB} class's description for a discussion of error codes. */ @Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try { BaseDocument toInsert = new BaseDocument(key); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { toInsert.addAttribute(entry.getKey(), byteIteratorToString(entry.getValue())); } DocumentCreateOptions options = new DocumentCreateOptions().waitForSync(waitForSync); arangoDB.db(databaseName).collection(table).insertDocument(toInsert, options); return Status.OK; } catch (ArangoDBException e) { logger.error("Exception while trying insert {} {} with ex {}", table, key, e.toString()); } return Status.ERROR; }
TransactionOptions options = new TransactionOptions(); options.writeCollections(table); options.params(createDocumentHandle(table, key)); arangoDB.db(databaseName).transaction(transactionAction, Void.class, options); return Status.OK;
/** * * @param rules * A list of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling the * optimizer to include or exclude specific rules. To disable a rule, prefix its name with a -, to enable * a rule, prefix it with a +. There is also a pseudo-rule all, which will match all optimizer rules * @return options */ public AqlQueryOptions rules(final Collection<String> rules) { getOptions().getOptimizer().rules = rules; return this; }
public static GraphCreateOptions build( final GraphCreateOptions options, final String name, final Collection<EdgeDefinition> edgeDefinitions) { return options.name(name).edgeDefinitions(edgeDefinitions); }
/** * @param rules * an array of to-be-included or to-be-excluded optimizer rules can be put into this attribute, telling * the optimizer to include or exclude specific rules. * @return options */ public AqlQueryExplainOptions rules(final Collection<String> rules) { getOptions().getOptimizer().rules = rules; return this; }
/** * * @param vertices * Specifies uniqueness for vertices can be "none", "global" or "path" * @return options */ public TraversalOptions verticesUniqueness(final UniquenessType vertices) { getUniqueness().setVertices(vertices); return this; }
/** * @param smartGraphAttribute * The attribute name that is used to smartly shard the vertices of a graph. Every vertex in this Graph * has to have this attribute. Cannot be modified later. * @return options */ public GraphCreateOptions smartGraphAttribute(final String smartGraphAttribute) { getOptions().setSmartGraphAttribute(smartGraphAttribute); return this; }
/** * @param numberOfShards * The number of shards that is used for every collection within this graph. Cannot be modified later. * @return options */ public GraphCreateOptions numberOfShards(final Integer numberOfShards) { getOptions().setNumberOfShards(numberOfShards); return this; }
/** * * @param edges * Specifies uniqueness for edges can be "none", "global" or "path" * @return options */ public TraversalOptions edgesUniqueness(final UniquenessType edges) { getUniqueness().setEdges(edges); return this; }
public Integer getReplicationFactor() { return getOptions().getReplicationFactor(); }
public Integer getNumberOfShards() { return getOptions().getNumberOfShards(); }
public String getSmartGraphAttribute() { return getOptions().getSmartGraphAttribute(); }
/** * * @param maxPlans * Limits the maximum number of plans that are created by the AQL query optimizer. * @return options */ public AqlQueryOptions maxPlans(final Integer maxPlans) { getOptions().maxPlans = maxPlans; return this; }
private Uniqueness getUniqueness() { if (uniqueness == null) { uniqueness = new Uniqueness(); uniqueness.vertices = UniquenessType.none; uniqueness.edges = UniquenessType.none; } return uniqueness; }
private Options getOptions() { if (options == null) { options = new Options(); } return options; }
public Collection<String> getRules() { return getOptions().getOptimizer().rules; }
/** * @param profile * If set to true, then the additional query profiling information will be returned in the sub-attribute * profile of the extra return attribute if the query result is not served from the query cache. * @return options */ public AqlQueryOptions profile(final Boolean profile) { getOptions().profile = profile; return this; }
/** * @param maxWarningCount * Limits the maximum number of warnings a query will return. The number of warnings a query will return * is limited to 10 by default, but that number can be increased or decreased by setting this attribute. * @since ArangoDB 3.2.0 * @return options */ public AqlQueryOptions maxWarningCount(final Long maxWarningCount) { getOptions().maxWarningCount = maxWarningCount; return this; }