Search in sources :

Example 1 with BusinessObjectDataAvailabilityCollectionResponse

use of org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse in project herd by FINRAOS.

the class CheckBusinessObjectDataAvailabilityCollection method executeImpl.

@Override
public void executeImpl(DelegateExecution execution) throws Exception {
    String contentTypeString = activitiHelper.getRequiredExpressionVariableAsString(contentType, execution, "ContentType").trim();
    String requestString = activitiHelper.getRequiredExpressionVariableAsString(businessObjectDataAvailabilityCollectionRequest, execution, "BusinessObjectDataAvailabilityCollectionRequest").trim();
    BusinessObjectDataAvailabilityCollectionRequest request = getRequestObject(contentTypeString, requestString, BusinessObjectDataAvailabilityCollectionRequest.class);
    // Call the business object data availability service.
    BusinessObjectDataAvailabilityCollectionResponse businessObjectDataAvailabilityCollectionResponse = businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(request);
    // Set the JSON response as a workflow variable.
    setJsonResponseAsWorkflowVariable(businessObjectDataAvailabilityCollectionResponse, execution);
    // Set workflow variables for whether all the data is available or not available for easy access.
    setTaskWorkflowVariable(execution, VARIABLE_IS_ALL_DATA_AVAILABLE, businessObjectDataAvailabilityCollectionResponse.isIsAllDataAvailable());
    setTaskWorkflowVariable(execution, VARIABLE_IS_ALL_DATA_NOT_AVAILABLE, businessObjectDataAvailabilityCollectionResponse.isIsAllDataNotAvailable());
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)

Example 2 with BusinessObjectDataAvailabilityCollectionResponse

use of org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse in project herd by FINRAOS.

the class BusinessObjectDataServiceImpl method checkBusinessObjectDataAvailabilityCollectionImpl.

/**
 * Performs an availability check for a collection of business object data.
 *
 * @param businessObjectDataAvailabilityCollectionRequest the business object data availability collection requests
 *
 * @return the business object data availability information
 */
protected BusinessObjectDataAvailabilityCollectionResponse checkBusinessObjectDataAvailabilityCollectionImpl(BusinessObjectDataAvailabilityCollectionRequest businessObjectDataAvailabilityCollectionRequest) {
    // Perform the validation of the entire request, before we start processing the individual requests that requires the database access.
    validateBusinessObjectDataAvailabilityCollectionRequest(businessObjectDataAvailabilityCollectionRequest);
    // Process the individual requests and build the response.
    BusinessObjectDataAvailabilityCollectionResponse businessObjectDataAvailabilityCollectionResponse = new BusinessObjectDataAvailabilityCollectionResponse();
    List<BusinessObjectDataAvailability> businessObjectDataAvailabilityResponses = new ArrayList<>();
    businessObjectDataAvailabilityCollectionResponse.setBusinessObjectDataAvailabilityResponses(businessObjectDataAvailabilityResponses);
    boolean isAllDataAvailable = true;
    boolean isAllDataNotAvailable = true;
    for (BusinessObjectDataAvailabilityRequest request : businessObjectDataAvailabilityCollectionRequest.getBusinessObjectDataAvailabilityRequests()) {
        // Please note that when calling to process individual availability requests, we ask to skip the request validation and trimming step.
        BusinessObjectDataAvailability businessObjectDataAvailability = checkBusinessObjectDataAvailabilityImpl(request, true);
        businessObjectDataAvailabilityResponses.add(businessObjectDataAvailability);
        isAllDataAvailable = isAllDataAvailable && businessObjectDataAvailability.getNotAvailableStatuses().isEmpty();
        isAllDataNotAvailable = isAllDataNotAvailable && businessObjectDataAvailability.getAvailableStatuses().isEmpty();
    }
    businessObjectDataAvailabilityCollectionResponse.setIsAllDataAvailable(isAllDataAvailable);
    businessObjectDataAvailabilityCollectionResponse.setIsAllDataNotAvailable(isAllDataNotAvailable);
    return businessObjectDataAvailabilityCollectionResponse;
}
Also used : BusinessObjectDataAvailabilityRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest) BusinessObjectDataAvailability(org.finra.herd.model.api.xml.BusinessObjectDataAvailability) ArrayList(java.util.ArrayList) BusinessObjectDataAvailabilityCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)

Example 3 with BusinessObjectDataAvailabilityCollectionResponse

use of org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse in project herd by FINRAOS.

the class BusinessObjectDataRestControllerTest method testCheckBusinessObjectDataAvailabilityCollection.

@Test
public void testCheckBusinessObjectDataAvailabilityCollection() {
    // Create a business object data availability collection request.
    BusinessObjectDataAvailabilityCollectionRequest businessObjectDataAvailabilityCollectionRequest = new BusinessObjectDataAvailabilityCollectionRequest();
    // Create a business object data availability collection response.
    BusinessObjectDataAvailabilityCollectionResponse businessObjectDataAvailabilityCollectionResponse = new BusinessObjectDataAvailabilityCollectionResponse();
    // Mock the external calls.
    when(businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(businessObjectDataAvailabilityCollectionRequest)).thenReturn(businessObjectDataAvailabilityCollectionResponse);
    // Call the method under test.
    BusinessObjectDataAvailabilityCollectionResponse result = businessObjectDataRestController.checkBusinessObjectDataAvailabilityCollection(businessObjectDataAvailabilityCollectionRequest);
    // Verify the external calls.
    verify(businessObjectDataService).checkBusinessObjectDataAvailabilityCollection(businessObjectDataAvailabilityCollectionRequest);
    verifyNoMoreInteractionsHelper();
    // Validate the results.
    assertEquals(businessObjectDataAvailabilityCollectionResponse, result);
}
Also used : BusinessObjectDataAvailabilityCollectionRequest(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest) BusinessObjectDataAvailabilityCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse) Test(org.junit.Test)

