Change Type of Document in Alfresco

In Alfresco Share when we go to document details page of and content we could see change type action available there which could allow users to change type of content. But this is not as simple as it appears. You need to configure properly in share-config-custom.xml for your custom content types to get your custom content types visible under that menu.

Here are the steps to do that.

Step 1:

Create custom content model (if not available) I am not going to elaborate on this one as I had already explained everything about creating custom content model in this blog.

For example, we have content type with following three content types.

<types>

	<type name="custom:childType1">

		<title>Test Document1</title>

		<description>Child1</description>

		<parent>cm:content</parent>

	</type>

	<type name="custom:childType2">

		<title>Test Document2</title>

		<description> Child2</description>

		<parent>cm:content</parent>

	</type>

	<type name="custom:childType3">

		<title>Test Document3</title>

		<description> Child3</description>

		<parent>cm:content</parent>

	</type>

	<type name="custom:grandChildType1">

		<title>Grand childType1</title>

		<description>GrandChild1</description>

		<parent> custom:childType1</parent>

	</type>

	<type name="custom:grandChildType2">

		<title> Grand childType2</title>

		<description>GrandChild2</description>

		<parent> custom:childType1</parent>

	</type>

</types>

In above content model we have type tree something like this

ContentTypes
 

Step 2:

Create share-config-custom.xml (If not available because if you have already added your custom types and then to show it in user interface you must have added related configurations under share-config-custom.xml) and place it under

<ALF_HOME>/tomcat/share/classes/alfresco/web-extension

In case you are using AMP files you can place it under

<Share Project Root>\src\main\amp\config\alfresco\web-extension

Step 3:

Add following entry under share-config-custom.xml

<config evaluator="string-compare" condition="DocumentLibrary">
	<tree>
		<evaluate-child-folders>true</evaluate-child-folders>
		<maximum-folder-count>-1</maximum-folder-count>
	</tree>
	<aspects>
		<visible>
			<aspect name="cm:generalclassifiable" />
			<aspect name="cm:complianceable" />
			<aspect name="cm:dublincore" />
			<aspect name="cm:effectivity" />
			<aspect name="cm:summarizable" />
			<aspect name="cm:versionable" />
			<aspect name="cm:templatable" />
			<aspect name="cm:emailed" />
			<aspect name="emailserver:aliasable" />
			<aspect name="cm:taggable" />
			<aspect name="app:inlineeditable" />
			<aspect name="gd:googleEditable" />
			<aspect name="cm:geographic" />
			<aspect name="exif:exif" />
		</visible>
		<addable>
		</addable>
		<removeable>
		</removeable>
	</aspects>
	<types>
		<type name="cm:content">
			<subtype name="custom:childType1" />
			<subtype name="custom:childType2" />
			<subtype name="custom:childType3" />
		</type>
		<type name="custom:childType1">
			<subtype name="custom:grandChildType2" />
			<subtype name=" custom:grandChildType2" />
		</type>
		<type name="cm:folder">
		</type>
	</types>
	 
</config>

Step 4:

Deploy the changes if you are using AMP and restart server.

Step 5:

Create new content in alfresco share with basic content type. And go to detail page of it, you will be able to see change type action when you click on that you will have drop down appear which will show childType1, childType2 and childType3. If you select “childType1” and click on ok content will be modified to content of type “childType1”. If refresh the page and click on change type link again you will be able to see “grandChildType2” and “grandChildType2” in list as existing content is already specialized to type “childType1” and it cannot be go back to normal content or it’s sibling content type.

NOTE: Content can only be specialized to child type once it is converted to specialized type it cannot be moved back. This restriction is imposed to restrict loss of information.

 

Looking for quality Alfresco Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

One Comment on Change Type of Document in Alfresco

  1. Just a small correction on your text.
    You’ve written /tomcat/share/classes/alfresco/web-extension, when the correct path would have “shared” into it instead of “share”, as you have written.

Leave a Reply

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