use of org.apache.atlas.model.instance.AtlasObjectId in project atlas by apache.
the class HiveDDLEntityFilter method apply.
private HookNotification.EntityPartialUpdateRequestV2 apply(HookNotification.EntityPartialUpdateRequestV2 notification) {
AtlasObjectId objectId = filterObjectId(notification.getEntityId());
if (objectId == null) {
return null;
}
AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = apply(notification.getEntity());
if (entityWithExtInfo == null) {
return null;
}
return new HookNotification.EntityPartialUpdateRequestV2(notification.getUser(), objectId, entityWithExtInfo);
}
use of org.apache.atlas.model.instance.AtlasObjectId in project atlas by apache.
the class DropTable method getHiveEntities.
public List<AtlasObjectId> getHiveEntities() {
List<AtlasObjectId> ret = new ArrayList<>();
for (Entity entity : getOutputs()) {
if (entity.getType() == Entity.Type.TABLE) {
String tblQName = getQualifiedName(entity.getTable());
AtlasObjectId tblId = new AtlasObjectId(HIVE_TYPE_TABLE, ATTRIBUTE_QUALIFIED_NAME, tblQName);
context.removeFromKnownTable(tblQName);
ret.add(tblId);
}
}
return ret;
}
use of org.apache.atlas.model.instance.AtlasObjectId in project atlas by apache.
the class HiveITBase method validateHDFSPaths.
protected void validateHDFSPaths(AtlasEntity processEntity, String attributeName, String... testPaths) throws Exception {
List<AtlasObjectId> hdfsPathIds = toAtlasObjectIdList(processEntity.getAttribute(attributeName));
for (String testPath : testPaths) {
Path path = new Path(testPath);
String testPathNormed = lower(path.toString());
String hdfsPathId = assertHDFSPathIsRegistered(testPathNormed);
assertHDFSPathIdsContain(hdfsPathIds, hdfsPathId);
}
}
use of org.apache.atlas.model.instance.AtlasObjectId in project atlas by apache.
the class HiveITBase method toAtlasObjectIdList.
protected List<AtlasObjectId> toAtlasObjectIdList(Object obj) {
final List<AtlasObjectId> ret;
if (obj instanceof Collection) {
Collection coll = (Collection) obj;
ret = new ArrayList<>(coll.size());
for (Object item : coll) {
AtlasObjectId objId = toAtlasObjectId(item);
if (objId != null) {
ret.add(objId);
}
}
} else {
AtlasObjectId objId = toAtlasObjectId(obj);
if (objId != null) {
ret = new ArrayList<>(1);
ret.add(objId);
} else {
ret = null;
}
}
return ret;
}
use of org.apache.atlas.model.instance.AtlasObjectId in project atlas by apache.
the class TestAtlasObjectIdType method testObjectIdTypeGetNormalizedValue.
@Test
public void testObjectIdTypeGetNormalizedValue() {
assertNull(objectIdType.getNormalizedValue(null), "value=" + null);
for (Object value : validValues) {
if (value == null) {
continue;
}
AtlasObjectId normalizedValue = objectIdType.getNormalizedValue(value);
assertNotNull(normalizedValue, "value=" + value);
if (value instanceof AtlasObjectId) {
assertEquals(normalizedValue, value, "value=" + value);
} else if (value instanceof Map) {
assertEquals(normalizedValue.getTypeName(), ((Map) value).get(AtlasObjectId.KEY_TYPENAME), "value=" + value);
if (((Map) value).get(AtlasObjectId.KEY_GUID) == null) {
assertEquals(normalizedValue.getGuid(), ((Map) value).get(AtlasObjectId.KEY_GUID), "value=" + value);
} else {
assertEquals(normalizedValue.getGuid(), ((Map) value).get(AtlasObjectId.KEY_GUID), "value=" + value);
}
assertEquals(normalizedValue.getUniqueAttributes(), ((Map) value).get(AtlasObjectId.KEY_UNIQUE_ATTRIBUTES), "value=" + value);
}
}
}
Aggregations