use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceImpl method searchBusinessObjectDefinitionColumns.
@Override
public BusinessObjectDefinitionColumnSearchResponse searchBusinessObjectDefinitionColumns(BusinessObjectDefinitionColumnSearchRequest request, Set<String> fields) {
// Validate search request
validateBusinessObjectDefinitionColumnSearchRequest(request);
// Validate the fields
validateSearchResponseFields(fields);
// Only a single search filter and a single search key is allowed at this time.
// Use the first search filter and first search key in the filter and keys list.
BusinessObjectDefinitionKey businessObjectDefinitionKey = new BusinessObjectDefinitionKey(request.getBusinessObjectDefinitionColumnSearchFilters().get(0).getBusinessObjectDefinitionColumnSearchKeys().get(0).getNamespace(), request.getBusinessObjectDefinitionColumnSearchFilters().get(0).getBusinessObjectDefinitionColumnSearchKeys().get(0).getBusinessObjectDefinitionName());
// Retrieve the business object definition and ensure it exists.
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoHelper.getBusinessObjectDefinitionEntity(businessObjectDefinitionKey);
return new BusinessObjectDefinitionColumnSearchResponse(businessObjectDefinitionEntity.getColumns().stream().map(businessObjectDefinitionColumnEntity -> createBusinessObjectDefinitionColumnFromEntity(businessObjectDefinitionColumnEntity, false, fields, false)).collect(Collectors.toList()));
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testSearchBusinessObjectDefinitionColumnsMissingOptionalParameters.
@Test
public void testSearchBusinessObjectDefinitionColumnsMissingOptionalParameters() {
createDatabaseEntitiesForBusinessObjectDefinitionColumnSearchTesting();
// Search business object definition columns without specifying optional parameters except for the description field option.
assertEquals(new BusinessObjectDefinitionColumnSearchResponse(Lists.newArrayList(new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, null, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), COLUMN_NAME_2, null, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS))), businessObjectDefinitionColumnService.searchBusinessObjectDefinitionColumns(new BusinessObjectDefinitionColumnSearchRequest(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchFilter(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchKey(BDEF_NAMESPACE, BDEF_NAME))))), Sets.newHashSet(SCHEMA_COLUMN_NAME_FIELD)));
// Search business object definition columns without specifying optional parameters except for the schema column name field option.
assertEquals(new BusinessObjectDefinitionColumnSearchResponse(Lists.newArrayList(new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), null, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), null, BDEF_COLUMN_DESCRIPTION_2, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS))), businessObjectDefinitionColumnService.searchBusinessObjectDefinitionColumns(new BusinessObjectDefinitionColumnSearchRequest(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchFilter(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchKey(BDEF_NAMESPACE, BDEF_NAME))))), Sets.newHashSet(DESCRIPTION_FIELD)));
// Search business object definition columns without specifying optional parameters.
assertEquals(new BusinessObjectDefinitionColumnSearchResponse(Lists.newArrayList(new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), null, null, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), null, null, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS))), businessObjectDefinitionColumnService.searchBusinessObjectDefinitionColumns(new BusinessObjectDefinitionColumnSearchRequest(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchFilter(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchKey(BDEF_NAMESPACE, BDEF_NAME))))), Sets.newHashSet()));
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testSearchBusinessObjectDefinitionColumns.
@Test
public void testSearchBusinessObjectDefinitionColumns() {
createDatabaseEntitiesForBusinessObjectDefinitionColumnSearchTesting();
// Search the business object definition columns using all field parameters.
BusinessObjectDefinitionColumnSearchResponse businessObjectDefinitionColumnSearchResponse = businessObjectDefinitionColumnService.searchBusinessObjectDefinitionColumns(new BusinessObjectDefinitionColumnSearchRequest(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchFilter(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchKey(BDEF_NAMESPACE, BDEF_NAME))))), Sets.newHashSet(SCHEMA_COLUMN_NAME_FIELD, DESCRIPTION_FIELD));
// Validate the response object.
assertEquals(new BusinessObjectDefinitionColumnSearchResponse(Lists.newArrayList(new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), COLUMN_NAME_2, BDEF_COLUMN_DESCRIPTION_2, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS))), businessObjectDefinitionColumnSearchResponse);
}
use of org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnSearchResponse 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.BusinessObjectDefinitionColumnSearchResponse in project herd by FINRAOS.
the class BusinessObjectDefinitionColumnServiceTest method testSearchBusinessObjectDefinitionColumnsLowerCaseParameters.
@Test
public void testSearchBusinessObjectDefinitionColumnsLowerCaseParameters() {
createDatabaseEntitiesForBusinessObjectDefinitionColumnSearchTesting();
// Search the business object definition columns using lower case input parameters.
BusinessObjectDefinitionColumnSearchResponse businessObjectDefinitionColumnSearchResponse = businessObjectDefinitionColumnService.searchBusinessObjectDefinitionColumns(new BusinessObjectDefinitionColumnSearchRequest(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchFilter(Lists.newArrayList(new BusinessObjectDefinitionColumnSearchKey(BDEF_NAMESPACE, BDEF_NAME))))), Sets.newHashSet(SCHEMA_COLUMN_NAME_FIELD.toLowerCase(), DESCRIPTION_FIELD.toLowerCase()));
// Validate the response object.
assertEquals(new BusinessObjectDefinitionColumnSearchResponse(Lists.newArrayList(new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), new BusinessObjectDefinitionColumn(NO_ID, new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME_2), COLUMN_NAME_2, BDEF_COLUMN_DESCRIPTION_2, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS))), businessObjectDefinitionColumnSearchResponse);
}
Aggregations