Git Product home page Git Product logo

cmislib-alfresco-extension's Introduction

Alfresco cmislib Extension

Aspects are an essential tool to model metadata in Alfresco. The CMIS specification does not define aspects or something similar, but it defines several extension points. Alfresco uses these extensions point to send aspect data back and forth between a CMIS client and the server.

CMIS extensions are XML fragments placed in different parts of a CMIS object. The Alfresco aspect fragments are documented on the Alfresco Wiki. So, theoretically, they are available to all CMIS clients out there including cmislib.

In reality, dealing with CMIS extensions isn't fun and can require quite a lot of code. cmislib does all the XML parsing for you but, since it doesn't know anything about aspects, it can't provide pretty interfaces.

That's where the "Alfresco cmislib Extension" steps in. It seamlessly merges aspect properties with object properties and provides interfaces to get, add and remove aspects.

Setting it up

The "Alfresco cmislib Extension (Release 0.3.2)" requires cmislib 0.5.1. If you use easy_install, this requirement will be automatically satisfied.

The extension dynamically injects new methods in cmislib objects. To activate the extension, simply import cmislibalf.

# The following import injects new methods into cmislib classes
import cmislibalf
from cmislib import CmisClient

cmisClient = CmisClient("http://localhost:8080/alfresco/service/cmis", "admin", "admin")
repo = cmisClient.getDefaultRepository()
aDoc = repo.getObjectByPath('/someFolder/aDoc')

# documents and folders have new methods related to aspects
if (len(aDoc.getAspects()) > 0) and aDoc.hasAspect('P:cm:summarizable'):
    aspect = aDoc.findAspect('cm:summarizable')
    # aspects' properties are mixed with regular properties
    if aDoc.getProperties()['cm:summary'] == "some summary":
        ...
    ...
    aDoc.removeAspect('P:cm:summarizable')
else:
    aDoc.addAspect('P:cm:summarizable')
    props = {'cm:summary': 'some summary'}
    aDoc.updateProperties(props)
    ...

cmislib-alfresco-extension's People

Contributors

costerwi avatar googlecodeexporter avatar jpotts avatar pcollardez avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.