01-08-2009 10:26 AM
<aspect name="test:classifications">
<title>Test Classifications</title>
<parent>cm:classifiable</parent>
<properties>
<property name="test:categories">
<title>Categories</title>
<type>d:category</type>
<mandatory>false</mandatory>
<multiple>true</multiple>
<index enabled="true">
<atomic>true</atomic>
<stored>true</stored>
<tokenised>true</tokenised>
</index>
</property>
</properties>
</aspect>
Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/com/centrom/test.get.js': Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/com/centrom/test.get.js': Wrapped org.alfresco.error.AlfrescoRuntimeException: Missing classification: {http://centrom.com/testing}classifications (AlfrescoScript#20)
10-15-2010 04:19 AM
var check = search.luceneSearch("@cm\\:name:\"MYCLASSIFICATION\" AND TYPE:\"category\"");
if(check.length == 0) {
// /{http://www.alfresco.org/model/content/1.0}categoryRoot
var root = search.luceneSearch("@cm\\:name:\"categories\" AND TYPE:\"category_root\"")[0];
root.createNode("MYCLASSIFICATION", "{http://www.alfresco.org/model/content/1.0}category", "cm:categories");
}
07-26-2011 06:54 AM
07-27-2011 02:56 AM
var props = new Array();
props["cm:name"] = categoryName;
if(categoryDescription!=null){
props["cm:description"] = categoryDescription
}
model.newNode = nodeParent.createNode(categoryName, "{http://www.alfresco.org/model/content/1.0}category", props, "cm:subcategories");var parentNodeRef = args.categorynoderef;
var categoryName = args.name;
var categoryDescription = args.description;
var rootNodeRef = args.rootcategorynoderef;
var resultString = "Action failed";
var resultCode = 501;
try {
if ((categoryName == null) || (categoryName == "")) {
resultString = "Category must have a Name";
} else {
if ((parentNodeRef != null) && (parentNodeRef != "")) {
var nodeParent = search.findNode(parentNodeRef);
if (nodeParent != null) {
//Check if already exists a category with the same name as the given one
var root = search.findNode(rootNodeRef);
if (root != null){
var query = "+PATH:\""+root.qnamePath+"//*\" +TYPE:\"cm:category\"";
query += " +@cm\\:name:\""+categoryName+"\"";
var nodes = search.luceneSearch(query);
var nodeExists = false;
for each(node in nodes) {
if (node.name == categoryName) {
nodeExists = true;
break;
}
}
if (nodeExists){
//Already exists with same name
resultString = "Category with the name '"+categoryName+"' already exists.";
} else {
//Doesn't exist, then create it
var props = new Array();
props["cm:name"] = categoryName;
if(categoryDescription!=null){
props["cm:description"] = categoryDescription
}
model.newNode = nodeParent.createNode(categoryName, "{http://www.alfresco.org/model/content/1.0}category", props, "cm:subcategories");
resultString = "New category created";
resultCode = 200;
}
} else{
resultString = "Invalid root node";
}
} else {
resultString = "Invalid parent node";
}
} else {
resultString = "Invalid param";
}
}
} catch (e) {
resultString = "Action failed due to an exception: "+e.toString();
}
model.resultString = resultString;
model.resultCode = resultCode;
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.