Search in sources :

Example 1 with CMISNodeInfoImpl

use of org.alfresco.opencmis.CMISNodeInfoImpl in project alfresco-remote-api by Alfresco.

the class RepoService method getProperties.

/*
     * Get (CMIS) node properties
     */
private Properties getProperties(NodeRef nodeRef) {
    CMISNodeInfoImpl nodeInfo = cmisConnector.createNodeInfo(nodeRef);
    final Properties properties = cmisConnector.getNodeProperties(nodeInfo, null);
    // fake the title property, which CMIS doesn't give us
    String title = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_TITLE);
    final PropertyStringImpl titleProp = new PropertyStringImpl(ContentModel.PROP_TITLE.toString(), title);
    Properties wrapProperties = new Properties() {

        @Override
        public List<CmisExtensionElement> getExtensions() {
            return properties.getExtensions();
        }

        @Override
        public void setExtensions(List<CmisExtensionElement> extensions) {
            properties.setExtensions(extensions);
        }

        @Override
        public Map<String, PropertyData<?>> getProperties() {
            Map<String, PropertyData<?>> updatedProperties = new HashMap<String, PropertyData<?>>(properties.getProperties());
            updatedProperties.put(titleProp.getId(), titleProp);
            return updatedProperties;
        }

        @Override
        public List<PropertyData<?>> getPropertyList() {
            List<PropertyData<?>> propertyList = new ArrayList<PropertyData<?>>(properties.getPropertyList());
            propertyList.add(titleProp);
            return propertyList;
        }
    };
    return wrapProperties;
}
Also used : CmisExtensionElement(org.apache.chemistry.opencmis.commons.data.CmisExtensionElement) PropertyData(org.apache.chemistry.opencmis.commons.data.PropertyData) CMISNodeInfoImpl(org.alfresco.opencmis.CMISNodeInfoImpl) PropertyStringImpl(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Properties(org.apache.chemistry.opencmis.commons.data.Properties)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 CMISNodeInfoImpl (org.alfresco.opencmis.CMISNodeInfoImpl)1 CmisExtensionElement (org.apache.chemistry.opencmis.commons.data.CmisExtensionElement)1 Properties (org.apache.chemistry.opencmis.commons.data.Properties)1 PropertyData (org.apache.chemistry.opencmis.commons.data.PropertyData)1 PropertyStringImpl (org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl)1