@Test public void testAppend() { final DataType dataType = mock(DataType.class); final DataType dataTypeWithoutName = mock(DataType.class); final DataType updatedDataType = mock(DataType.class); final DataTypeManager withDataType = mock(DataTypeManager.class); final DataTypeManager withNoName = mock(DataTypeManager.class); final ItemDefinition itemDefinition = mock(ItemDefinition.class); final List<DataType> expectedAffectedDataTypes = asList(mock(DataType.class), mock(DataType.class)); when(dataTypeManager.withDataType(dataType)).thenReturn(withDataType); when(withDataType.withNoName()).thenReturn(withNoName); when(withNoName.get()).thenReturn(dataTypeWithoutName); when(recordEngine.update(updatedDataType)).thenReturn(expectedAffectedDataTypes); doReturn(updatedDataType).when(handler).updateDataTypeProperties(dataTypeWithoutName, TOP_LEVEL_PARENT_UUID, itemDefinition); final List<DataType> actualAffectedDataTypes = handler.append(dataType, itemDefinition); assertEquals(expectedAffectedDataTypes, actualAffectedDataTypes); }
public List<DataType> append(final DataType dataType, final ItemDefinition itemDefinition) { final DataType named; if (Strings.isNullOrEmpty(dataType.getName())) { named = withNoName(dataType); } else { named = dataType; } final DataType updateDataType = updateDataTypeProperties(named, TOP_LEVEL_PARENT_UUID, itemDefinition); return recordEngine.update(updateDataType); }
DataTypeCreateHandler extends DataTypeHandler { public List<DataType> append(final DataType dataType, final ItemDefinition itemDefinition) { final DataType named; if (Strings.isNullOrEmpty(dataType.getName())) { named = withNoName(dataType); } else { named = dataType; } final DataType updateDataType = updateDataTypeProperties(named, TOP_LEVEL_PARENT_UUID, itemDefinition); return recordEngine.update(updateDataType); } }
DataTypeCreateHandler extends DataTypeHandler { public List<DataType> append(final DataType dataType, final ItemDefinition itemDefinition) { final DataType named; if (Strings.isNullOrEmpty(dataType.getName())) { named = withNoName(dataType); } else { named = dataType; } final DataType updateDataType = updateDataTypeProperties(named, TOP_LEVEL_PARENT_UUID, itemDefinition); return recordEngine.update(updateDataType); } @Inject  DataTypeCreateHandler(final DataTypeStore dataTypeStore,
                                 final DataTypeManager dataTypeManager); }
DataTypeCreateHandler extends DataTypeHandler { public List<DataType> append(final DataType dataType, final ItemDefinition itemDefinition) { final DataType named; if (Strings.isNullOrEmpty(dataType.getName())) { named = withNoName(dataType); } else { named = dataType; } final DataType updateDataType = updateDataTypeProperties(named, TOP_LEVEL_PARENT_UUID, itemDefinition); return recordEngine.update(updateDataType); } @Inject  DataTypeCreateHandler(final DataTypeStore dataTypeStore,
                                 final DataTypeManager dataTypeManager); List<DataType> append(final DataType dataType,
                                 final ItemDefinition itemDefinition); List<DataType> insertSibling(final DataType dataType,
                                        final DataType reference,
                                        final CreationType creationType,
                                        final ItemDefinition itemDefinition); List<DataType> insertNested(final DataType dataType,
                                       final DataType reference,
                                       final ItemDefinition itemDefinition); }
DataTypeCreateHandler extends DataTypeHandler { public List<DataType> append(final DataType dataType, final ItemDefinition itemDefinition) { final DataType named; if (Strings.isNullOrEmpty(dataType.getName())) { named = withNoName(dataType); } else { named = dataType; } final DataType updateDataType = updateDataTypeProperties(named, TOP_LEVEL_PARENT_UUID, itemDefinition); return recordEngine.update(updateDataType); } @Inject  DataTypeCreateHandler(final DataTypeStore dataTypeStore,
                                 final DataTypeManager dataTypeManager); List<DataType> append(final DataType dataType,
                                 final ItemDefinition itemDefinition); List<DataType> insertSibling(final DataType dataType,
                                        final DataType reference,
                                        final CreationType creationType,
                                        final ItemDefinition itemDefinition); List<DataType> insertNested(final DataType dataType,
                                       final DataType reference,
                                       final ItemDefinition itemDefinition);  }