cancel
Showing results for 
Search instead for 
Did you mean: 

Error attempting to obtain child nodes

tonygarnet
Champ in-the-making
Champ in-the-making
Hi
I have attempted to retireve the children of a node from the repository using:

try{
       Reference reference = new Reference(STORE, null, path);
        QueryResult queryResult = null;
        try{
           queryResult = repositoryService.queryChildren(reference);
        }catch(Exception en){

However, I get an exception:
Error occured getting fragment for path: /CWS/Microsite/C000003184/documentsThe error being: org.iop.microsite.repository.exception.MicrositeApplicationException: AlfrescoMicrositeContentRepositoryDao.getChildNodes- Error reading the child nodes for path: //*[@cm:name='CWS']/*[@cm:name='Microsite']/*[@cm:name='C000003184']/*[@cm:name='documents']

I know that the particular space exists. I need to obtain all the contents from that space.
I have been unable to obtain an error message and using the toString method on the exception does not give any detail.
It would be appreciated if you could assist me and indicate what is wrong.
Tony
7 REPLIES 7

doblek
Champ in-the-making
Champ in-the-making
Hi,

If you know the node UUID from which you want to get its children, give this code a try:

QueryResult qr = WebServiceFactory.getRepositoryService().queryChildren(inNode);
for (int i=0; i<qr.getResultSet().getRows().length; i++){
     node_child.setStore(STORE);
     node_child.setPath(null);
     node_child.setUuid(qr.getResultSet().getRows(i).getNode().getId());
}

That way, in each loop iteration you will have the Reference object (node_child) of each child of the Reference object you specify as inNode.

You have to import:
    import org.alfresco.webservice.util.WebServiceFactory;
    import org.alfresco.webservice.types.Reference;
    import org.alfresco.webservice.types.Store;
    import org.alfresco.webservice.repository.QueryResult;
Hope that helps.

Regards,
Enrique

tonygarnet
Champ in-the-making
Champ in-the-making
Hi Enrique

I take it that the line:
QueryResult qr = WebServiceFactory.getRepositoryService().queryChildren(inNode);
is the same line which generates an error in my code.
From the documentation the "inNode" that you refer to is a Reference.
If this is the case, then my problem still persists, as your intial line will generate the same error.
I may be mistaking what you are saying, are you stating that if I use a UUID to obtain a Reference (I have not met this approach so far), it behaves differently than when you obtain a Reference using:
Reference reference = new Reference(STORE, null, path);

Tony

doblek
Champ in-the-making
Champ in-the-making
Hi,

I'm using that code to going through the tree of nodes and I'm not getting any error…

Can you try to add this code:
Store[] stores = WebServiceFactory.getRepositoryService.getStores();
Store STORE = stores[4];       //Index for "SpacesStore" (at least in my computer)

Reference inNode = new Reference();
inNode.setStore(STORE);
inNode.setPath(null);
inNode.setUuid(UUID);          //where UUID is a String with the Node UUID you want to get its children.

//And then the code I gave you in the former post
Reference node_child = new Reference();
QueryResult qr = WebServiceFactory.getRepositoryService().queryChildren(inNode);
for (int i=0; i<qr.getResultSet().getRows().length; i++){
     node_child.setStore(STORE);
     node_child.setPath(null);
     node_child.setUuid(qr.getResultSet().getRows(i).getNode().getId());
     //At this point, node_child contains the Node Reference to one child
}

I haven't seen your error before, so I can't help you much with that… sorry. But it seems to be related with the path, that's why I suggest you use UUID instead of the path…

Regards,
Enrique

tonygarnet
Champ in-the-making
Champ in-the-making
Hi Enrique
Appreciate the help given, it has worked.
One last question, do you know how to get the name of the child references that are obtained?
I need to be able to distinguish them but node name does not appear to be present in the QueryResult.

Tony

doblek
Champ in-the-making
Champ in-the-making
Hi,

Ok. That's good news… 😃

Regarding your question I have to say that, as far as I know, it's *not* possible to get the name of the node… You have to deal with UUID instead. Once you create a node, it is given a unique identifer… Write it down somewhere and try to look if the UUID you're processing at some specific loop iteration matches the UUID you're looking for.

Regards,
Enrique

tonygarnet
Champ in-the-making
Champ in-the-making
Hi
I have obtained the name of the node by using :
String name = qr.getResultSet().getRows(i).getColumns()[5].getValue();
As the name of the node is passed as part of the result set.
Your help has been much appreciated.

One other question, How do I obtain the effective start and end date for an aspect.
I have looked at the metadata and the result set, but I do not appear to see it. I would consider that it must be able to be accessed out side of the scope of the aspect that it is defined in?

Tony

doblek
Champ in-the-making
Champ in-the-making
Hi,

Hi
I have obtained the name of the node by using :
String name = qr.getResultSet().getRows(i).getColumns()[5].getValue();
As the name of the node is passed as part of the result set.
Your help has been much appreciated.

You're welcome 😃

One other question, How do I obtain the effective start and end date for an aspect.
I have looked at the metadata and the result set, but I do not appear to see it. I would consider that it must be able to be accessed out side of the scope of the aspect that it is defined in?

I don't know too much about "aspects" yet, since I didn't have to deal much with them at the moment…  :?
But, as far as I understand from this page in the wiki, it is possible to get the aspect of a node from the queryresult, isn't it?

ResultSet » row » node » aspect

or maybe in metadata…  :?

I know I'm not helping you much, but that's all I can do at this moment  Smiley Surprisedops: Sorry

Regards
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.