Create new document type in Alfresco

Alfresco have many options to extend their document management system and one of them is to create a new document type as seen in the picture below. The new document is a Whitepaper, but we could have added other document types like a functional specification, meeting minutes, risk matrix and whatever that tingles our needs.

All documents that are uploaded or created in alfresco is by default marked as “content”, a generic term that can encompass everything. To create a document type is an easy way of setting documents apart/a way of categorizing and structuring the content itself. A developer can add certain functionality/behavior to a document type like a doc type having certain metadata connected to it, workflow (review, acceptance, publish), add versioning, that certain people shall be notified of changes or add permission so that only specific people can create and edit the document. One can add advanced search capabilities like searching for a specific document type.

screenshot_003

So, down to the gritty details. First one have to define the document type (custom content model) (config/extension/model/whitepaper.xml):


<?xml version="1.0" encoding="UTF-8"?>

<!-- Definition of new Model -->
<model name="mb:mybusiness.whitepaper.model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
    <description>My business Whitepaper</description>
    <author>Helene Klungvik</author>
    <version>1.0</version>

    <!--
		Imports are required to allow references to definitions in other
		models
	-->
	<imports>
		<!-- Import Alfresco System Definitions -->
		<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
		<!-- Import Alfresco Dictionary Definitions -->
		<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
		<!-- Import Alfresco Content Domain Model Definitions -->
		<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
	</imports>

	<namespaces>
		<namespace uri="mybusiness.whitepaper.model" prefix="mb" />
	</namespaces>

    <types>
		<type name="mb:doc">
			<title>Whitepaper</title>
			<parent>cm:content</parent>			
		</type>
   </types>

</model>

Then create a spring bean that imports the whitepaper model (config/alfresco/extension/module-context.xml):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!--
    Document   : module-context.xml
    Created on : March 11, 2009, 10:00 AM
    Author     : Helene Klungvik
    Description:
        Define a new document type for whitepapers
-->

<beans>
    <bean id="mybusiness.dictionaryBootstrap"
        parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/model/rwhitepaper.xml</value>
            </list>
        </property>
    </bean>
</beans>

And that’s it.

About Haridasi

integrity - the state of being whole, entire, or undiminished.
This entry was posted in Technology and tagged . Bookmark the permalink.

6 Responses to Create new document type in Alfresco

  1. pietro says:

    Helene,
    Do you know how to add custom fields to your doctype?
    Thanks
    Pietro

  2. Sufie says:

    Helene,

    Thanks for the post. Do you know how I can load word templates to a document library? I want to be able to instantiate a new document into my template based on a word template.

    Thanks,

    Sufie

  3. Hi Sufie,

    I’m sorry, but I no longer work with Alfresco 🙁

  4. Necip AKCA says:

    hi i am try to use on weblogic and i did what you wrote but it does not work for me why i dont know there is no log error,info nothing i think it relate weblogic by the way my developer platform is win2008R2,oracle 11rR2 and alfresco 3.4 enterprise

    i am stuck here and not add any content type to alfresco.
    Do you have any idea abouth this problem?

    Regards
    Good Works

  5. Necip AKCA says:

    hi helene,
    I am trying to use alfresco 3.4 enterprise on oracle weblogic and i did what you wrote and a lot of examples which i found at wiki alfresco or another but all of them does not work for me.It is not appear at new content or add content,there is no log error or warning nothing i could not find any solution for this situation :(:(

    i tihink this is relate weblogic,
    Do you have any idea ?
    Thanks,
    Regards
    Necip AKCA

  6. Dear Necip,

    I’m sorry, but I can’t help you. It’s about two years since I worked with Alfresco.

Leave a Reply

Your email address will not be published. Required fields are marked *