cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a null refrence of a node.

prateekgoyal
Champ in-the-making
Champ in-the-making
Hi All,

I have created a program using web ser api which is the web-client-config-custom.xml in Data Dictionary>Web Client Extension folder.
In this if the file i.e web-client-config-custom.xml already exist in the folder then it will be deleted first and then again uploaded the updated file.
But when i'm checking for the existence of the file using,
Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");   
query = new Query(Constants.QUERY_LANG_LUCENE, "PATH:\"/app:company_home/app:dictionary/app:webclient_extension/" + FileName + "\"");
ResultSet rs =repositoryService.query(storeRef, query, false).getResultSet();
ResultSetRow[] rsRows = rs.getRows();

I am getting a null value even though that file is already present in that folder.
So i want to know that is their any other way of checking for the existence of a node in data dictionary.

Thanks,
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
Is your filename qualified by a namespace?   I suspect its just an incorrect query.

prateekgoyal
Champ in-the-making
Champ in-the-making
Hey,
I tried it by creating as a new file in the same folder i.e. web client extension folder in alfresco using the following code
ContentFormat format = new ContentFormat("text/plain", "UTF-8");
CMLCreate create = new CMLCreate("1", companyHomeParent, companyHomeParent.getUuid(), Constants.ASSOC_CONTAINS, null, Constants.PROP_CONTENT, contentProps);            
cml = new CML();
cml.setCreate(new CMLCreate[] {create});
cml.setAddAspect(new CMLAddAspect[] {addAspect});            
UpdateResult[] result = repositoryService.update(cml);
Reference content = result[0].getDestination();            
contentService.write(content,Constants.PROP_CONTENT , bytes, format);
The same querry works fine and the file is getting created in alfresco.