I have added the following custom aspect to my content model:
<aspect name="my:locationDocumentClassification">
<title>My Location Document Classification</title>
<parent>cm:classifiable</parent>
<properties>
<property name="my:locationDocumentCategory">
<title>Location Document Categories</title>
<type>d:category</type>
<mandatory>false</mandatory>
<multiple>false</multiple>
<index enabled="true">
<atomic>true</atomic>
<stored>true</stored>
<tokenised>false</tokenised>
</index>
</property>
</properties>
</aspect>
Now I want to be able to populate a set of categories to the classification. I am using the following Webscript to populate the categories:
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
// NodeRef newRootCat = categoryService.createRootCategory(
// StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
// ContentModel.ASPECT_GEN_CLASSIFIABLE,
// "testroot");
// LOGGER.log(Level.INFO, "Created: {0}", newRootCat.toString());
// NodeRef newCategory = categoryService.createCategory(newRootCat, "testcat");
// LOGGER.log(Level.INFO, "Created: {0}", newCategory.toString());
// NodeRef locationDocumentClassification = categoryService.createClassification(
// StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
// MyModel.ASPECT_MY_LOCATION_DOCUMENT_CLASSIFICATION,
// "locationDocumentClassification");
// LOGGER.log(Level.INFO, "Created: {0}", locationDocumentClassification.toString());
NodeRef locationDocumentRootCat = categoryService.createRootCategory(
StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
MyModel.ASPECT_MY_LOCATION_DOCUMENT_CLASSIFICATION,
"testroot");
LOGGER.log(Level.INFO, "Created: {0}", locationDocumentRootCat.toString());
NodeRef klantDocCat = categoryService.createCategory(locationDocumentRootCat, "testcat");
LOGGER.log(Level.INFO, "Created: {0}", klantDocCat.toString());
return new HashMap<>();
}
When I execute the code, I get the following error:
10170041 Wrapped Exception (with status template): 10170014 Missing classification: {http://my.company.com/model/content/1.0}locationDocumentClassification
The first two commented out statements in the code is the example code from Alfresco, which works fine. The third commented out statement is me trying to create a classification first to see if that works. The error that I get when I uncomment the createClassification
statement:
java.lang.UnsupportedOperationException at org.alfresco.repo.search.impl.lucene.LuceneCategoryServiceImpl.createClassification(LuceneCategoryServiceImpl.java:369)
So no luck there. I hope there is anyone out there who can see the problem. I read all the posts and forums I could find about this, but could not figure out an answer.
I am using Alfresco 5.0d community edition.