Search in sources :

Example 6 with ConflictStatus

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

the class PropertyKeyService method checkConflict.

public void checkConflict(List<PropertyKeyEntity> entities, ConflictDetail detail, int connId, boolean compareEachOther) {
    if (CollectionUtils.isEmpty(entities)) {
        return;
    }
    Map<String, PropertyKeyEntity> originEntities = new HashMap<>();
    for (PropertyKeyEntity entity : this.list(connId)) {
        originEntities.put(entity.getName(), entity);
    }
    // Compare reused entity with origin in target graph
    for (PropertyKeyEntity entity : entities) {
        PropertyKeyEntity originEntity = originEntities.get(entity.getName());
        ConflictStatus status = SchemaEntity.compare(entity, originEntity);
        detail.add(entity, status);
    }
    // Compare resued entities with each other
    if (compareEachOther) {
        compareWithEachOther(detail, SchemaType.PROPERTY_KEY);
    }
}
Also used : ConflictStatus(com.baidu.hugegraph.entity.schema.ConflictStatus) HashMap(java.util.HashMap) PropertyKeyEntity(com.baidu.hugegraph.entity.schema.PropertyKeyEntity)

Aggregations

ConflictStatus (com.baidu.hugegraph.entity.schema.ConflictStatus)6 HashMap (java.util.HashMap)4 ConflictDetail (com.baidu.hugegraph.entity.schema.ConflictDetail)1 EdgeLabelEntity (com.baidu.hugegraph.entity.schema.EdgeLabelEntity)1 PropertyIndex (com.baidu.hugegraph.entity.schema.PropertyIndex)1 PropertyKeyEntity (com.baidu.hugegraph.entity.schema.PropertyKeyEntity)1 SchemaConflict (com.baidu.hugegraph.entity.schema.SchemaConflict)1 VertexLabelEntity (com.baidu.hugegraph.entity.schema.VertexLabelEntity)1