Search in sources :

Example 6 with PullRequestMetadata

use of com.palantir.stash.stashbot.persistence.PullRequestMetadata in project stashbot by palantir.

the class ConfigurationPersistenceImpl method setPullRequestMetadata.

// Allows fromHash and toHash to be set by the caller, in case we are referring to older commits
/* (non-Javadoc)
     * @see com.palantir.stash.stashbot.config.ConfigurationPersistenceService#setPullRequestMetadata(com.atlassian.stash.pull.PullRequest, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean, java.lang.Boolean)
     */
@Override
public void setPullRequestMetadata(PullRequest pr, String fromHash, String toHash, Boolean buildStarted, Boolean success, Boolean override, Boolean failed) {
    PullRequestMetadata prm = getPullRequestMetadata(pr.getToRef().getRepository().getId(), pr.getId(), fromHash, toHash);
    if (buildStarted != null) {
        prm.setBuildStarted(buildStarted);
    }
    if (success != null) {
        prm.setSuccess(success);
    }
    if (override != null) {
        prm.setOverride(override);
    }
    if (failed != null) {
        prm.setFailed(failed);
    }
    prm.save();
    publisher.publish(new StashbotMetadataUpdatedEvent(this, pr));
}
Also used : StashbotMetadataUpdatedEvent(com.palantir.stash.stashbot.event.StashbotMetadataUpdatedEvent) PullRequestMetadata(com.palantir.stash.stashbot.persistence.PullRequestMetadata)

Aggregations

PullRequestMetadata (com.palantir.stash.stashbot.persistence.PullRequestMetadata)6 Repository (com.atlassian.stash.repository.Repository)2 StashbotMetadataUpdatedEvent (com.palantir.stash.stashbot.event.StashbotMetadataUpdatedEvent)2 RepositoryConfiguration (com.palantir.stash.stashbot.persistence.RepositoryConfiguration)2 SQLException (java.sql.SQLException)2 DBParam (net.java.ao.DBParam)2 BuildStats (com.atlassian.stash.build.BuildStats)1 Changeset (com.atlassian.stash.content.Changeset)1 ChangesetsBetweenRequest (com.atlassian.stash.content.ChangesetsBetweenRequest)1 PullRequest (com.atlassian.stash.pull.PullRequest)1 PageRequest (com.atlassian.stash.util.PageRequest)1 PageRequestImpl (com.atlassian.stash.util.PageRequestImpl)1 Test (org.junit.Test)1