fun deleteExpectedPartitionValues(expectedPartitionValuesDeleteRequest: ExpectedPartitionValuesDeleteRequest): ExpectedPartitionValuesInformation? { validateExpectedPartitionValuesDeleteRequest(expectedPartitionValuesDeleteRequest) val partitionKeyGroupEntity: PartitionKeyGroupEntity = partitionKeyGroupDaoHelper.getPartitionKeyGroupEntity( expectedPartitionValuesDeleteRequest.getPartitionKeyGroupKey() ) val expectedPartitionValueEntityMap: Map<String, ExpectedPartitionValueEntity> = getExpectedPartitionValueEntityMap(partitionKeyGroupEntity.getExpectedPartitionValues()) val deletedExpectedPartitionValueEntities: MutableCollection<ExpectedPartitionValueEntity> = ArrayList() for (expectedPartitionValue in expectedPartitionValuesDeleteRequest.getExpectedPartitionValues()) { val expectedPartitionValueEntity: ExpectedPartitionValueEntity? = expectedPartitionValueEntityMap[expectedPartitionValue] if (expectedPartitionValueEntity != null) { deletedExpectedPartitionValueEntities.add(expectedPartitionValueEntity) } else { throw ObjectNotFoundException( java.lang.String.format( "Expected partition value \"%s\" doesn't exist in \"%s\" partition key group.", expectedPartitionValue, partitionKeyGroupEntity.getPartitionKeyGroupName() ) ) } } for (expectedPartitionValueEntity in deletedExpectedPartitionValueEntities) { partitionKeyGroupEntity.getExpectedPartitionValues() .remove(expectedPartitionValueEntity) } expectedPartitionValueDao.saveAndRefresh(partitionKeyGroupEntity) return createExpectedPartitionValuesInformationFromEntities( partitionKeyGroupEntity, deletedExpectedPartitionValueEntities ) }
Deletes specified expected partition values from an existing partition key group which is identified by name .