@Test public void testCloneAction() throws Exception { for (Action a : ModelTestUtil.getAllOOTBActions()) { assertNotNull(a); Action b = AtlasModelFactory.cloneAction((Action)a); assertNotNull(String.format("Add %s to AtlasModelFactory#cloneAction()", a.getClass().getSimpleName()), b); assertNotSame(a, b); assertEquals(a.getClass().getCanonicalName(), b.getClass().getCanonicalName()); } }
public static Action cloneAction(Action action) { if (action == null) { return null; } try { ObjectMapper mapper = new ObjectMapper() .enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES); String s = mapper.writeValueAsString(action); System.out.println(s); return mapper.readerFor(Action.class).readValue(s); } catch (IOException e) { throw new RuntimeException(e); } }
AtlasModelFactory { public static Action cloneAction(Action action) { if (action == null) { return null; } try { ObjectMapper mapper = new ObjectMapper() .enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES); String s = mapper.writeValueAsString(action); System.out.println(s); return mapper.readerFor(Action.class).readValue(s); } catch (IOException e) { throw new RuntimeException(e); } } }
AtlasModelFactory { public static Action cloneAction(Action action) { if (action == null) { return null; } try { ObjectMapper mapper = new ObjectMapper() .enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES); String s = mapper.writeValueAsString(action); System.out.println(s); return mapper.readerFor(Action.class).readValue(s); } catch (IOException e) { throw new RuntimeException(e); } } private  AtlasModelFactory(); }
AtlasModelFactory { public static Action cloneAction(Action action) { if (action == null) { return null; } try { ObjectMapper mapper = new ObjectMapper() .enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES); String s = mapper.writeValueAsString(action); System.out.println(s); return mapper.readerFor(Action.class).readValue(s); } catch (IOException e) { throw new RuntimeException(e); } } private  AtlasModelFactory(); @SuppressWarnings("unchecked") static T createMapping(MappingType type); static AtlasMapping createAtlasMapping(); static Collection createCollection(); static MockDocument createMockDocument(); static MockField createMockField(); static PropertyField createPropertyField(); static BaseMapping cloneMapping(BaseMapping baseMapping, boolean deepClone); static Field cloneField(Field f); static FieldGroup copyFieldGroup(FieldGroup fg); static SimpleField cloneFieldToSimpleField(Field field); static void copyField(Field from, Field to, boolean withActions); static FieldGroup createFieldGroupFrom(Field field, boolean withActions); static ArrayList<Action> cloneFieldActions(ArrayList<Action> actions); static Action cloneAction(Action action); static String toString(PropertyField f); static String toString(Field f); static Field wrapWithField(Object val); static Field wrapWithField(Object val, String parentPath); static Object unwrapField(Field f); }
AtlasModelFactory { public static Action cloneAction(Action action) { if (action == null) { return null; } try { ObjectMapper mapper = new ObjectMapper() .enable(MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES); String s = mapper.writeValueAsString(action); System.out.println(s); return mapper.readerFor(Action.class).readValue(s); } catch (IOException e) { throw new RuntimeException(e); } } private  AtlasModelFactory(); @SuppressWarnings("unchecked") static T createMapping(MappingType type); static AtlasMapping createAtlasMapping(); static Collection createCollection(); static MockDocument createMockDocument(); static MockField createMockField(); static PropertyField createPropertyField(); static BaseMapping cloneMapping(BaseMapping baseMapping, boolean deepClone); static Field cloneField(Field f); static FieldGroup copyFieldGroup(FieldGroup fg); static SimpleField cloneFieldToSimpleField(Field field); static void copyField(Field from, Field to, boolean withActions); static FieldGroup createFieldGroupFrom(Field field, boolean withActions); static ArrayList<Action> cloneFieldActions(ArrayList<Action> actions); static Action cloneAction(Action action); static String toString(PropertyField f); static String toString(Field f); static Field wrapWithField(Object val); static Field wrapWithField(Object val, String parentPath); static Object unwrapField(Field f); static final String GENERATED_PATH; }