use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class ExportService method processItems.
private AtlasExportResult.OperationStatus[] processItems(AtlasExportRequest request, ExportContext context) throws AtlasServiceException, AtlasException, AtlasBaseException {
AtlasExportResult.OperationStatus[] statuses = new AtlasExportResult.OperationStatus[request.getItemsToExport().size()];
List<AtlasObjectId> itemsToExport = request.getItemsToExport();
for (int i = 0; i < itemsToExport.size(); i++) {
AtlasObjectId item = itemsToExport.get(i);
statuses[i] = processObjectId(item, context);
}
return statuses;
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class InverseReferenceUpdateV1Test method verifyReferenceValue.
protected void verifyReferenceValue(AtlasEntity entity, String refName, String expectedGuid) {
Object refValue = entity.getAttribute(refName);
if (expectedGuid == null) {
assertNull(refValue);
} else {
assertTrue(refValue instanceof AtlasObjectId);
AtlasObjectId referencedObjectId = (AtlasObjectId) refValue;
assertEquals(referencedObjectId.getGuid(), expectedGuid);
}
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class SoftDeleteHandlerV1Test method assertJohnForTestDisconnectBidirectionalReferences.
@Override
protected void assertJohnForTestDisconnectBidirectionalReferences(final AtlasEntity.AtlasEntityWithExtInfo john, final String janeGuid) throws Exception {
AtlasObjectId mgr = (AtlasObjectId) john.getEntity().getAttribute("manager");
assertNotNull(mgr);
assertEquals(mgr.getGuid(), janeGuid);
final AtlasEntity.AtlasEntityWithExtInfo mgrEntity = entityStore.getById(mgr.getGuid());
assertEquals(mgrEntity.getEntity().getStatus(), AtlasEntity.Status.DELETED);
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class InverseReferenceUpdateSoftDeleteV1Test method verify_testInverseReferenceAutoUpdate_Map.
@Override
protected void verify_testInverseReferenceAutoUpdate_Map(AtlasEntity a1, AtlasEntity b1, AtlasEntity b2, AtlasEntity b3) {
Object value = a1.getAttribute("mapToB");
assertTrue(value instanceof Map);
Map<String, AtlasObjectId> refMap = (Map<String, AtlasObjectId>) value;
assertEquals(refMap.size(), 3);
AtlasObjectId referencedEntityId = refMap.get("b3");
assertEquals(referencedEntityId, AtlasTypeUtil.getAtlasObjectId(b3));
verifyReferenceValue(b1, "mappedFromA", a1.getGuid());
verifyReferenceValue(b2, "mappedFromA", a1.getGuid());
}
use of org.apache.atlas.model.instance.AtlasObjectId in project incubator-atlas by apache.
the class FullTextMapperV2 method mapAttribute.
private void mapAttribute(Object value, AtlasEntityExtInfo entityExtInfo, StringBuilder sb, Set<String> processedGuids) throws AtlasBaseException {
if (value instanceof AtlasObjectId) {
if (followReferences) {
AtlasObjectId objectId = (AtlasObjectId) value;
AtlasEntity entity = entityExtInfo.getEntity(objectId.getGuid());
if (entity != null) {
map(entity, entityExtInfo, sb, processedGuids);
}
}
} else if (value instanceof List) {
List valueList = (List) value;
for (Object listElement : valueList) {
mapAttribute(listElement, entityExtInfo, sb, processedGuids);
}
} else if (value instanceof Map) {
Map valueMap = (Map) value;
for (Object key : valueMap.keySet()) {
mapAttribute(key, entityExtInfo, sb, processedGuids);
mapAttribute(valueMap.get(key), entityExtInfo, sb, processedGuids);
}
} else if (value instanceof Enum) {
Enum enumValue = (Enum) value;
sb.append(enumValue.name()).append(FULL_TEXT_DELIMITER);
} else if (value instanceof AtlasStruct) {
AtlasStruct atlasStruct = (AtlasStruct) value;
for (Map.Entry<String, Object> entry : atlasStruct.getAttributes().entrySet()) {
sb.append(entry.getKey()).append(FULL_TEXT_DELIMITER);
mapAttribute(entry.getValue(), entityExtInfo, sb, processedGuids);
}
} else {
sb.append(String.valueOf(value)).append(FULL_TEXT_DELIMITER);
}
}
Aggregations