use of org.craftercms.studio.api.v1.exception.EnvironmentNotFoundException in project studio by craftercms.
the class DeploymentServiceImpl method publishCommits.
@Override
@ValidateParams
public void publishCommits(@ValidateStringParam(name = "site") String site, @ValidateStringParam(name = "environment") String environment, List<String> commitIds, @ValidateStringParam(name = "comment") String comment) throws SiteNotFoundException, EnvironmentNotFoundException, CommitNotFoundException {
if (!siteService.exists(site)) {
throw new SiteNotFoundException();
}
Set<String> environments = getAllPublishedEnvironments(site);
if (!environments.contains(environment)) {
throw new EnvironmentNotFoundException();
}
if (!checkCommitIds(site, commitIds)) {
throw new CommitNotFoundException();
}
logger.debug("Creating publish request items for queue for site " + site + " environment " + environment);
List<PublishRequest> publishRequests = createCommitItems(site, environment, commitIds, ZonedDateTime.now(ZoneOffset.UTC), securityService.getCurrentUser(), comment);
logger.debug("Insert publish request items to the queue");
for (PublishRequest request : publishRequests) {
publishRequestMapper.insertItemForDeployment(request);
}
logger.debug("Completed adding commits to publishing queue");
}
Aggregations