Search in sources :

Example 16 with BusinessObjectDefinitionColumnEntity

use of org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity in project herd by FINRAOS.

the class BusinessObjectDefinitionColumnServiceImpl method getBusinessObjectDefinitionColumn.

@Override
public BusinessObjectDefinitionColumn getBusinessObjectDefinitionColumn(BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey, Boolean includeBusinessObjectDefinitionColumnUpdateHistory) {
    // Validate and trim the business object definition column key.
    validateBusinessObjectDefinitionColumnKey(businessObjectDefinitionColumnKey);
    // Retrieve and ensure that a business object definition column exists with the business object definition.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
    // Create and return the business object definition column object from the persisted entity.
    return createBusinessObjectDefinitionColumnFromEntity(businessObjectDefinitionColumnEntity, true, getValidSearchResponseFields(), includeBusinessObjectDefinitionColumnUpdateHistory);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity)

Example 17 with BusinessObjectDefinitionColumnEntity

use of org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity in project herd by FINRAOS.

the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnWithChangeEvents.

@Test
public void testGetBusinessObjectDefinitionColumnWithChangeEvents() {
    // Create and persist a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create and persist a schema column for this business object format.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME);
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create a business object definition column.
    businessObjectDefinitionColumnService.createBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnCreateRequest(businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION));
    // Get the business object definition column entity.
    BusinessObjectDefinitionColumnEntity resultBusinessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoHelper.getBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey);
    // Get the business object definition column.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(businessObjectDefinitionColumnKey, true);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(resultBusinessObjectDefinitionColumn.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, Lists.newArrayList(new BusinessObjectDefinitionColumnChangeEvent(BDEF_COLUMN_DESCRIPTION, resultBusinessObjectDefinitionColumn.getBusinessObjectDefinitionColumnChangeEvents().get(0).getEventTime(), resultBusinessObjectDefinitionColumnEntity.getCreatedBy()))), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnCreateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumnChangeEvent(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Test(org.junit.Test)

Example 18 with BusinessObjectDefinitionColumnEntity

use of org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity in project herd by FINRAOS.

the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnUpperCaseParameters.

@Test
public void testGetBusinessObjectDefinitionColumnUpperCaseParameters() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create and persist a business object definition column.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // Create and persist a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create and persist a schema column for this business object format that is linked with the business object definition column.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
    // Get this business object definition column using upper case parameter values.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), BDEF_COLUMN_NAME.toUpperCase()), false);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Test(org.junit.Test)

Example 19 with BusinessObjectDefinitionColumnEntity

use of org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity in project herd by FINRAOS.

the class BusinessObjectDefinitionColumnServiceTest method testUpdateBusinessObjectDefinitionColumnMissingOptionalParameters.

@Test
public void testUpdateBusinessObjectDefinitionColumnMissingOptionalParameters() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create and persist a business object definition column.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // Create and persist a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create and persist a schema column for this business object format that is linked with the business object definition column.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
    // Update the business object definition column without passing optional parameters.
    BusinessObjectDefinitionColumn updatedBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.updateBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME), new BusinessObjectDefinitionColumnUpdateRequest(NO_BDEF_COLUMN_DESCRIPTION));
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, NO_BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), updatedBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) BusinessObjectDefinitionColumnUpdateRequest(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest) Test(org.junit.Test)

Example 20 with BusinessObjectDefinitionColumnEntity

use of org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity in project herd by FINRAOS.

the class BusinessObjectDefinitionColumnServiceTest method testGetBusinessObjectDefinitionColumnTrimParameters.

@Test
public void testGetBusinessObjectDefinitionColumnTrimParameters() {
    // Create a business object definition column key.
    BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey = new BusinessObjectDefinitionColumnKey(BDEF_NAMESPACE, BDEF_NAME, BDEF_COLUMN_NAME);
    // Create and persist a business object definition column.
    BusinessObjectDefinitionColumnEntity businessObjectDefinitionColumnEntity = businessObjectDefinitionColumnDaoTestHelper.createBusinessObjectDefinitionColumnEntity(businessObjectDefinitionColumnKey, BDEF_COLUMN_DESCRIPTION);
    // Create and persist a business object format entity.
    BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper.createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, LATEST_VERSION_FLAG_SET, PARTITION_KEY);
    // Create and persist a schema column for this business object format that is linked with the business object definition column.
    schemaColumnDaoTestHelper.createSchemaColumnEntity(businessObjectFormatEntity, COLUMN_NAME, businessObjectDefinitionColumnEntity);
    // Get this business object definition column using input parameters with leading and trailing empty spaces.
    BusinessObjectDefinitionColumn resultBusinessObjectDefinitionColumn = businessObjectDefinitionColumnService.getBusinessObjectDefinitionColumn(new BusinessObjectDefinitionColumnKey(addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(BDEF_COLUMN_NAME)), false);
    // Validate the returned object.
    assertEquals(new BusinessObjectDefinitionColumn(businessObjectDefinitionColumnEntity.getId(), businessObjectDefinitionColumnKey, COLUMN_NAME, BDEF_COLUMN_DESCRIPTION, NO_BUSINESS_OBJECT_DEFINITION_COLUMN_CHANGE_EVENTS), resultBusinessObjectDefinitionColumn);
}
Also used : BusinessObjectDefinitionColumnEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity) BusinessObjectDefinitionColumnKey(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey) BusinessObjectDefinitionColumn(org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Test(org.junit.Test)

Aggregations

BusinessObjectDefinitionColumnEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionColumnEntity)29 BusinessObjectDefinitionColumnKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKey)20 Test (org.junit.Test)19 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)18 BusinessObjectDefinitionColumn (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumn)16 BusinessObjectDefinitionColumnUpdateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnUpdateRequest)6 BusinessObjectDefinitionEntity (org.finra.herd.model.jpa.BusinessObjectDefinitionEntity)5 BusinessObjectDefinitionColumnCreateRequest (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnCreateRequest)4 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)3 BusinessObjectDefinitionColumnChangeEvent (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnChangeEvent)3 SchemaColumnEntity (org.finra.herd.model.jpa.SchemaColumnEntity)3 ArrayList (java.util.ArrayList)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)2 Predicate (javax.persistence.criteria.Predicate)2 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)2 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)1 BusinessObjectDefinitionColumnKeys (org.finra.herd.model.api.xml.BusinessObjectDefinitionColumnKeys)1 BusinessObjectDefinitionKey (org.finra.herd.model.api.xml.BusinessObjectDefinitionKey)1 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)1