Commit 8244f8bf by Vimal Sharma Committed by Madhan Neethiraj

ATLAS-1572: updated notification processing to handle messages from v1 hooks

parent 9e16600c
...@@ -42,22 +42,26 @@ public class AtlasArrayFormatConverter extends AtlasAbstractFormatConverter { ...@@ -42,22 +42,26 @@ public class AtlasArrayFormatConverter extends AtlasAbstractFormatConverter {
Collection ret = null; Collection ret = null;
if (v1Obj != null) { if (v1Obj != null) {
if (v1Obj instanceof List) { if (v1Obj instanceof Set) {
ret = new ArrayList();
} else if (v1Obj instanceof Set) {
ret = new LinkedHashSet(); ret = new LinkedHashSet();
} else { } else {
throw new AtlasBaseException(AtlasErrorCode.UNEXPECTED_TYPE, "List or Set", ret = new ArrayList();
v1Obj.getClass().getCanonicalName());
} }
AtlasArrayType arrType = (AtlasArrayType) type; AtlasArrayType arrType = (AtlasArrayType) type;
AtlasType elemType = arrType.getElementType(); AtlasType elemType = arrType.getElementType();
AtlasFormatConverter elemConverter = converterRegistry.getConverter(elemType.getTypeCategory()); AtlasFormatConverter elemConverter = converterRegistry.getConverter(elemType.getTypeCategory());
Collection v1List = (Collection) v1Obj;
for (Object v1Elem : v1List) { if (v1Obj instanceof Collection) {
Object convertedVal = elemConverter.fromV1ToV2(v1Elem, elemType, ctx); Collection v1List = (Collection) v1Obj;
for (Object v1Elem : v1List) {
Object convertedVal = elemConverter.fromV1ToV2(v1Elem, elemType, ctx);
ret.add(convertedVal);
}
} else {
Object convertedVal = elemConverter.fromV1ToV2(v1Obj, elemType, ctx);
ret.add(convertedVal); ret.add(convertedVal);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment