Search in sources :

Example 1 with BusinessObjectDefinitionColumnChangeEvent

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;
}
Also used : BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn)

Example 2 with BusinessObjectDefinitionColumnChangeEvent

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);
}
Also used : BusinessObjectDefinitionColumnSearchFilter(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchFilter) BusinessObjectDefinitionColumnSearchKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchKey) BusinessObjectDefinitionColumnSearchResponse(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse) BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumnSearchRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) Test(org.junit.Test)

Example 3 with BusinessObjectDefinitionColumnChangeEvent

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);
}
Also used : BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) Test(org.junit.Test)

Example 4 with BusinessObjectDefinitionColumnChangeEvent

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);
}
Also used : BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) Test(org.junit.Test)

Example 5 with BusinessObjectDefinitionColumnChangeEvent

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);
}
Also used : BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionColumn (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn)10 BusinessObjectDefinitionColumnChangeEvent (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent)10 BusinessObjectDefinitionColumnKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey)9 Test (org.junit.Test)9 BusinessObjectDefinitionColumnCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest)4 BusinessObjectDefinitionColumnEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity)3 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)3 BusinessObjectDefinitionColumnUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest)2 BusinessObjectDefinitionColumnSearchFilter (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchFilter)1 BusinessObjectDefinitionColumnSearchKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchKey)1 BusinessObjectDefinitionColumnSearchRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchRequest)1 BusinessObjectDefinitionColumnSearchResponse (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse)1 SchemaColumnEntity (org.finra.herd.model.jpa.SchemaColumnEntity)1