Search in sources :

Example 11 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class HistogramSearchJobs method searchJobs.

// Search Jobs with histogram queries.
public static void searchJobs(String projectId, String tenantId, String query) 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);
        String domain = "http://www.jobUrl.com";
        String sessionId = "Hashed session identifier";
        String userId = "Hashed user identifier";
        RequestMetadata requestMetadata = RequestMetadata.newBuilder().setDomain(domain).setSessionId(sessionId).setUserId(userId).build();
        HistogramQuery histogramQueriesElement = HistogramQuery.newBuilder().setHistogramQuery(query).build();
        SearchJobsRequest request = SearchJobsRequest.newBuilder().setParent(parent.toString()).setRequestMetadata(requestMetadata).addHistogramQueries(histogramQueriesElement).build();
        for (SearchJobsResponse.MatchingJob responseItem : jobServiceClient.searchJobs(request).getMatchingJobsList()) {
            System.out.format("Job summary: %s%n", responseItem.getJobSummary());
            System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet());
            Job job = responseItem.getJob();
            System.out.format("Job name: %s%n", job.getName());
            System.out.format("Job title: %s%n", job.getTitle());
        }
    }
}
Also used : SearchJobsRequest(com.google.cloud.talent.v4.SearchJobsRequest) SearchJobsResponse(com.google.cloud.talent.v4.SearchJobsResponse) TenantName(com.google.cloud.talent.v4.TenantName) HistogramQuery(com.google.cloud.talent.v4.HistogramQuery) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job) RequestMetadata(com.google.cloud.talent.v4.RequestMetadata)

Example 12 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class JobSearchCreateClientEvent method createClientEvent.

// Creates a client event.
public static void createClientEvent(String projectId, String tenantId, String requestId, String eventId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        // The timestamp of the event as seconds of UTC time since Unix epoch
        // For more information on how to create google.protobuf.Timestamps
        // See:
        // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto
        long seconds = 3L;
        Timestamp createTime = Timestamp.newBuilder().setSeconds(seconds).build();
        // The type of event attributed to the behavior of the end user
        JobEvent.JobEventType type = JobEvent.JobEventType.VIEW;
        // List of job names associated with this event
        String jobsElement = "projects/[Project ID]/tenants/[Tenant ID]/jobs/[Job ID]";
        String jobsElement2 = "projects/[Project ID]/tenants/[Tenant ID]/jobs/[Job ID]";
        List<String> jobs = Arrays.asList(jobsElement, jobsElement2);
        JobEvent jobEvent = JobEvent.newBuilder().setType(type).addAllJobs(jobs).build();
        ClientEvent clientEvent = ClientEvent.newBuilder().setRequestId(requestId).setEventId(eventId).setCreateTime(createTime).setJobEvent(jobEvent).build();
        CreateClientEventRequest request = CreateClientEventRequest.newBuilder().setParent(parent.toString()).setClientEvent(clientEvent).build();
        ClientEvent response = eventServiceClient.createClientEvent(request);
        System.out.println("Created client event. ");
        System.out.println(response.toString());
    }
}
Also used : JobEvent(com.google.cloud.talent.v4.JobEvent) CreateClientEventRequest(com.google.cloud.talent.v4.CreateClientEventRequest) TenantName(com.google.cloud.talent.v4.TenantName) Timestamp(com.google.protobuf.Timestamp) EventServiceClient(com.google.cloud.talent.v4.EventServiceClient) ClientEvent(com.google.cloud.talent.v4.ClientEvent)

Example 13 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class JobSearchGetJob method getJob.

// Get Job.
public static void getJob(String projectId, String tenantId, String jobId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        JobName name = JobName.of(projectId, tenantId, jobId);
        GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build();
        Job response = jobServiceClient.getJob(request);
        System.out.format("Job name: %s%n", response.getName());
        System.out.format("Requisition ID: %s%n", response.getRequisitionId());
        System.out.format("Title: %s%n", response.getTitle());
        System.out.format("Description: %s%n", response.getDescription());
        System.out.format("Posting language: %s%n", response.getLanguageCode());
        for (String address : response.getAddressesList()) {
            System.out.format("Address: %s%n", address);
        }
        for (String email : response.getApplicationInfo().getEmailsList()) {
            System.out.format("Email: %s%n", email);
        }
        for (String websiteUri : response.getApplicationInfo().getUrisList()) {
            System.out.format("Website: %s%n", websiteUri);
        }
    }
}
Also used : GetJobRequest(com.google.cloud.talent.v4.GetJobRequest) JobName(com.google.cloud.talent.v4.JobName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job)

Example 14 with Job

use of com.google.cloud.talent.v4.Job 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 15 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class JobSearchCreateJobCustomAttributes method sampleCreateJob.

/**
 * Create Job with Custom Attributes
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenantd
 */
public static void sampleCreateJob(String projectId, String tenantId, String companyName, String requisitionId, String languageCode) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        Job job = Job.newBuilder().setCompany(companyName).setRequisitionId(requisitionId).setLanguageCode(languageCode).build();
        CreateJobRequest request = CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();
        Job response = jobServiceClient.createJob(request);
        System.out.printf("Created job: %s\n", response.getName());
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName) Job(com.google.cloud.talent.v4beta1.Job) CreateJobRequest(com.google.cloud.talent.v4beta1.CreateJobRequest)

Aggregations

Job (org.pentaho.platform.api.scheduler2.Job)94 Test (org.junit.Test)89 Job (io.fabric8.kubernetes.api.model.batch.v1.Job)38 Serializable (java.io.Serializable)25 ArrayList (java.util.ArrayList)24 SimpleJobTrigger (org.pentaho.platform.api.scheduler2.SimpleJobTrigger)21 Job (com.google.cloud.talent.v4beta1.Job)20 HashMap (java.util.HashMap)20 JobScheduleRequest (org.pentaho.platform.web.http.api.resources.JobScheduleRequest)19 ComplexJobTrigger (org.pentaho.platform.api.scheduler2.ComplexJobTrigger)18 SchedulerException (org.pentaho.platform.api.scheduler2.SchedulerException)17 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)16 Date (java.util.Date)14 IJobFilter (org.pentaho.platform.api.scheduler2.IJobFilter)14 Job (com.google.cloud.video.transcoder.v1.Job)13 TranscoderServiceClient (com.google.cloud.video.transcoder.v1.TranscoderServiceClient)13 JobBuilder (io.fabric8.kubernetes.api.model.batch.v1.JobBuilder)13 IJobTrigger (org.pentaho.platform.api.scheduler2.IJobTrigger)12 Map (java.util.Map)11 Test (org.junit.jupiter.api.Test)10