Search in sources :

Example 1 with State

use of org.datatransferproject.spi.cloud.types.PortabilityJob.State in project data-transfer-project by google.

the class JobStoreWithValidator method updateJobState.

private void updateJobState(UUID jobId, State state, State prevState, JobAuthorization.State prevAuthState) throws IOException {
    PortabilityJob existingJob = findJob(jobId);
    PortabilityJob updatedJob = existingJob.toBuilder().setState(state).build();
    updateJob(jobId, updatedJob, ((previous, updated) -> {
        Preconditions.checkState(previous.state() == prevState);
        Preconditions.checkState(previous.jobAuthorization().state() == prevAuthState);
    }));
}
Also used : Strings(com.google.common.base.Strings) JobAuthorization(org.datatransferproject.spi.cloud.types.JobAuthorization) CREDS_AVAILABLE(org.datatransferproject.spi.cloud.types.JobAuthorization.State.CREDS_AVAILABLE) CREDS_STORED(org.datatransferproject.spi.cloud.types.JobAuthorization.State.CREDS_STORED) State(org.datatransferproject.spi.cloud.types.PortabilityJob.State) CREDS_ENCRYPTION_KEY_GENERATED(org.datatransferproject.spi.cloud.types.JobAuthorization.State.CREDS_ENCRYPTION_KEY_GENERATED) PortabilityJob(org.datatransferproject.spi.cloud.types.PortabilityJob) Preconditions(com.google.common.base.Preconditions) IOException(java.io.IOException) UUID(java.util.UUID) PortabilityJob(org.datatransferproject.spi.cloud.types.PortabilityJob)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 IOException (java.io.IOException)1 UUID (java.util.UUID)1 JobAuthorization (org.datatransferproject.spi.cloud.types.JobAuthorization)1 CREDS_AVAILABLE (org.datatransferproject.spi.cloud.types.JobAuthorization.State.CREDS_AVAILABLE)1 CREDS_ENCRYPTION_KEY_GENERATED (org.datatransferproject.spi.cloud.types.JobAuthorization.State.CREDS_ENCRYPTION_KEY_GENERATED)1 CREDS_STORED (org.datatransferproject.spi.cloud.types.JobAuthorization.State.CREDS_STORED)1 PortabilityJob (org.datatransferproject.spi.cloud.types.PortabilityJob)1 State (org.datatransferproject.spi.cloud.types.PortabilityJob.State)1