AnsweredAssumed Answered

Adding Dublin Core aspect to Sites (CMIS)

Question asked by akerenyi on Mar 2, 2015
Latest reply on Mar 5, 2015 by rjohnson
Hi,

I would like to add the Dublin Core aspect to my Alfresco Sites.
As a template, I used one of Jeff Potts's gists (https://gist.github.com/jpotts/7242070).*
However whenever I add do this it messes up the site and Share too and they will not be accessible from Share.
The received error message is "Internal Server Error" (see attached screenshot);
Removing the aspect does not fix it, the site has to be deleted altogether.

Could anyone help fix this issue? I need my sites to have a couple of field which would be available in the Dublin Core aspect.

I'm using Alfresco 5.0c, OpenCMIS 0.12.0 and Java 1.7.

Please find my java code below:


public void addAspect() {
        Folder site = (Folder) this.cmisSession.getObjectByPath("/Sites/xy-site");
       
        List<Object> aspects = site.getProperty("cmis:secondaryObjectTypeIds").getValues();
      // Add Dublin Core aspect
      if (!aspects.contains("P:cm:dublincore")) {
         aspects.add("P:cm:dublincore");
         HashMap<String, Object> props = new HashMap<String, Object>();
         props.put("cmis:secondaryObjectTypeIds", aspects);
         site.updateProperties(props);
         System.out.println("Added aspect");
      } else {
         System.out.println("Doc already had aspect");
      }
      
        /*
        Map<String, Object> newProps = new HashMap<String, Object>();
       
        List<String> subList = new ArrayList<String>();
        subList.add("P:cm:dublincore");   // Replace Dublincore String with Object
        newProps.put("cmis:secondaryObjectTypeIds", subList); // multi-value property
       
        site.updateProperties(newProps);
        */
    }


Thank you very much in advance!

Adam

*corrected link

Outcomes