Package org.jivesoftware.smackx.packet

Examples of org.jivesoftware.smackx.packet.MultipleAddresses$Address


     * @param packet the packet to check.
     * @return the MultipleRecipientInfo contained in the specified packet or <tt>null</tt>
     *         if none was found.
     */
    public static MultipleRecipientInfo getMultipleRecipientInfo(Packet packet) {
        MultipleAddresses extension = (MultipleAddresses) packet
                .getExtension("addresses", "http://jabber.org/protocol/address");
        return extension == null ? null : new MultipleRecipientInfo(extension);
    }
View Full Code Here


    private static void sendThroughService(Connection connection, Packet packet, List<String> to,
            List<String> cc, List<String> bcc, String replyTo, String replyRoom, boolean noReply,
            String serviceAddress) {
        // Create multiple recipient extension
        MultipleAddresses multipleAddresses = new MultipleAddresses();
        if (to != null) {
            for (Iterator<String> it = to.iterator(); it.hasNext();) {
                String jid = it.next();
                multipleAddresses.addAddress(MultipleAddresses.TO, jid, null, null, false, null);
            }
        }
        if (cc != null) {
            for (Iterator<String> it = cc.iterator(); it.hasNext();) {
                String jid = it.next();
                multipleAddresses.addAddress(MultipleAddresses.CC, jid, null, null, false, null);
            }
        }
        if (bcc != null) {
            for (Iterator<String> it = bcc.iterator(); it.hasNext();) {
                String jid = it.next();
                multipleAddresses.addAddress(MultipleAddresses.BCC, jid, null, null, false, null);
            }
        }
        if (noReply) {
            multipleAddresses.setNoReply();
        }
        else {
            if (replyTo != null && replyTo.trim().length() > 0) {
                multipleAddresses
                        .addAddress(MultipleAddresses.REPLY_TO, replyTo, null, null, false, null);
            }
            if (replyRoom != null && replyRoom.trim().length() > 0) {
                multipleAddresses.addAddress(MultipleAddresses.REPLY_ROOM, replyRoom, null, null,
                        false, null);
            }
        }
        // Set the multiple recipient service address as the target address
        packet.setTo(serviceAddress);
View Full Code Here

    public MultipleAddressesProvider() {
    }

    public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
        boolean done = false;
        MultipleAddresses multipleAddresses = new MultipleAddresses();
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG) {
                if (parser.getName().equals("address")) {
                    String type = parser.getAttributeValue("", "type");
                    String jid = parser.getAttributeValue("", "jid");
                    String node = parser.getAttributeValue("", "node");
                    String desc = parser.getAttributeValue("", "desc");
                    boolean delivered = "true".equals(parser.getAttributeValue("", "delivered"));
                    String uri = parser.getAttributeValue("", "uri");
                    // Add the parsed address
                    multipleAddresses.addAddress(type, jid, node, desc, delivered, uri);
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals(multipleAddresses.getElementName())) {
                    done = true;
                }
            }
        }
        return multipleAddresses;
View Full Code Here

                List<Address> r = new ArrayList<Address>();
                if (address == null) {
                        return r;
                }
                for (int i = 0; i < address.size(); i++) {
                        Address x = new Address();
                        x.setSortCode(address.get(i).getSortCode());
                        x.setTModelKey(address.get(i).getTModelKey());
                        x.setUseType(address.get(i).getUseType());
                        x.getAddressLine().addAll(MapAddressLine(address.get(i).getAddressLine()));
                        r.add(x);
                }
                return r;
        }
View Full Code Here

    addressLineThree.setKeyName("zip");
    addressLineThree.setKeyValue("zip");
    addressLineThree.setValue(data.getZip(5));
   
    //One address for the contact. Can be more but only one here.
    Address address = new Address();
    address.setLang("en");
    address.setSortCode("1");
    address.setTModelKey("uddi:tmodelKey:address");
    address.setUseType("HQ");
    address.getAddressLine().add(addressLineOne);
    address.getAddressLine().add(addressLineTwo);
    address.getAddressLine().add(addressLineThree);
   
    //Contacts phone number details
    Phone phone = new Phone();
    phone.setUseType("Hotline");
    phone.setValue(data.getUSPhoneNumber());
View Full Code Here

   * @param useType
   * @return
   */
  public static Address generateAddress(List<AddressLine> addressLines, String lang, String sortCode, String tModelKey, String useType)
  {
    Address address = new Address();
    if (addressLines != null)
      for (AddressLine al : addressLines)
        address.getAddressLine().add(al);
    if (lang != null)
      address.setLang(lang);
    if (sortCode != null)
      address.setSortCode(sortCode);
    if (tModelKey != null)
      address.setTModelKey(tModelKey);
    if (useType != null)
      address.setUseType(useType);
   
    return address;
  }
View Full Code Here

  }
 
  public static Address getAddress(List<Address> entityList, String lang) {
   
    if (entityList.size()==0) {
      Address address = new Address();
      address.setLang(lang);
      entityList.add(address);
    }
    if (lang==null) return entityList.get(0);
    for (Address entity : entityList) {
      if (lang.equalsIgnoreCase(entity.getLang())) {
View Full Code Here

        PersonName n = new PersonName();
        n.setValue("Bob");
        c.getPersonName().add(n);

        cc.getContact().add(c);
        Address a = new Address();
        if (oversizedSortCode) {
            a.setSortCode(str11);
        } else {
            a.setSortCode(str10);
        }
        if (oversizedLang) {
            a.setLang(str27);
        } else {
            a.setLang(str26);
        }
        if (oversizedTmodel) {
            a.setTModelKey(str256);
        } else {
            a.setTModelKey(str255);
        }
        if (oversizedUseType) {
            a.setUseType(str256);
        } else {
            a.setUseType(str255);
        }
        if (oversizedSortCode) {
            a.setSortCode(str11);
        } else {
            a.setSortCode(str10);
        }
        AddressLine al = new AddressLine();
        if (oversizedAddressKN) {
            al.setKeyName(str256); //optional
        } else {
            al.setKeyName(str255); //optional
        }
        if (oversizedAddressKV) {
            al.setKeyValue(str256); //optional
        } else {
            al.setKeyValue(str255); //optional
        }
        if (oversizedAddressLineValue) {
            al.setValue(str81); //this one is required
        } else {
            al.setValue(str80);
        }
        a.getAddressLine().add(al);
        c.getAddress().add(a);
        return cc;
    }
View Full Code Here

                Contact admin = new Contact();
                admin.setUseType("it support");
                admin.getEmail().add(new Email("admin@localhost", "primary"));
                admin.getDescription().add(new Description("the guy in that keeps the lights green", "en"));
                admin.getPersonName().add(new PersonName("admin1", "en"));
                Address r=new Address();
                r.setLang("en");
                r.setSortCode("none");
                r.setTModelKey(domainprefix + "address");
                r.setUseType("mailing address");
                r.getAddressLine().add(new AddressLine("keyname","keyval","1313 mockingbird lane"));
                admin.getAddress().add(r);
                c.getContact().add(admin);
                return c;
               
        }
View Full Code Here

                List<Address> r = new ArrayList<Address>();
                if (address == null) {
                        return r;
                }
                for (int i = 0; i < address.size(); i++) {
                        Address x = new Address();
                        x.setSortCode(address.get(i).getSortCode());
                        x.setTModelKey(address.get(i).getTModelKey());
                        x.setUseType(address.get(i).getUseType());
                        x.getAddressLine().addAll(MapAddressLine(address.get(i).getAddressLine()));
                        r.add(x);
                }
                return r;

        }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.packet.MultipleAddresses$Address

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.