beyond the jcr
TRANSCRIPT
DD.MM.YYYY at Venue/CustomerFirst Last, Role
Beyond the JCR
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd.
Casey Dement Date: 5.7.2015
1
Beyond the JCR
• Brief Introduction: What is Sharecare? / Who am I?• What's a JCR?• Activation vs. Custom Content App• Architecture of a Custom Content App
• Configuration• Code
• Caveats• Use Cases
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 2
Brief Introduction - What is Sharecare?
• What is Sharecare?
• Founded by Jeff Arnold, Dr. Oz, Oprah, Sony, and Discovery• WebMD - “What would you do differently?”
• Humanize and Personalize Medical Information• Bring the Power of Social Media to Medical Care• Focus on Turning Knowledge into Action
• Who am I?
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 3
What's a JCR
• Standard specification for accessing a content repository in Java (JSR-170/283)• Used by most Java enterprise CMS applications
• Logically much like a dynamic XML file• Unstructured and extremely flexible• Simple to navigate and understand• Querying has its challenges
• Primarily designed around data hierarchy• Great for expressing parent-child relationships• Not so great for cross-cutting concerns
• No inherent notion of clustering or replication
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 4
5
How do I get content out of the JCR and into a full database but still create, modify and publish pages
in Magnolia?
Activation vs. Custom Content App
Activation
• Create and edit content in Magnolia JCR as usual• But... add a custom activation handler to extract content• Extracted content is mirrored to external store• Advantages
• Available forever• Simple synchronization with one action
• Disadvantages• Difficult to ensure consistency• Content can only be modified by the author
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 6
Activation vs. Custom Content App
Custom Content App
• Manage content in Magnolia• But... content is persisted directly in external store• Advantages
• No synchronization - always consistent• Magnolia can access content modified externally
• Disadvantages• Page definition is a separate step• A bit delicate to implement
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 7
Custom Content App - Configuration
• In browser• In actions - specify delete item action implementation class• In workbench - specify empty path (override default "/")• In each browser contentView - specify definition class• In contentConnector - specify implementation class
• In detail• In actions - specify commit item action implementation class• In contentConnector - extend contentConnector from browser
10
Custom Content App - Code
• Container - loads and creates items(tip - leverage BeanContainer and BeanItemContainer)
• Connector - references & dereferences items and URL fragments• Actions -
• Perform actual persistence operations (commit and delete)• Fire ContentChangedEvent to refresh view
• Presenter Definition - specifies presenter implementation class• Presenter - accesses custom container
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 11
Content Selector - Configuration
• Within defining Custom Content App:• In fieldTypes - specify definition and factory classes• In app - define chooseDialog
• Can define individual columns or extend app browser workbench• Needed only to specify different actions or show different columns from
browser workbench• Within app containing link reference to selector:
• In form field - specify custom link field definition• In contentView - specify custom column definition
12
Content Selector - Code
• Selector Field Definition - references selector app• Selector Field Factory -
• Extracts link id from selected item in selector• Assigns link id value to calling form field
• Column Formatter Definition - specifies the formatter class• Column Formatter - maps link id to pretty value
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 13
Caveats
• Legacy of the hierarchical JCR makes lists hard
• ContentConnector.getDefaultItemId (return null)
• WorkbenchField.initContent (must define tree view)
• ContentChangedEvent constructor (return deleted itemId)
• Content selector provides no access mechanism in templates (implement manual query mechanism)
• Separate containers for each sub-app complicates new item creation (bind container to app and inject)
14
hic sunt dracones
Use-Cases
• Simplify and unify content management
• Modify all content, regardless of location, with a common metaphor
• Rapid definition and deployment of management interface
• Use external content in Magnolia templates
• Content searching, selection and view within app browsers and forms
• Content searching and linking with template dialogs
• Link value included as part of template content (but must dereference manually)
• DAM v2 is a simplified model of the above for asset reference
• Defines most of the components in a generic way that works for all assets
• Just implement the assetProvider and go!
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 16
More Information
• Everything presented is part of an open-source demo application• The demo application is open source and for your use• Web app at https://github.com/cadement/AmplifyDemo• Content app at https://github.com/catdement/Articles-App
• More questions - contact me!• Email - [email protected]• LinkedIn - https://www.linkedin.com/pub/casey-dement/2/a27/95b
Version 1.1 Magnolia is a registered trademark owned by Magnolia International Ltd. 17