Example 4 with BusinessObjectDataAvailabilityCollectionResponse

use of org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse in project herd by FINRAOS.

the class BusinessObjectDataServiceTestHelper method getExpectedBusinessObjectDataAvailabilityCollectionResponse.

/**
 * Creates an expected business object data availability collection response using hard coded test values.
 *
 * @return the business object data availability collection response
 */
public BusinessObjectDataAvailabilityCollectionResponse getExpectedBusinessObjectDataAvailabilityCollectionResponse() {
    // Prepare a check availability collection response using hard coded test values.
    BusinessObjectDataAvailabilityCollectionResponse businessObjectDataAvailabilityCollectionResponse = new BusinessObjectDataAvailabilityCollectionResponse();
    // Create a list of check business object data availability responses.
    List<BusinessObjectDataAvailability> businessObjectDataAvailabilityResponses = new ArrayList<>();
    businessObjectDataAvailabilityCollectionResponse.setBusinessObjectDataAvailabilityResponses(businessObjectDataAvailabilityResponses);
    // Create a business object data availability response.
    BusinessObjectDataAvailability businessObjectDataAvailability = new BusinessObjectDataAvailability(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, AbstractServiceTest.FORMAT_FILE_TYPE_CODE, AbstractServiceTest.FORMAT_VERSION, Arrays.asList(new PartitionValueFilter(AbstractServiceTest.PARTITION_KEY, Arrays.asList(AbstractServiceTest.PARTITION_VALUE), AbstractServiceTest.NO_PARTITION_VALUE_RANGE, AbstractServiceTest.NO_LATEST_BEFORE_PARTITION_VALUE, AbstractServiceTest.NO_LATEST_AFTER_PARTITION_VALUE)), null, AbstractServiceTest.DATA_VERSION, AbstractServiceTest.NO_STORAGE_NAMES, AbstractServiceTest.STORAGE_NAME, Arrays.asList(new BusinessObjectDataStatus(AbstractServiceTest.FORMAT_VERSION, AbstractServiceTest.PARTITION_VALUE, AbstractServiceTest.SUBPARTITION_VALUES, AbstractServiceTest.DATA_VERSION, BusinessObjectDataStatusEntity.VALID)), new ArrayList<>());
    businessObjectDataAvailabilityResponses.add(businessObjectDataAvailability);
    // Set the expected values for the flags.
    businessObjectDataAvailabilityCollectionResponse.setIsAllDataAvailable(true);
    businessObjectDataAvailabilityCollectionResponse.setIsAllDataNotAvailable(false);
    return businessObjectDataAvailabilityCollectionResponse;
}
Also used : BusinessObjectDataAvailability(org.finra.herd.model.api.xml.BusinessObjectDataAvailability) ArrayList(java.util.ArrayList) BusinessObjectDataStatus(org.finra.herd.model.api.xml.BusinessObjectDataStatus) BusinessObjectDataAvailabilityCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse) PartitionValueFilter(org.finra.herd.model.api.xml.PartitionValueFilter)

Example 5 with BusinessObjectDataAvailabilityCollectionResponse

use of org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse in project herd by FINRAOS.

the class BusinessObjectDataServiceCheckBusinessObjectDataAvailabilityCollectionTest method testCheckBusinessObjectDataAvailabilityCollection.

@Test
public void testCheckBusinessObjectDataAvailabilityCollection() {
    // Prepare database entities required for testing.
    businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataAvailabilityCollectionTesting();
    // Check an availability for a collection of business object data.
    BusinessObjectDataAvailabilityCollectionResponse resultBusinessObjectDataAvailabilityCollectionResponse = businessObjectDataService.checkBusinessObjectDataAvailabilityCollection(businessObjectDataServiceTestHelper.getTestBusinessObjectDataAvailabilityCollectionRequest());
    // Validate the response object.
    assertEquals(businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataAvailabilityCollectionResponse(), resultBusinessObjectDataAvailabilityCollectionResponse);
}
Also used : BusinessObjectDataAvailabilityCollectionResponse(org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse) Test(org.junit.Test)

Aggregations

BusinessObjectDataAvailabilityCollectionResponse (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionResponse)5 ArrayList (java.util.ArrayList)2 BusinessObjectDataAvailability (org.finra.herd.model.api.xml.BusinessObjectDataAvailability)2 BusinessObjectDataAvailabilityCollectionRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityCollectionRequest)2 Test (org.junit.Test)2 BusinessObjectDataAvailabilityRequest (org.finra.herd.model.api.xml.BusinessObjectDataAvailabilityRequest)1 BusinessObjectDataStatus (org.finra.herd.model.api.xml.BusinessObjectDataStatus)1 PartitionValueFilter (org.finra.herd.model.api.xml.PartitionValueFilter)1