31
31
/**
32
32
* The sample in this file introduce featured job, including:
33
33
*
34
- * - Construct a featured job
34
+ * <p> - Construct a featured job
35
35
*
36
- * - Search featured job
36
+ * <p> - Search featured job
37
37
*/
38
38
public final class FeaturedJobsSearchSample {
39
39
40
40
private static final String DEFAULT_PROJECT_ID =
41
41
"projects/" + System .getenv ("GOOGLE_CLOUD_PROJECT" );
42
42
43
- private static CloudTalentSolution talentSolutionClient = JobServiceQuickstart
44
- .getTalentSolutionClient ();
43
+ private static CloudTalentSolution talentSolutionClient =
44
+ JobServiceQuickstart .getTalentSolutionClient ();
45
45
46
46
// [START featured_job]
47
47
48
- /**
49
- * Creates a job as featured.
50
- */
48
+ /** Creates a job as featured. */
51
49
public static Job generateFeaturedJob (String companyName ) throws IOException {
52
50
// requisition id should be a unique Id in your system.
53
- String requisitionId =
54
- "featuredJob:" + String .valueOf (new Random ().nextLong ());
51
+ String requisitionId = "featuredJob:" + String .valueOf (new Random ().nextLong ());
55
52
ApplicationInfo applicationInfo =
56
53
new ApplicationInfo ().setUris (Arrays .asList ("http://careers.google.com" ));
57
54
@@ -61,8 +58,7 @@ public static Job generateFeaturedJob(String companyName) throws IOException {
61
58
.setTitle ("Software Engineer" )
62
59
.setCompanyName (companyName )
63
60
.setApplicationInfo (applicationInfo )
64
- .setDescription (
65
- "Design, develop, test, deploy, maintain and improve software." )
61
+ .setDescription ("Design, develop, test, deploy, maintain and improve software." )
66
62
// Featured job is the job with positive promotion value
67
63
.setPromotionValue (2 );
68
64
System .out .println ("Job generated: " + job );
@@ -72,9 +68,7 @@ public static Job generateFeaturedJob(String companyName) throws IOException {
72
68
73
69
// [START search_featured_job]
74
70
75
- /**
76
- * Searches featured jobs.
77
- */
71
+ /** Searches featured jobs. */
78
72
public static void searchFeaturedJobs (String companyName ) throws IOException {
79
73
// Make sure to set the requestMetadata the same as the associated search request
80
74
RequestMetadata requestMetadata =
@@ -113,12 +107,13 @@ public static void main(String... args) throws Exception {
113
107
String companyName = BasicCompanySample .createCompany (companyToBeCreated ).getName ();
114
108
115
109
Job jobToBeCreated = generateFeaturedJob (companyName );
116
- String jobName = BasicJobSample .createJob (jobToBeCreated ).getName ();
110
+ final String jobName = BasicJobSample .createJob (jobToBeCreated ).getName ();
117
111
118
112
// Wait several seconds for post processing
119
- Thread .sleep (10000 );
113
+ Thread .sleep (5000 );
120
114
searchFeaturedJobs (companyName );
121
115
116
+ Thread .sleep (5000 );
122
117
BasicJobSample .deleteJob (jobName );
123
118
BasicCompanySample .deleteCompany (companyName );
124
119
}
0 commit comments