Java 类javax.validation.groups.ConvertGroup 实例源码

项目:syndesis    文件:IntegrationHandler.java   
@Override
public Integration create(@Context SecurityContext sec, @ConvertGroup(from = Default.class, to = AllValidations.class) final Integration integration) {
    Date rightNow = new Date();

    Integration encryptedIntegration = encryptionSupport.encrypt(integration);

    IntegrationRevision revision = IntegrationRevision
        .createNewRevision(encryptedIntegration)
        .withCurrentState(IntegrationRevisionState.Draft);

    Integration updatedIntegration = new Integration.Builder()
        .createFrom(encryptedIntegration)
        .deployedRevisionId(revision.getVersion())
        .addRevision(revision)
        .userId(SecurityContextHolder.getContext().getAuthentication().getName())
        .statusMessage(Optional.empty())
        .lastUpdated(rightNow)
        .createdDate(rightNow)
        .currentStatus(determineCurrentStatus(encryptedIntegration))
        .userId(sec.getUserPrincipal().getName())
        .stepsDone(new ArrayList<>())
        .build();

    return Creator.super.create(sec, updatedIntegration);
}
项目:syndesis    文件:IntegrationHandler.java   
@Override
public void update(String id, @ConvertGroup(from = Default.class, to = AllValidations.class) Integration integration) {
    Integration existing = Getter.super.get(id);

    Status currentStatus = determineCurrentStatus(integration);
    IntegrationRevision currentRevision = IntegrationRevision.deployedRevision(existing)
        .withCurrentState(IntegrationRevisionState.from(currentStatus))
        .withTargetState(IntegrationRevisionState.from(integration.getDesiredStatus().orElse(Status.Pending)));

    Integration updatedIntegration = new Integration.Builder()
        .createFrom(encryptionSupport.encrypt(integration))
        .deployedRevisionId(existing.getDeployedRevisionId())
        .lastUpdated(new Date())
        .currentStatus(currentStatus)
        .addRevision(currentRevision)
        .stepsDone(new ArrayList<>())
        .build();

    Updater.super.update(id, updatedIntegration);
}
项目:syndesis    文件:ConnectionHandler.java   
@Override
public void update(final String id,
    @ConvertGroup(from = Default.class, to = AllValidations.class) final Connection connection) {

    // Lets make sure we store encrypt secrets.
    Map<String, String> configuredProperties =connection.getConfiguredProperties();
    if( connection.getConnectorId().isPresent() ) {
        Map<String, ConfigurationProperty> connectorProperties = getConnectorProperties(connection.getConnectorId().get());
        configuredProperties = encryptionComponent.encryptPropertyValues(configuredProperties, connectorProperties);
    }

    final Connection updatedConnection = new Connection.Builder()
        .createFrom(connection)
        .configuredProperties(configuredProperties)
        .lastUpdated(new Date())
        .build();
    Updater.super.update(id, updatedConnection);
}
项目:syndesis-rest    文件:IntegrationHandler.java   
@Override
public Integration create(@Context SecurityContext sec, @ConvertGroup(from = Default.class, to = AllValidations.class) final Integration integration) {
    Date rightNow = new Date();

    Integration encryptedIntegration = encryptionSupport.encrypt(integration);

    IntegrationRevision revision = IntegrationRevision
        .createNewRevision(encryptedIntegration)
        .withCurrentState(IntegrationRevisionState.Draft);

    Integration updatedIntegration = new Integration.Builder()
        .createFrom(encryptedIntegration)
        .deployedRevisionId(revision.getVersion())
        .addRevision(revision)
        .userId(SecurityContextHolder.getContext().getAuthentication().getName())
        .statusMessage(Optional.empty())
        .lastUpdated(rightNow)
        .createdDate(rightNow)
        .currentStatus(determineCurrentStatus(encryptedIntegration))
        .userId(sec.getUserPrincipal().getName())
        .build();

    return Creator.super.create(sec, updatedIntegration);
}
项目:syndesis-rest    文件:IntegrationHandler.java   
@Override
public void update(String id, @ConvertGroup(from = Default.class, to = AllValidations.class) Integration integration) {
    Integration existing = Getter.super.get(id);

    Status currentStatus = determineCurrentStatus(integration);
    IntegrationRevision currentRevision = IntegrationRevision.deployedRevision(existing)
        .withCurrentState(IntegrationRevisionState.from(currentStatus))
        .withTargetState(IntegrationRevisionState.from(integration.getDesiredStatus().orElse(Status.Pending)));

    Integration updatedIntegration = new Integration.Builder()
        .createFrom(encryptionSupport.encrypt(integration))
        .deployedRevisionId(existing.getDeployedRevisionId())
        .lastUpdated(new Date())
        .currentStatus(currentStatus)
        .addRevision(currentRevision)
        .build();

    Updater.super.update(id, updatedIntegration);
}
项目:syndesis-rest    文件:ConnectionHandler.java   
@Override
public void update(final String id,
    @ConvertGroup(from = Default.class, to = AllValidations.class) final Connection connection) {

    // Lets make sure we store encrypt secrets.
    Map<String, String> configuredProperties =connection.getConfiguredProperties();
    if( connection.getConnectorId().isPresent() ) {
        Map<String, ConfigurationProperty> connectorProperties = getConnectorProperties(connection.getConnectorId().get());
        configuredProperties = encryptionComponent.encryptPropertyValues(configuredProperties, connectorProperties);
    }

    final Connection updatedConnection = new Connection.Builder()
        .createFrom(connection)
        .configuredProperties(configuredProperties)
        .lastUpdated(new Date())
        .build();
    Updater.super.update(id, updatedConnection);
}
项目:syndesis    文件:ConnectionHandler.java   
@Override
public Connection
    create(@Context SecurityContext sec, @ConvertGroup(from = Default.class, to = AllValidations.class) final Connection connection) {
    final Date rightNow = new Date();

    // Lets make sure we store encrypt secrets.
    Map<String, String> configuredProperties =connection.getConfiguredProperties();
    if( connection.getConnectorId().isPresent() ) {
        Map<String, ConfigurationProperty> connectorProperties = getConnectorProperties(connection.getConnectorId().get());
        configuredProperties = encryptionComponent.encryptPropertyValues(configuredProperties, connectorProperties);
    }

    final Connection updatedConnection = new Connection.Builder()
        .createFrom(connection)
        .createdDate(rightNow)
        .lastUpdated(rightNow)
        .configuredProperties(configuredProperties)
        .userId(sec.getUserPrincipal().getName())
        .build();

    final Set<CredentialFlowState> flowStates = CredentialFlowState.Builder.restoreFrom(state::restoreFrom,
        request);

    final Connection connectionToCreate = flowStates.stream().map(s -> {
        final Cookie removal = new Cookie(s.persistenceKey(), "");
        removal.setPath("/");
        removal.setMaxAge(0);

        response.addCookie(removal);

        return credentials.apply(updatedConnection, s);
    }).findFirst().orElse(updatedConnection);

    return Creator.super.create(sec, connectionToCreate);
}
项目:syndesis-rest    文件:ConnectionHandler.java   
@Override
public Connection
    create(@Context SecurityContext sec, @ConvertGroup(from = Default.class, to = AllValidations.class) final Connection connection) {
    final Date rightNow = new Date();

    // Lets make sure we store encrypt secrets.
    Map<String, String> configuredProperties =connection.getConfiguredProperties();
    if( connection.getConnectorId().isPresent() ) {
        Map<String, ConfigurationProperty> connectorProperties = getConnectorProperties(connection.getConnectorId().get());
        configuredProperties = encryptionComponent.encryptPropertyValues(configuredProperties, connectorProperties);
    }

    final Connection updatedConnection = new Connection.Builder()
        .createFrom(connection)
        .createdDate(rightNow)
        .lastUpdated(rightNow)
        .configuredProperties(configuredProperties)
        .userId(sec.getUserPrincipal().getName())
        .build();

    final Set<CredentialFlowState> flowStates = CredentialFlowState.Builder.restoreFrom(state::restoreFrom,
        request);

    final Connection connectionToCreate = flowStates.stream().map(s -> {
        final Cookie removal = new Cookie(s.persistenceKey(), "");
        removal.setPath("/");
        removal.setMaxAge(0);

        response.addCookie(removal);

        return credentials.apply(updatedConnection, s);
    }).findFirst().orElse(updatedConnection);

    return Creator.super.create(sec, connectionToCreate);
}