コード例 #1
0
 @Override
 public Form getEditionForm(ProjectEntity entity, AutoPromotionProperty value) {
   PromotionLevel promotionLevel = (PromotionLevel) entity;
   return Form.create()
       .with(
           MultiSelection.of("validationStamps")
               .label("Validation stamps")
               .items(
                   structureService
                       .getValidationStampListForBranch(promotionLevel.getBranch().getId())
                       .stream()
                       .map(
                           vs ->
                               new ValidationStampSelection(
                                   vs, value != null && value.containsDirectValidationStamp(vs)))
                       .collect(Collectors.toList()))
               .help(
                   "When all the selected validation stamps have passed for a build, the promotion will automatically be granted."))
       .with(
           Text.of("include")
               .label("Include")
               .optional()
               .value(value != null ? value.getInclude() : "")
               .help("Regular expression to select validation stamps by name"))
       .with(
           Text.of("exclude")
               .label("Exclude")
               .optional()
               .value(value != null ? value.getExclude() : "")
               .help("Regular expression to exclude validation stamps by name"));
 }
コード例 #2
0
 @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());
 }