cancel
Showing results for 
Search instead for 
Did you mean: 

Searching Other Stores in Javascript

vamirr
Champ on-the-rise
Champ on-the-rise
I seem to be having an issue searching for nodes in a newly created store.


I created a new store in java using:


        nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "metricStore");



I then created a webscript to create and query nodes within this store.

In order to create nodes, I need a reference to the root node for the store.   I'm having a hard time getting that.


The lucene query below fails with the error: <strong>JavaException: org.alfresco.error.AlfrescoRuntimeException: 09240085 Failed to execute search: TYPE:"sys:store_root"</strong>


<javascript>
        var metricStoreNode = search.luceneSearch("workspace://metricStore", "TYPE:\"sys:store_root\"");

        if(metricStoreNode[0]){
                logger.log(metricStoreNode[0].nodeRef);
                logger.log(metricStoreNode[0].displayPath);
        }
        else
                logger.log("metricStore node not found");
</javascript>


Simply changing "workspace://metricStore" to "workspace://SpacesStore" and the luceneSearch properly finds the root node of SpacesStore.

What am I doing wrong here?   How else could/should I get the root node of this store.
1 REPLY 1

vamirr
Champ on-the-rise
Champ on-the-rise
I seem to be having an issue with creating nodes under this store as well.   

I have a javascript code that attempts to create a node under the store's root node.

<javascript>

//note that this method gets me the store's root node, but I'd rather be able to do this by path, so my original question still stands.
var metricStoreNode = utils.getNodeFromString("workspace://metricStore/623e4fc6-195a-4d59-91cd-c856633d8961"); 
yearNode = metricStoreNode.createFolder("test");
</javascript>

Upon execution, I get the following error in my logs:


2013-10-24 13:21:25,788  ERROR [node.integrity.IntegrityChecker] [catalina-exec-4] Found 1 integrity violations:
The association source type is incorrect:
   Source Node: workspace://metricStore/623e4fc6-195a-4d59-91cd-c856633d8961
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1  .0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/system/1.0}store_root
2013-10-24 13:21:25,790  ERROR [extensions.webscripts.AbstractRuntime] [catalina-exec-4] Exception from executeScript - redirecting to status tem  plate error: 09240457 Found 1 integrity violations:
The association source type is incorrect:
   Source Node: workspace://metricStore/623e4fc6-195a-4d59-91cd-c856633d8961
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1  .0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/system/1.0}store_root
org.alfresco.repo.node.integrity.IntegrityException: 09240457 Found 1 integrity violations:
The association source type is incorrect:
   Source Node: workspace://metricStore/623e4fc6-195a-4d59-91cd-c856633d8961
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1  .0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/system/1.0}store_root
        at org.alfresco.repo.node.integrity.IntegrityChecker.checkIntegrity(IntegrityChecker.java:661)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:69  2)
        at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:  927)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:410)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:68)
        at sun.reflect.GeneratedMethodAccessor465.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy250.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.alfresco.web.app.servlet.WebScriptSSOAuthenticationFilter.doFilter(WebScriptSSOAuthenticationFilter.java:140)
        at sun.reflect.GeneratedMethodAccessor465.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:103)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at com.sun.proxy.$Proxy250.doFilter(Unknown Source)
        at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:197)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
        at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1771)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)