public EventBuilder withPromotionRun(PromotionRun promotionRun) { return withBuild(promotionRun.getBuild()).with(promotionRun.getPromotionLevel()).with(promotionRun.getSignature()); }
public PromotionRun withId(ID id) { return new PromotionRun( id, build, promotionLevel, signature, description ); }
@Override public PromotionRun newPromotionRun(PromotionRun promotionRun) { return promotionRun.withId( id( dbCreate( "INSERT INTO PROMOTION_RUNS(BUILDID, PROMOTIONLEVELID, CREATION, CREATOR, DESCRIPTION) VALUES (:buildId, :promotionLevelId, :creation, :creator, :description)", params("buildId", promotionRun.getBuild().id()) .addValue("promotionLevelId", promotionRun.getPromotionLevel().id()) .addValue("description", promotionRun.getDescription()) .addValue("creation", dateTimeForDB(promotionRun.getSignature().getTime())) .addValue("creator", promotionRun.getSignature().getUser().getName()) ) ) ); }
@Override public Event deletePromotionRun(PromotionRun promotionRun) { return Event.of(DELETE_PROMOTION_RUN) .withBranch(promotionRun.getBuild().getBranch()) .with(promotionRun.getBuild()) .with(promotionRun.getPromotionLevel()) .get(); }
PromotionRun.of( build, promotionLevel,
protected PromotionRun toPromotionRun(ResultSet rs, Function<ID, Build> buildLoader, Function<ID, PromotionLevel> promotionLevelLoader) throws SQLException { return PromotionRun.of( buildLoader.apply(id(rs, "buildId")), promotionLevelLoader.apply(id(rs, "promotionLevelId")), readSignature(rs), rs.getString("description") ).withId(id(rs)); }
@Override protected Optional<Signature> getSignature(PromotionRun entity) { return Optional.ofNullable(entity.getSignature()); } }
@Override public Project getProject() { return getBuild().getProject(); }
int promotionLevelId = run.getPromotionLevel().id(); if (index.contains(promotionLevelId)) { index.remove(promotionLevelId);
@Override public String render(ProjectEntity projectEntity, Event event) { switch (projectEntity.getProjectEntityType()) { case PROJECT: return ((Project) projectEntity).getName(); case BRANCH: return ((Branch) projectEntity).getName(); case PROMOTION_LEVEL: return ((PromotionLevel) projectEntity).getName(); case VALIDATION_STAMP: return ((ValidationStamp) projectEntity).getName(); case BUILD: return ((Build) projectEntity).getName(); case VALIDATION_RUN: return "#" + ((ValidationRun) projectEntity).getRunOrder(); case PROMOTION_RUN: PromotionRun promotionRun = (PromotionRun) projectEntity; return String.format( "%s->%s", promotionRun.getBuild().getName(), promotionRun.getPromotionLevel().getName() ); default: throw new EventCannotRenderEntityException(event.getEventType().getTemplate(), projectEntity); } }
protected PromotionRun doPromote(Build build, PromotionLevel promotionLevel, String description) throws Exception { return asUser().with(build.projectId(), PromotionRunCreate.class).call(() -> structureService.newPromotionRun( PromotionRun.of( build, promotionLevel, Signature.of("test"), description ) ) ); }
PromotionRun.of( buildOpt.get(), promotionLevelOpt.get(),
public static PromotionRun of(Build build, PromotionLevel promotionLevel, Signature signature, String description) { return new PromotionRun( ID.NONE, build, promotionLevel, signature, description ); }