Search in sources :

Example 41 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project googleads-java-lib by googleads.

the class CreateLabels method runExample.

/**
 * Runs the example.
 *
 * @param adManagerServices the services factory.
 * @param session the session.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException {
    // Get the LabelService.
    LabelServiceInterface labelService = adManagerServices.get(session, LabelServiceInterface.class);
    // Create a competitive exclusion label.
    Label competitiveExclusionLabel = new Label();
    competitiveExclusionLabel.setName("Car company label #" + new Random().nextInt(Integer.MAX_VALUE));
    competitiveExclusionLabel.setTypes(new LabelType[] { LabelType.COMPETITIVE_EXCLUSION });
    // Create an ad unit frequency cap label.
    Label adUnitFrequencyCapLabel = new Label();
    adUnitFrequencyCapLabel.setName("Don't run too often label #" + new Random().nextInt(Integer.MAX_VALUE));
    adUnitFrequencyCapLabel.setTypes(new LabelType[] { LabelType.AD_UNIT_FREQUENCY_CAP });
    // Create the labels on the server.
    Label[] labels = labelService.createLabels(new Label[] { competitiveExclusionLabel, adUnitFrequencyCapLabel });
    for (Label createdLabel : labels) {
        System.out.printf("A label with ID %d and name '%s' was created.%n", createdLabel.getId(), createdLabel.getName());
    }
}
Also used : Random(java.util.Random) LabelServiceInterface(com.google.api.ads.admanager.axis.v202205.LabelServiceInterface) Label(com.google.api.ads.admanager.axis.v202205.Label)

Example 42 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project olca-modules by GreenDelta.

the class ProcessDoc method addDefaultCompany.

private void addDefaultCompany() {
    String id = "b35ea934-b41d-4830-b1aa-c7c678270240";
    for (Company company : dataSet.masterData.companies) {
        if (Objects.equals(id, company.id))
            return;
    }
    Company company = new Company();
    company.code = "UKNWN";
    company.comment = "This is a default entry as we cannot create persons" + " without company information for the EcoEditor.";
    company.id = id;
    company.name = "Unknown";
    dataSet.masterData.companies.add(company);
}
Also used : Company(spold2.Company)

Example 43 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project universal-db by teamapps-org.

the class DeleteTest method testRemoveReferencesOnEntityDeletion.

@Test
public void testRemoveReferencesOnEntityDeletion() {
    Person p = Person.create().setLastName("p");
    Company c = Company.create().setName("c").addEmployees(p).save();
    assertEquals(p, c.getEmployees().get(0));
    assertEquals(1, c.getEmployeesCount());
    p.delete();
    assertEquals(0, c.getEmployeesCount());
}
Also used : Company(org.teamapps.datamodel.testdb1.Company) Person(org.teamapps.datamodel.testdb1.Person) Test(org.junit.Test)

Example 44 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project universal-db by teamapps-org.

the class DeleteTest method testDeleteReferences.

@Test
public void testDeleteReferences() {
    Person p1 = Person.create().setLastName("p1").save();
    Person p2 = Person.create().setLastName("p2").save();
    Person p3 = Person.create().setLastName("p3").save();
    Person p4 = Person.create().setLastName("p4").save();
    Company c1 = Company.create().setName("c1").addEmployees(p1, p2, p3).save();
    Company c2 = Company.create().setName("c2").addEmployees(p4).save();
    assertTrue("employess of c1", TestBase.compareEntities(c1.getEmployees(), p1, p2, p3));
    assertTrue("employess of c2", TestBase.compareEntities(c2.getEmployees(), p4));
    assertEquals(p1.getCompany(), c1);
    assertEquals(p2.getCompany(), c1);
    assertEquals(p3.getCompany(), c1);
    assertEquals(p4.getCompany(), c2);
    c1.removeAllEmployees().save();
    assertTrue("p1 has no c", p1.getCompany() == null);
    assertTrue("p2 has no c", p2.getCompany() == null);
    assertTrue("p3 has no c", p3.getCompany() == null);
    assertTrue("p4 has c", p4.getCompany() != null);
    assertEquals("c1 has no employees", 0, c1.getEmployeesCount());
    assertTrue("employess of c1", TestBase.compareEntities(c1.getEmployees()));
}
Also used : Company(org.teamapps.datamodel.testdb1.Company) Person(org.teamapps.datamodel.testdb1.Person) Test(org.junit.Test)

Example 45 with Company

use of com.google.api.ads.admanager.axis.v202205.Company in project java-talent by googleapis.

the class JobSearchGetCompany method sampleGetCompany.

/**
 * Get Company
 */
public static void sampleGetCompany(String projectId, String tenantId, String companyId) {
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        CompanyName name = CompanyWithTenantName.of(projectId, tenantId, companyId);
        GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(name.toString()).build();
        Company response = companyServiceClient.getCompany(request);
        System.out.printf("Company name: %s\n", response.getName());
        System.out.printf("Display name: %s\n", response.getDisplayName());
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : CompanyName(com.google.cloud.talent.v4beta1.CompanyName) CompanyServiceClient(com.google.cloud.talent.v4beta1.CompanyServiceClient) Company(com.google.cloud.talent.v4beta1.Company) GetCompanyRequest(com.google.cloud.talent.v4beta1.GetCompanyRequest)

Aggregations

Random (java.util.Random)12 Test (org.junit.Test)11 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 Size (com.google.api.ads.admanager.axis.v202205.Size)6 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)6 AdManagerSession (com.google.api.ads.admanager.lib.client.AdManagerSession)5 MockHttpIntegrationTest (com.google.api.ads.common.lib.testing.MockHttpIntegrationTest)5 GoogleCredential (com.google.api.client.googleapis.auth.oauth2.GoogleCredential)5 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202205.StatementBuilder)4 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 Creative (com.google.api.ads.admanager.axis.v202205.Creative)4 CreativeServiceInterface (com.google.api.ads.admanager.axis.v202205.CreativeServiceInterface)4 NetHttpTransport (com.google.api.client.http.javanet.NetHttpTransport)4