use of com.google.cloud.talent.v4beta1.BatchUpdateJobsRequest in project java-talent by googleapis.
the class JobSearchBatchUpdateJobs method sampleBatchUpdateJobs.
/**
* Batch Update Jobs
*
* @param projectId Your Google Cloud Project ID
* @param tenantId Identifier of the Tenant
*/
public static void sampleBatchUpdateJobs(String projectId, String tenantId, String jobNameOne, String companyNameOne, String requisitionIdOne, String titleOne, String descriptionOne, String jobApplicationUrlOne, String addressOne, String languageCodeOne, String jobNameTwo, String companyNameTwo, String requisitionIdTwo, String titleTwo, String descriptionTwo, String jobApplicationUrlTwo, String addressTwo, String languageCodeTwo) {
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format(projectId, tenantId);
List<String> uris = Arrays.asList(jobApplicationUrlOne);
Job.ApplicationInfo applicationInfo = Job.ApplicationInfo.newBuilder().addAllUris(uris).build();
List<String> addresses = Arrays.asList(addressOne);
Job jobsElement = Job.newBuilder().setName(jobNameOne).setCompany(companyNameOne).setRequisitionId(requisitionIdOne).setTitle(titleOne).setDescription(descriptionOne).setApplicationInfo(applicationInfo).addAllAddresses(addresses).setLanguageCode(languageCodeOne).build();
List<String> uris2 = Arrays.asList(jobApplicationUrlTwo);
Job.ApplicationInfo applicationInfo2 = Job.ApplicationInfo.newBuilder().addAllUris(uris2).build();
List<String> addresses2 = Arrays.asList(addressTwo);
Job jobsElement2 = Job.newBuilder().setName(jobNameTwo).setCompany(companyNameTwo).setRequisitionId(requisitionIdTwo).setTitle(titleTwo).setDescription(descriptionTwo).setApplicationInfo(applicationInfo2).addAllAddresses(addresses2).setLanguageCode(languageCodeTwo).build();
List<Job> jobs = Arrays.asList(jobsElement, jobsElement2);
BatchUpdateJobsRequest request = BatchUpdateJobsRequest.newBuilder().setParent(formattedParent).addAllJobs(jobs).build();
OperationFuture<JobOperationResult, BatchOperationMetadata> future = jobServiceClient.batchUpdateJobsAsync(request);
System.out.println("Waiting for operation to complete...");
JobOperationResult response = future.get();
System.out.printf("Batch response: %s\n", response);
} catch (Exception exception) {
System.err.println("Failed to create the client due to: " + exception);
}
}
Aggregations