Search in sources :

Example 1 with ListJobsRequest

use of com.google.cloud.dataproc.v1beta2.ListJobsRequest in project java-talent by googleapis.

the class JobSearchListJobs method sampleListJobs.

/**
 * List Jobs
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleListJobs(String projectId, String tenantId, String filter) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build();
        for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) {
            System.out.printf("Job name: %s\n", responseItem.getName());
            System.out.printf("Job requisition ID: %s\n", responseItem.getRequisitionId());
            System.out.printf("Job title: %s\n", responseItem.getTitle());
            System.out.printf("Job description: %s\n", responseItem.getDescription());
        }
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : ListJobsRequest(com.google.cloud.talent.v4beta1.ListJobsRequest) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName) Job(com.google.cloud.talent.v4beta1.Job)

Example 2 with ListJobsRequest

use of com.google.cloud.dataproc.v1beta2.ListJobsRequest in project java-talent by googleapis.

the class JobSearchListJobs method listJobs.

// Search Jobs with histogram queries.
public static void listJobs(String projectId, String tenantId, String filter) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build();
        for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) {
            System.out.format("Job name: %s%n", responseItem.getName());
            System.out.format("Job requisition ID: %s%n", responseItem.getRequisitionId());
            System.out.format("Job title: %s%n", responseItem.getTitle());
            System.out.format("Job description: %s%n", responseItem.getDescription());
        }
    }
}
Also used : ListJobsRequest(com.google.cloud.talent.v4.ListJobsRequest) TenantName(com.google.cloud.talent.v4.TenantName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job)

Example 3 with ListJobsRequest

use of com.google.cloud.dataproc.v1beta2.ListJobsRequest in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchListJobs method listJobs.

// Search Jobs with histogram queries.
public static void listJobs(String projectId, String tenantId, String filter) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build();
        for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) {
            System.out.format("Job name: %s%n", responseItem.getName());
            System.out.format("Job requisition ID: %s%n", responseItem.getRequisitionId());
            System.out.format("Job title: %s%n", responseItem.getTitle());
            System.out.format("Job description: %s%n", responseItem.getDescription());
        }
    }
}
Also used : ListJobsRequest(com.google.cloud.talent.v4beta1.ListJobsRequest) TenantName(com.google.cloud.talent.v4beta1.TenantName) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) Job(com.google.cloud.talent.v4beta1.Job)

Example 4 with ListJobsRequest

use of com.google.cloud.dataproc.v1beta2.ListJobsRequest in project java-talent by googleapis.

the class ITSystemTest method listJobsTest.

@Test
public void listJobsTest() {
    String filter = "companyName =" + "\"" + company.getName() + "\"";
    ListJobsRequest request = ListJobsRequest.newBuilder().setParent(tenantName.toString()).setFilter(filter).build();
    for (Job actual : jobServiceClient.listJobs(request).iterateAll()) {
        if (job.getName().equals(actual.getName())) {
            assertEquals(job.getName(), actual.getName());
            assertEquals(job.getCompany(), actual.getCompany());
            assertEquals(job.getRequisitionId(), actual.getRequisitionId());
            assertEquals(job.getTitle(), actual.getTitle());
            assertEquals(job.getDescription(), actual.getDescription());
            assertEquals(job.getApplicationInfo(), actual.getApplicationInfo());
            assertEquals(job.getAddressesCount(), actual.getAddressesCount());
            assertEquals(job.getLanguageCode(), actual.getLanguageCode());
        }
    }
}
Also used : ListJobsRequest(com.google.cloud.talent.v4beta1.ListJobsRequest) Job(com.google.cloud.talent.v4beta1.Job) Test(org.junit.Test)

Aggregations

Job (com.google.cloud.talent.v4beta1.Job)3 ListJobsRequest (com.google.cloud.talent.v4beta1.ListJobsRequest)3 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)2 Job (com.google.cloud.talent.v4.Job)1 JobServiceClient (com.google.cloud.talent.v4.JobServiceClient)1 ListJobsRequest (com.google.cloud.talent.v4.ListJobsRequest)1 TenantName (com.google.cloud.talent.v4.TenantName)1 TenantName (com.google.cloud.talent.v4beta1.TenantName)1 TenantOrProjectName (com.google.cloud.talent.v4beta1.TenantOrProjectName)1 Test (org.junit.Test)1