use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class EntityGraphMapper method mapAttributesAndClassifications.
public EntityMutationResponse mapAttributesAndClassifications(EntityMutationContext context, final boolean isPartialUpdate, final boolean replaceClassifications) throws AtlasBaseException {
EntityMutationResponse resp = new EntityMutationResponse();
Collection<AtlasEntity> createdEntities = context.getCreatedEntities();
Collection<AtlasEntity> updatedEntities = context.getUpdatedEntities();
if (CollectionUtils.isNotEmpty(createdEntities)) {
for (AtlasEntity createdEntity : createdEntities) {
String guid = createdEntity.getGuid();
AtlasVertex vertex = context.getVertex(guid);
AtlasEntityType entityType = context.getType(guid);
mapAttributes(createdEntity, vertex, CREATE, context);
resp.addEntity(CREATE, constructHeader(createdEntity, entityType, vertex));
addClassifications(context, guid, createdEntity.getClassifications());
}
}
if (CollectionUtils.isNotEmpty(updatedEntities)) {
for (AtlasEntity updatedEntity : updatedEntities) {
String guid = updatedEntity.getGuid();
AtlasVertex vertex = context.getVertex(guid);
AtlasEntityType entityType = context.getType(guid);
mapAttributes(updatedEntity, vertex, UPDATE, context);
if (isPartialUpdate) {
resp.addEntity(PARTIAL_UPDATE, constructHeader(updatedEntity, entityType, vertex));
} else {
resp.addEntity(UPDATE, constructHeader(updatedEntity, entityType, vertex));
}
if (replaceClassifications) {
deleteClassifications(guid);
addClassifications(context, guid, updatedEntity.getClassifications());
}
}
}
RequestContextV1 req = RequestContextV1.get();
for (AtlasObjectId id : req.getDeletedEntityIds()) {
resp.addEntity(DELETE, constructHeader(id));
}
for (AtlasObjectId id : req.getUpdatedEntityIds()) {
if (isPartialUpdate) {
resp.addEntity(PARTIAL_UPDATE, constructHeader(id));
} else {
resp.addEntity(UPDATE, constructHeader(id));
}
}
return resp;
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class ExportServiceTest method tamperEmployeeRequest.
private void tamperEmployeeRequest(AtlasExportRequest request) {
AtlasObjectId objectId = request.getItemsToExport().get(0);
objectId.getUniqueAttributes().remove("name");
objectId.getUniqueAttributes().put("qualifiedName", "XXX@121");
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class ExportServiceTest method getRequestForFullFetch.
private AtlasExportRequest getRequestForFullFetch() {
AtlasExportRequest request = new AtlasExportRequest();
List<AtlasObjectId> itemsToExport = new ArrayList<>();
itemsToExport.add(new AtlasObjectId("hive_db", "qualifiedName", "default@cl1"));
request.setItemsToExport(itemsToExport);
return request;
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class ExportServiceTest method getRequestForEmployee.
private AtlasExportRequest getRequestForEmployee() {
AtlasExportRequest request = new AtlasExportRequest();
List<AtlasObjectId> itemsToExport = new ArrayList<>();
itemsToExport.add(new AtlasObjectId("Employee", "name", "Max"));
request.setItemsToExport(itemsToExport);
setOptionsMap(request, true, "CONNECTED", false, "");
return request;
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class ZipSinkTest method getDefaultExportResult.
private AtlasExportResult getDefaultExportResult() {
AtlasExportRequest request = new AtlasExportRequest();
List<AtlasObjectId> itemsToExport = new ArrayList<>();
itemsToExport.add(new AtlasObjectId("hive_db", "qualifiedName", "default"));
request.setItemsToExport(itemsToExport);
defaultExportResult = new AtlasExportResult(request, "admin", "1.0.0.0", "root", 100);
return defaultExportResult;
}
Aggregations