9th Jan, 2012

Alfresco tutorial: Custom content types including Share config and CMIS

It is hard to believe that the original version of my “Working With Custom Content Types” tutorial for Alfresco is almost five years old. That page has had over 37,000 unique visits since it was posted. It makes sense that it would be popular–creating a content model, exposing it to the user interface, and then performing CRUD functions against the repository through code are the first steps for most Alfresco development projects.

The fundamentals of content modeling haven’t changed since 2007, but since the original tutorial was posted the Alfresco Share web client has replaced Alfresco Explorer as the preferred user interface and the Content Management Interoperability Services (CMIS) API has become the first choice for writing remote code against the repository. That, combined with the influx of newcomers to the platform and a continued demand for how-to’s on the basics motivated me to revise the tutorial.

The second edition moves the Alfresco Explorer configuration to the Appendix and replaces it with steps for doing the same thing in Alfresco Share. I also moved the Java Web Services API to the Appendix and replaced that with Java examples that leverage the Apache Chemistry OpenCMIS API to create, update, query, and delete content in the repository. I’m executing the same queries as the first edition, just implemented using CMIS, so if you want to compare Lucene queries to CMIS Query Language, this is one place to do it.

I tested the document and the code against Alfresco 4.0.c Community. It may work on earlier versions, but no promises. It will probably work on Alfresco 4.0 Enterprise when it becomes available.

My goal is to revise the rest of the Alfresco Developer Series tutorials for Alfresco 4 over the next month or two so stay tuned.

Responses

[...] I’ve recently published a second edition of this tutorial that updates the original with Alfresco Share and [...]

[...] code that accompanies the tutorial builds on the content types tutorial, so it includes the SomeCo content model and the user interface configuration needed to expose that [...]

Hi jeff,
thanks for great tutorial,

I downloaded the code of your example, I changed my settings using build.properties file:

# Used by the CMIS Web Services and examples
alfresco.sdk.dir = C :/ Documents and Settings/silverio.giancristof/workspace/alfresco-sdk-4.0.b
# Used by the content model, Explorer config, config examples and Share
alfresco.webapp.dir = C :/ tomcat/Instance1/webapps/alfresco
share.webapp.dir = C :/ tomcat/Instance1/webapps/share

But nothing happens on Alfresco that I do not see the changes when i try change type in any document. What is wrong?

Silverio,

Did you run “ant deploy” after changing the settings in build.properties? If so, go look in your Alfresco and Share webapps. In $TOMCAT_HOME/webapps/alfresco you should see the unpacked WAR. Within that, you should see an extension directory under $TOMCAT_HOME/webapps/alfresco/WEB-INF/classes/alfresco that contains things like the model directory, web-client-config-custom.xml, etc. Over in $TOMCAT_HOME/webapps/share you should see the unpacked Share WAR. Within that, you should see a web-extension directory under $TOMCAT_HOME/webapps/share/WEB-INF/classes/alfresco that contains share-config-custom.xml.

If those are missing, something is wrong with your build. If those are there but the custom types aren’t showing up, try restarting Tomcat and watching the log for errors that might give you a hint as to what is wrong.

Jeff

Hi Jeff,

on eclipse i make right click on build.xml and run ant and i see BUILD SUCCESSFUL, but i don’t see unpacked Share WAR in $TOMCAT_HOME/webapps/share

Sorry sorry Jeff, i’m stupid man :D ,

I have deployed and now I see the directories added.

Thanks a lot.

Great tutorial!
Just a question.. i created a new content model but i cant hide any properties of the original cm:content from which i derived my own model (title or description). Hide option in share-config-custom.xml doesnt work for me.
Any suggestion?
Thanks in advance

Daniele,

Have you tried adding a form config to share-config-custom.xml and removing the “show” element and the “field” element for the properties you want to hide?

Jeff

Leave a response

Your response:

Categories