Search in sources :

Example 1 with ConflictDetail

use of com.baidu.hugegraph.entity.schema.ConflictDetail in project incubator-hugegraph-toolchain by apache.

the class EdgeLabelService method checkConflict.

public ConflictDetail checkConflict(ConflictCheckEntity entity, int connId, boolean compareEachOther) {
    ConflictDetail detail = new ConflictDetail(SchemaType.EDGE_LABEL);
    if (CollectionUtils.isEmpty(entity.getElEntities())) {
        return detail;
    }
    Map<String, EdgeLabelEntity> originElEntities = new HashMap<>();
    for (EdgeLabelEntity e : this.list(connId)) {
        originElEntities.put(e.getName(), e);
    }
    this.pkService.checkConflict(entity.getPkEntities(), detail, connId, compareEachOther);
    this.piService.checkConflict(entity.getPiEntities(), detail, connId, compareEachOther);
    this.vlService.checkConflict(entity.getVlEntities(), detail, connId, compareEachOther);
    for (EdgeLabelEntity elEntity : entity.getElEntities()) {
        // Firstly check if any properties are conflicted
        if (detail.anyPropertyKeyConflict(elEntity.getPropNames())) {
            detail.add(elEntity, ConflictStatus.DEP_CONFLICT);
            continue;
        }
        // Then check if any property indexes are conflicted
        if (detail.anyPropertyIndexConflict(elEntity.getIndexProps())) {
            detail.add(elEntity, ConflictStatus.DEP_CONFLICT);
            continue;
        }
        // Then determine if source/target vertex labels are conflicted
        if (detail.anyVertexLabelConflict(elEntity.getLinkLabels())) {
            detail.add(elEntity, ConflictStatus.DEP_CONFLICT);
            continue;
        }
        // Then check conflict of edge label itself
        EdgeLabelEntity originElEntity = originElEntities.get(elEntity.getName());
        ConflictStatus status = SchemaEntity.compare(elEntity, originElEntity);
        detail.add(elEntity, status);
    }
    if (compareEachOther) {
        compareWithEachOther(detail, SchemaType.EDGE_LABEL);
    }
    return detail;
}
Also used : ConflictDetail(com.baidu.hugegraph.entity.schema.ConflictDetail) EdgeLabelEntity(com.baidu.hugegraph.entity.schema.EdgeLabelEntity) ConflictStatus(com.baidu.hugegraph.entity.schema.ConflictStatus) HashMap(java.util.HashMap)

Example 2 with ConflictDetail

use of com.baidu.hugegraph.entity.schema.ConflictDetail in project incubator-hugegraph-toolchain by apache.

the class VertexLabelService method checkConflict.

public ConflictDetail checkConflict(ConflictCheckEntity entity, int connId, boolean compareEachOther) {
    ConflictDetail detail = new ConflictDetail(SchemaType.VERTEX_LABEL);
    if (CollectionUtils.isEmpty(entity.getVlEntities())) {
        return detail;
    }
    this.pkService.checkConflict(entity.getPkEntities(), detail, connId, compareEachOther);
    this.piService.checkConflict(entity.getPiEntities(), detail, connId, compareEachOther);
    this.checkConflict(entity.getVlEntities(), detail, connId, compareEachOther);
    return detail;
}
Also used : ConflictDetail(com.baidu.hugegraph.entity.schema.ConflictDetail)

Example 3 with ConflictDetail

use of com.baidu.hugegraph.entity.schema.ConflictDetail in project incubator-hugegraph-toolchain by apache.

the class PropertyKeyService method checkConflict.

public ConflictDetail checkConflict(ConflictCheckEntity entity, int connId, boolean compareEachOther) {
    ConflictDetail detail = new ConflictDetail(SchemaType.PROPERTY_KEY);
    if (CollectionUtils.isEmpty(entity.getPkEntities())) {
        return detail;
    }
    this.checkConflict(entity.getPkEntities(), detail, connId, compareEachOther);
    return detail;
}
Also used : ConflictDetail(com.baidu.hugegraph.entity.schema.ConflictDetail)

Aggregations

ConflictDetail (com.baidu.hugegraph.entity.schema.ConflictDetail)3 ConflictStatus (com.baidu.hugegraph.entity.schema.ConflictStatus)1 EdgeLabelEntity (com.baidu.hugegraph.entity.schema.EdgeLabelEntity)1 HashMap (java.util.HashMap)1