public static Signature of(LocalDateTime dateTime, String name) { return new Signature( dateTime, User.of(name) ); }
protected Signature readSignature(ResultSet rs, String creationColumn, String creatorColumn) throws SQLException { return Signature.of( dateTimeFromDB(rs.getString(creationColumn)), rs.getString(creatorColumn) ); }
public static Project of(NameDescription nameDescription) { return new Project(ID.NONE, nameDescription.getName(), nameDescription.getDescription(), false, Signature.none()); }
private Build doCreateBuild(Branch branch, TCopyEvent copy, String buildName, SVNRepository repository) { // The build date is assumed to be the creation of the tag SVNRevisionInfo revisionInfo = svnService.getRevisionInfo(repository, copy.getRevision()); LocalDateTime revisionTime = revisionInfo.getDateTime(); // Creation of the build return structureService.newBuild( Build.of( branch, new NameDescription( buildName, String.format("Build created by SVN synchronisation from tag %s", copy.getCopyToPath()) ), securityService.getCurrentSignature().withTime(revisionTime) ) ); }
private void audit(EntityDataStoreRecordAuditType type, int recordId, Signature signature) { getNamedParameterJdbcTemplate().update( "INSERT INTO ENTITY_DATA_STORE_AUDIT(RECORD_ID, AUDIT_TYPE, TIMESTAMP, CREATOR) " + "VALUES (:recordId, :auditType, :timestamp, :user)", params("recordId", recordId) .addValue("auditType", type.name()) .addValue("timestamp", dateTimeForDB(signature.getTime())) .addValue("user", signature.getUser().getName()) ); } }
public static Signature of(String name) { return of(Time.now(), name); }
public static Branch of(Project project, NameDescriptionState nameDescription) { return new Branch( ID.NONE, nameDescription.getName(), nameDescription.getDescription(), nameDescription.isDisabled(), BranchType.CLASSIC, project, Signature.none() ); }
@Override public void post(Event event) { StringBuilder sql = new StringBuilder("INSERT INTO EVENTS(EVENT_VALUES, EVENT_TIME, EVENT_USER, EVENT_TYPE, REF"); MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("eventValues", writeJson(event.getValues())); params.addValue("eventTime", dateTimeForDB(event.getSignature().getTime())); params.addValue("eventUser", event.getSignature().getUser().getName()); params.addValue("eventType", event.getEventType().getId()); params.addValue("ref", event.getRef() != null ? event.getRef().name() : null); for (ProjectEntityType type : event.getEntities().keySet()) { sql.append(", ").append(type.name()); } sql.append(") VALUES (:eventValues, :eventTime, :eventUser, :eventType, :ref"); for (Map.Entry<ProjectEntityType, ProjectEntity> entry : event.getEntities().entrySet()) { ProjectEntityType type = entry.getKey(); ProjectEntity entity = entry.getValue(); String typeEntry = type.name().toLowerCase(); sql.append(", :").append(typeEntry); params.addValue(typeEntry, entity.id()); } sql.append(")"); getNamedParameterJdbcTemplate().update( sql.toString(), params ); }
protected Build doCreateBuild(Branch branch, NameDescription nameDescription) throws Exception { return doCreateBuild(branch, nameDescription, Signature.of("test")); }
public static Project of(NameDescriptionState nameDescription) { return new Project(ID.NONE, nameDescription.getName(), nameDescription.getDescription(), nameDescription.isDisabled(), Signature.none()); }
public Signature withTime(LocalDateTime dateTime) { return new Signature(dateTime != null ? dateTime : Time.now(), user); } }
protected void newValidationRunStatus(int validationRunId, ValidationRunStatus validationRunStatus) { dbCreate( "INSERT INTO VALIDATION_RUN_STATUSES(VALIDATIONRUNID, VALIDATIONRUNSTATUSID, CREATION, CREATOR, DESCRIPTION) " + "VALUES (:validationRunId, :validationRunStatusId, :creation, :creator, :description)", params("validationRunId", validationRunId) .addValue("validationRunStatusId", validationRunStatus.getStatusID().getId()) .addValue("description", validationRunStatus.getDescription()) .addValue("creation", dateTimeForDB(validationRunStatus.getSignature().getTime())) .addValue("creator", validationRunStatus.getSignature().getUser().getName()) ); }
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 ) ) ); }
public static PromotionLevel of(Branch branch, NameDescription nameDescription) { Entity.isEntityDefined(branch, "Branch must be defined"); Entity.isEntityDefined(branch.getProject(), "Project must be defined"); return new PromotionLevel(ID.NONE, nameDescription.getName(), nameDescription.getDescription(), branch, false, Signature.none() ); }
public static Signature none() { return new Signature( Time.now(), User.anonymous() ); }