use of org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity in project herd by FINRAOS.
the class BusinessObjectDataAttributeDaoTestHelper method createBusinessObjectDataAttributeEntity.
/**
* Creates and persists a new business object data attribute entity.
*
* @param businessObjectDataEntity the business object data entity
* @param businessObjectDataAttributeName the business object data attribute name
* @param businessObjectDataAttributeValue the business object data attribute value
*
* @return the newly created business object data attribute entity.
*/
public BusinessObjectDataAttributeEntity createBusinessObjectDataAttributeEntity(BusinessObjectDataEntity businessObjectDataEntity, String businessObjectDataAttributeName, String businessObjectDataAttributeValue) {
// Create a new business object data attribute entity.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = new BusinessObjectDataAttributeEntity();
businessObjectDataAttributeEntity.setBusinessObjectData(businessObjectDataEntity);
businessObjectDataAttributeEntity.setName(businessObjectDataAttributeName);
businessObjectDataAttributeEntity.setValue(businessObjectDataAttributeValue);
// Update the parent entity.
businessObjectDataEntity.getAttributes().add(businessObjectDataAttributeEntity);
businessObjectDataAttributeDao.saveAndRefresh(businessObjectDataEntity);
return businessObjectDataAttributeEntity;
}
use of org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithAttributeValueFiltersWithNoAttributeValueFilter.
@Test
public void testBusinessObjectDataSearchWithAttributeValueFiltersWithNoAttributeValueFilter() {
// Create and persist an attribute for the business object data
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataAttributeEntity.getBusinessObjectData();
String namespace = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode();
String bDefName = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName();
String usage = businessObjectDataEntity.getBusinessObjectFormat().getUsage();
String fileTypeCode = businessObjectDataEntity.getBusinessObjectFormat().getFileType().getCode();
int formatVersion = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion();
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
businessObjectDataSearchKey.setNamespace(namespace);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(bDefName);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(usage);
businessObjectDataSearchKey.setBusinessObjectFormatFileType(fileTypeCode);
businessObjectDataSearchKey.setBusinessObjectFormatVersion(formatVersion);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(1, result.size());
for (BusinessObjectData data : result) {
assertEquals(NAMESPACE, data.getNamespace());
assertEquals(BDEF_NAME, data.getBusinessObjectDefinitionName());
assertEquals(FORMAT_USAGE_CODE, data.getBusinessObjectFormatUsage());
assertEquals(FORMAT_FILE_TYPE_CODE, data.getBusinessObjectFormatFileType());
assertTrue(FORMAT_VERSION == data.getBusinessObjectFormatVersion());
assertNull(data.getAttributes());
}
}
use of org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity in project herd by FINRAOS.
the class BusinessObjectDataDaoTest method testBusinessObjectDataSearchWithAttributeValueFilters.
@Test
public void testBusinessObjectDataSearchWithAttributeValueFilters() {
// Create and persist an attribute for the business object data
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_2_MIXED_CASE, ATTRIBUTE_VALUE_2);
businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION_2, PARTITION_VALUE, null, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataAttributeEntity.getBusinessObjectData();
String namespace = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode();
String bDefName = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName();
String usage = businessObjectDataEntity.getBusinessObjectFormat().getUsage();
String fileTypeCode = businessObjectDataEntity.getBusinessObjectFormat().getFileType().getCode();
int formatVersion = businessObjectDataEntity.getBusinessObjectFormat().getBusinessObjectFormatVersion();
BusinessObjectDataSearchKey businessObjectDataSearchKey = new BusinessObjectDataSearchKey();
List<AttributeValueFilter> attributeValueFilters = new ArrayList<>();
attributeValueFilters.add(new AttributeValueFilter(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1));
businessObjectDataSearchKey.setAttributeValueFilters(attributeValueFilters);
businessObjectDataSearchKey.setNamespace(namespace);
businessObjectDataSearchKey.setBusinessObjectDefinitionName(bDefName);
businessObjectDataSearchKey.setBusinessObjectFormatUsage(usage);
businessObjectDataSearchKey.setBusinessObjectFormatFileType(fileTypeCode);
businessObjectDataSearchKey.setBusinessObjectFormatVersion(formatVersion);
List<BusinessObjectData> result = businessObjectDataDao.searchBusinessObjectData(businessObjectDataSearchKey, DEFAULT_PAGE_NUMBER, DEFAULT_PAGE_SIZE);
assertEquals(1, result.size());
for (BusinessObjectData data : result) {
assertEquals(NAMESPACE, data.getNamespace());
assertEquals(BDEF_NAME, data.getBusinessObjectDefinitionName());
assertEquals(FORMAT_USAGE_CODE, data.getBusinessObjectFormatUsage());
assertEquals(FORMAT_FILE_TYPE_CODE, data.getBusinessObjectFormatFileType());
assertTrue(FORMAT_VERSION == data.getBusinessObjectFormatVersion());
assertEquals(ATTRIBUTE_NAME_1_MIXED_CASE, data.getAttributes().get(0).getName());
assertEquals(ATTRIBUTE_VALUE_1, data.getAttributes().get(0).getValue());
}
}
use of org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity in project herd by FINRAOS.
the class BusinessObjectDataAttributeServiceImpl method createBusinessObjectDataAttributeEntity.
/**
* Creates a new business object data attribute entity from the business object data entity and the request information.
*
* @param businessObjectDataEntity the business object data entity
* @param request the business object data attribute create request
*
* @return the newly created business object data attribute entity
*/
private BusinessObjectDataAttributeEntity createBusinessObjectDataAttributeEntity(BusinessObjectDataEntity businessObjectDataEntity, BusinessObjectDataAttributeCreateRequest request) {
// Create a new entity.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = new BusinessObjectDataAttributeEntity();
businessObjectDataAttributeEntity.setBusinessObjectData(businessObjectDataEntity);
businessObjectDataAttributeEntity.setName(request.getBusinessObjectDataAttributeKey().getBusinessObjectDataAttributeName());
businessObjectDataAttributeEntity.setValue(request.getBusinessObjectDataAttributeValue());
return businessObjectDataAttributeEntity;
}
use of org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity in project herd by FINRAOS.
the class BusinessObjectDataAttributeServiceImpl method getBusinessObjectDataAttributeImpl.
/**
* Gets an existing business object data attribute by key.
*
* @param businessObjectDataAttributeKey the business object data attribute key
*
* @return the business object data attribute information
*/
protected BusinessObjectDataAttribute getBusinessObjectDataAttributeImpl(BusinessObjectDataAttributeKey businessObjectDataAttributeKey) {
// Validate and trim the key.
businessObjectDataAttributeHelper.validateBusinessObjectDataAttributeKey(businessObjectDataAttributeKey);
// Retrieve and ensure that a business object data attribute exists with the specified key.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoHelper.getBusinessObjectDataAttributeEntity(businessObjectDataAttributeKey);
// Create and return the business object data attribute object from the persisted entity.
return createBusinessObjectDataAttributeFromEntity(businessObjectDataAttributeEntity);
}
Aggregations