Accessing the form's metadata and being able to add custom metadata

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing the form's metadata and being able to add custom metadata

ktangirala
Hi,

I would like to know how to access the metadata of the form such as app name, form name, title etc. If I see the XHTML source in the Form Builder (using Edit Source link), it looks like this:

            <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
                <metadata>
                    <application-name>testapp</application-name>
                    <form-name>testform</form-name>
                    <title xml:lang="en">Application for Citizenship</title>
                    <description xml:lang="en"/>
                    <author/>
                    <logo mediatype="" filename="" size=""/>
                </metadata>
            </xforms:instance>


I would like to access this metadata programmatically in a Java serverside file (say, in my REST API persistence layer).

Optionally, I would also like to know how to add new metadata while designing this form. For example, in my case, I want to store the department name this form belongs to. Can I simply add the tag <department>My Department</department> to the XHTML source? Is there any automatic way of doing this since I will have to do this on hundreds of forms.

Any help would be appreciated.

Cheers,
K
DL
Reply | Threaded
Open this post in threaded view
|

Re: Accessing the form's metadata and being able to add custom metadata

DL
Out of curiosity I searched the forum and found these two threads .. there might be other ways ..


http://orbeon-forms-ops-users.24843.n4.nabble.com/Integrating-custom-jsps-with-Orbeon-Form-Runner-td3010153.html


http://orbeon-forms-ops-users.24843.n4.nabble.com/including-the-form-name-in-the-submitted-XML-workflow-send-td2327974.html#a2538958


From the second thread above it seems that there is some project in the orbeon team's work in progress ..

http://wiki.orbeon.com/forms/projects/form-runner-builder/form-runner-data-envelope

Rationale

Form Runner currently receives and sends form data only, as an XML document. Metadata such as form name, app name, document UUID, are provided via request parameters.

For more advanced applications, including workflow-based applications, this is not enough as the amount of metadata increases.

We propose to allow Form Runner to encapsulate form data within a Form Runner-specific envelope, which can contain this type of metadata.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing the form's metadata and being able to add custom metadata

Erik Bruchez
Administrator
In reply to this post by ktangirala
This information is in the form definition, as you noticed.

Now if you want to access this from your persistence layer upon e.g. a save, you could:

* load the form definition (easy if it's handled by your persistence layer as well)
* parse the resulting XML
* search for the <metadata> element and its sub-elements in the form definition

The Form Runner summary page actually does something similar: in order to learn about which form fields to show, etc. it also loads the form definition.

That metadata section was initially designed for Form Builder/Runner use only.

We have recently started thinking about adding support for an envelope:


That would be more appropriate for what you are looking to do, but unfortunately it's not yet implemented.

This said, if you add your <department> element, Form Builder/Runner won't complain.

-Erik

On Mon, Jan 17, 2011 at 3:29 AM, ktangirala <[hidden email]> wrote:

Hi,

I would like to know how to access the metadata of the form such as app
name, form name, title etc. If I see the XHTML source in the Form Builder
(using Edit Source link), it looks like this:

           <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
               <metadata>
                   <application-name>testapp</application-name>
                   <form-name>testform</form-name>
                   <title xml:lang="en">Application for Citizenship</title>
                   <description xml:lang="en"/>
                   <author/>
                   <logo mediatype="" filename="" size=""/>
               </metadata>
           </xforms:instance>

I would like to access this metadata programmatically in a Java serverside
file (say, in my REST API persistence layer).

Optionally, I would also like to know how to add new metadata while
designing this form. For example, in my case, I want to store the department
name this form belongs to. Can I simply add the tag <department>My
Department</department> to the XHTML source? Is there any automatic way of
doing this since I will have to do this on hundreds of forms.

Any help would be appreciated.

Cheers,
K

--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Accessing-the-form-s-metadata-and-being-able-to-add-custom-metadata-tp3221052p3221052.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Accessing the form's metadata and being able to add custom metadata

ktangirala
Thanks, DL and Erik for your replies. Understood the solution to my problem.

K