use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceImpl method createBusinessObjectDefinitionColumnFromEntity.
/**
* Creates a business object definition column from the persisted entity.
*
* @param businessObjectDefinitionColumnEntity the business object definition column entity
* @param includeId boolean value indicating whether or not to include the id
* @param fields set of field parameters to include on the business object definition column
*
* @return the business object definition column
*/
private BusinessObjectDefinitionColumn createBusinessObjectDefinitionColumnFromEntity(BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity, boolean includeId, Set<String> fields, Boolean includeBusinessObjectDefinitionColumnUpdateHistory) {
BusinessObjectDefinitionColumn businessObjectDefinitionColumn = new BusinessObjectDefinitionColumn();
if (includeId) {
businessObjectDefinitionColumn.setId(businessObjectDefinitionColumnEntity.getId());
}
businessObjectDefinitionColumn.setBusinessObjectDefinitionColumnKey(getBusinessObjectDefinitionColumnKey(businessObjectDefinitionColumnEntity));
if (fields.contains(DESCRIPTION_FIELD)) {
businessObjectDefinitionColumn.setDescription(businessObjectDefinitionColumnEntity.getDescription());
}
if (fields.contains(SCHEMA_COLUMN_NAME_FIELD) && CollectionUtils.isNotEmpty(businessObjectDefinitionColumnEntity.getSchemaColumns())) {
businessObjectDefinitionColumn.setSchemaColumnName(IterableUtils.get(businessObjectDefinitionColumnEntity.getSchemaColumns(), 0).getName());
}
// Add change events.
final List<BusinessObjectDefinitionColumnChangeEvent> businessObjectDefinitionColumnChangeEvents = Lists.newArrayList();
if (BooleanUtils.isTrue(includeBusinessObjectDefinitionColumnUpdateHistory)) {
businessObjectDefinitionColumnEntity.getChangeEvents().forEach(businessObjectDefinitionColumnChangeEventEntity -> businessObjectDefinitionColumnChangeEvents.add(new BusinessObjectDefinitionColumnChangeEvent(businessObjectDefinitionColumnChangeEventEntity.getDescription(), HerdDateUtils.getXMLGregorianCalendarValue(businessObjectDefinitionColumnChangeEventEntity.getCreatedOn()), businessObjectDefinitionColumnChangeEventEntity.getCreatedBy())));
}
businessObjectDefinitionColumn.setBusinessObjectDefinitionColumnChangeEvents(businessObjectDefinitionColumnChangeEvents);
return businessObjectDefinitionColumn;
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnRestControllerTest method testSearchBusinessObjectDefinitionColumns.
@Test
public void testSearchBusinessObjectDefinitionColumns() {
// Create business object definition change event
List<BusinessObjectDefinitionColumnChangeEvent> businessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, CREATED_ON, CREATED_BY));
BusinessObjectDefinitionColumnSearchRequest request = new BusinessObjectDefinitionColumnSearchRequest(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchFilter(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchKey(BDEF_NAMESPACE, BDEF_NAME)))));
BusinessObjectDefinitionColumnSearchResponse businessObjectDefinitionColumnSearchResponse = new BusinessObjectDefinitionColumnSearchResponse(Arrays.asList(new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, businessObjectDefinitionColumnChangeEvents), new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), COLUMN_NAME_2, BDEF_COLUMN_DESCRIPTION_2, businessObjectDefinitionColumnChangeEvents)));
Set<String> set = Sets.newHashSet(SCHEMA_COLUMN_NAME_FIELD, DESCRIPTION_FIELD);
when(businessObjectDefinitionColumnService.searchBusinessObjectDefinitionColumns(request, set)).thenReturn(businessObjectDefinitionColumnSearchResponse);
// Search the business object definition columns.
BusinessObjectDefinitionColumnSearchResponse resultSearchResponse = businessObjectDefinitionColumnRestController.searchBusinessObjectDefinitionColumns(set, request);
// Verify the external calls.
verify(businessObjectDefinitionColumnService).searchBusinessObjectDefinitionColumns(request, set);
verifyNoMoreInteractions(businessObjectDefinitionColumnService);
// Validate the returned object.
assertEquals(businessObjectDefinitionColumnSearchResponse, resultSearchResponse);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnRestControllerTest method testGetBusinessObjectDefinitionColumnWithUpdateHistory.
@Test
public void testGetBusinessObjectDefinitionColumnWithUpdateHistory() {
// Create business object definition change event
List<BusinessObjectDefinitionColumnChangeEvent> businessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, CREATED_ON, CREATED_BY));
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
BusinessObjectDefinitionColumn businessObjectDefinitionColumn = new BusinessObjectDefinitionColumn(ID, businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, businessObjectDefinitionColumnChangeEvents);
when(businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, true)).thenReturn(businessObjectDefinitionColumn);
// Get the business object definition column.
BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnRestController.getBusinessObjectDefinitionColumn(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME, true);
// Verify the external calls.
verify(businessObjectDefinitionColumnService).getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, true);
verifyNoMoreInteractions(businessObjectDefinitionColumnService);
// Validate the returned object.
assertEquals(businessObjectDefinitionColumn, resultBusinessObjectDefinitionColumn);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnRestControllerTest method testDeleteBusinessObjectDefinitionColumn.
@Test
public void testDeleteBusinessObjectDefinitionColumn() {
// Create business object definition change event
List<BusinessObjectDefinitionColumnChangeEvent> businessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, CREATED_ON, CREATED_BY));
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
BusinessObjectDefinitionColumn businessObjectDefinitionColumn = new BusinessObjectDefinitionColumn(ID, businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, businessObjectDefinitionColumnChangeEvents);
when(businessObjectDefinitionColumnService.deleteBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey)).thenReturn(businessObjectDefinitionColumn);
BusinessObjectDefinitionColumn deletedBusinessObjectDefinitionColumn = businessObjectDefinitionColumnRestController.deleteBusinessObjectDefinitionColumn(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
// Verify the external calls.
verify(businessObjectDefinitionColumnService).deleteBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey);
verifyNoMoreInteractions(businessObjectDefinitionColumnService);
// Validate the returned object.
assertEquals(businessObjectDefinitionColumn, deletedBusinessObjectDefinitionColumn);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnRestControllerTest method testGetBusinessObjectDefinitionColumn.
@Test
public void testGetBusinessObjectDefinitionColumn() {
// Create business object definition change event
List<BusinessObjectDefinitionColumnChangeEvent> businessObjectDefinitionColumnChangeEvents = Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, CREATED_ON, CREATED_BY));
BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
BusinessObjectDefinitionColumn businessObjectDefinitionColumn = new BusinessObjectDefinitionColumn(ID, businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, businessObjectDefinitionColumnChangeEvents);
when(businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, false)).thenReturn(businessObjectDefinitionColumn);
// Get the business object definition column.
BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnRestController.getBusinessObjectDefinitionColumn(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME, false);
// Verify the external calls.
verify(businessObjectDefinitionColumnService).getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, false);
verifyNoMoreInteractions(businessObjectDefinitionColumnService);
// Validate the returned object.
assertEquals(businessObjectDefinitionColumn, resultBusinessObjectDefinitionColumn);
}
Aggregations