public static IntegrationDeployment sanitize(IntegrationDeployment integrationDeployment, DataManager dataManager, EncryptionComponent encryptionSupport) { final int stepCount = integrationDeployment.getSpec().getSteps().size(); final List<Step> steps = new ArrayList<>(stepCount); final IntegrationDeploymentSpec.Builder builder = new IntegrationDeploymentSpec.Builder().createFrom(integrationDeployment.getSpec()); .spec(builder.steps(steps).build()) .build();
protected IntegrationDeployment newIntegration(Step... steps) { for (int i = 0; i < steps.length; i++) { steps[i].getConnection().filter(r -> r.getId().isPresent()).ifPresent( resource -> resourceManager.put(resource.getId().get(), resource) ); steps[i].getAction().filter(ConnectorAction.class::isInstance).map(ConnectorAction.class::cast).filter(r -> r.getId().isPresent()).ifPresent( resource -> resourceManager.put(resource.getId().get(), resource) ); steps[i].getExtension().filter(r -> r.getId().isPresent()).ifPresent( resource -> resourceManager.put(resource.getId().get(), resource) ); if (steps[i] instanceof SimpleStep) { steps[i] = new SimpleStep.Builder().createFrom(steps[i]).putMetadata(Step.METADATA_STEP_INDEX, Integer.toString(i + 1)).build(); } else if (steps[i] instanceof ExpressionFilterStep) { steps[i] = new ExpressionFilterStep.Builder().createFrom(steps[i]).putMetadata(Step.METADATA_STEP_INDEX, Integer.toString(i + 1)).build(); } else if (steps[i] instanceof RuleFilterStep) { steps[i] = new RuleFilterStep.Builder().createFrom(steps[i]).putMetadata(Step.METADATA_STEP_INDEX, Integer.toString(i + 1)).build(); } } return new IntegrationDeployment.Builder() .integrationId("test-integration") .name("Test Integration") .spec(new IntegrationDeploymentSpec.Builder() .description("This is a test integration!") .steps(Arrays.asList(steps)) .build()) .lastUpdated(new Date(0)) .lastUpdated(new Date(0)) .build(); }
private static IntegrationDeployment newDeployment(List<Step> steps) { return new IntegrationDeployment.Builder().spec(new IntegrationDeploymentSpec.Builder().steps(steps).build()).currentState(IntegrationDeploymentState.Active).build(); } }
public IntegrationDeployment encrypt(IntegrationDeployment integrationDeployment) { return new IntegrationDeployment.Builder() .createFrom(integrationDeployment) .spec(new IntegrationDeploymentSpec.Builder().createFrom(integrationDeployment.getSpec()).steps(encrypt(integrationDeployment.getSpec().getSteps())).build()) .build(); }