Extending properties in ical4j-vcard

2012-10-23
2013-06-05
  • Pascal Robert
    Pascal Robert
    2012-10-23

    Hi,

    What is the trick to add extended properties in ical4j-vcard? I need to get some X- attributes coming out from CardDAV stores, and it look need I will need to change the code of ical4j-connector to pass along a custom factory. But the other problem is that all standard properties for vCard are in Property.Id, which is a enum, and I can't extend this enum to add non-standard properties.

     
  • Ben Fortuna
    Ben Fortuna
    2012-10-23

    Hi Pascal,

    You don't need to create a new enum for the extended property, as there is a special enum value EXTENDED applied for non-standard properties.

    From memory you should create an implementation of PropertyFactory (http://build.mnode.org/projects/ical4j-vcard/apidocs/net/fortuna/ical4j/vcard/PropertyFactory.html) and register it with an instance of PropertyFactoryRegistry. eg:

    PropertyFactoryRegistry propRegistry = new PropertyFactoryRegistry();
    propRegistry.register("MYPROP", new MyPropPropertyFactory());
    VCardBuilder builder = new VCardBuilder(in, new GroupRegistry(), propRegistry, new ParameterFactoryRegistry());
    ...
    

    It's a little bit clunky actually, but I think that is the general idea..

    regards,
    ben

     
  • Pascal Robert
    Pascal Robert
    2012-10-24

    Ok, I will try that. But I can't even test it, I just saw that my Kerio Connect "friend" is not even including the extended properties in CardDAV responses… So I have another problem :-)