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)