cancel
Showing results for 
Search instead for 
Did you mean: 

cmobject metadata templates

tcuser
Champ on-the-rise
Champ on-the-rise

Hi all,

I'm trying to display a custom type matadata template. This type extends cm:cmobject, like this:

<type name="tc:box">
	<title>Box</title>
	<parent>cm:cmobject</parent>
	<properties>
		<property name="tc:boxName">
			<type>d:int</type>
		</property>				
	</properties>
</type>

Following the official Alfresco documentation, I've declared the evaluators:

<bean id="tc.evaluator.isBox" parent="evaluator.doclib.action.nodeType">
	<property name="types">
		<list>
			<value>tc:box</value>
		</list>
	</property>
</bean>

And the metadata template:

<template id="tcBoxMetadataTemplate">
	<evaluator>tc.evaluator.isBox</evaluator>
	<line index="10" id="description" view="detailed">I AM A BOX</line>
</template>	

Everything in the same way I do with folders or content. I'm able to change the metadata displayed in custon types that extends cm:folder or cm:content, but not in this particular case. In fact it doesn't show any information at all, not even a default icon, like the folder was empty.

Is there any limitation on adding new metadata templates or do I have to declare this custom type somewhere, maybe?

Thank you in advanced! Regards.

5 REPLIES 5

angelborroy
Community Manager Community Manager
Community Manager

If you want to use Alfresco Share standard Document Library you need to inherit your custom type from cm:folder or cm:content base type. Alternatively, you can modify this component to show nodes inheriting from cm:cmobject base type.

Hyland Developer Evangelist

OK that answers it, thank you.

Hi Ángel,

Thank you for your response. What's the component I need to modify in order to show cmobject properties?

tcuser
Champ on-the-rise
Champ on-the-rise

Ok, I *think* I finally detect where to add my custom type in order to display those nodes.

It seems to me that the file filters.lib.js (inside the alfresco-share-services.amp --> alfresco-share-services-11.140/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary) declares the type of nodes that are displayed in the Share explorer:

   TYPE_MAP:
   {
      "documents": '+(TYPE:"content" OR TYPE:"app:filelink" OR TYPE:"folder")',
      "folders": '+(TYPE:"folder" OR TYPE:"app:folderlink")',
      "images": '+@cm\\:content.mimetype:image/*'
   }

 I copied this file into my eclipse project in src > main >  resources > alfresco > extension > templates > webscripts > org > alfresco > slingshot > documentlibrary and changed it like this:

   TYPE_MAP:
   {
      "documents": '+(TYPE:"content" OR TYPE:"app:filelink" OR TYPE:"folder")',
      "folders": '+(TYPE:"folder" OR TYPE:"tc:box" OR TYPE:"app:folderlink")',
      "images": '+@cm\\:content.mimetype:image/*'
   },

But nothing happens... Alfresco does not display tc:box objects.

I don't know if I'm not overriding this component correctly or this isn't the solution at all.

Can anyone help me with this one? Thank you!

tcuser
Champ on-the-rise
Champ on-the-rise

Ok, it seems it's not enough to overwrite the documentlibrary webscript, since finally it calls the FileFolderService, where the type of nodes the webscript returns are declared:

    /** Shallow search for files and folders with a name pattern */
    private static final String XPATH_QUERY_SHALLOW_ALL = "./*" + "[like(@cm:name, $cm:name, false)" + " and not (subtypeOf('"
            + ContentModel.TYPE_SYSTEM_FOLDER + "'))" + " and (subtypeOf('" + ContentModel.TYPE_FOLDER + "') or subtypeOf('"
            + ContentModel.TYPE_CONTENT + "')" + " or subtypeOf('" + ContentModel.TYPE_LINK + "'))]";

    /** Deep search for files and folders with a name pattern */
    private static final String XPATH_QUERY_DEEP_ALL = ".//*" + "[like(@cm:name, $cm:name, false)" + " and not (subtypeOf('"
            + ContentModel.TYPE_SYSTEM_FOLDER + "'))" + " and (subtypeOf('" + ContentModel.TYPE_FOLDER + "') or subtypeOf('"
            + ContentModel.TYPE_CONTENT + "')" + " or subtypeOf('" + ContentModel.TYPE_LINK + "'))]";

    /** Deep search for folders with a name pattern */
    private static final String XPATH_QUERY_DEEP_FOLDERS = ".//*" + "[like(@cm:name, $cm:name, false)" + " and not (subtypeOf('"
            + ContentModel.TYPE_SYSTEM_FOLDER + "'))" + " and (subtypeOf('" + ContentModel.TYPE_FOLDER + "'))]";

    /** Deep search for files with a name pattern */
    private static final String XPATH_QUERY_DEEP_FILES = ".//*" + "[like(@cm:name, $cm:name, false)" + " and not (subtypeOf('"
            + ContentModel.TYPE_SYSTEM_FOLDER + "'))" + " and (subtypeOf('" + ContentModel.TYPE_CONTENT + "')" + " or subtypeOf('"
            + ContentModel.TYPE_LINK + "'))]";

Now... How can I override an Alfresco service implementation?

Thank you! Smiley Happy