use of org.neo4j.values.AnyValue in project neo4j by neo4j.
the class BuiltInDbmsProceduresIT method listAllCapabilities.
@Test
void listAllCapabilities() throws KernelException {
QualifiedName procedureName = procedureName("dbms", "listAllCapabilities");
int procedureId = procs().procedureGet(procedureName).id();
RawIterator<AnyValue[], ProcedureException> callResult = procs().procedureCallDbms(procedureId, new AnyValue[] {}, ProcedureCallContext.EMPTY);
List<AnyValue[]> capabilities = asList(callResult);
List<String> capabilityNames = capabilities.stream().map(c -> ((TextValue) c[0]).stringValue()).collect(Collectors.toList());
assertThat(capabilityNames).containsExactlyInAnyOrder(DBMSCapabilities.dbms_instance_version.name().fullName(), DBMSCapabilities.dbms_instance_kernel_version.name().fullName(), DBMSCapabilities.dbms_instance_edition.name().fullName(), DBMSCapabilities.dbms_instance_operational_mode.name().fullName(), TestCapabilities.my_custom_capability.name().fullName(), TestCapabilities.my_internal_capability.name().fullName(), TestCapabilities.my_dynamic_capability.name().fullName());
}
use of org.neo4j.values.AnyValue in project neo4j by neo4j.
the class RecordMessageEncoder method encode.
@Override
public void encode(Neo4jPack.Packer packer, RecordMessage message) throws IOException {
AnyValue[] fields = message.fields();
packer.packStructHeader(1, message.signature());
packer.packListHeader(fields.length);
for (AnyValue field : fields) {
packer.pack(field);
}
}
use of org.neo4j.values.AnyValue in project neo4j by neo4j.
the class CypherBoolean method in.
@CalledFromGeneratedCode
public static Value in(AnyValue lhs, AnyValue rhs) {
assert rhs != NO_VALUE;
ListValue anyValues = CypherFunctions.asList(rhs);
boolean seenUndefined = false;
for (AnyValue value : anyValues) {
switch(lhs.ternaryEquals(value)) {
case TRUE:
return Values.TRUE;
case UNDEFINED:
seenUndefined = true;
case FALSE:
break;
default:
throw new IllegalStateException("Unknown state");
}
}
return seenUndefined ? NO_VALUE : Values.FALSE;
}
use of org.neo4j.values.AnyValue in project neo4j by neo4j.
the class PathValueBuilder method addMultipleIncoming.
/**
* Adds multiple incoming relationships to the path
*
* @param relationships the incoming relationships to add
* @param target the final target node of the path
*/
@CalledFromGeneratedCode
public void addMultipleIncoming(ListValue relationships, NodeValue target) {
if (relationships.isEmpty()) {
// nothing to do here
return;
}
int i;
for (i = 0; i < relationships.size() - 1; i++) {
AnyValue value = relationships.value(i);
if (notNoValue(value)) {
RelationshipValue relationship = (RelationshipValue) value;
nodes.add(relationship.startNode());
rels.add(relationship);
}
}
AnyValue last = relationships.value(i);
if (notNoValue(last)) {
rels.add((RelationshipValue) last);
nodes.add(target);
}
}
use of org.neo4j.values.AnyValue in project neo4j by neo4j.
the class PathValueBuilder method addMultipleOutgoing.
/**
* Adds multiple outgoing relationships to the path
*
* @param relationships the outgoing relationships to add
*/
@CalledFromGeneratedCode
public void addMultipleOutgoing(ListValue relationships) {
for (AnyValue value : relationships) {
if (notNoValue(value)) {
// we know these relationships have already loaded start and end relationship
// so we should not use CypherFunctions::[start,end]Node to look them up
RelationshipValue relationship = (RelationshipValue) value;
nodes.add(relationship.endNode());
rels.add(relationship);
}
}
}
Aggregations