Search in sources :

Example 21 with BusinessObjectDataAttributeEntity

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

the class BusinessObjectDataDaoImpl method getQueryResultListFromEntityList.

/**
 * Gets a query result list from an entity list.
 *
 * @param entityArray entity array from query
 * @param attributeValueList attribute value list
 *
 * @return the list of business object data
 */
private List<BusinessObjectData> getQueryResultListFromEntityList(List<BusinessObjectDataEntity> entityArray, List<AttributeValueFilter> attributeValueList) {
    List<BusinessObjectData> businessObjectDataList = new ArrayList<>();
    Set<Integer> businessObjectIdSet = new HashSet<>();
    for (BusinessObjectDataEntity dataEntity : entityArray) {
        // need to skip the same data entity
        if (businessObjectIdSet.contains(dataEntity.getId())) {
            continue;
        }
        BusinessObjectData businessObjectData = new BusinessObjectData();
        businessObjectIdSet.add(dataEntity.getId());
        businessObjectData.setId(dataEntity.getId());
        businessObjectData.setPartitionValue(dataEntity.getPartitionValue());
        businessObjectData.setVersion(dataEntity.getVersion());
        businessObjectData.setLatestVersion(dataEntity.getLatestVersion());
        BusinessObjectFormatEntity formatEntity = dataEntity.getBusinessObjectFormat();
        businessObjectData.setNamespace(formatEntity.getBusinessObjectDefinition().getNamespace().getCode());
        businessObjectData.setBusinessObjectDefinitionName(formatEntity.getBusinessObjectDefinition().getName());
        businessObjectData.setBusinessObjectFormatUsage(formatEntity.getUsage());
        businessObjectData.setBusinessObjectFormatFileType(formatEntity.getFileType().getCode());
        businessObjectData.setBusinessObjectFormatVersion(formatEntity.getBusinessObjectFormatVersion());
        businessObjectData.setPartitionKey(formatEntity.getPartitionKey());
        businessObjectData.setStatus(dataEntity.getStatus().getCode());
        List<String> subpartitions = new ArrayList<>();
        if (dataEntity.getPartitionValue2() != null) {
            subpartitions.add(dataEntity.getPartitionValue2());
        }
        if (dataEntity.getPartitionValue3() != null) {
            subpartitions.add(dataEntity.getPartitionValue3());
        }
        if (dataEntity.getPartitionValue4() != null) {
            subpartitions.add(dataEntity.getPartitionValue4());
        }
        if (dataEntity.getPartitionValue5() != null) {
            subpartitions.add(dataEntity.getPartitionValue5());
        }
        if (subpartitions.size() > 0) {
            businessObjectData.setSubPartitionValues(subpartitions);
        }
        // add attribute name and values in the request to the response
        if (attributeValueList != null && !attributeValueList.isEmpty()) {
            Collection<BusinessObjectDataAttributeEntity> dataAttributeCollection = dataEntity.getAttributes();
            List<Attribute> attributeList = new ArrayList<>();
            for (BusinessObjectDataAttributeEntity attributeEntity : dataAttributeCollection) {
                Attribute attribute = new Attribute(attributeEntity.getName(), attributeEntity.getValue());
                if (shouldIncludeAttributeInResponse(attributeEntity, attributeValueList) && !attributeList.contains(attribute)) {
                    attributeList.add(attribute);
                }
            }
            businessObjectData.setAttributes(attributeList);
        }
        businessObjectDataList.add(businessObjectData);
    }
    return businessObjectDataList;
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectData(org.finra.herd.model.api.xml.BusinessObjectData) Attribute(org.finra.herd.model.api.xml.Attribute) SingularAttribute(javax.persistence.metamodel.SingularAttribute) ArrayList(java.util.ArrayList) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) HashSet(java.util.HashSet)

Example 22 with BusinessObjectDataAttributeEntity

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

the class BusinessObjectDataDaoImpl method createAttributeValueFilters.

/**
 * Creates a predicate for attribute value filters.
 *
 * @param businessDataSearchKey business object search key
 * @param businessObjectDataEntity business object data entity
 * @param builder query build
 * @param predicatePram predicate
 *
 * @return the predicate with added attribute value filters
 */
