use of net.nemerosa.ontrack.client.JsonClientMappingException in project ontrack by nemerosa.
the class BuildSvnRevisionLinkMigrationAction method migrateSvnBranchConfiguration.
protected void migrateSvnBranchConfiguration(ObjectNode node) {
// Gets the build path & branch path
String branchPath = node.get("branchPath").asText();
String buildPath = node.get("buildPath").asText();
// Removes the build path property
node.remove("buildPath");
// Converts to a service configuration
ConfiguredBuildSvnRevisionLink<?> configuredBuildSvnRevisionLink = toBuildSvnRevisionLinkConfiguration(buildPath);
// Gets the configuration representation
ServiceConfiguration serviceConfiguration = configuredBuildSvnRevisionLink.toServiceConfiguration();
// As json...
node.put("buildRevisionLink", (ObjectNode) objectMapper.valueToTree(serviceConfiguration));
// Logging
try {
logger.info("SVN branch config for {} with build expression {} has been converted to {}", branchPath, buildPath, objectMapper.writeValueAsString(serviceConfiguration));
} catch (IOException ex) {
throw new JsonClientMappingException(ex);
}
}
Aggregations