05-15-2014 10:44 AM
/**
* @param tags array( with tag names in it)
*/
function getTag(tags){
var store = "workspace://SpacesStore/";
for(var t=0; t< tags.length; t++) {
var tag = taggingService.getTag(store, tags[t]);
var tagExists = (tag != null);
if (!tagExists){
//It creates tag with lower case
tag = taggingService.createTag(store, tags[t]);
//For some reason after createTag tag was null in some cases
var tagNode = search.findNode("workspace://SpacesStore/"+tag.id);
//Give it a name originally intended
tagNode.properties.name=tags[t];
tagNode.save();
}
tags[t] = tag;
}
return tags;
}
tags = getTag(tags);
for(var t=0; t<tags.length; t++) {
//This line works fine
logger.info(tags[t].name);
//This line again sometimes throws NullPointer even though tags array has all nodes
upload.addTag(tags[t].name);
}
05-15-2014 12:37 PM
var tag = taggingService.getTag(store, tags[t]);
which will not lower the case,so nothing will return. tag = taggingService.createTag(store, tags[t]);
,but in createTag implementation ,"Information" will be lowered case to "information".upload.addTag(tags[t].name);
which is ScriptNode.addTag()
method ,in ScriptNode.addTag alfresco will lower the case of the tag(to "information" again),but in repository there is no node named "information",so you get a null pointer.05-15-2014 05:44 PM
05-15-2014 07:57 PM
upload.addTag(tags[t].name)
method :upload.addTag(tag)
method.05-16-2014 12:37 AM
05-16-2014 01:23 AM
05-16-2014 02:01 AM
05-16-2014 07:04 AM
"message" : "04160002 Wrapped Exception (with status template): 04160015 Failed to execute script 'classpath*:alfresco\/templates\/webscripts\/com\/passivsystems\/upload.post.js': 04160014 No solr query support for store workspace:\/\/SpacesStore\/",
"exception" : "org.springframework.extensions.webscripts.WebScriptException - 04160002 Wrapped Exception (with status template): 04160015 Failed to execute script 'classpath*:alfresco\/templates\/webscripts\/com\/passivsystems\/upload.post.js': 04160014 No solr query support for store workspace:\/\/SpacesStore\/",
"callstack" :
[
"" ,"org.alfresco.error.AlfrescoRuntimeException: 04160014 No solr query support for store workspace:\/\/SpacesStore\/"
,"org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:224)"
,"org.alfresco.repo.search.impl.solr.SolrQueryLanguage.executeQuery(SolrQueryLanguage.java:49)"
,"org.alfresco.repo.search.impl.solr.SolrSearchService.query(SolrSearchService.java:348)"
,"org.alfresco.repo.search.impl.solr.SolrSearchService.query(SolrSearchService.java:152)"
,"org.alfresco.repo.search.impl.lucene.LuceneCategoryServiceImpl.getClassificationNodes(LuceneCategoryServiceImpl.java:311)"
,"org.alfresco.repo.search.impl.lucene.LuceneCategoryServiceImpl.getRootCategories(LuceneCategoryServiceImpl.java:447)"
,"sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"
,"sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)"
,"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
05-16-2014 09:35 PM
workspace://SpacesStore
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.