Search in sources :

Example 6 with CreateJobRequest

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

the class JobSearchCreateJob method createJob.

// Create a job.
public static void createJob(String projectId, String tenantId, String companyId, String requisitionId, String jobApplicationUrl) 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);
        Job.ApplicationInfo applicationInfo = Job.ApplicationInfo.newBuilder().addUris(jobApplicationUrl).build();
        List<String> addresses = Arrays.asList("1600 Amphitheatre Parkway, Mountain View, CA 94043", "111 8th Avenue, New York, NY 10011");
        // By default, job will expire in 30 days.
        // https://cloud.google.com/talent-solution/job-search/docs/jobs
        Job job = Job.newBuilder().setCompany(companyId).setRequisitionId(requisitionId).setTitle("Software Developer").setDescription("Develop, maintain the software solutions.").setApplicationInfo(applicationInfo).addAllAddresses(addresses).setLanguageCode("en-US").build();
        CreateJobRequest request = CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();
        Job response = jobServiceClient.createJob(request);
        System.out.format("Created job: %s%n", response.getName());
    }
}
Also used : TenantName(com.google.cloud.talent.v4.TenantName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job) CreateJobRequest(com.google.cloud.talent.v4.CreateJobRequest)

Example 7 with CreateJobRequest

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

the class JobSearchCreateJobCustomAttributes method createJob.

// Create Job with Custom Attributes.
public static void createJob(String projectId, String tenantId, String companyId, String requisitionId) 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);
        // Custom attribute can be string or numeric value, and can be filtered in search queries.
        // https://cloud.google.com/talent-solution/job-search/docs/custom-attributes
        CustomAttribute customAttribute = CustomAttribute.newBuilder().addStringValues("Internship").addStringValues("Apprenticeship").setFilterable(true).build();
        Job job = Job.newBuilder().setCompany(companyId).setTitle("Software Developer I").setDescription("This is a description of this <i>wonderful</i> job!").putCustomAttributes("FOR_STUDENTS", customAttribute).setRequisitionId(requisitionId).setLanguageCode("en-US").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());
    }
}
Also used : TenantName(com.google.cloud.talent.v4.TenantName) CustomAttribute(com.google.cloud.talent.v4.CustomAttribute) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job) CreateJobRequest(com.google.cloud.talent.v4.CreateJobRequest)

Aggregations

CreateJobRequest (com.google.cloud.talent.v4beta1.CreateJobRequest)5 Job (com.google.cloud.talent.v4beta1.Job)5 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)4 CreateJobRequest (com.google.cloud.talent.v4.CreateJobRequest)2 Job (com.google.cloud.talent.v4.Job)2 JobServiceClient (com.google.cloud.talent.v4.JobServiceClient)2 TenantName (com.google.cloud.talent.v4.TenantName)2 TenantName (com.google.cloud.talent.v4beta1.TenantName)2 TenantOrProjectName (com.google.cloud.talent.v4beta1.TenantOrProjectName)2 CustomAttribute (com.google.cloud.talent.v4.CustomAttribute)1 Company (com.google.cloud.talent.v4beta1.Company)1 CreateCompanyRequest (com.google.cloud.talent.v4beta1.CreateCompanyRequest)1 CreateTenantRequest (com.google.cloud.talent.v4beta1.CreateTenantRequest)1 CustomAttribute (com.google.cloud.talent.v4beta1.CustomAttribute)1 Tenant (com.google.cloud.talent.v4beta1.Tenant)1 BeforeClass (org.junit.BeforeClass)1