Search in sources :

Example 1 with TenantOrProjectName

use of com.google.cloud.talent.v4beta1.TenantOrProjectName in project java-talent by googleapis.

the class JobSearchCommuteSearch method sampleSearchJobs.

/**
 * Search Jobs using commute distance
 */
public static void sampleSearchJobs(String projectId, String tenantId) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        String domain = "www.example.com";
        String sessionId = "Hashed session identifier";
        String userId = "Hashed user identifier";
        RequestMetadata requestMetadata = RequestMetadata.newBuilder().setDomain(domain).setSessionId(sessionId).setUserId(userId).build();
        CommuteMethod commuteMethod = CommuteMethod.TRANSIT;
        long seconds = 1800L;
        Duration travelDuration = Duration.newBuilder().setSeconds(seconds).build();
        double latitude = 37.422408;
        double longitude = -122.084068;
        LatLng startCoordinates = LatLng.newBuilder().setLatitude(latitude).setLongitude(longitude).build();
        CommuteFilter commuteFilter = CommuteFilter.newBuilder().setCommuteMethod(commuteMethod).setTravelDuration(travelDuration).setStartCoordinates(startCoordinates).build();
        JobQuery jobQuery = JobQuery.newBuilder().setCommuteFilter(commuteFilter).build();
        SearchJobsRequest request = SearchJobsRequest.newBuilder().setParent(parent.toString()).setRequestMetadata(requestMetadata).setJobQuery(jobQuery).build();
        for (SearchJobsResponse.MatchingJob responseItem : jobServiceClient.searchJobs(request).iterateAll()) {
            System.out.printf("Job summary: %s\n", responseItem.getJobSummary());
            System.out.printf("Job title snippet: %s\n", responseItem.getJobTitleSnippet());
            Job job = responseItem.getJob();
            System.out.printf("Job name: %s\n", job.getName());
            System.out.printf("Job title: %s\n", job.getTitle());
        }
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : SearchJobsRequest(com.google.cloud.talent.v4beta1.SearchJobsRequest) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) Duration(com.google.protobuf.Duration) RequestMetadata(com.google.cloud.talent.v4beta1.RequestMetadata) CommuteFilter(com.google.cloud.talent.v4beta1.CommuteFilter) JobQuery(com.google.cloud.talent.v4beta1.JobQuery) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName) LatLng(com.google.type.LatLng) Job(com.google.cloud.talent.v4beta1.Job) CommuteMethod(com.google.cloud.talent.v4beta1.CommuteMethod)

Example 2 with TenantOrProjectName

use of com.google.cloud.talent.v4beta1.TenantOrProjectName in project java-talent by googleapis.

the class JobSearchCreateCompany method sampleCreateCompany.

/**
 * Create Company
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleCreateCompany(String projectId, String tenantId, String displayName, String externalId) {
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        Company company = Company.newBuilder().setDisplayName(displayName).setExternalId(externalId).build();
        CreateCompanyRequest request = CreateCompanyRequest.newBuilder().setParent(parent.toString()).setCompany(company).build();
        Company response = companyServiceClient.createCompany(request);
        System.out.println("Created Company");
        System.out.printf("Name: %s\n", response.getName());
        System.out.printf("Display Name: %s\n", response.getDisplayName());
        System.out.printf("External ID: %s\n", response.getExternalId());
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : CompanyServiceClient(com.google.cloud.talent.v4beta1.CompanyServiceClient) Company(com.google.cloud.talent.v4beta1.Company) CreateCompanyRequest(com.google.cloud.talent.v4beta1.CreateCompanyRequest) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName)

Example 3 with TenantOrProjectName

use of com.google.cloud.talent.v4beta1.TenantOrProjectName 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 4 with TenantOrProjectName

use of com.google.cloud.talent.v4beta1.TenantOrProjectName 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)

Example 5 with TenantOrProjectName

use of com.google.cloud.talent.v4beta1.TenantOrProjectName in project java-talent by googleapis.

the class JobSearchCustomRankingSearch method sampleSearchJobs.

/**
 * Search Jobs using custom rankings
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenantd
 */
public static void sampleSearchJobs(String projectId, String tenantId) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        String domain = "www.example.com";
        String sessionId = "Hashed session identifier";
        String userId = "Hashed user identifier";
        RequestMetadata requestMetadata = RequestMetadata.newBuilder().setDomain(domain).setSessionId(sessionId).setUserId(userId).build();
        SearchJobsRequest.CustomRankingInfo.ImportanceLevel importanceLevel = SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME;
        String rankingExpression = "(someFieldLong + 25) * 0.25";
        SearchJobsRequest.CustomRankingInfo customRankingInfo = SearchJobsRequest.CustomRankingInfo.newBuilder().setImportanceLevel(importanceLevel).setRankingExpression(rankingExpression).build();
        String orderBy = "custom_ranking desc";
        SearchJobsRequest request = SearchJobsRequest.newBuilder().setParent(parent.toString()).setRequestMetadata(requestMetadata).setCustomRankingInfo(customRankingInfo).setOrderBy(orderBy).build();
        for (SearchJobsResponse.MatchingJob responseItem : jobServiceClient.searchJobs(request).iterateAll()) {
            System.out.printf("Job summary: %s\n", responseItem.getJobSummary());
            System.out.printf("Job title snippet: %s\n", responseItem.getJobTitleSnippet());
            Job job = responseItem.getJob();
            System.out.printf("Job name: %s\n", job.getName());
            System.out.printf("Job title: %s\n", job.getTitle());
        }
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : SearchJobsRequest(com.google.cloud.talent.v4beta1.SearchJobsRequest) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName) Job(com.google.cloud.talent.v4beta1.Job) RequestMetadata(com.google.cloud.talent.v4beta1.RequestMetadata)

Aggregations

TenantOrProjectName (com.google.cloud.talent.v4beta1.TenantOrProjectName)11 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)7 Job (com.google.cloud.talent.v4beta1.Job)6 RequestMetadata (com.google.cloud.talent.v4beta1.RequestMetadata)3 SearchJobsRequest (com.google.cloud.talent.v4beta1.SearchJobsRequest)3 Company (com.google.cloud.talent.v4beta1.Company)2 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)2 CreateJobRequest (com.google.cloud.talent.v4beta1.CreateJobRequest)2 BatchDeleteJobsRequest (com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest)1 ClientEvent (com.google.cloud.talent.v4beta1.ClientEvent)1 CommuteFilter (com.google.cloud.talent.v4beta1.CommuteFilter)1 CommuteMethod (com.google.cloud.talent.v4beta1.CommuteMethod)1 CompleteQueryRequest (com.google.cloud.talent.v4beta1.CompleteQueryRequest)1 CompleteQueryResponse (com.google.cloud.talent.v4beta1.CompleteQueryResponse)1 CompletionClient (com.google.cloud.talent.v4beta1.CompletionClient)1 CreateClientEventRequest (com.google.cloud.talent.v4beta1.CreateClientEventRequest)1 CreateCompanyRequest (com.google.cloud.talent.v4beta1.CreateCompanyRequest)1 EventServiceClient (com.google.cloud.talent.v4beta1.EventServiceClient)1 HistogramQuery (com.google.cloud.talent.v4beta1.HistogramQuery)1 JobEvent (com.google.cloud.talent.v4beta1.JobEvent)1