Search in sources :

Example 1 with JsonClientMappingException

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);
    }
}
Also used : ServiceConfiguration(net.nemerosa.ontrack.model.structure.ServiceConfiguration) IOException(java.io.IOException) JsonClientMappingException(net.nemerosa.ontrack.client.JsonClientMappingException)

Aggregations

IOException (java.io.IOException)1 JsonClientMappingException (net.nemerosa.ontrack.client.JsonClientMappingException)1 ServiceConfiguration (net.nemerosa.ontrack.model.structure.ServiceConfiguration)1