Custom Node Modeling question
dharrison Apr 26, 2017 1:26 AMHello,
I have a scenario where I need to create a custom Node Definition for a Brand / Customer, it will have some basic properties, but it most of it's content will be on its child nodes. It will have a Style content node as a child, and up to three logos (main, header, footer).
For the Brand's Logos (files), is this the right way to model the CND? I'm trying to setup an explicit reference to the binaries/logos as properties so the ModeShape garbage collection process does not remove them. FYI, I'm using the database for binary storage and regular content.
Thanks! I'm open to any suggestions or feedback.
Brand CND
<jcr='http://www.jcp.org/jcr/1.0'> \
<nt='http://www.jcp.org/jcr/nt/1.0'> \
<mix='http://www.jcp.org/jcr/mix/1.0'> \
<brand='http://www.modeshape.org/examples/brand/1.02'>
<style='http://www.modeshape.org/examples/style/1.01'>
[brand:Brand] > mix:created, mix:lastModified
- brand:code (string)
- brand:name (string)
+ brand:style (style:Style) = style:Style
+ brand:logo_main (nt:file) = nt:file
+ brand:logo_header (nt:file) = nt:file
+ brand:logo_footer (nt:file) = nt:file
Style CND
<jcr='http://www.jcp.org/jcr/1.0'>
<nt='http://www.jcp.org/jcr/nt/1.0'>
<mix='http://www.jcp.org/jcr/mix/1.0'>
<style='http://www.modeshape.org/examples/style/1.01'>
[style:Style] > mix:created, mix:lastModified, mix:versionable
- style:system_code (string)
- style:subsystem_code (string)
- style:client_code (string)
- style:brand_primary_color
- style:brand_secondary_color
- style:button_primary_color
Sample Insertion / Node Creation Script
curl -m 60 -H "Content-Type: application/json" \ -H "Accept: application/json" \ --user admin:admin \ -X POST http://localhost:8080/modeshape-psi/rest/repo/default/items/brandTest001 \ -d @- << EOF { "jcr:primaryType" : "brand:Brand", "brand:code" : "brandTest001" } EOF curl -m 60 -H "Content-Type: application/json" \ -H "Accept: application/json" \ --user admin:admin \ -X POST http://localhost:8080/modeshape-psi/rest/repo/default/items/brandTest001/brand%3astyle \ -d @- << EOF { "jcr:primaryType":"style:Style", "style:system_code" : "lc", "style:subsystem_code" : "ucs", "style:client_code": "psi", "style:brand_primary_color" : "#701c45", "style:brand_secondary_color" : "#003056", "style:button_primary_color" : "#003056" } EOF curl -X POST --data-binary @sample-content/system/lc/ucs/branding/psi/logo/logo.png --user admin:admin http://localhost:8080/modeshape-psi/rest/repo/default/upload/brandTest001/brand%3alogo_main curl -X POST --data-binary @sample-content/system/lc/ucs/branding/psi/logo/logo2.jpg --user admin:admin http://localhost:8080/modeshape-psi/rest/repo/default/upload/brandTest001/brand%3alogo_header curl -X POST --data-binary @sample-content/system/lc/ucs/branding/psi/logo/logo3.jpg --user admin:admin http://localhost:8080/modeshape-psi/rest/repo/default/upload/brandTest001/brand%3alogo_footer