Search in sources :

Example 1 with Company

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

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

the class ITSystemTest method updateCompanyTest.

@Test
public void updateCompanyTest() {
    String careerSiteUri = "www.example.com";
    Company updateCompany = company.toBuilder().setCareerSiteUri(careerSiteUri).build();
    UpdateCompanyRequest request = UpdateCompanyRequest.newBuilder().setCompany(updateCompany).build();
    Company actual = companyServiceClient.updateCompany(request);
    assertEquals(company.getName(), actual.getName());
    assertEquals(company.getDisplayName(), actual.getDisplayName());
    assertEquals(careerSiteUri, actual.getCareerSiteUri());
}
Also used : Company(com.google.cloud.talent.v4beta1.Company) UpdateCompanyRequest(com.google.cloud.talent.v4beta1.UpdateCompanyRequest) Test(org.junit.Test)

Example 3 with Company

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

the class ITSystemTest method beforeTest.

@BeforeClass
public static void beforeTest() throws IOException {
    /* create tenant */
    tenantServiceClient = TenantServiceClient.create();
    Tenant createTenant = Tenant.newBuilder().setName(TENANT_NAME).setExternalId(EXTERNAL_ID).build();
    CreateTenantRequest request = CreateTenantRequest.newBuilder().setParent(PROJECT_NAME.toString()).setTenant(createTenant).build();
    tenant = tenantServiceClient.createTenant(request);
    tenantId = getId(tenant.getName());
    tenantName = TenantName.of(PROJECT_ID, tenantId);
    /* create company */
    companyServiceClient = CompanyServiceClient.create();
    Company createCompany = Company.newBuilder().setDisplayName(DISPLAY_NAME).setExternalId(EXTERNAL_ID).build();
    CreateCompanyRequest companyRequest = CreateCompanyRequest.newBuilder().setParent(tenantName.toString()).setCompany(createCompany).build();
    company = companyServiceClient.createCompany(companyRequest);
    companyId = getId(company.getName());
    companyName = CompanyName.ofProjectTenantCompanyName(PROJECT_ID, tenantId, companyId);
    /* create job */
    jobServiceClient = JobServiceClient.create();
    Job.ApplicationInfo applicationInfo = Job.ApplicationInfo.newBuilder().addAllUris(Arrays.asList(JOB_APPLICATION_URL)).build();
    Job createJob = Job.newBuilder().setCompany(companyId).setRequisitionId(REQUISITION_ID).setTitle(TITLE).setDescription(DESCRIPTION).setApplicationInfo(applicationInfo).addAllAddresses(Arrays.asList(ADDRESS_ONE, ADDRESS_TWO)).setLanguageCode(LANGUAGE_CODE).build();
    CreateJobRequest jobRequest = CreateJobRequest.newBuilder().setParent(tenantName.toString()).setJob(createJob).build();
    job = jobServiceClient.createJob(jobRequest);
    jobId = getId(job.getName());
    jobName = JobName.ofProjectTenantJobName(PROJECT_ID, tenantId, jobId);
    /*create event */
    eventServiceClient = EventServiceClient.create();
    // create completion
    completionClient = CompletionClient.create();
}
Also used : CreateTenantRequest(com.google.cloud.talent.v4beta1.CreateTenantRequest) Company(com.google.cloud.talent.v4beta1.Company) Tenant(com.google.cloud.talent.v4beta1.Tenant) CreateCompanyRequest(com.google.cloud.talent.v4beta1.CreateCompanyRequest) Job(com.google.cloud.talent.v4beta1.Job) CreateJobRequest(com.google.cloud.talent.v4beta1.CreateJobRequest) BeforeClass(org.junit.BeforeClass)

Example 4 with Company

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

the class JobSearchCreateCompany method createCompany.

// Create a company.
public static void createCompany(String projectId, String tenantId, String displayName, String externalId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        TenantName 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.format("Name: %s%n", response.getName());
        System.out.format("Display Name: %s%n", response.getDisplayName());
        System.out.format("External ID: %s%n", response.getExternalId());
    }
}
Also used : CompanyServiceClient(com.google.cloud.talent.v4.CompanyServiceClient) Company(com.google.cloud.talent.v4.Company) CreateCompanyRequest(com.google.cloud.talent.v4.CreateCompanyRequest) TenantName(com.google.cloud.talent.v4.TenantName)

Example 5 with Company

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

the class JobSearchListCompanies method listCompanies.

// List Companies.
public static void listCompanies(String projectId, String tenantId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        ListCompaniesRequest request = ListCompaniesRequest.newBuilder().setParent(parent.toString()).build();
        for (Company responseItem : companyServiceClient.listCompanies(request).iterateAll()) {
            System.out.format("Company Name: %s%n", responseItem.getName());
            System.out.format("Display Name: %s%n", responseItem.getDisplayName());
            System.out.format("External ID: %s%n", responseItem.getExternalId());
        }
    }
}
Also used : ListCompaniesRequest(com.google.cloud.talent.v4.ListCompaniesRequest) CompanyServiceClient(com.google.cloud.talent.v4.CompanyServiceClient) Company(com.google.cloud.talent.v4.Company) TenantName(com.google.cloud.talent.v4.TenantName)

Aggregations

Test (org.junit.Test)13 Company (com.google.cloud.talent.v4beta1.Company)10 Company (com.google.api.ads.admanager.axis.v202205.Company)7 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202205.CompanyServiceInterface)7 AdManagerSession (com.google.api.ads.admanager.lib.client.AdManagerSession)6 MockHttpIntegrationTest (com.google.api.ads.common.lib.testing.MockHttpIntegrationTest)6 GoogleCredential (com.google.api.client.googleapis.auth.oauth2.GoogleCredential)6 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)6 NetHttpTransport (com.google.api.client.http.javanet.NetHttpTransport)5 JacksonFactory (com.google.api.client.json.jackson2.JacksonFactory)5 Company (com.google.api.ads.admanager.axis.v202108.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202108.CompanyServiceInterface)4 Company (com.google.api.ads.admanager.axis.v202111.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202111.CompanyServiceInterface)4 Company (com.google.api.ads.admanager.axis.v202202.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202202.CompanyServiceInterface)4 CompanyServiceClient (com.google.cloud.talent.v4.CompanyServiceClient)4 Random (java.util.Random)4 Diff (org.xmlunit.diff.Diff)4 AdManagerServices (com.google.api.ads.admanager.axis.factory.AdManagerServices)3