"Official" API to create programatically a field ?
Sébastien Landeau <[email protected]>
| Newsgroups | gmane.comp.cms.jahia.devel |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
i am writing a tool to import some content in an empty site and i have
to create fields of various types dynamically from jahia API.
Some research on the mailing list point me out the static methods of the
subclass of class 'org.jahia.services.fields.ContentField'.
Everithing works fine with :
~ - ContentPageField.createNewPage(...) for creating direct page fields
~ - ContentSmallTextField.createSmallText(..) for creating smalltext
fields
but methods for some other types failed due to the field type miscoded
inside the static method.
The exemple below stands for Float field and is ripped from class
'org.jahia.services.fields.ContentFloatField' ::
//--------------------------------------------------------------------------
public static synchronized ContentFloatField
~ createFloat (int siteID, int pageID, int containerID,
~ int fieldDefID, int parentAclID, int aclID,
~ float value, ParamBean jParams)
~ throws JahiaException
{
~ ContentFloatField result = (ContentFloatField)
~ ContentField.createField (
~ siteID, pageID, containerID,fieldDefID,
~ ContentFieldTypes.BOOLEAN, <------- IS THIS NORMAL ??????
~ ConnectionTypes.LOCAL, parentAclID,aclID);
~ EntrySaveRequest saveRequest = new EntrySaveRequest(
~ jParams.getUser (),ContentField.SHARED_LANGUAGE);
~ result.setFloat (value, saveRequest);
~ return result;
~ }
The same problem show up at least for :
~ - ContentPageField.createPageLink(...)
~ - ContentPageField.createRemoteURL(...)
~ - ContentDateField.createDate(...)
Am i using the right API ? If not (this one should be deprecated) which
API can i use ?
thanks in advance
Emmanuel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCQobgPYMbxu29ktsRAtn0AKCFfJEOLitWevlAk0A4gp+VuZB3kwCff4i+
+06qGL5x2BnCM2vpn7LheJQ=
=mSUK
-----END PGP SIGNATURE-----