/** As a list of validation stamp IDs */ @Override public JsonNode forStorage(AutoPromotionProperty value) { return format( MapBuilder.create() .with( "validationStamps", value.getValidationStamps().stream().map(Entity::id).collect(Collectors.toList())) .with("include", value.getInclude()) .with("exclude", value.getExclude()) .get()); }
@Override public AutoPromotionProperty copy( ProjectEntity sourceEntity, AutoPromotionProperty value, ProjectEntity targetEntity, Function<String, String> replacementFn) { PromotionLevel targetPromotionLevel = (PromotionLevel) targetEntity; return new AutoPromotionProperty( value .getValidationStamps() .stream() .map( vs -> structureService.findValidationStampByName( targetPromotionLevel.getBranch().getProject().getName(), targetPromotionLevel.getBranch().getName(), vs.getName())) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.toList()), value.getInclude(), value.getExclude()); }