Search in sources :

Example 1 with RecoverTopologyOperation

use of org.alien4cloud.tosca.editor.operations.RecoverTopologyOperation in project alien4cloud by alien4cloud.

the class EditorService method getRecoverTopologyOperation.

private RecoverTopologyOperation getRecoverTopologyOperation(String topologyId) {
    try {
        editionContextManager.init(topologyId);
        RecoverTopologyOperation operation = EditionContextManager.get().getRecoveryOperation();
        EditionContextManager.get().setRecoveryOperation(null);
        return operation != null ? operation : new RecoverTopologyOperation();
    } finally {
        editionContextManager.destroy();
    }
}
Also used : RecoverTopologyOperation(org.alien4cloud.tosca.editor.operations.RecoverTopologyOperation)

Example 2 with RecoverTopologyOperation

use of org.alien4cloud.tosca.editor.operations.RecoverTopologyOperation in project alien4cloud by alien4cloud.

the class EditorService method recover.

/**
 * Recovers a topology
 *
 * @param topologyId The id of the topology.
 * @param lastOperationId
 * @return
 */
public TopologyDTO recover(String topologyId, String lastOperationId) {
    // The recovering process is done via operation so that we can have it in the history
    RecoverTopologyOperation operation = getRecoverTopologyOperation(topologyId);
    operation.setPreviousOperationId(lastOperationId);
    return executeAndSave(topologyId, operation);
}
Also used : RecoverTopologyOperation(org.alien4cloud.tosca.editor.operations.RecoverTopologyOperation)

Example 3 with RecoverTopologyOperation

use of org.alien4cloud.tosca.editor.operations.RecoverTopologyOperation in project alien4cloud by alien4cloud.

the class EditorTopologyRecoveryHelperService method buildRecoveryOperation.

/**
 * analyse a given topology and build a {@link RecoverTopologyOperation} to apply to the topology to make it synch
 * with the dependencies present in the repository
 *
 * @param topology
 * @return a {@link RecoverTopologyOperation}
 */
@ToscaContextual(requiresNew = true)
public RecoverTopologyOperation buildRecoveryOperation(Topology topology) {
    RecoverTopologyOperation operation = new RecoverTopologyOperation();
    buildRecoveryOperation(topology, operation);
    return CollectionUtils.isNotEmpty(operation.getUpdatedDependencies()) ? operation : null;
}
Also used : RecoverTopologyOperation(org.alien4cloud.tosca.editor.operations.RecoverTopologyOperation) ToscaContextual(alien4cloud.tosca.context.ToscaContextual)

Aggregations

RecoverTopologyOperation (org.alien4cloud.tosca.editor.operations.RecoverTopologyOperation)3 ToscaContextual (alien4cloud.tosca.context.ToscaContextual)1