use of ezvcard.property.Url in project ez-vcard by mangstadt.
the class SampleVCardsTest method rfc6350_example.
@Test
public void rfc6350_example() throws Throwable {
VCardAsserter asserter = read("rfc6350-example.vcf");
asserter.next(V4_0);
// @formatter:off
asserter.simpleProperty(FormattedName.class).value("Simon Perreault").noMore();
asserter.structuredName().family("Perreault").given("Simon").suffixes("ing. jr", "M.Sc.").noMore();
asserter.dateProperty(Birthday.class).partialDate(PartialDate.builder().month(2).date(3).build()).noMore();
asserter.dateProperty(Anniversary.class).partialDate(PartialDate.builder().year(2009).month(8).date(8).hour(14).minute(30).offset(new UtcOffset(false, -5, 0)).build()).noMore();
asserter.property(Gender.class).expected(Gender.male()).noMore();
asserter.simpleProperty(Language.class).value("fr").param("PREF", "1").next().value("en").param("PREF", "2").noMore();
asserter.listProperty(Organization.class).param("TYPE", "work").values("Viagenie").noMore();
asserter.address().extendedAddress("Suite D2-630").streetAddress("2875 Laurier").locality("Quebec").region("QC").postalCode("G1V 2M2").country("Canada").types(AddressType.WORK).noMore();
asserter.telephone().types(TelephoneType.WORK, TelephoneType.VOICE).uri(new TelUri.Builder("+1-418-656-9254").extension("102").build()).param("PREF", "1").next().types(TelephoneType.WORK, TelephoneType.CELL, TelephoneType.VOICE, TelephoneType.VIDEO, TelephoneType.TEXT).uri(new TelUri.Builder("+1-418-262-6501").build()).noMore();
asserter.email().types(EmailType.WORK).value("simon.perreault@viagenie.ca").noMore();
asserter.geo().latitude(46.772673).longitude(-71.282945).param("TYPE", "work").noMore();
asserter.binaryProperty(Key.class).url("http://www.viagenie.ca/simon.perreault/simon.asc").param("TYPE", "work").noMore();
asserter.timezone().offset(new UtcOffset(false, -5, 0)).noMore();
asserter.simpleProperty(Url.class).value("http://nomis80.org").param("TYPE", "home").noMore();
// @formatter:on
asserter.validate().run();
asserter.done();
}
use of ezvcard.property.Url in project ez-vcard by mangstadt.
the class XCardDocumentTest method read_rfc6351_example.
@Test
public void read_rfc6351_example() throws Throwable {
VCardAsserter asserter = readFile("rfc6351-example.xml");
asserter.next(V4_0);
// @formatter:off
asserter.simpleProperty(FormattedName.class).value("Simon Perreault").noMore();
asserter.structuredName().family("Perreault").given("Simon").suffixes("ing. jr", "M.Sc.").noMore();
asserter.dateProperty(Birthday.class).partialDate(PartialDate.builder().month(2).date(3).build()).noMore();
asserter.dateProperty(Anniversary.class).partialDate(PartialDate.builder().year(2009).month(8).date(8).hour(14).minute(30).offset(new UtcOffset(false, -5, 0)).build()).noMore();
asserter.property(Gender.class).expected(Gender.male()).noMore();
asserter.simpleProperty(Language.class).value("fr").param("PREF", "1").next().value("en").param("PREF", "2").noMore();
asserter.listProperty(Organization.class).values("Viagenie").param("TYPE", "work").noMore();
asserter.address().streetAddress("2875 boul. Laurier, suite D2-630").locality("Quebec").region("QC").postalCode("G1V 2M2").country("Canada").label("Simon Perreault\n2875 boul. Laurier, suite D2-630\nQuebec, QC, Canada\nG1V 2M2").types(AddressType.WORK).noMore();
asserter.telephone().uri(new TelUri.Builder("+1-418-656-9254").extension("102").build()).types(TelephoneType.WORK, TelephoneType.VOICE).next().uri(new TelUri.Builder("+1-418-262-6501").build()).types(TelephoneType.WORK, TelephoneType.TEXT, TelephoneType.VOICE, TelephoneType.CELL, TelephoneType.VIDEO).noMore();
asserter.email().value("simon.perreault@viagenie.ca").types(EmailType.WORK).noMore();
asserter.geo().latitude(46.766336).longitude(-71.28955).param("TYPE", "work").noMore();
asserter.binaryProperty(Key.class).url("http://www.viagenie.ca/simon.perreault/simon.asc").param("TYPE", "work").noMore();
asserter.timezone().text("America/Montreal").noMore();
asserter.simpleProperty(Url.class).value("http://nomis80.org").param("TYPE", "home").noMore();
// @formatter:on
asserter.validate().run();
asserter.done();
}
use of ezvcard.property.Url in project ez-vcard by mangstadt.
the class JCardReaderTest method jcard_example.
@Test
public void jcard_example() throws Throwable {
JCardReader reader = new JCardReader(getClass().getResourceAsStream("jcard-example.json"));
VCardAsserter asserter = new VCardAsserter(reader);
asserter.next(V4_0);
// @formatter:off
asserter.simpleProperty(FormattedName.class).value("Simon Perreault").noMore();
asserter.structuredName().family("Perreault").given("Simon").suffixes("ing. jr", "M.Sc.").noMore();
asserter.dateProperty(Birthday.class).partialDate(PartialDate.builder().month(2).date(3).build()).noMore();
asserter.dateProperty(Anniversary.class).date("2009-08-08 19:30:00 +0000").noMore();
asserter.property(Gender.class).expected(Gender.male()).noMore();
asserter.simpleProperty(Language.class).value("fr").param("PREF", "1").next().value("en").param("PREF", "2").noMore();
asserter.listProperty(Organization.class).values("Viagenie").param("TYPE", "work").noMore();
asserter.address().extendedAddress("Suite D2-630").streetAddress("2875 Laurier").locality("Quebec").region("QC").postalCode("G1V 2M2").country("Canada").types(AddressType.WORK).noMore();
asserter.telephone().uri(new TelUri.Builder("+1-418-656-9254").extension("102").build()).types(TelephoneType.WORK, TelephoneType.VOICE).param("PREF", "1").next().uri(new TelUri.Builder("+1-418-262-6501").build()).types(TelephoneType.WORK, TelephoneType.CELL, TelephoneType.VOICE, TelephoneType.VIDEO, TelephoneType.TEXT).noMore();
asserter.email().value("simon.perreault@viagenie.ca").types(EmailType.WORK).noMore();
asserter.geo().latitude(46.772673).longitude(-71.282945).param("TYPE", "work").noMore();
asserter.binaryProperty(Key.class).url("http://www.viagenie.ca/simon.perreault/simon.asc").param("TYPE", "work").noMore();
asserter.timezone().offset(new UtcOffset(false, -5, 0)).noMore();
asserter.simpleProperty(Url.class).value("http://nomis80.org").param("TYPE", "home").noMore();
// @formatter:on
asserter.validate().run();
asserter.done();
}
use of ezvcard.property.Url in project qksms by moezbhatti.
the class ContactOperations method convertWebsites.
private void convertWebsites(List<NonEmptyContentValues> contentValues, VCard vcard) {
for (Url url : vcard.getUrls()) {
String urlValue = url.getValue();
if (isEmpty(urlValue)) {
continue;
}
int type = DataMappings.getWebSiteType(url.getType());
NonEmptyContentValues cv = new NonEmptyContentValues(ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE);
cv.put(ContactsContract.CommonDataKinds.Website.URL, urlValue);
cv.put(ContactsContract.CommonDataKinds.Website.TYPE, type);
contentValues.add(cv);
}
}
use of ezvcard.property.Url in project android by nextcloud.
the class ContactOperations method convertWebsites.
private void convertWebsites(List<NonEmptyContentValues> contentValues, VCard vcard) {
for (Url url : vcard.getUrls()) {
String urlValue = url.getValue();
if (isEmpty(urlValue)) {
continue;
}
int type = DataMappings.getWebSiteType(url.getType());
NonEmptyContentValues cv = new NonEmptyContentValues(ContactsContract.CommonDataKinds.Website.CONTENT_ITEM_TYPE);
cv.put(ContactsContract.CommonDataKinds.Website.URL, urlValue);
cv.put(ContactsContract.CommonDataKinds.Website.TYPE, type);
contentValues.add(cv);
}
}
Aggregations