From 2b2f213ac82a5fbd101da8c16ac01166ece3c61d Mon Sep 17 00:00:00 2001 From: Marcel Berkholz Date: Sun, 7 Feb 2021 16:49:02 +0100 Subject: [PATCH] add fax entries from vcard, fixes #31 --- src/main/java/org/berkholz/vcard2fritzXML/CommandOptions.java | 3 ++- src/main/java/org/berkholz/vcard2fritzXML/Main.java | 4 ++-- src/main/java/org/berkholz/vcard2fritzXML/Telephony.java | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/berkholz/vcard2fritzXML/CommandOptions.java b/src/main/java/org/berkholz/vcard2fritzXML/CommandOptions.java index 457dccc..4e349b4 100644 --- a/src/main/java/org/berkholz/vcard2fritzXML/CommandOptions.java +++ b/src/main/java/org/berkholz/vcard2fritzXML/CommandOptions.java @@ -203,7 +203,7 @@ private static String generateTemplate(String filetype) { } private static String generateCSVTemplate() { - return "givenname,familyname,home,work,mobile,email\nJohn,Doe,0821/37097123,,,john.doe@example.com"; + return "givenname,familyname,home,work,mobile,fax,email\nJohn,Doe,0821/37097123,,,,john.doe@example.com"; } private static String generateVcardTemplate() { @@ -214,6 +214,7 @@ private static String generateVcardTemplate() { vcardExample.addTelephoneNumber("0821/37097123", TelephoneTypeParameter.HOME); vcardExample.addTelephoneNumber("0821/37097122", TelephoneTypeParameter.WORK); vcardExample.addTelephoneNumber("0171/37097121", TelephoneTypeParameter.CELL); + vcardExample.addTelephoneNumber("030/55512345", TelephoneTypeParameter.FAX); StructuredNameType sn = new StructuredNameType(); sn.setGiven("John"); sn.setFamily("Doe"); diff --git a/src/main/java/org/berkholz/vcard2fritzXML/Main.java b/src/main/java/org/berkholz/vcard2fritzXML/Main.java index f7d2503..56cf892 100644 --- a/src/main/java/org/berkholz/vcard2fritzXML/Main.java +++ b/src/main/java/org/berkholz/vcard2fritzXML/Main.java @@ -204,7 +204,7 @@ protected void createContactsFromCSVs() { //String fax_work = csvElement.get("fax_work"); c1.setServices(csvElement.get("email")); - Telephony tp = new Telephony(csvElement.get("home"), csvElement.get("work"), csvElement.get("mobile")); + Telephony tp = new Telephony(csvElement.get("home"), csvElement.get("work"), csvElement.get("mobile"), csvElement.get("fax")); c1.setTelephony(tp); @@ -256,7 +256,7 @@ protected void createContactsFromVCards() { // TODO: nach mehreren Begriffen suchen, wie cell, mobile etc. Telephony tp = new Telephony(Main.getTelephoneNumberByType(vcardElement.getTelephoneNumbers(), "home"), Main.getTelephoneNumberByType(vcardElement.getTelephoneNumbers(), "work"), Main.getTelephoneNumberByType( - vcardElement.getTelephoneNumbers(), "cell")); + vcardElement.getTelephoneNumbers(), "cell"), Main.getTelephoneNumberByType(vcardElement.getTelephoneNumbers(), "fax")); c1.setTelephony(tp); diff --git a/src/main/java/org/berkholz/vcard2fritzXML/Telephony.java b/src/main/java/org/berkholz/vcard2fritzXML/Telephony.java index 4dcd518..0fba923 100644 --- a/src/main/java/org/berkholz/vcard2fritzXML/Telephony.java +++ b/src/main/java/org/berkholz/vcard2fritzXML/Telephony.java @@ -18,6 +18,7 @@ package org.berkholz.vcard2fritzXML; import java.util.ArrayList; +import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; @@ -45,7 +46,7 @@ public class Telephony { * @param numberWork String representation of the work number. * @param numberMobile String representation of the mobile number. */ - public Telephony(String numberHome, String numberWork, String numberMobile) { + public Telephony(String numberHome, String numberWork, String numberMobile, String numberFax) { // create list of Numbers this.numbers = new ArrayList<>();