private Predicate createAttributeValueFilters(BusinessObjectDataSearchKey businessDataSearchKey, Root<BusinessObjectDataEntity> businessObjectDataEntity, CriteriaBuilder builder, Predicate predicatePram) {
    Predicate predicate = predicatePram;
    if (businessDataSearchKey.getAttributeValueFilters() != null && !businessDataSearchKey.getAttributeValueFilters().isEmpty()) {
        for (AttributeValueFilter attributeValueFilter : businessDataSearchKey.getAttributeValueFilters()) {
            Join<BusinessObjectDataEntity, BusinessObjectDataAttributeEntity> dataAttributeEntity = businessObjectDataEntity.join(BusinessObjectDataEntity_.attributes);
            String attributeName = attributeValueFilter.getAttributeName();
            String attributeValue = attributeValueFilter.getAttributeValue();
            if (!StringUtils.isEmpty(attributeName)) {
                predicate = builder.and(predicate, builder.equal(builder.upper(dataAttributeEntity.get(BusinessObjectDataAttributeEntity_.name)), attributeName.toUpperCase()));
            }
            if (!StringUtils.isEmpty(attributeValue)) {
                predicate = builder.and(predicate, builder.like(dataAttributeEntity.get(BusinessObjectDataAttributeEntity_.value), "%" + attributeValue + "%"));
            }
        }
    }
    return predicate;
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) AttributeValueFilter(org.finra.herd.model.api.xml.AttributeValueFilter) Predicate(javax.persistence.criteria.Predicate)

Example 23 with BusinessObjectDataAttributeEntity

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

the class CleanupDestroyedBusinessObjectDataServiceImplTest method testCleanupS3StorageUnit.

