BusinessObjectFormatServiceImpl implements BusinessObjectFormatService { @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.WRITE) @Override public BusinessObjectFormat updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(BusinessObjectFormatKey businessObjectFormatKey, BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest) { Assert.notNull(businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest, "A business object format schema backwards compatibility changes update request must be specified."); Assert.notNull(businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest.isAllowNonBackwardsCompatibleChanges(), "allowNonBackwardsCompatibleChanges flag in business object format schema backwards compatibility changes update request must be specified."); businessObjectFormatHelper.validateBusinessObjectFormatKey(businessObjectFormatKey, false); Assert.isNull(businessObjectFormatKey.getBusinessObjectFormatVersion(), "Business object format version must not be specified."); BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoHelper.getBusinessObjectFormatEntity(businessObjectFormatKey); businessObjectFormatEntity.setAllowNonBackwardsCompatibleChanges( BooleanUtils.isTrue(businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest.isAllowNonBackwardsCompatibleChanges())); businessObjectFormatEntity = businessObjectFormatDao.saveAndRefresh(businessObjectFormatEntity); return businessObjectFormatHelper.createBusinessObjectFormatFromEntity(businessObjectFormatEntity); }  @PublishNotificationMessages @NamespacePermission(fields = "#request.namespace", permissions = NamespacePermissionEnum.WRITE) @Override BusinessObjectFormat createBusinessObjectFormat(BusinessObjectFormatCreateRequest request); @PublishNotificationMessages @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.WRITE) @Override BusinessObjectFormat updateBusinessObjectFormat(BusinessObjectFormatKey businessObjectFormatKey, BusinessObjectFormatUpdateRequest request); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) BusinessObjectFormat getBusinessObjectFormat(BusinessObjectFormatKey businessObjectFormatKey); @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.WRITE) @Override BusinessObjectFormat deleteBusinessObjectFormat(BusinessObjectFormatKey businessObjectFormatKey); @Override BusinessObjectFormatKeys getBusinessObjectFormats(BusinessObjectDefinitionKey businessObjectDefinitionKey, boolean latestBusinessObjectFormatVersion); @Override BusinessObjectFormatKeys getBusinessObjectFormatsWithFilters(BusinessObjectDefinitionKey businessObjectDefinitionKey,
        String businessObjectFormatUsage, boolean latestBusinessObjectFormatVersion); @Override @Transactional(propagation = Propagation.REQUIRES_NEW) BusinessObjectFormatDdl generateBusinessObjectFormatDdl(BusinessObjectFormatDdlRequest request); @NamespacePermission(fields = "#request?.businessObjectFormatDdlRequests?.![namespace]", permissions = NamespacePermissionEnum.READ) @Override @Transactional(propagation = Propagation.REQUIRES_NEW) BusinessObjectFormatDdlCollectionResponse generateBusinessObjectFormatDdlCollection(BusinessObjectFormatDdlCollectionRequest request); @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = {NamespacePermissionEnum.WRITE, NamespacePermissionEnum.WRITE_DESCRIPTIVE_CONTENT}) @Override BusinessObjectFormat updateBusinessObjectFormatParents(BusinessObjectFormatKey businessObjectFormatKey,
        BusinessObjectFormatParentsUpdateRequest businessObjectFormatParentsUpdateRequest); @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.WRITE) @Override BusinessObjectFormat updateBusinessObjectFormatAttributes(BusinessObjectFormatKey businessObjectFormatKey,
        BusinessObjectFormatAttributesUpdateRequest businessObjectFormatAttributesUpdateRequest); @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.WRITE) @Override BusinessObjectFormat updateBusinessObjectFormatAttributeDefinitions(BusinessObjectFormatKey businessObjectFormatKey,
        BusinessObjectFormatAttributeDefinitionsUpdateRequest businessObjectFormatAttributeDefinitionsUpdateRequest); @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.WRITE) @Override BusinessObjectFormat updateBusinessObjectFormatRetentionInformation(BusinessObjectFormatKey businessObjectFormatKey,
        BusinessObjectFormatRetentionInformationUpdateRequest updateRequest); @NamespacePermission(fields = "#businessObjectFormatKey.namespace", permissions = NamespacePermissionEnum.WRITE) @Override BusinessObjectFormat updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(BusinessObjectFormatKey businessObjectFormatKey,
        BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest); static final Set<String> SCHEMA_COLUMN_DATA_TYPES_WITH_ALLOWED_SIZE_INCREASE; }
@Test public void testUpdateBusinessObjectFormatSchemaBackwardsCompatibilityChanges() { BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION); BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest = new BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest(ALLOW_NON_BACKWARDS_COMPATIBLE_CHANGES_SET); BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); BusinessObjectFormat businessObjectFormat = new BusinessObjectFormat(); businessObjectFormat.setId(ID); when(businessObjectFormatDaoHelper.getBusinessObjectFormatEntity(businessObjectFormatKey)).thenReturn(businessObjectFormatEntity); when(businessObjectFormatDao.saveAndRefresh(businessObjectFormatEntity)).thenReturn(businessObjectFormatEntity); when(businessObjectFormatHelper.createBusinessObjectFormatFromEntity(businessObjectFormatEntity)).thenReturn(businessObjectFormat); BusinessObjectFormat result = businessObjectFormatServiceImpl.updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(businessObjectFormatKey, businessObjectFormatSchemaBackwardsCompatibilityUpdateRequest); verify(businessObjectFormatHelper).validateBusinessObjectFormatKey(businessObjectFormatKey, false); verify(businessObjectFormatDaoHelper).getBusinessObjectFormatEntity(businessObjectFormatKey); verify(businessObjectFormatDao).saveAndRefresh(businessObjectFormatEntity); verify(businessObjectFormatHelper).createBusinessObjectFormatFromEntity(businessObjectFormatEntity); verifyNoMoreInteractionsHelper(); assertEquals(businessObjectFormat, result); assertEquals(businessObjectFormatEntity.isAllowNonBackwardsCompatibleChanges(), ALLOW_NON_BACKWARDS_COMPATIBLE_CHANGES_SET); }
@Test public void testUpdateBusinessObjectFormatSchemaBackwardsCompatibilityChangesMissingRequiredParameters() { BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, NO_FORMAT_VERSION); try { businessObjectFormatServiceImpl.updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(businessObjectFormatKey, null); fail(); } catch (IllegalArgumentException e) { assertEquals("A business object format schema backwards compatibility changes update request must be specified.", e.getMessage()); } try { businessObjectFormatServiceImpl.updateBusinessObjectFormatSchemaBackwardsCompatibilityChanges(businessObjectFormatKey, new BusinessObjectFormatSchemaBackwardsCompatibilityUpdateRequest(null)); fail(); } catch (IllegalArgumentException e) { assertEquals( "allowNonBackwardsCompatibleChanges flag in business object format schema backwards compatibility changes update request must be specified.", e.getMessage()); } verifyNoMoreInteractionsHelper(); }