use of org.craftercms.studio.api.v1.ebus.EventListener in project studio by craftercms.
the class EnvironmentDeployer method onEnvironmentDeploymentEvent.
@EventListener(EVENT_PUBLISH_TO_ENVIRONMENT)
public void onEnvironmentDeploymentEvent(DeploymentEventContext context) {
List<DeploymentItem> items = context.getItems();
List<DeploymentItemTO> deploymentItems = new ArrayList<DeploymentItemTO>();
for (DeploymentItem item : items) {
DeploymentItemTO deploymentItem = new DeploymentItemTO();
deploymentItem.setSite(item.getSite());
deploymentItem.setPath(item.getPath());
deploymentItem.setCommitId(item.getCommitId());
deploymentItem.setPackageId(item.getPackageId());
}
try {
contentRepository.publish(context.getSite(), StringUtils.EMPTY, deploymentItems, context.getEnvironment(), context.getAuthor(), context.getComment());
} catch (DeploymentException e) {
logger.error("Error when publishing site " + context.getSite() + " to environment " + context.getEnvironment(), e);
}
}
Aggregations