jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Thompson" <elephant...@gmail.com>
Subject Re: UUID
Date Fri, 23 Mar 2007 00:19:30 GMT
Why are you creating a query to look for the uuid?  Why not just use
session.getNodeByUUID()?

-Brian



On 3/22/07, Michal Hybler <m.hybler@email.cz> wrote:
>
> <snip>
> >
>
> I have this method
>
>                         ws = session.getWorkspace();
>                         manager = ws.getQueryManager();
>                         query = manager.createQuery("select * from
> nt:unstructured where jcr:uuid
> = '"+id+"'",Query.SQL);
>                         QueryResult result = query.execute();
>                         NodeIterator it = result.getNodes();
>                         return it.nextNode();
> with Id which I remembered when I insert file into jackrabbit.
>
> after that I run this code
>
> HashMap<String,String> properties = new HashMap<String,String>();
>                 try {
>                         PropertyIterator iter = node.getProperties();
>                         while(iter.hasNext()){
>                                 Property prop = iter.nextProperty();
>                                 if (!prop.getDefinition().isMultiple()) {
>                                         properties.put(prop.getName(),
> prop.getValue().getString());
>                                 }
>
>                         }
>                         if (getResNode(node) != null) {
>                                 Node resNode = getResNode(node);
>                                 iter = resNode.getProperties();
>                                 while(iter.hasNext()){
>                                         Property prop = iter.nextProperty
> ();
>                                         if
> (!prop.getDefinition().isMultiple()) {
>                                                 properties.put(
> prop.getName(), prop.getValue().getString());
>                                         }
>                                 }
>                         }
>                 } catch (RepositoryException e) {
>                         // TODO Auto-generated catch block
>                         e.printStackTrace();
>                 }
>
> and write map on console
>
> Set keys = properties.keySet();
>                 Iterator iter = keys.iterator();
>                 while (iter.hasNext()) {
>                         String key = (String) iter.next();
>                         String value = properties.get(key);
>                         System.out.println("property "+key+" with value
> "+value);
>                 }
>
>
> UUID which this code writes on the console is distinct from id which I
> insert on the start of code. If I insert This id which is shown on the
> console the repository returns no file.
>
> --
> View this message in context:
> http://www.nabble.com/UUID-tf3448236.html#a9618986
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message