@Test
public void testCleanupS3StorageUnit() {
    // Create some data for testing the cleanup
    BusinessObjectDataStorageUnitKey businessObjectDataStorageUnitKey = createDatabaseEntitiesForCleanupDestroyedBusinessObjectDataTesting();
    // Get a business object data key.
    BusinessObjectDataKey businessObjectDataKey = businessObjectDataHelper.createBusinessObjectDataKeyFromStorageUnitKey(businessObjectDataStorageUnitKey);
    // Confirm the business object data entity exists.
    BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDao.getBusinessObjectDataByAltKey(businessObjectDataKey);
    assertThat("The business object data entity is null.", businessObjectDataEntity, is(notNullValue()));
    // Confirm the business object data attribute exists.
    BusinessObjectDataAttributeKey businessObjectDataAttributeKey = businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME);
    assertThat("The business object data attribute key is null.", businessObjectDataAttributeKey, is(notNullValue()));
    assertThat("The business object data entity attributes size is not correct.", businessObjectDataEntity.getAttributes().size(), is(equalTo(1)));
    // Confirm the business object data attribute exists.
    BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(businessObjectDataAttributeKey);
    assertThat("The business object data attribute entity is null.", businessObjectDataAttributeEntity, is(notNullValue()));
    // Confirm the storage unity exists.
    StorageUnitEntity storageUnitEntity = storageUnitDaoHelper.getStorageUnitEntityByKey(businessObjectDataStorageUnitKey);
    assertThat("The storage unit entity is null.", storageUnitEntity, is(notNullValue()));
    // Confirm the storage file exists.
    StorageFileEntity storageFileEntity = storageFileDao.getStorageFileByStorageNameAndFilePath(STORAGE_NAME, STORAGE_DIRECTORY_PATH);
    assertThat("The storage file entity is null.", storageFileEntity, is(notNullValue()));
    // Confirm the business object data status history exists.
    Collection<BusinessObjectDataStatusHistoryEntity> businessObjectDataStatusHistoryEntities = businessObjectDataEntity.getHistoricalStatuses();
    assertThat("The business object data status history entities size is not correct.", businessObjectDataStatusHistoryEntities.size(), is(equalTo(1)));
    // Confirm the business object data children
    assertThat("The business object data children size is not correct.", businessObjectDataEntity.getBusinessObjectDataChildren().size(), is(equalTo(1)));
    BusinessObjectDataEntity businessObjectDataEntityChild = businessObjectDataEntity.getBusinessObjectDataChildren().get(0);
    assertThat("The business object data children is not correct.", businessObjectDataEntityChild.getBusinessObjectDataParents().get(0), is(businessObjectDataEntity));
    // Confirm the business object data parents
    assertThat("The business object data parents size is not correct.", businessObjectDataEntity.getBusinessObjectDataParents().size(), is(equalTo(1)));
    assertThat(businessObjectDataEntityChild.getBusinessObjectDataParents().get(0), is(businessObjectDataEntity));
    BusinessObjectDataEntity businessObjectDataEntityParent = businessObjectDataEntity.getBusinessObjectDataParents().get(0);
    assertThat("The business object data parent is not correct.", businessObjectDataEntityParent.getBusinessObjectDataChildren().get(0), is(businessObjectDataEntity));
    // All traces of BData are removed: BData record, Attributes, related Storage Units and Storage Files, Status history, parent-child relationships
    cleanupDestroyedBusinessObjectDataService.cleanupS3StorageUnit(businessObjectDataStorageUnitKey);
    // Verify the business object data has been removed.
    businessObjectDataEntity = businessObjectDataDao.getBusinessObjectDataByAltKey(businessObjectDataKey);
    assertThat("The business object data entity is not null.", businessObjectDataEntity, is(nullValue()));
    // Verify the business object data attribute has been removed.
    businessObjectDataAttributeEntity = businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(businessObjectDataAttributeKey);
    assertThat("The business object data attribute entity is not null.", businessObjectDataAttributeEntity, is(nullValue()));
    // Verify the storage unit has been removed.
    storageUnitEntity = storageUnitDao.getStorageUnitByKey(businessObjectDataStorageUnitKey);
    assertThat("The storage unit entity is not null.", storageUnitEntity, is(nullValue()));
    // Verify the storage file has been removed.
    storageFileEntity = storageFileDao.getStorageFileByStorageNameAndFilePath(STORAGE_NAME, STORAGE_DIRECTORY_PATH);
    assertThat("The storage file entity is not null.", storageFileEntity, is(nullValue()));
    // Verify the business object data children parent relationship has been removed
    businessObjectDataEntityChild = businessObjectDataDaoHelper.getBusinessObjectDataEntity(businessObjectDataHelper.createBusinessObjectDataKeyFromEntity(businessObjectDataEntityChild));
    assertThat("The business object data children size is not correct.", businessObjectDataEntityChild.getBusinessObjectDataParents().size(), is(equalTo(0)));
    // // Verify the business object data parent child relationship has been removed
    businessObjectDataEntityParent = businessObjectDataDaoHelper.getBusinessObjectDataEntity(businessObjectDataHelper.createBusinessObjectDataKeyFromEntity(businessObjectDataEntityParent));
    assertThat("The business object data parents size is not correct.", businessObjectDataEntityParent.getBusinessObjectDataChildren().size(), is(equalTo(0)));
}
Also used : BusinessObjectDataStorageUnitKey(org.finra.herd.model.api.xml.BusinessObjectDataStorageUnitKey) BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectDataStatusHistoryEntity(org.finra.herd.model.jpa.BusinessObjectDataStatusHistoryEntity) StorageFileEntity(org.finra.herd.model.jpa.StorageFileEntity) StorageUnitEntity(org.finra.herd.model.jpa.StorageUnitEntity) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Example 24 with BusinessObjectDataAttributeEntity

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

the class BusinessObjectDataAttributeDaoImpl method getBusinessObjectDataAttributeByKey.

