cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot create a custom classification

martijnburger
Champ in-the-making
Champ in-the-making
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.
3 REPLIES 3

martijnburger
Champ in-the-making
Champ in-the-making
For a better formatted question and a stack overflow bonus for the same question, see: http://stackoverflow.com/questions/33763639/cannot-create-a-custom-classification

Anyone reading this and having some thoughts to help me along?

hdalang
Champ in-the-making
Champ in-the-making
I think you better paste the complete code, what I know is that you should extends from parent class and it will extend two methods. please paste the whole code so we can understand.