if (email.getTypes().isEmpty()) { r.addProperty(VCARD4.hasEmail, mailTo); } else { Resource emailResource = personModel.createResource(); emailResource.addProperty(VCARD4.value, mailTo); for (EmailType type : email.getTypes()) { for (Resource emailTypeResource : getPhoneOrMailTypes(type.getValue(), MAP_OF_EMAIL_TYPES)) {
if (emailResource.hasProperty(RDF.type)) { emailResource.listProperties(RDF.type).forEachRemaining(typeProperty -> email.getTypes().add(EmailType.find(typeProperty.getResource().getLocalName())));
/** * <p> * Adds an email address. * </p> * <p> * <b>Property name:</b> {@code EMAIL}<br> * <b>Supported versions:</b> {@code 2.1, 3.0, 4.0} * </p> * @param email the email address to add (e.g. "johndoe@aol.com") * @param types the type(s) to assign to the email * @return the property object that was created * @see <a href="http://tools.ietf.org/html/rfc6350#page-36">RFC 6350 * p.36</a> * @see <a href="http://tools.ietf.org/html/rfc2426#page-15">RFC 2426 * p.15</a> * @see <a href="http://www.imc.org/pdi/vcard-21.doc">vCard 2.1 p.15</a> */ public Email addEmail(String email, EmailType... types) { Email property = new Email(email); property.getTypes().addAll(Arrays.asList(types)); addEmail(property); return property; }
@Override protected void _validate(List<ValidationWarning> warnings, VCardVersion version, VCard vcard) { super._validate(warnings, version, vcard); for (EmailType type : getTypes()) { if (type == EmailType.PREF) { //ignore because it is converted to a PREF parameter for 4.0 vCards continue; } if (!type.isSupportedBy(version)) { warnings.add(new ValidationWarning(9, type.getValue())); } } }
emailString += arrayToString(email.getTypes().toArray()) + ": " + email.getValue() + "\n";
if (nbEmailAddr > 1) { boolean workEmail = false; for (EmailType emailType : email.getTypes()) { if (EmailType.PREF.equals(emailType) || EmailType.WORK.equals(emailType)) { workEmail = true;