@Override public ExpectedPartitionValuesInformation createExpectedPartitionValues(ExpectedPartitionValuesCreateRequest expectedPartitionValuesCreateRequest){
  validateExpectedPartitionValuesCreateRequest(expectedPartitionValuesCreateRequest);
  PartitionKeyGroupEntity partitionKeyGroupEntity=partitionKeyGroupDaoHelper.getPartitionKeyGroupEntity(expectedPartitionValuesCreateRequest.getPartitionKeyGroupKey());
  Map<String,ExpectedPartitionValueEntity> expectedPartitionValueEntityMap=getExpectedPartitionValueEntityMap(partitionKeyGroupEntity.getExpectedPartitionValues());
  for (  String expectedPartitionValue : expectedPartitionValuesCreateRequest.getExpectedPartitionValues()) {
    if (expectedPartitionValueEntityMap.containsKey(expectedPartitionValue)) {
      throw new IllegalArgumentException(String.format("Expected partition value \"%s\" already exists in \"%s\" partition key group.",expectedPartitionValue,partitionKeyGroupEntity.getPartitionKeyGroupName()));
    }
  }
  Collection<ExpectedPartitionValueEntity> createdExpectedPartitionValueEntities=new ArrayList<>();
  for (  String expectedPartitionValue : expectedPartitionValuesCreateRequest.getExpectedPartitionValues()) {
    ExpectedPartitionValueEntity expectedPartitionValueEntity=new ExpectedPartitionValueEntity();
    createdExpectedPartitionValueEntities.add(expectedPartitionValueEntity);
    expectedPartitionValueEntity.setPartitionKeyGroup(partitionKeyGroupEntity);
    expectedPartitionValueEntity.setPartitionValue(expectedPartitionValue);
    expectedPartitionValueDao.saveAndRefresh(expectedPartitionValueEntity);
  }
  expectedPartitionValueDao.saveAndRefresh(partitionKeyGroupEntity);
  return createExpectedPartitionValuesInformationFromEntities(partitionKeyGroupEntity,createdExpectedPartitionValueEntities);
}

@ Override public ExpectedPartitionValuesInformation createExpectedPartitionValues ( ExpectedPartitionValuesCreateRequest expectedPartitionValuesCreateRequest ) { validateExpectedPartitionValuesCreateRequest ( expectedPartitionValuesCreateRequest ) ; PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoHelper . getPartitionKeyGroupEntity ( expectedPartitionValuesCreateRequest . getPartitionKeyGroupKey ( ) ) ; Map < String , ExpectedPartitionValueEntity > expectedPartitionValueEntityMap = getExpectedPartitionValueEntityMap ( partitionKeyGroupEntity . getExpectedPartitionValues ( ) ) ; for ( String expectedPartitionValue : expectedPartitionValuesCreateRequest . getExpectedPartitionValues ( ) ) { if ( expectedPartitionValueEntityMap . containsKey ( expectedPartitionValue ) ) { throw new IllegalArgumentException ( String . format ( "Expected partition value \"%s\" already exists in \"%s\" partition key group." , expectedPartitionValue , partitionKeyGroupEntity . getPartitionKeyGroupName ( ) ) ) ; } } Collection < ExpectedPartitionValueEntity > createdExpectedPartitionValueEntities = new ArrayList < > ( ) ; for ( String expectedPartitionValue : expectedPartitionValuesCreateRequest . getExpectedPartitionValues ( ) ) { ExpectedPartitionValueEntity expectedPartitionValueEntity = new ExpectedPartitionValueEntity ( ) ; createdExpectedPartitionValueEntities . add ( expectedPartitionValueEntity ) ; expectedPartitionValueEntity . setPartitionKeyGroup ( partitionKeyGroupEntity ) ; expectedPartitionValueEntity . setPartitionValue ( expectedPartitionValue ) ; expectedPartitionValueDao . saveAndRefresh ( expectedPartitionValueEntity ) ; } expectedPartitionValueDao . saveAndRefresh ( partitionKeyGroupEntity ) ; return createExpectedPartitionValuesInformationFromEntities ( partitionKeyGroupEntity , createdExpectedPartitionValueEntities ) ; }
creates a list of expected partition values for an existing partition key group .
