Package com.google.api.ads.dfp.v201308

Examples of com.google.api.ads.dfp.v201308.Contact


   */
  public static Value createValue(Object value) {
    if (value instanceof Value) {
      return (Value) value;
    } else if (value == null) {
      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else if (value instanceof Date) {
View Full Code Here


      // Set the ID of the contact to update.
      Long contactId = Long.parseLong("INSERT_CONTACT_ID_HERE");

      // Get the contact.
      Contact contact = contactService.getContact(contactId);

      // Update the address of the contact.
      contact.setAddress("123 New Street, New York, NY, 10011");

      // Update the contact on the server.
      Contact[] contacts = contactService.updateContacts(new Contact[] {contact});

      for (Contact updatedContact : contacts) {
View Full Code Here

      // Set the IDs of the companies for the contacts.
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");
      Long agencyCompanyId = Long.parseLong("INSERT_AGENCY_COMPANY_ID_HERE");

      // Create an advertiser contact.
      Contact advertiserContact = new Contact();
      advertiserContact.setName("Mr. Advertiser #" + new Random().nextLong());
      advertiserContact.setEmail("advertiser@advertising.com");
      advertiserContact.setCompanyId(advertiserCompanyId);

      // Create an agency contact.
      Contact agencyContact = new Contact();
      agencyContact.setName("Ms. Agency #" + new Random().nextLong());
      agencyContact.setEmail("agency@agencies.com");
      agencyContact.setCompanyId(agencyCompanyId);

      // Create the contacts on the server.
      Contact[] contacts =
          contactService.createContacts(new Contact[] {advertiserContact, agencyContact});
View Full Code Here

    /**
     * Create an instance of {@link Contact }
     *
     */
    public Contact createContact() {
        return new Contact();
    }
View Full Code Here

            /*
             * first do primary, and then filter that out in the loop
             */
            if (primaryContact != null) {
                Contact ct = getContactFromJAXRUser(primaryContact);
                carr[0] = ct;
            }

            it = users.iterator();
            int carrPos = 1;
            while (it.hasNext()) {
                User u = (User) it.next();

                if (u != primaryContact) {
                    Contact ct = getContactFromJAXRUser(u);
                    carr[carrPos] = ct;
                    carrPos++;
                }
            }

View Full Code Here

     *
     * Convert JAXR User Object to UDDI  Contact
     */
    public static Contact getContactFromJAXRUser(User user)
      throws JAXRException {
    Contact ct = objectFactory.createContact();
        if (user == null) {
            return null;
        }

    Address[] addarr = new Address[0];
    Phone[] phonearr = new Phone[0];
    Email[] emailarr = new Email[0];
    try {
     
      if (user.getPersonName() != null && user.getPersonName().getFullName() != null) {
        ct.setPersonName(user.getPersonName().getFullName());
      }
     
      if (user.getType() != null) {
            ct.setUseType(user.getType());
      }
      // Postal Address
            Collection<PostalAddress> postc = user.getPostalAddresses();

      addarr = new Address[postc.size()];

            Iterator<PostalAddress> iterator = postc.iterator();
      int addarrPos = 0;
      while (iterator.hasNext()) {
                PostalAddress post = (PostalAddress) iterator.next();
        addarr[addarrPos] = ScoutJaxrUddiHelper.getAddress(post);
        addarrPos++;
            }
      // Phone Numbers
            Collection ph = user.getTelephoneNumbers(null);

      phonearr = new Phone[ph.size()];

            Iterator it = ph.iterator();
      int phonearrPos = 0;
      while (it.hasNext()) {
                TelephoneNumber t = (TelephoneNumber) it.next();
        Phone phone = objectFactory.createPhone();
                String str = t.getNumber();
                log.debug("Telephone=" + str);
       
        // FIXME: If phone number is null, should the phone
        // not be set at all, or set to empty string?
        if (str != null) {
          phone.setValue(str);
        } else {
          phone.setValue("");
        }

        phonearr[phonearrPos] = phone;
        phonearrPos++;
            }

      // Email Addresses
            Collection ec = user.getEmailAddresses();

      emailarr = new Email[ec.size()];

            Iterator iter = ec.iterator();
      int emailarrPos = 0;
      while (iter.hasNext()) {
                EmailAddress ea = (EmailAddress) iter.next();
        Email email = objectFactory.createEmail();
       
        if (ea.getAddress() != null) {
          email.setValue(ea.getAddress());
        }
        // email.setText( ea.getAddress() );
       
        if (ea.getType() != null) {
                email.setUseType(ea.getType());
            }

        emailarr[emailarrPos] = email;
        emailarrPos++;
      }
      ct.getAddress().addAll(Arrays.asList(addarr));
      ct.getPhone().addAll(Arrays.asList(phonearr));
      ct.getEmail().addAll(Arrays.asList(emailarr));
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return ct;
    }
View Full Code Here

            /*
             * first do primary, and then filter that out in the loop
             */
            if (primaryContact != null) {
                Contact ct = getContactFromJAXRUser(primaryContact);
                carr[0] = ct;
            }

            it = users.iterator();
            int carrPos = 1;
            while (it.hasNext()) {
                User u = (User) it.next();

                if (u != primaryContact) {
                    Contact ct = getContactFromJAXRUser(u);
                    carr[carrPos] = ct;
                    carrPos++;
                }
            }

View Full Code Here

     *
     * Convert JAXR User Object to UDDI  Contact
     */
    public static Contact getContactFromJAXRUser(User user)
      throws JAXRException {
    Contact ct = objectFactory.createContact();
        if (user == null) {
            return null;
        }

    Address[] addarr = new Address[0];
    Phone[] phonearr = new Phone[0];
    Email[] emailarr = new Email[0];
    try {
     
      if (user.getPersonName() != null && user.getPersonName().getFullName() != null) {
        ct.setPersonName(user.getPersonName().getFullName());
      }
     
      if (user.getType() != null) {
            ct.setUseType(user.getType());
      }
      // Postal Address
            Collection<PostalAddress> postc = user.getPostalAddresses();

      addarr = new Address[postc.size()];

            Iterator<PostalAddress> iterator = postc.iterator();
      int addarrPos = 0;
      while (iterator.hasNext()) {
                PostalAddress post = (PostalAddress) iterator.next();
        addarr[addarrPos] = ScoutJaxrUddiHelper.getAddress(post);
        addarrPos++;
            }
      // Phone Numbers
            Collection ph = user.getTelephoneNumbers(null);

      phonearr = new Phone[ph.size()];

            Iterator it = ph.iterator();
      int phonearrPos = 0;
      while (it.hasNext()) {
                TelephoneNumber t = (TelephoneNumber) it.next();
        Phone phone = objectFactory.createPhone();
                String str = t.getNumber();
                log.debug("Telephone=" + str);
       
        // FIXME: If phone number is null, should the phone
        // not be set at all, or set to empty string?
        if (str != null) {
          phone.setValue(str);
        } else {
          phone.setValue("");
        }

        phonearr[phonearrPos] = phone;
        phonearrPos++;
            }

      // Email Addresses
            Collection ec = user.getEmailAddresses();

      emailarr = new Email[ec.size()];

            Iterator iter = ec.iterator();
      int emailarrPos = 0;
      while (iter.hasNext()) {
                EmailAddress ea = (EmailAddress) iter.next();
        Email email = objectFactory.createEmail();
       
        if (ea.getAddress() != null) {
          email.setValue(ea.getAddress());
        }
        // email.setText( ea.getAddress() );
       
        if (ea.getType() != null) {
                email.setUseType(ea.getType());
            }

        emailarr[emailarrPos] = email;
        emailarrPos++;
      }
      ct.getAddress().addAll(Arrays.asList(addarr));
      ct.getPhone().addAll(Arrays.asList(phonearr));
      ct.getEmail().addAll(Arrays.asList(emailarr));
    } catch (Exception ud) {
            throw new JAXRException("Apache JAXR Impl:", ud);
        }
        return ct;
    }
View Full Code Here

      return setExportLifetime;
   }

   public static Contact createContact(Postal postal, Telecom telecom, Online online)
   {
      Contact contact = new Contact();
      contact.setPostal(postal);
      contact.setTelecom(telecom);
      contact.setOnline(online);

      return contact;
   }
View Full Code Here

      {
         PersonName name = toV2PersonName(v1UserProfile.getName());
         XMLGregorianCalendar bdate = v1UserProfile.getBdate();
         String gender = v1UserProfile.getGender();
         EmployerInfo employerInfo = toV2EmployerInfo(v1UserProfile.getEmployerInfo());
         Contact homeInfo = toV2Context(v1UserProfile.getHomeInfo());
         Contact businessInfo = toV2Context(v1UserProfile.getBusinessInfo());
         UserProfile userProfile = WSRPTypeFactory.createUserProfile(name, bdate, gender, employerInfo, homeInfo, businessInfo);

         return userProfile;
      }
      else
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201308.Contact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.