Company
Copyright: Copyright (c) KnowGate 2003
55565758596061626364656667
if (company == null) { throw new IllegalArgumentException("company may not be null."); } Company returnCompany = new Company(); returnCompany.setName("MultipartSoft"); returnCompany.setPresident("Dr. Multipart"); company.value = returnCompany; lastSavedCustomer = parameters.getCustomer(); }
251252253254255256257258259260261
{ String json = "{\"employees\":[" + "{\"id\":1,\"name\":\"First\",\"manager\":2,\"reports\":[]}," + "{\"id\":2,\"name\":\"Second\",\"manager\":null,\"reports\":[1]}" + "]}"; Company company = mapper.readValue(json, Company.class); assertEquals(2, company.employees.size()); Employee firstEmployee = company.employees.get(0); Employee secondEmployee = company.employees.get(1); assertEquals(1, firstEmployee.id); assertEquals(2, secondEmployee.id);
424344454647484950515253545556575859
// Get the CompanyService. CompanyServiceInterface companyService = dfpServices.get(session, CompanyServiceInterface.class); // Create an advertiser. Company company1 = new Company(); company1.setName("Advertiser #" + new Random().nextLong()); company1.setType(CompanyType.ADVERTISER); // Create an agency. Company company2 = new Company(); company2.setName("Agency #" + new Random().nextLong()); company2.setType(CompanyType.AGENCY); // Create the companies on the server. Company[] companies = companyService.createCompanies(new Company[] {company1, company2}); for (Company company : companies) {
// Get the CompanyService. CompanyServiceInterface companyService = dfpServices.get(session, CompanyServiceInterface.class); // Create an advertiser. Company advertiser = new Company(); advertiser.setName("Advertiser #" + new Random().nextInt(Integer.MAX_VALUE)); advertiser.setType(CompanyType.ADVERTISER); // Create an agency. Company agency = new Company(); agency.setName("Agency #" + new Random().nextInt(Integer.MAX_VALUE)); agency.setType(CompanyType.AGENCY); // Create the companies on the server. Company[] companies = companyService.createCompanies(new Company[] {advertiser, agency}); for (Company createdCompany : companies) {
4344454647484950515253545556
// Get the CompanyService. CompanyServiceInterface companyService = dfpServices.get(session, CompanyServiceInterface.class); // Get the company. Company company = companyService.getCompany(companyId); // Update the comment. company.setComment(company.getComment() + " Updated."); // Update the company on the server. Company[] companies = companyService.updateCompanies(new Company[] {company}); for (Company updatedCompany : companies) {
6263646566676869707172
.withNetworkCode("TEST_NETWORK_CODE") .build(); CompanyServiceInterface companyService = new DfpServices().get(session, CompanyServiceInterface.class); List<Company> companies = companyService.createCompanies(Lists.newArrayList(new Company())); assertEquals(1234L, companies.get(0).getId().longValue()); assertEquals(SoapRequestXmlProvider.getClientLoginSoapRequest(API_VERSION), testHttpServer.getLastRequestBody()); }
43444546474849505152535455565758
// Set the ID of the company to get. Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE"); // Get the company. Company company = companyService.getCompany(companyId); if (company != null) { System.out.println("Company with ID \"" + company.getId() + "\", name \"" + company.getName() + "\", and type \"" + company.getType() + "\" was found."); } else { System.out.println("No company found for this ID."); } } catch (Exception e) { e.printStackTrace();