How to add custom object and custom metadata | Community
Skip to main content
Level 6
October 16, 2015
Solved

How to add custom object and custom metadata

  • October 16, 2015
  • 11 replies
  • 4283 views

I want to create new object type by extending existing nt:file/nt:folder. Can someone please let me know how can I create my own custom type and custom metadata?

After searching through Google I couldn't find good tutorial on how to do this. I found this thread but could not get much on how to implement new custom type and custom metadata. 

Thank you for your help!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

Hi Sam,

In general, extensive use of node types isn't recommended. If you just want a bag of properties, you should use nt:unstructured and create whatever properties you need.

See http://www.quora.com/Repositories/When-using-a-Java-Content-Repository-Apache-JackRabbit-or-Adobe-CRX-for-example-should-you-be-creating-your-own-node-types-or-have-an-unstructured-free-for-all and http://wiki.apache.org/jackrabbit/DavidsModel

The specific scenario you describe, however, does require the use of a custom node type because nt:file and nt:resource are "strong" node types and do not support residual properties. The best thing to do would be to create a mixin node type which defines your properties (or just * to allow any property) and then add that mixin to the nt:resource node (see Rule #6 in David's Model linked to above).

Regards,

Justin

11 replies

Ojjis
Level 7
October 16, 2015

Glad it worked.

As described in the above links, a mixin node only applies characteristics to another node, that is "...a type that further define properties and children that beyond those defined by the primary type.." (http://modeshape.wordpress.com/2010/01/29/the-shape-of-your-information/
As I have understood it, for a node to be able to have your own created one as the primary type,  you need to create another custom node that is not a mixin. 

Regarding the CND files, they are files which in you declare custom namespaces in.
You can create your custom namespace like sam: for a new type called sam:mytype. This can either be done in the Node Type Configurations window under Namespaces or via the CND files that you can deploy yourself. More info here (http://blogs.adobe.com/contentmanagement/tag/cnd-file/).

Then, after you have created your own namespace you can continue with creating maybe a mixin node type with that namespace (and maybe, if you want and feel like it's the right thing, even create your own custom node types and then apply the primary node type as the one you created... )