Package rocks.xmpp.extensions.vcard.temp.model

Examples of rocks.xmpp.extensions.vcard.temp.model.VCard$Address


                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

                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

                "    <CLASS><PUBLIC/></CLASS>\n" +
                "  </vCard>\n" +
                "</iq>\n";

        IQ iq = unmarshal(xml, IQ.class);
        VCard vCard = iq.getExtension(VCard.class);
        Assert.assertNotNull(vCard);
        Assert.assertEquals(vCard.getFormattedName(), "Peter Saint-Andre");
        Assert.assertNotNull(vCard.getName());
        Assert.assertEquals(vCard.getName().getFamilyName(), "Saint-Andre");
        Assert.assertEquals(vCard.getName().getGivenName(), "Peter");
        Assert.assertEquals(vCard.getName().getMiddleName(), "");
        Assert.assertEquals(vCard.getNickName(), "stpeter");
        Assert.assertEquals(vCard.getUrl().toString(), new URL("http://www.xmpp.org/xsf/people/stpeter.shtml").toString());
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(vCard.getBirthday());
        Assert.assertEquals(calendar.get(Calendar.YEAR), 1966);
        Assert.assertEquals(calendar.get(Calendar.MONTH), Calendar.AUGUST);
        Assert.assertEquals(calendar.get(Calendar.DATE), 6);
        Assert.assertNotNull(vCard.getOrganization());
        Assert.assertEquals(vCard.getOrganization().getOrganizationName(), "XMPP Standards Foundation");
        Assert.assertEquals(vCard.getOrganization().getOrgUnits().size(), 1);
        Assert.assertEquals(vCard.getTitle(), "Executive Director");
        Assert.assertEquals(vCard.getRole(), "Patron Saint");

        Assert.assertEquals(vCard.getTelephoneNumbers().size(), 6);
        Assert.assertEquals(vCard.getTelephoneNumbers().get(0).getNumber(), "303-308-3282");
        Assert.assertTrue(vCard.getTelephoneNumbers().get(0).isVoice());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(0).isWork());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(1).isFax());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(1).isWork());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(2).isMsg());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(2).isWork());
        Assert.assertEquals(vCard.getTelephoneNumbers().get(3).getNumber(), "303-555-1212");
        Assert.assertTrue(vCard.getTelephoneNumbers().get(3).isVoice());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(3).isHome());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(4).isFax());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(4).isHome());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(5).isMsg());
        Assert.assertTrue(vCard.getTelephoneNumbers().get(5).isHome());

        Assert.assertTrue(vCard.getEmails().get(0).isPreferred());
        Assert.assertTrue(vCard.getEmails().get(0).isInternet());
        Assert.assertEquals(vCard.getEmails().get(0).getEmail(), "stpeter@jabber.org");
        Assert.assertEquals(vCard.getJid(), Jid.valueOf("stpeter@jabber.org"));
        Assert.assertEquals(vCard.getCategories().size(), 1);
        Assert.assertEquals(vCard.getCategories().get(0), "test");

        Assert.assertEquals(vCard.getDesc(), "\n" +
                "      More information about me is located on my \n" +
                "      personal website: http://www.saint-andre.com/\n" +
                "    ");

    }
View Full Code Here

    }

    @Test
    public void marshalVCard() throws JAXBException, XMLStreamException {
        VCard vCard = new VCard();
        String xml = marshal(vCard);
        Assert.assertEquals("<vCard xmlns=\"vcard-temp\" version=\"3.0\"></vCard>", xml);
    }
View Full Code Here

        Assert.assertEquals("<vCard xmlns=\"vcard-temp\" version=\"3.0\"></vCard>", xml);
    }

    @Test
    public void marshalBirthDayVCard() throws JAXBException, XMLStreamException {
        VCard vCard = new VCard();
        Calendar calendar = new GregorianCalendar();
        calendar.set(Calendar.YEAR, 2004);
        calendar.set(Calendar.MONTH, Calendar.MARCH);
        calendar.set(Calendar.DATE, 19);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        vCard.setBirthday(calendar.getTime());
        String xml = marshal(vCard);
        Assert.assertEquals("<vCard xmlns=\"vcard-temp\" version=\"3.0\"><BDAY>2004-03-19Z</BDAY></vCard>", xml);
    }
View Full Code Here

                                @Override
                                public void handle(ActionEvent actionEvent) {
                                    VCardManager vCardManager = xmppSession.getExtensionManager(VCardManager.class);
                                    try {
                                        Jid jid = new Jid(item.contact.get().getJid().getLocal(), item.contact.get().getJid().getDomain());
                                        VCard vCard = vCardManager.getVCard(jid);
                                        int i = 0;
                                    } catch (XmppException e) {
                                        e.printStackTrace();
                                    }
View Full Code Here

     * @return The vCard.
     * @throws rocks.xmpp.core.stanza.model.StanzaException If the entity returned a stanza error.
     * @throws rocks.xmpp.core.session.NoResponseException  If the entity did not respond.
     */
    public VCard getVCard() throws XmppException {
        IQ result = xmppSession.query(new IQ(IQ.Type.GET, new VCard()));
        return result.getExtension(VCard.class);
    }
View Full Code Here

     */
    public VCard getVCard(Jid jid) throws XmppException {
        if (jid == null) {
            throw new IllegalArgumentException("jid must not be null.");
        }
        IQ result = xmppSession.query(new IQ(jid.asBareJid(), IQ.Type.GET, new VCard()));
        return result.getExtension(VCard.class);
    }
View Full Code Here

                avatar = new byte[0];
                hash = "";
                VCardManager vCardManager = xmppSession.getExtensionManager(VCardManager.class);

                // Load the vCard for that user
                VCard vCard;
                if (contact.equals(xmppSession.getConnectedResource().asBareJid())) {
                    vCard = vCardManager.getVCard();
                } else {
                    vCard = vCardManager.getVCard(contact);
                }
                if (vCard != null) {
                    // And check if it has a photo.
                    VCard.Image image = vCard.getPhoto();
                    if (image != null && image.getValue() != null) {
                        hash = XmppUtils.hash(image.getValue());
                        if (hash != null) {
                            avatar = image.getValue();
                        }
View Full Code Here

TOP

Related Classes of rocks.xmpp.extensions.vcard.temp.model.VCard$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.