You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Fernando Cabredo <fc...@yahoo.com> on 2009/02/24 16:10:23 UTC

Retrieving Property Values

Hi,

I am a developer based here in the Philippines and I am new to Apache Jackrabbit. 

I would like to retrieve some property values such as File Size, Date Last Modified, etc.

You may take a look at the following code fragments which I am using for retrieving the property values:

         PropertyIterator propIter = n.getProperties();
            while(propIter.hasNext()){
                    Property prop = propIter.nextProperty();
                    NodeProperty nodeproperty = new NodeProperty();
                    nodeproperty.setPropertyname(prop.getName());
                    nodeproperty.setPropertyvalue(prop.getValue().getString());
                    System.out.println("Property Name --->"+nodeproperty.getPropertyname());
                    System.out.println("Property Value --->"+nodeproperty.getPropertyvalue());
                    aList.add(nodeproperty);
            }

Output:

    Property Name --->jcr:created
    Property Value --->2009-02-24T19:51:44.765+08:00

    Property Name --->jcr:primaryType
    Property Value --->nt:file
    
I was expecting to find in the above code the properties I was looking for but only found two properties. These are the jcr:created and jcr:properties as shown in my sample output.

I hope somebody may help me on this. Thank you very much.


Fernando Cabredo



      

Re: Retrieving Property Values

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Feb 24, 2009 at 4:10 PM, Fernando Cabredo <fc...@yahoo.com> wrote:
> I would like to retrieve some property values such as File Size, Date Last Modified, etc.
>
> I was expecting to find in the above code the properties I was looking for but only found
> two properties. These are the jcr:created and jcr:properties as shown in my sample output.

The node type nt:file has a child node named "jcr:content", which is
typically of type "nt:resource" and contains the actual file contents
(in the binary jcr:data property) and also the mime type
(jcr:mimeType) and last modified (jcr:lastModified) - if available.
That depends on who created those nodes in the first place - are you
using Jackrabbit's webdav?

Have a look at the JCR spec [1], printing it out and reading it is
mandatory ;-) The nt:file node type is specified in section 6.7.22.6
[2]. There are also shorter tutorials linked on the web [3]

[1] http://jcp.org/en/jsr/detail?id=170
[2] http://www.day.com/specs/jcr/1.0/6.7.22.6_nt_file.html
[3] http://wiki.apache.org/jackrabbit/JcrLinks

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com