Skip to content

Rebrand Cloud Job Discovery to Cloud Talent Solution and add the V3 code samples #1166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c70d4f1
cjd samples
xinyunh0929 May 25, 2018
a28ec01
cjd samples
xinyunh0929 May 25, 2018
7f7293c
modify README
xinyunh0929 May 25, 2018
c570984
modify README
xinyunh0929 May 25, 2018
73dda6b
revert gitignore
xinyunh0929 May 25, 2018
003db4c
Add license header
xinyunh0929 Jun 7, 2018
d2e0a91
Update the samples
xinyunh0929 Jun 12, 2018
d7a4c66
Reorganize the samples and add more comments
xinyunh0929 Jun 13, 2018
9b44abc
Change the google could samples version from LATEST to 1.0.9
xinyunh0929 Jun 14, 2018
ef17884
Modify the tenantJobSearch
xinyunh0929 Jun 15, 2018
93b9d6a
separate the sample tests
xinyunh0929 Jun 26, 2018
8607285
Add quickstart and remove the deprecated samples
xinyunh0929 Jul 6, 2018
9e43b55
Remove unused folder
xinyunh0929 Jul 6, 2018
85b9cb4
cjd samples
xinyunh0929 May 25, 2018
239cc2c
cjd samples
xinyunh0929 May 25, 2018
c51199e
modify README
xinyunh0929 May 25, 2018
43281ca
modify README
xinyunh0929 May 25, 2018
6501db6
revert gitignore
xinyunh0929 May 25, 2018
e183b36
Add license header
xinyunh0929 Jun 7, 2018
7da2831
Update the samples
xinyunh0929 Jun 12, 2018
570c483
Reorganize the samples and add more comments
xinyunh0929 Jun 13, 2018
78449e5
Change the google could samples version from LATEST to 1.0.9
xinyunh0929 Jun 14, 2018
b7cd304
Modify the tenantJobSearch
xinyunh0929 Jun 15, 2018
4ba8fc5
separate the sample tests
xinyunh0929 Jun 26, 2018
036df70
Add quickstart and remove the deprecated samples
xinyunh0929 Jul 6, 2018
f6472ed
Remove unused folder
xinyunh0929 Jul 6, 2018
0bc11e5
Remove deprecated code sample and modify the comment
xinyunh0929 Jul 9, 2018
7e4ece1
Remove service util
xinyunh0929 Jul 10, 2018
9a04af1
V3 quickstart change
xinyunh0929 Jul 19, 2018
d10c911
Merge with GoogleCloudPlatform and add v3 samples
xinyunh0929 Jul 25, 2018
2bea522
Add v3 samples
xinyunh0929 Jul 30, 2018
a50c30f
Remove v3 local resource from pom
xinyunh0929 Jul 30, 2018
8670838
Modify Readme
xinyunh0929 Jul 30, 2018
183f380
Merge branch 'master' into cloud-talent-solution
xinyunh0929 Jul 30, 2018
fa85218
Modify V3 code sample and related tests
xinyunh0929 Aug 25, 2018
7832c54
Merge branch 'cloud-talent-solution' of https://github.com/xinyunh092…
xinyunh0929 Aug 25, 2018
e0034de
Modify the package version
xinyunh0929 Aug 25, 2018
244649a
Merge branch 'master' into cloud-talent-solution
xinyunh0929 Aug 25, 2018
9ab80cf
Unify the setup and modify some samples
xinyunh0929 Aug 27, 2018
db06179
Merge branch 'cloud-talent-solution' of https://github.com/xinyunh092…
xinyunh0929 Aug 27, 2018
c17c3b0
Remove unnecessary files
xinyunh0929 Aug 27, 2018
fdaa515
Merge branch 'master' into cloud-talent-solution
xinyunh0929 Aug 29, 2018
f5d189a
Delete READONLY
xinyunh0929 Aug 31, 2018
df239d8
Fix some typo errors
xinyunh0929 Aug 31, 2018
d3c8e4f
Merge branch 'master' into cloud-talent-solution
xinyunh0929 Aug 31, 2018
d1ddc58
Format the V3 code samples
xinyunh0929 Sep 4, 2018
0bc77bc
Merge branch 'master' into cloud-talent-solution
xinyunh0929 Sep 4, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion READONLY

This file was deleted.

10 changes: 5 additions & 5 deletions jobs/cjd_sample/README.md → jobs/v2/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Cloud Job Discovery client samples
# Cloud Talent Solution client samples

<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=jobs/cjd_sample/README.md">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

[Cloud Job Discovery][jobs] is part of Google for Jobs - a Google-wide commitment to help people find jobs more easily. Job Discovery provides plug and play access to Google’s search and machine learning capabilities, enabling the entire recruiting ecosystem - company career sites, job boards, applicant tracking systems, and staffing agencies to improve job site engagement and candidate conversion.
[Cloud Talent Solution][jobs] is part of Google for Jobs - a Google-wide commitment to help people find jobs more easily. Talent Solution provides plug and play access to Google’s search and machine learning capabilities, enabling the entire recruiting ecosystem - company career sites, job boards, applicant tracking systems, and staffing agencies to improve job site engagement and candidate conversion.

This sample Java application demonstrates how to access the Cloud Job Discovery API using the [Google Cloud Client Library for Java][google-cloud-java].
This sample Java application demonstrates how to access the Cloud Talent Solution API using the [Google Cloud Client Library for Java][google-cloud-java].

[jobs]: https://cloud.google.com/job-discovery/
[jobs]: https://cloud.google.com/talent-solution/job-search/docs
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java

## Setup

