@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"));
 }
 @Override
 protected Form blankForm(ID branchId) {
   // Promotion levels for this branch
   List<PromotionLevel> promotionLevels =
       structureService.getPromotionLevelListForBranch(branchId);
   // Form
   return Form.create()
       .with(
           Int.of("count")
               .label("Maximum count")
               .help("Maximum number of builds to display")
               .min(1)
               .value(10))
       .with(
           Text.of("fromBuild")
               .label("From build")
               .help(
                   "Expression to identify a list of build. Only the most recent one is kept. "
                       + "* (star) can be used as a placeholder."))
       .with(
           Text.of("toBuild")
               .label("To build")
               .optional()
               .help(
                   "Optional expression to identify a list of build. Only the most recent one is kept. "
                       + "If unset, the first build that does not comply with the \"from build\" expression is kept by default. "
                       + "* (star) can be used as a placeholder."))
       .with(
           Selection.of("withPromotionLevel")
               .label("With promotion level")
               .help(
                   "Optional. If set, restrict both \"from\" and \"to\" list to the builds with a promotion level.")
               .items(promotionLevels)
               .itemId("name")
               .optional());
 }
示例#3
0
 @Override
 public Form getEditionForm(ProjectEntity entity, TestProperty value) {
   return Form.create()
       .with(Text.of("value").label("Value").value(value != null ? value.getValue() : ""));
 }