fields,
- @RequestBody BusinessObjectDefinitionIndexSearchRequest request)
- {
- return businessObjectDefinitionService.indexSearchBusinessObjectDefinitions(request, fields);
- }
-
}
diff --git a/herd-code/herd-rest/src/main/java/org/finra/herd/rest/BusinessObjectFormatRestController.java b/herd-code/herd-rest/src/main/java/org/finra/herd/rest/BusinessObjectFormatRestController.java
index 724763f77e..7c905d223d 100755
--- a/herd-code/herd-rest/src/main/java/org/finra/herd/rest/BusinessObjectFormatRestController.java
+++ b/herd-code/herd-rest/src/main/java/org/finra/herd/rest/BusinessObjectFormatRestController.java
@@ -39,6 +39,7 @@
import org.finra.herd.model.api.xml.BusinessObjectFormatKeys;
import org.finra.herd.model.api.xml.BusinessObjectFormatParentsUpdateRequest;
import org.finra.herd.model.api.xml.BusinessObjectFormatRetentionInformationUpdateRequest;
+import org.finra.herd.model.api.xml.BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest;
import org.finra.herd.model.api.xml.BusinessObjectFormatUpdateRequest;
import org.finra.herd.model.dto.SecurityFunctions;
import org.finra.herd.service.BusinessObjectFormatService;
@@ -330,4 +331,31 @@ public BusinessObjectFormat updateBusinessObjectFormatRetentionInformation(@Path
new BusinessObjectFormatKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, null);
return businessObjectFormatService.updateBusinessObjectFormatRetentionInformation(businessObjectFormatKey, request);
}
+
+ /**
+ * Updates an existing Business Object Format to allow non-backwards compatibility changes to the format schema based on the
+ * 'allowNonBackwardsCompatibleChanges' flag. Requires WRITE permission on namespace
+ *
+ * @param namespace the namespace code
+ * @param businessObjectDefinitionName the business object definition name
+ * @param businessObjectFormatUsage the business object format usage
+ * @param businessObjectFormatFileType the business object format file type
+ * @param request the information needed to update the business object format to allow non-backwards compatibility changes to the format schema
+ *
+ * @return the updated business object format.
+ */
+ @RequestMapping(value = "/businessObjectFormatSchemaBackwardsCompatibility/namespaces/{namespace}/businessObjectDefinitionNames/" +
+ "{businessObjectDefinitionName}/businessObjectFormatUsages/{businessObjectFormatUsage}/businessObjectFormatFileTypes/{businessObjectFormatFileType}",
+ method = RequestMethod.PUT, consumes = {"application/xml", "application/json"})
+ @Secured(SecurityFunctions.FN_BUSINESS_OBJECT_FORMAT_SCHEMA_BACKWARDS_COMPATIBILITY_PUT)
+ public BusinessObjectFormat updateBusinessObjectFormatSchemaBackwardsCompatibleChanges(@PathVariable("namespace") String namespace,
+ @PathVariable("businessObjectDefinitionName") String businessObjectDefinitionName,
+ @PathVariable("businessObjectFormatUsage") String businessObjectFormatUsage,
+ @PathVariable("businessObjectFormatFileType") String businessObjectFormatFileType,
+ @RequestBody BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest request)
+ {
+ BusinessObjectFormatKey businessObjectFormatKey =
+ new BusinessObjectFormatKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, null);
+ return businessObjectFormatService.updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(businessObjectFormatKey, request);
+ }
}
diff --git a/herd-code/herd-rest/src/test/java/org/finra/herd/rest/BusinessObjectDefinitionRestControllerIndexTest.java b/herd-code/herd-rest/src/test/java/org/finra/herd/rest/BusinessObjectDefinitionRestControllerIndexTest.java
deleted file mode 100755
index d6fb0dc9a3..0000000000
--- a/herd-code/herd-rest/src/test/java/org/finra/herd/rest/BusinessObjectDefinitionRestControllerIndexTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-* Copyright 2015 herd contributors
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.finra.herd.rest;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import org.finra.herd.model.api.xml.BusinessObjectDefinition;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionIndexSearchRequest;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionIndexSearchResponse;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchKey;
-import org.finra.herd.model.api.xml.Facet;
-import org.finra.herd.model.api.xml.TagKey;
-import org.finra.herd.model.dto.FacetTypeEnum;
-import org.finra.herd.model.dto.TagIndexSearchResponseDto;
-import org.finra.herd.model.dto.TagTypeIndexSearchResponseDto;
-import org.finra.herd.model.jpa.BusinessObjectDefinitionEntity;
-import org.finra.herd.service.BusinessObjectDefinitionService;
-
-/**
- * This class tests search index functionality within the business object definition REST controller. This separate test class was created because this one uses
- * a mock business object definition service.
- */
-public class BusinessObjectDefinitionRestControllerIndexTest extends AbstractRestTest
-{
- @InjectMocks
- private BusinessObjectDefinitionRestController businessObjectDefinitionRestController;
-
- @Mock
- private BusinessObjectDefinitionService businessObjectDefinitionService;
-
- @Before
- public void before()
- {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testIndexSearchBusinessObjectDefinitions()
- {
- // Create a new tag key with a tag type and a tag code
- TagKey tagKey = new TagKey(TAG_TYPE, TAG_CODE);
-
- // Create a new business object definition search key for use in the business object definition search key list
- BusinessObjectDefinitionSearchKey businessObjectDefinitionSearchKey = new BusinessObjectDefinitionSearchKey(tagKey, INCLUDE_TAG_HIERARCHY);
-
- // Create a new business object definition search key list with the tag key and the include tag hierarchy boolean flag
- List businessObjectDefinitionSearchKeyList = new ArrayList<>();
- businessObjectDefinitionSearchKeyList.add(businessObjectDefinitionSearchKey);
-
- // Create a new business object definition search filter list with the new business object definition search key list
- List businessObjectDefinitionSearchFilterList = new ArrayList<>();
- businessObjectDefinitionSearchFilterList.add(new BusinessObjectDefinitionSearchFilter(false, businessObjectDefinitionSearchKeyList));
-
-
- //Create a list of facet fields
- List facetFields = new ArrayList<>();
- facetFields.add("Invalid");
- // Create a new business object definition search request that will be used when testing the index search business object definitions method
- BusinessObjectDefinitionIndexSearchRequest businessObjectDefinitionSearchRequest =
- new BusinessObjectDefinitionIndexSearchRequest(businessObjectDefinitionSearchFilterList, facetFields);
-
- // Create a new fields set that will be used when testing the index search business object definitions method
- Set fields = Sets.newHashSet(FIELD_DATA_PROVIDER_NAME, FIELD_DISPLAY_NAME, FIELD_SHORT_DESCRIPTION);
-
- // Create a business object definition entity list to return from the search business object definitions by tags function
- List businessObjectDefinitionEntityList = new ArrayList<>();
- businessObjectDefinitionEntityList.add(businessObjectDefinitionDaoTestHelper
- .createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION,
- businessObjectDefinitionServiceTestHelper.getNewAttributes()));
- businessObjectDefinitionEntityList.add(businessObjectDefinitionDaoTestHelper
- .createBusinessObjectDefinitionEntity(NAMESPACE, BDEF_NAME_2, DATA_PROVIDER_NAME_2, BDEF_DESCRIPTION_2,
- businessObjectDefinitionServiceTestHelper.getNewAttributes()));
-
- // Create a list to hold the business object definitions that will be returned as part of the search response
- List businessObjectDefinitions = new ArrayList<>();
-
- // Retrieve all unique business object definition entities and construct a list of business object definitions based on the requested fields.
- for (BusinessObjectDefinitionEntity businessObjectDefinitionEntity : ImmutableSet.copyOf(businessObjectDefinitionEntityList))
- {
- // Convert the business object definition entity to a business object definition and add it to the list of business object definitions that will be
- // returned as a part of the search response
- BusinessObjectDefinition businessObjectDefinition = new BusinessObjectDefinition();
-
- // Populate the business object definition
- businessObjectDefinition.setNamespace(businessObjectDefinitionEntity.getNamespace().getCode());
- businessObjectDefinition.setBusinessObjectDefinitionName(businessObjectDefinitionEntity.getName());
- businessObjectDefinition.setDataProviderName(businessObjectDefinitionEntity.getDataProvider().getName());
- businessObjectDefinition.setShortDescription(StringUtils.left(businessObjectDefinitionEntity.getDescription(), SHORT_DESCRIPTION_LENGTH));
- businessObjectDefinition.setDisplayName(businessObjectDefinitionEntity.getDisplayName());
- businessObjectDefinitions.add(businessObjectDefinition);
- }
-
- List tagTypeIndexSearchResponseDtos = new ArrayList<>();
- List tagIndexSearchResponseDtos = new ArrayList<>();
- tagIndexSearchResponseDtos.add(new TagIndexSearchResponseDto(TAG_CODE, TAG_COUNT, TAG_DISPLAY_NAME));
- tagIndexSearchResponseDtos.add(new TagIndexSearchResponseDto(TAG_CODE_2, TAG_COUNT, TAG_DISPLAY_NAME_2));
- TagTypeIndexSearchResponseDto tagTypeIndexSearchResponseDto =
- new TagTypeIndexSearchResponseDto(TAG_TYPE, tagIndexSearchResponseDtos, TAG_TYPE_DISPLAY_NAME);
- tagTypeIndexSearchResponseDtos.add(tagTypeIndexSearchResponseDto);
-
- List tagTypeFacets = new ArrayList<>();
- for (TagTypeIndexSearchResponseDto tagTypeIndexSearchResponse : ImmutableSet.copyOf(tagTypeIndexSearchResponseDtos))
- {
-
- List tagFacets = new ArrayList<>();
-
- for (TagIndexSearchResponseDto tagIndexSearchResponseDto : tagTypeIndexSearchResponse.getTagIndexSearchResponseDtos())
- {
- Facet tagFacet = new Facet(tagIndexSearchResponseDto.getTagDisplayName(), tagIndexSearchResponseDto.getCount(), FacetTypeEnum.TAG.value(),
- tagIndexSearchResponseDto.getTagCode(), null);
- tagFacets.add(tagFacet);
- }
-
- tagTypeFacets.add(new Facet(tagTypeIndexSearchResponse.getDisplayName(), null, FacetTypeEnum.TAG_TYPE.value(),
- tagTypeIndexSearchResponse.getCode(), tagFacets));
- }
-
- // Construct business object search response.
- BusinessObjectDefinitionIndexSearchResponse businessObjectDefinitionSearchResponse = new BusinessObjectDefinitionIndexSearchResponse();
- businessObjectDefinitionSearchResponse.setBusinessObjectDefinitions(businessObjectDefinitions);
- businessObjectDefinitionSearchResponse.setFacets(tagTypeFacets);
-
- // Mock the call to the business object definition service
- when(businessObjectDefinitionService.indexSearchBusinessObjectDefinitions(businessObjectDefinitionSearchRequest, fields))
- .thenReturn(businessObjectDefinitionSearchResponse);
-
- // Create a business object definition.
- BusinessObjectDefinitionIndexSearchResponse businessObjectDefinitionSearchResponseFromRestCall =
- businessObjectDefinitionRestController.indexSearchBusinessObjectDefinitions(fields, businessObjectDefinitionSearchRequest);
-
- // Verify the method call to businessObjectDefinitionService.indexAllBusinessObjectDefinitions()
- verify(businessObjectDefinitionService, times(1)).indexSearchBusinessObjectDefinitions(businessObjectDefinitionSearchRequest, fields);
-
- // Validate the returned object.
- assertThat("Business object definition index search response was null.", businessObjectDefinitionSearchResponseFromRestCall, not(nullValue()));
- assertThat("Business object definition index search response was not correct.", businessObjectDefinitionSearchResponseFromRestCall,
- is(businessObjectDefinitionSearchResponse));
- assertThat("Business object definition index search response was not an instance of BusinessObjectDefinitionSearchResponse.class.",
- businessObjectDefinitionSearchResponseFromRestCall, instanceOf(BusinessObjectDefinitionIndexSearchResponse.class));
- }
-}
diff --git a/herd-code/herd-rest/src/test/java/org/finra/herd/rest/BusinessObjectFormatRestControllerTest.java b/herd-code/herd-rest/src/test/java/org/finra/herd/rest/BusinessObjectFormatRestControllerTest.java
index 4246a14e6e..f29c8ede45 100755
--- a/herd-code/herd-rest/src/test/java/org/finra/herd/rest/BusinessObjectFormatRestControllerTest.java
+++ b/herd-code/herd-rest/src/test/java/org/finra/herd/rest/BusinessObjectFormatRestControllerTest.java
@@ -44,6 +44,7 @@
import org.finra.herd.model.api.xml.BusinessObjectFormatKeys;
import org.finra.herd.model.api.xml.BusinessObjectFormatParentsUpdateRequest;
import org.finra.herd.model.api.xml.BusinessObjectFormatRetentionInformationUpdateRequest;
+import org.finra.herd.model.api.xml.BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest;
import org.finra.herd.model.api.xml.BusinessObjectFormatUpdateRequest;
import org.finra.herd.model.jpa.FileTypeEntity;
import org.finra.herd.model.jpa.RetentionTypeEntity;
@@ -81,7 +82,8 @@ public void testCreateBusinessObjectFormat()
BusinessObjectFormat businessObjectFormat =
new BusinessObjectFormat(ID, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, 0, true, PARTITION_KEY, FORMAT_DESCRIPTION,
businessObjectDefinitionServiceTestHelper.getNewAttributes(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(),
- businessObjectFormatServiceTestHelper.getTestSchema(), null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE);
+ businessObjectFormatServiceTestHelper.getTestSchema(), null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE,
+ NO_ALLOW_NON_BACKWARDS_COMPATIBLE_CHANGES_SET);
when(businessObjectFormatService.createBusinessObjectFormat(request)).thenReturn(businessObjectFormat);
BusinessObjectFormat resultBusinessObjectFormat = businessObjectFormatRestController.createBusinessObjectFormat(request);
@@ -99,7 +101,8 @@ public void testDeleteBusinessObjectFormat() throws Exception
BusinessObjectFormat businessObjectFormat =
new BusinessObjectFormat(ID, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, true, PARTITION_KEY,
FORMAT_DESCRIPTION, NO_ATTRIBUTES, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(),
- businessObjectFormatServiceTestHelper.getTestSchema(), null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE);
+ businessObjectFormatServiceTestHelper.getTestSchema(), null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE,
+ NO_ALLOW_NON_BACKWARDS_COMPATIBLE_CHANGES_SET);
BusinessObjectFormatKey businessObjectFormatKey =
new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION);
@@ -171,7 +174,8 @@ public void testGetBusinessObjectFormat()
BusinessObjectFormat businessObjectFormat =
new BusinessObjectFormat(ID, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, true, PARTITION_KEY,
FORMAT_DESCRIPTION, NO_ATTRIBUTES, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(),
- businessObjectFormatServiceTestHelper.getTestSchema(), null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE);
+ businessObjectFormatServiceTestHelper.getTestSchema(), null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE,
+ NO_ALLOW_NON_BACKWARDS_COMPATIBLE_CHANGES_SET);
BusinessObjectFormatKey businessObjectFormatKey =
new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION);
@@ -235,7 +239,7 @@ public void testUpdateBusinessObjectFormat()
BusinessObjectFormat businessObjectFormat =
new BusinessObjectFormat(ID, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, 1, true, PARTITION_KEY, FORMAT_DESCRIPTION_2,
NO_ATTRIBUTES, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema2(),
- null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE);
+ null, null, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE, NO_ALLOW_NON_BACKWARDS_COMPATIBLE_CHANGES_SET);
BusinessObjectFormatKey businessObjectFormatKey =
new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION);
@@ -350,4 +354,27 @@ public void testUpdateBusinessObjectFormatRetentionInformation()
// Validate the returned object.
assertEquals(businessObjectFormat, updatedBusinessObjectFormat);
}
+
+ @Test
+ public void testUpdateBusinessObjectFormatSchemaCompatibleChanges()
+ {
+ BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null);
+ BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest updateRequest = new BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest();
+ updateRequest.setAllowNonBackwardsCompatibleChanges(true);
+
+ BusinessObjectFormat businessObjectFormat = new BusinessObjectFormat();
+ when(businessObjectFormatService.updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(businessObjectFormatKey, updateRequest))
+ .thenReturn(businessObjectFormat);
+
+ BusinessObjectFormat updatedBusinessObjectFormat = businessObjectFormatRestController
+ .updateBusinessObjectFormatSchemaBackwardsCompatibleChanges(businessObjectFormatKey.getNamespace(),
+ businessObjectFormatKey.getBusinessObjectDefinitionName(), businessObjectFormatKey.getBusinessObjectFormatUsage(),
+ businessObjectFormatKey.getBusinessObjectFormatFileType(), updateRequest);
+
+ // Verify the external calls.
+ verify(businessObjectFormatService).updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(businessObjectFormatKey, updateRequest);
+ verifyNoMoreInteractions(businessObjectFormatService);
+ // Validate the returned object.
+ assertEquals(businessObjectFormat, updatedBusinessObjectFormat);
+ }
}
diff --git a/herd-code/herd-sdk/pom.xml b/herd-code/herd-sdk/pom.xml
index 606972900e..a39fc5f310 100644
--- a/herd-code/herd-sdk/pom.xml
+++ b/herd-code/herd-sdk/pom.xml
@@ -21,7 +21,7 @@
org.finra.herd
herd-code
- 0.70.0-SNAPSHOT
+ 0.71.0-SNAPSHOT
diff --git a/herd-code/herd-service/pom.xml b/herd-code/herd-service/pom.xml
index bf67e41998..49f474962a 100755
--- a/herd-code/herd-service/pom.xml
+++ b/herd-code/herd-service/pom.xml
@@ -21,7 +21,7 @@
org.finra.herd
herd-code
- 0.70.0-SNAPSHOT
+ 0.71.0-SNAPSHOT
herd service
diff --git a/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectDefinitionService.java b/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectDefinitionService.java
index 1214341586..655a848eb3 100755
--- a/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectDefinitionService.java
+++ b/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectDefinitionService.java
@@ -21,8 +21,6 @@
import org.finra.herd.model.api.xml.BusinessObjectDefinition;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionCreateRequest;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionDescriptiveInformationUpdateRequest;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionIndexSearchRequest;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionIndexSearchResponse;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionKey;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionKeys;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchRequest;
@@ -138,14 +136,6 @@ public BusinessObjectDefinition getBusinessObjectDefinition(BusinessObjectDefini
public BusinessObjectDefinitionSearchResponse searchBusinessObjectDefinitions(BusinessObjectDefinitionSearchRequest businessObjectDefinitionSearchRequest,
Set fields);
- /**
- * Searches across all business object definitions that are in search index per specified search filters and keys
- *
- * @return the retrieved business object definition list
- */
- public BusinessObjectDefinitionIndexSearchResponse indexSearchBusinessObjectDefinitions(
- BusinessObjectDefinitionIndexSearchRequest businessObjectDefinitionIndexSearchRequest, Set fields);
-
/**
* Update business object definition sample file
*
diff --git a/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectFormatService.java b/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectFormatService.java
index 5e13aa1c9f..bacfa11015 100755
--- a/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectFormatService.java
+++ b/herd-code/herd-service/src/main/java/org/finra/herd/service/BusinessObjectFormatService.java
@@ -28,6 +28,7 @@
import org.finra.herd.model.api.xml.BusinessObjectFormatKeys;
import org.finra.herd.model.api.xml.BusinessObjectFormatParentsUpdateRequest;
import org.finra.herd.model.api.xml.BusinessObjectFormatRetentionInformationUpdateRequest;
+import org.finra.herd.model.api.xml.BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest;
import org.finra.herd.model.api.xml.BusinessObjectFormatUpdateRequest;
/**
@@ -151,11 +152,24 @@ public BusinessObjectFormat updateBusinessObjectFormatAttributeDefinitions(Busin
BusinessObjectFormatAttributeDefinitionsUpdateRequest businessObjectFormatAttributeDefinitionsUpdateRequest);
/**
- * Update business object format retention information
+ * Updates business object format retention information
+ *
* @param businessObjectFormatKey the business object format alternate key
* @param businessObjectFormatRetentionInformationUpdateRequest business object format retention information update request
+ *
* @return updated business object format
*/
public BusinessObjectFormat updateBusinessObjectFormatRetentionInformation(BusinessObjectFormatKey businessObjectFormatKey,
BusinessObjectFormatRetentionInformationUpdateRequest businessObjectFormatRetentionInformationUpdateRequest);
+
+ /**
+ * Updates business object format schema backwards compatible changes
+ *
+ * @param businessObjectFormatKey the business object format alternate key
+ * @param businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest business object format schema backwards compatible changes update request
+ *
+ * @return updated business object format
+ */
+ public BusinessObjectFormat updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(BusinessObjectFormatKey businessObjectFormatKey,
+ BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest);
}
diff --git a/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/BusinessObjectFormatHelper.java b/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/BusinessObjectFormatHelper.java
index d7f9aaa635..9c9af06cb7 100755
--- a/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/BusinessObjectFormatHelper.java
+++ b/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/BusinessObjectFormatHelper.java
@@ -239,6 +239,9 @@ public BusinessObjectFormat createBusinessObjectFormatFromEntity(BusinessObject
businessObjectFormat.setRetentionType(latestVersionBusinessObjectFormatEntity.getRetentionType().getCode());
}
+ // Add business object format schema backwards compatibility changes flag.
+ businessObjectFormat.setAllowNonBackwardsCompatibleChanges(latestVersionBusinessObjectFormatEntity.isAllowNonBackwardsCompatibleChanges());
+
return businessObjectFormat;
}
diff --git a/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/EmrClusterDefinitionDaoHelper.java b/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/EmrClusterDefinitionDaoHelper.java
index 440fdd2fe7..c426e8ef82 100755
--- a/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/EmrClusterDefinitionDaoHelper.java
+++ b/herd-code/herd-service/src/main/java/org/finra/herd/service/helper/EmrClusterDefinitionDaoHelper.java
@@ -15,13 +15,18 @@
*/
package org.finra.herd.service.helper;
+import java.util.List;
+
+import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.finra.herd.dao.EmrClusterDefinitionDao;
+import org.finra.herd.dao.NamespaceDao;
import org.finra.herd.model.ObjectNotFoundException;
import org.finra.herd.model.api.xml.EmrClusterDefinitionKey;
import org.finra.herd.model.jpa.EmrClusterDefinitionEntity;
+import org.finra.herd.model.jpa.NamespaceEntity;
/**
* Helper for EMR cluster definition related operations which require DAO.
@@ -32,37 +37,62 @@ public class EmrClusterDefinitionDaoHelper
@Autowired
private EmrClusterDefinitionDao emrClusterDefinitionDao;
+ @Autowired
+ private NamespaceDao namespaceDao;
+
/**
- * Gets an EMR cluster definition entity based on the key and makes sure that it exists.
+ * Retrieves an EMR cluster definition entity based on the EMR cluster definition key and makes sure that it exists.
*
* @param emrClusterDefinitionKey the EMR cluster definition key
*
* @return the EMR cluster definition entity
- * @throws ObjectNotFoundException if the EMR cluster definition entity doesn't exist
+ * @throws ObjectNotFoundException if EMR cluster definition entity doesn't exist
*/
public EmrClusterDefinitionEntity getEmrClusterDefinitionEntity(EmrClusterDefinitionKey emrClusterDefinitionKey) throws ObjectNotFoundException
{
- return getEmrClusterDefinitionEntity(emrClusterDefinitionKey.getNamespace(), emrClusterDefinitionKey.getEmrClusterDefinitionName());
+ EmrClusterDefinitionEntity emrClusterDefinitionEntity = null;
+
+ // Try to retrieve the relative namespace entity.
+ NamespaceEntity namespaceEntity = namespaceDao.getNamespaceByCd(emrClusterDefinitionKey.getNamespace());
+
+ // If namespace entity exists, try to retrieve EMR cluster definition entity by namespace entity and EMR cluster definition name.
+ if (namespaceEntity != null)
+ {
+ emrClusterDefinitionEntity =
+ emrClusterDefinitionDao.getEmrClusterDefinitionByNamespaceAndName(namespaceEntity, emrClusterDefinitionKey.getEmrClusterDefinitionName());
+ }
+
+ // Throw an exception if EMR cluster definition entity does not exist.
+ if (emrClusterDefinitionEntity == null)
+ {
+ throw new ObjectNotFoundException(String
+ .format("EMR cluster definition with name \"%s\" doesn't exist for namespace \"%s\".", emrClusterDefinitionKey.getEmrClusterDefinitionName(),
+ emrClusterDefinitionKey.getNamespace()));
+ }
+
+ return emrClusterDefinitionEntity;
}
/**
- * Gets an EMR cluster definition entity based on the namespace and cluster definition name and makes sure that it exists.
+ * Gets a list of keys for all EMR cluster definitions defined in the system for the specified namespace.
*
- * @param namespace the namespace
- * @param clusterDefinitionName the cluster definition name
+ * @param namespace the namespace (case-insensitive)
*
- * @return the EMR cluster definition entity
- * @throws ObjectNotFoundException if the EMR cluster definition entity doesn't exist
+ * @return the list of EMR cluster definition keys
*/
- public EmrClusterDefinitionEntity getEmrClusterDefinitionEntity(String namespace, String clusterDefinitionName) throws ObjectNotFoundException
+ public List getEmrClusterDefinitionKeys(String namespace)
{
- // Get the EMR cluster definition and ensure it exists.
- EmrClusterDefinitionEntity emrClusterDefinitionEntity = emrClusterDefinitionDao.getEmrClusterDefinitionByAltKey(namespace, clusterDefinitionName);
- if (emrClusterDefinitionEntity == null)
+ // Try to retrieve the relative namespace entity.
+ NamespaceEntity namespaceEntity = namespaceDao.getNamespaceByCd(namespace);
+
+ // If namespace entity exists, retrieve EMR cluster definition keys by namespace entity.
+ if (namespaceEntity != null)
{
- throw new ObjectNotFoundException("EMR cluster definition with name \"" + clusterDefinitionName + "\" doesn't exist for namespace \"" +
- namespace + "\".");
+ return emrClusterDefinitionDao.getEmrClusterDefinitionKeysByNamespace(namespaceEntity);
+ }
+ else
+ {
+ return Lists.newArrayList();
}
- return emrClusterDefinitionEntity;
}
}
diff --git a/herd-code/herd-service/src/main/java/org/finra/herd/service/impl/BusinessObjectDefinitionServiceImpl.java b/herd-code/herd-service/src/main/java/org/finra/herd/service/impl/BusinessObjectDefinitionServiceImpl.java
index 5e0f460cc9..b7b4ddd136 100755
--- a/herd-code/herd-service/src/main/java/org/finra/herd/service/impl/BusinessObjectDefinitionServiceImpl.java
+++ b/herd-code/herd-service/src/main/java/org/finra/herd/service/impl/BusinessObjectDefinitionServiceImpl.java
@@ -23,7 +23,6 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -48,17 +47,15 @@
import org.finra.herd.core.HerdStringUtils;
import org.finra.herd.core.helper.ConfigurationHelper;
import org.finra.herd.dao.BusinessObjectDefinitionDao;
-import org.finra.herd.dao.BusinessObjectDefinitionIndexSearchDao;
import org.finra.herd.dao.IndexFunctionsDao;
import org.finra.herd.dao.config.DaoSpringModuleConfig;
+import org.finra.herd.dao.helper.TagDaoHelper;
import org.finra.herd.model.annotation.NamespacePermission;
import org.finra.herd.model.api.xml.Attribute;
import org.finra.herd.model.api.xml.BusinessObjectDefinition;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionChangeEvent;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionCreateRequest;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionDescriptiveInformationUpdateRequest;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionIndexSearchRequest;
-import org.finra.herd.model.api.xml.BusinessObjectDefinitionIndexSearchResponse;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionKey;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionKeys;
import org.finra.herd.model.api.xml.BusinessObjectDefinitionSearchFilter;
@@ -69,23 +66,15 @@
import org.finra.herd.model.api.xml.BusinessObjectFormatKey;
import org.finra.herd.model.api.xml.DescriptiveBusinessObjectFormat;
import org.finra.herd.model.api.xml.DescriptiveBusinessObjectFormatUpdateRequest;
-import org.finra.herd.model.api.xml.Facet;
import org.finra.herd.model.api.xml.NamespacePermissionEnum;
import org.finra.herd.model.api.xml.SampleDataFile;
-import org.finra.herd.model.dto.BusinessObjectDefinitionIndexSearchResponseDto;
import org.finra.herd.model.dto.BusinessObjectDefinitionSampleFileUpdateDto;
import org.finra.herd.model.dto.ConfigurationValue;
-import org.finra.herd.model.dto.ElasticsearchResponseDto;
-import org.finra.herd.model.dto.FacetTypeEnum;
-import org.finra.herd.model.dto.SearchFilterType;
import org.finra.herd.model.dto.SearchIndexUpdateDto;
-import org.finra.herd.model.dto.TagIndexSearchResponseDto;
-import org.finra.herd.model.dto.TagTypeIndexSearchResponseDto;
import org.finra.herd.model.jpa.BusinessObjectDefinitionAttributeEntity;
import org.finra.herd.model.jpa.BusinessObjectDefinitionEntity;
import org.finra.herd.model.jpa.BusinessObjectDefinitionSampleDataFileEntity;
import org.finra.herd.model.jpa.BusinessObjectFormatEntity;
-import org.finra.herd.model.jpa.SearchIndexTypeEntity;
import org.finra.herd.model.jpa.StorageEntity;
import org.finra.herd.model.jpa.TagEntity;
import org.finra.herd.service.BusinessObjectDefinitionService;
@@ -96,10 +85,8 @@
import org.finra.herd.service.helper.BusinessObjectDefinitionDaoHelper;
import org.finra.herd.service.helper.BusinessObjectDefinitionHelper;
import org.finra.herd.service.helper.BusinessObjectFormatDaoHelper;
-import org.finra.herd.service.helper.SearchIndexDaoHelper;
import org.finra.herd.service.helper.SearchIndexUpdateHelper;
import org.finra.herd.service.helper.StorageDaoHelper;
-import org.finra.herd.dao.helper.TagDaoHelper;
import org.finra.herd.service.helper.TagHelper;
/**
@@ -154,12 +141,6 @@ public class BusinessObjectDefinitionServiceImpl implements BusinessObjectDefini
@Autowired
private SearchIndexUpdateHelper searchIndexUpdateHelper;
- @Autowired
- private SearchIndexDaoHelper searchIndexDaoHelper;
-
- @Autowired
- private BusinessObjectDefinitionIndexSearchDao businessObjectDefinitionIndexSearchDao;
-
// Constant to hold the data provider name option for the business object definition search
private static final String DATA_PROVIDER_NAME_FIELD = "dataprovidername";
@@ -530,140 +511,6 @@ public Set getValidFacetFields()
return ImmutableSet.of(TAG_FACET_FIELD);
}
- @Override
- public BusinessObjectDefinitionIndexSearchResponse indexSearchBusinessObjectDefinitions(BusinessObjectDefinitionIndexSearchRequest searchRequest,
- Set fieldsRequested)
- {
- // Get the configured values for index name and document type
- final String indexName = searchIndexDaoHelper.getActiveSearchIndex(SearchIndexTypeEntity.SearchIndexTypes.BUS_OBJCT_DFNTN.name());
- final String documentType = configurationHelper.getProperty(ConfigurationValue.ELASTICSEARCH_BDEF_DOCUMENT_TYPE, String.class);
-
- // Validate the business object definition search fields
- validateSearchResponseFields(fieldsRequested);
-
- // Create a new object to hold the search index response
- ElasticsearchResponseDto elasticsearchResponseDto;
-
- Set facetFields = new HashSet<>();
- if (CollectionUtils.isNotEmpty(searchRequest.getFacetFields()))
- {
- facetFields.addAll(validateFacetFields(new HashSet<>(searchRequest.getFacetFields())));
- }
-
- // If the request contains search filters
- if (CollectionUtils.isNotEmpty(searchRequest.getBusinessObjectDefinitionSearchFilters()))
- {
- // Validate the search request.
- validateBusinessObjectDefinitionIndexSearchRequest(searchRequest);
-
- List