@Override
public BusinessObjectDataAttributeEntity getBusinessObjectDataAttributeByKey(BusinessObjectDataAttributeKey businessObjectDataAttributeKey) {
    // Create the criteria builder and the criteria.
    CriteriaBuilder builder = entityManager.getCriteriaBuilder();
    CriteriaQuery<BusinessObjectDataAttributeEntity> criteria = builder.createQuery(BusinessObjectDataAttributeEntity.class);
    // The criteria root is the business object data attribute.
    Root<BusinessObjectDataAttributeEntity> businessObjectDataAttributeEntityRoot = criteria.from(BusinessObjectDataAttributeEntity.class);
    // Join to the other tables we can filter on.
    Join<BusinessObjectDataAttributeEntity, BusinessObjectDataEntity> businessObjectDataEntityJoin = businessObjectDataAttributeEntityRoot.join(BusinessObjectDataAttributeEntity_.businessObjectData);
    Join<BusinessObjectDataEntity, BusinessObjectFormatEntity> businessObjectFormatEntityJoin = businessObjectDataEntityJoin.join(BusinessObjectDataEntity_.businessObjectFormat);
    Join<BusinessObjectFormatEntity, FileTypeEntity> fileTypeEntityJoin = businessObjectFormatEntityJoin.join(BusinessObjectFormatEntity_.fileType);
    Join<BusinessObjectFormatEntity, BusinessObjectDefinitionEntity> businessObjectDefinitionEntityJoin = businessObjectFormatEntityJoin.join(BusinessObjectFormatEntity_.businessObjectDefinition);
    Join<BusinessObjectDefinitionEntity, NamespaceEntity> namespaceEntityJoin = businessObjectDefinitionEntityJoin.join(BusinessObjectDefinitionEntity_.namespace);
    // Create the standard restrictions (i.e. the standard where clauses).
    List<Predicate> predicates = new ArrayList<>();
    predicates.add(builder.equal(builder.upper(namespaceEntityJoin.get(NamespaceEntity_.code)), businessObjectDataAttributeKey.getNamespace().toUpperCase()));
    predicates.add(builder.equal(builder.upper(businessObjectDefinitionEntityJoin.get(BusinessObjectDefinitionEntity_.name)), businessObjectDataAttributeKey.getBusinessObjectDefinitionName().toUpperCase()));
    predicates.add(builder.equal(builder.upper(businessObjectDefinitionEntityJoin.get(BusinessObjectDefinitionEntity_.name)), businessObjectDataAttributeKey.getBusinessObjectDefinitionName().toUpperCase()));
    predicates.add(builder.equal(builder.upper(businessObjectFormatEntityJoin.get(BusinessObjectFormatEntity_.usage)), businessObjectDataAttributeKey.getBusinessObjectFormatUsage().toUpperCase()));
    predicates.add(builder.equal(builder.upper(fileTypeEntityJoin.get(FileTypeEntity_.code)), businessObjectDataAttributeKey.getBusinessObjectFormatFileType().toUpperCase()));
    predicates.add(builder.equal(businessObjectFormatEntityJoin.get(BusinessObjectFormatEntity_.businessObjectFormatVersion), businessObjectDataAttributeKey.getBusinessObjectFormatVersion()));
    predicates.add(getQueryRestrictionOnPartitionValues(builder, businessObjectDataEntityJoin, businessObjectDataAttributeKey.getPartitionValue(), businessObjectDataAttributeKey.getSubPartitionValues()));
    predicates.add(builder.equal(businessObjectDataEntityJoin.get(BusinessObjectDataEntity_.version), businessObjectDataAttributeKey.getBusinessObjectDataVersion()));
    predicates.add(builder.equal(builder.upper(businessObjectDataAttributeEntityRoot.get(BusinessObjectDataAttributeEntity_.name)), businessObjectDataAttributeKey.getBusinessObjectDataAttributeName().toUpperCase()));
    // Add the clauses for the query.
    criteria.select(businessObjectDataAttributeEntityRoot).where(builder.and(predicates.toArray(new Predicate[predicates.size()])));
    return executeSingleResultQuery(criteria, String.format("Found more than one business object data attribute instance with parameters {namespace=\"%s\", businessObjectDefinitionName=\"%s\"," + " businessObjectFormatUsage=\"%s\", businessObjectFormatFileType=\"%s\", businessObjectFormatVersion=\"%d\"," + " businessObjectDataPartitionValue=\"%s\", businessObjectDataSubPartitionValues=\"%s\", businessObjectDataVersion=\"%d\"," + " businessObjectDataAttributeName=\"%s\"}.", businessObjectDataAttributeKey.getNamespace(), businessObjectDataAttributeKey.getBusinessObjectDefinitionName(), businessObjectDataAttributeKey.getBusinessObjectFormatUsage(), businessObjectDataAttributeKey.getBusinessObjectFormatFileType(), businessObjectDataAttributeKey.getBusinessObjectFormatVersion(), businessObjectDataAttributeKey.getPartitionValue(), CollectionUtils.isEmpty(businessObjectDataAttributeKey.getSubPartitionValues()) ? "" : StringUtils.join(businessObjectDataAttributeKey.getSubPartitionValues(), ","), businessObjectDataAttributeKey.getBusinessObjectDataVersion(), businessObjectDataAttributeKey.getBusinessObjectDataAttributeName()));
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) NamespaceEntity(org.finra.herd.model.jpa.NamespaceEntity) FileTypeEntity(org.finra.herd.model.jpa.FileTypeEntity) ArrayList(java.util.ArrayList) BusinessObjectFormatEntity(org.finra.herd.model.jpa.BusinessObjectFormatEntity) Predicate(javax.persistence.criteria.Predicate) BusinessObjectDefinitionEntity(org.finra.herd.model.jpa.BusinessObjectDefinitionEntity) BusinessObjectDataEntity(org.finra.herd.model.jpa.BusinessObjectDataEntity)

