AnsweredAssumed Answered

CMIS:  populating properties (type and aspect)

Question asked by srowsell on Jul 17, 2014
Latest reply on Jul 23, 2014 by srowsell
I was helped out a while back in this community in this thread, and I was able to get things working well enough in my local test environment (4.1.7.3 Enterprise).  Now it's time to get it to work on what will become the production environment (4.2.f for now) and it's failing to populate a property.  Here's the code I'm using, with the following provisos:

- the session is established and is working
- the document specified by "id" is there, and is being accessed
- the propertyName parameter is valid
- the propertyValue parameter is valid

All that it's not doing is setting a property, and if I set a property manually the log.debug instruction at the bottom returns null (even in the working environment).

Any thoughts?


private static void changeProperties(String id, String propertyName, String propertyValue)
   {
      AlfrescoDocument alfDoc = (AlfrescoDocument) session.getObject(id);
   
      PropertiesImpl properties = new PropertiesImpl();
      List<CmisExtensionElement> extensions = new ArrayList<CmisExtensionElement>();
   
      CmisExtensionElement valueElem = new CmisExtensionElementImpl(
            ALFRESCO_EXTENSION_NAMESPACE, VALUE, null, propertyValue);
      
      List<CmisExtensionElement> valueElems = new ArrayList<CmisExtensionElement>();
      valueElems.add(valueElem);
   
      List<CmisExtensionElement> children = new ArrayList<CmisExtensionElement>();
      Map<String, String> attributes = new HashMap<String, String>();
      attributes.put(PROPERTY_DEFINITION_ID, propertyName);
      children.add(new CmisExtensionElementImpl(ALFRESCO_EXTENSION_NAMESPACE,
            PROPERTY_STRING, attributes, valueElems));
   
      List<CmisExtensionElement> propertyValuesExtension = new ArrayList<CmisExtensionElement>();
      propertyValuesExtension.add(new CmisExtensionElementImpl(
            ALFRESCO_EXTENSION_NAMESPACE, PROPERTIES, null, children));
   
      CmisExtensionElement setAspectsExtension = new CmisExtensionElementImpl(
            ALFRESCO_EXTENSION_NAMESPACE, SET_ASPECTS, null,
            propertyValuesExtension);
      extensions.add(setAspectsExtension);
      properties.setExtensions(extensions);
      String repId = session.getRepositoryInfo().getId();
      Holder<String> objectIdHolder = new Holder<String>(alfDoc.getId());
      session.getBinding().getObjectService().updateProperties(repId, objectIdHolder, null, properties, null);
      
      log.debug((alfDoc.getPropertyValue(propertyName)).toString());
   }

Outcomes