use of com.baidu.hugegraph.type.define.SchemaStatus in project incubator-hugegraph by apache.
the class TableSerializer method readVertexLabel.
@Override
public VertexLabel readVertexLabel(HugeGraph graph, BackendEntry backendEntry) {
if (backendEntry == null) {
return null;
}
TableBackendEntry entry = this.convertEntry(backendEntry);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
IdStrategy idStrategy = schemaEnum(entry, HugeKeys.ID_STRATEGY, IdStrategy.class);
Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
Object primaryKeys = schemaColumn(entry, HugeKeys.PRIMARY_KEYS);
Object nullableKeys = schemaColumn(entry, HugeKeys.NULLABLE_KEYS);
Object indexLabels = schemaColumn(entry, HugeKeys.INDEX_LABELS);
SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class);
Number ttl = schemaColumn(entry, HugeKeys.TTL);
Number ttlStartTime = schemaColumn(entry, HugeKeys.TTL_START_TIME);
VertexLabel vertexLabel = new VertexLabel(graph, this.toId(id), name);
vertexLabel.idStrategy(idStrategy);
vertexLabel.properties(this.toIdArray(properties));
vertexLabel.primaryKeys(this.toIdArray(primaryKeys));
vertexLabel.nullableKeys(this.toIdArray(nullableKeys));
vertexLabel.addIndexLabels(this.toIdArray(indexLabels));
vertexLabel.status(status);
vertexLabel.ttl(ttl.longValue());
vertexLabel.ttlStartTime(this.toId(ttlStartTime));
this.readEnableLabelIndex(vertexLabel, entry);
this.readUserdata(vertexLabel, entry);
return vertexLabel;
}
use of com.baidu.hugegraph.type.define.SchemaStatus in project incubator-hugegraph by apache.
the class TableSerializer method readEdgeLabel.
@Override
public EdgeLabel readEdgeLabel(HugeGraph graph, BackendEntry backendEntry) {
if (backendEntry == null) {
return null;
}
TableBackendEntry entry = this.convertEntry(backendEntry);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
Frequency frequency = schemaEnum(entry, HugeKeys.FREQUENCY, Frequency.class);
Number sourceLabel = schemaColumn(entry, HugeKeys.SOURCE_LABEL);
Number targetLabel = schemaColumn(entry, HugeKeys.TARGET_LABEL);
Object sortKeys = schemaColumn(entry, HugeKeys.SORT_KEYS);
Object nullableKeys = schemaColumn(entry, HugeKeys.NULLABLE_KEYS);
Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
Object indexLabels = schemaColumn(entry, HugeKeys.INDEX_LABELS);
SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class);
Number ttl = schemaColumn(entry, HugeKeys.TTL);
Number ttlStartTime = schemaColumn(entry, HugeKeys.TTL_START_TIME);
EdgeLabel edgeLabel = new EdgeLabel(graph, this.toId(id), name);
edgeLabel.frequency(frequency);
edgeLabel.sourceLabel(this.toId(sourceLabel));
edgeLabel.targetLabel(this.toId(targetLabel));
edgeLabel.properties(this.toIdArray(properties));
edgeLabel.sortKeys(this.toIdArray(sortKeys));
edgeLabel.nullableKeys(this.toIdArray(nullableKeys));
edgeLabel.addIndexLabels(this.toIdArray(indexLabels));
edgeLabel.status(status);
edgeLabel.ttl(ttl.longValue());
edgeLabel.ttlStartTime(this.toId(ttlStartTime));
this.readEnableLabelIndex(edgeLabel, entry);
this.readUserdata(edgeLabel, entry);
return edgeLabel;
}
use of com.baidu.hugegraph.type.define.SchemaStatus in project incubator-hugegraph by apache.
the class TableSerializer method readPropertyKey.
@Override
public PropertyKey readPropertyKey(HugeGraph graph, BackendEntry backendEntry) {
if (backendEntry == null) {
return null;
}
TableBackendEntry entry = this.convertEntry(backendEntry);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
DataType dataType = schemaEnum(entry, HugeKeys.DATA_TYPE, DataType.class);
Cardinality cardinality = schemaEnum(entry, HugeKeys.CARDINALITY, Cardinality.class);
AggregateType aggregateType = schemaEnum(entry, HugeKeys.AGGREGATE_TYPE, AggregateType.class);
WriteType writeType = schemaEnumOrDefault(entry, HugeKeys.WRITE_TYPE, WriteType.class, WriteType.OLTP);
Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class);
PropertyKey propertyKey = new PropertyKey(graph, this.toId(id), name);
propertyKey.dataType(dataType);
propertyKey.cardinality(cardinality);
propertyKey.aggregateType(aggregateType);
propertyKey.writeType(writeType);
propertyKey.properties(this.toIdArray(properties));
propertyKey.status(status);
this.readUserdata(propertyKey, entry);
return propertyKey;
}
use of com.baidu.hugegraph.type.define.SchemaStatus in project incubator-hugegraph by apache.
the class TableSerializer method readIndexLabel.
@Override
public IndexLabel readIndexLabel(HugeGraph graph, BackendEntry backendEntry) {
if (backendEntry == null) {
return null;
}
TableBackendEntry entry = this.convertEntry(backendEntry);
Number id = schemaColumn(entry, HugeKeys.ID);
String name = schemaColumn(entry, HugeKeys.NAME);
HugeType baseType = schemaEnum(entry, HugeKeys.BASE_TYPE, HugeType.class);
Number baseValueId = schemaColumn(entry, HugeKeys.BASE_VALUE);
IndexType indexType = schemaEnum(entry, HugeKeys.INDEX_TYPE, IndexType.class);
Object indexFields = schemaColumn(entry, HugeKeys.FIELDS);
SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class);
IndexLabel indexLabel = new IndexLabel(graph, this.toId(id), name);
indexLabel.baseType(baseType);
indexLabel.baseValue(this.toId(baseValueId));
indexLabel.indexType(indexType);
indexLabel.indexFields(this.toIdArray(indexFields));
indexLabel.status(status);
this.readUserdata(indexLabel, entry);
return indexLabel;
}
Aggregations