1. Install [Maven](http://maven.apache.org/).
1. [Enable](https://console.cloud.google.com/apis/api/jobs.googleapis.com/overview) Cloud Job Discovery API.
1. [Enable](https://console.cloud.google.com/apis/api/jobs.googleapis.com/overview) Cloud Talent Solution API.

## Build

Expand Down
52 changes: 52 additions & 0 deletions jobs/v2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.samples</groupId>
<artifactId>cloud-talent-solution-samples</artifactId>
<version>2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<!--
The parent pom defines common style checks and testing strategies for our samples.
Removing or replacing it should not affect the execution of the samples in anyway.
-->
<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.0.10</version>
</parent>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>

<prerequisites>
<maven>3.5</maven>
</prerequisites>

<dependencies>
<!-- [START dependencies] -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-jobs</artifactId>
<version>v2-rev17-1.24.1</version>
</dependency>
<!-- [END dependencies] -->

<!-- Test dependencies -->
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>0.40</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>RELEASE</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public static void jobTitleAutoComplete(String companyName, String query)

System.out.println(results);
}
// [END auto_complete_default]
// [END auto_complete_job_title]

// [START auto_complete_default]
/**
* Auto completes job titles within given companyName.
*/
Expand Down
39 changes: 39 additions & 0 deletions jobs/v3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Cloud Talent Solution client samples

<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=jobs/cjd_sample/README.md">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

[Cloud Talent Solution][jobs] is part of Google for Jobs - a Google-wide commitment to help people find jobs more easily. Talent Solution provides plug and play access to Google’s search and machine learning capabilities, enabling the entire recruiting ecosystem - company career sites, job boards, applicant tracking systems, and staffing agencies to improve job site engagement and candidate conversion.

This sample Java application demonstrates how to access the Cloud Talent Solution API using the [Google Cloud Client Library for Java][google-cloud-java].

[jobs]: https://cloud.google.com/talent-solution/job-search/docs
[google-cloud-java]: https://github.com/GoogleCloudPlatform/google-cloud-java

## Setup

1. Install [Maven](http://maven.apache.org/).
1. [Enable](https://console.cloud.google.com/apis/api/jobs.googleapis.com/overview) Cloud Talent Solution API.

## Build

Build your project with:
```
mvn clean package
```

## Local testing

1. [Create a service account](https://cloud.google.com/docs/authentication/getting-started#creating_the_service_account)
and set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable, for example:
```
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/key.json
```
2. Run all samples with command:
```
mvn -Dtest=SampleTests test
```
Or a single sample:
```
mvn exec:java -Dexec.mainClass="com.google.samples.BatchOperationSample"
```
6 changes: 3 additions & 3 deletions jobs/cjd_sample/pom.xml → jobs/v3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.samples</groupId>
<artifactId>cloud-job-discovery-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<artifactId>cloud-talent-solution-samples</artifactId>
<version>3.0-SNAPSHOT</version>
<packaging>jar</packaging>

<!--
Expand All @@ -32,7 +32,7 @@
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-jobs</artifactId>
<version>LATEST</version>
<version>v3-rev5-1.24.1</version>
</dependency>
<!-- [END dependencies] -->

Expand Down
106 changes: 106 additions & 0 deletions jobs/v3/src/main/java/com/google/samples/AutoCompleteSample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.samples;

import com.google.api.services.jobs.v3.CloudTalentSolution;
import com.google.api.services.jobs.v3.CloudTalentSolution.Projects.Complete;
import com.google.api.services.jobs.v3.model.Company;
import com.google.api.services.jobs.v3.model.CompleteQueryResponse;
import com.google.api.services.jobs.v3.model.Job;
import java.io.IOException;

/**
* The samples in this file introduced how to do the auto complete, including:
*
* - Default auto complete (on both company display name and job title)
*
* - Auto complete on job title only
*/
public final class AutoCompleteSample {

private static final String DEFAULT_PROJECT_ID =
"projects/" + System.getenv("GOOGLE_CLOUD_PROJECT");

private static CloudTalentSolution talentSolutionClient = JobServiceQuickstart
.getTalentSolutionClient();

//[START auto_complete_job_title]

/**
* Auto completes job titles within given companyName.
*/
public static void jobTitleAutoComplete(String companyName, String query)
throws IOException {

Complete complete =
talentSolutionClient
.projects()
.complete(DEFAULT_PROJECT_ID)
.setQuery(query)
.setLanguageCode("en-US")
.setType("JOB_TITLE")
.setPageSize(10);
if (companyName != null) {
complete.setCompanyName(companyName);
}

CompleteQueryResponse results = complete.execute();

System.out.println(results);
}
// [END auto_complete_default]

/**
* Auto completes job titles within given companyName.
*/
public static void defaultAutoComplete(String companyName, String query)
throws IOException {
Complete complete =
talentSolutionClient
.projects()
.complete(DEFAULT_PROJECT_ID)
.setQuery(query)
.setLanguageCode("en-US")
.setPageSize(10);
if (companyName != null) {
complete.setCompanyName(companyName);
}

CompleteQueryResponse results = complete.execute();

System.out.println(results);
}
// [END auto_complete_default]

public static void main(String... args) throws Exception {
Company companyToBeCreated = BasicCompanySample.generateCompany().setDisplayName("Google");
String companyName = BasicCompanySample.createCompany(companyToBeCreated).getName();

Job jobToBeCreated = BasicJobSample.generateJobWithRequiredFields(companyName)
.setTitle("Software engineer");
final String jobName = BasicJobSample.createJob(jobToBeCreated).getName();

// Wait several seconds for post processing
Thread.sleep(10000);
defaultAutoComplete(companyName, "goo");
defaultAutoComplete(companyName, "sof");
jobTitleAutoComplete(companyName, "sof");

BasicJobSample.deleteJob(jobName);
BasicCompanySample.deleteCompany(companyName);
}
}
Loading