Example 25 with BusinessObjectDataAttributeEntity

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

the class BusinessObjectDataAttributeDaoTest method testGetBusinessObjectDataAttributeByKey.

@Test
public void testGetBusinessObjectDataAttributeByKey() {
    // Create a business object data key.
    BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION);
    // Create a business object data attribute entity.
    BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
    // Get business object data attribute.
    assertEquals(businessObjectDataAttributeEntity, businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    // Get business object data attribute by passing all case-insensitive parameters in uppercase.
    assertEquals(businessObjectDataAttributeEntity, businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toUpperCase())));
    // Get business object data attribute by passing all case-insensitive parameters in lowercase.
    assertEquals(businessObjectDataAttributeEntity, businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE.toLowerCase())));
    // Try invalid values for all input parameters.
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey("I_DO_NOT_EXIST", BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, "I_DO_NOT_EXIST", FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, "I_DO_NOT_EXIST", FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, "I_DO_NOT_EXIST", FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INVALID_FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, "I_DO_NOT_EXIST", SUBPARTITION_VALUES, DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList("I_DO_NOT_EXIST", SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUBPARTITION_VALUES.get(0), "I_DO_NOT_EXIST", SUBPARTITION_VALUES.get(2), SUBPARTITION_VALUES.get(3)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), "I_DO_NOT_EXIST", SUBPARTITION_VALUES.get(3)), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(SUBPARTITION_VALUES.get(0), SUBPARTITION_VALUES.get(1), SUBPARTITION_VALUES.get(2), "I_DO_NOT_EXIST"), DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, INVALID_DATA_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE)));
    assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(new BusinessObjectDataAttributeKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION, "I_DO_NOT_EXIST")));
}
Also used : BusinessObjectDataAttributeEntity(org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity) BusinessObjectDataAttributeKey(org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey) BusinessObjectDataKey(org.finra.herd.model.api.xml.BusinessObjectDataKey) Test(org.junit.Test)

Aggregations

BusinessObjectDataAttributeEntity (org.finra.herd.model.jpa.BusinessObjectDataAttributeEntity)56 Test (org.junit.Test)41 BusinessObjectDataAttribute (org.finra.herd.model.api.xml.BusinessObjectDataAttribute)27 ArrayList (java.util.ArrayList)24 BusinessObjectDataAttributeKey (org.finra.herd.model.api.xml.BusinessObjectDataAttributeKey)23 BusinessObjectDataEntity (org.finra.herd.model.jpa.BusinessObjectDataEntity)23 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)15 HashMap (java.util.HashMap)11 FieldExtension (org.activiti.bpmn.model.FieldExtension)9 Parameter (org.finra.herd.model.api.xml.Parameter)9 Attribute (org.finra.herd.model.api.xml.Attribute)8 BusinessObjectData (org.finra.herd.model.api.xml.BusinessObjectData)8 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)6 AttributeValueFilter (org.finra.herd.model.api.xml.AttributeValueFilter)6 BusinessObjectDataSearchKey (org.finra.herd.model.api.xml.BusinessObjectDataSearchKey)6 BusinessObjectFormatEntity (org.finra.herd.model.jpa.BusinessObjectFormatEntity)6 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)6 BusinessObjectFormatKey (org.finra.herd.model.api.xml.BusinessObjectFormatKey)3 HashSet (java.util.HashSet)2 Predicate (javax.persistence.criteria.Predicate)2