Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
N hidden gems in forge (as of may '17)
1. N Hidden Gems in Forge (as of May ’17)
perhaps you haven’t seen yet...
Woonsan Ko
May 26, 2017
2. Sequel to N Hidden Gems You Didn’t Know…
(Amsterdam, 2016)
● slideshare.net/woonsan
● woonsanko.blogspot.com
3. Gem #1: External Taxonomy-like
Document Picker
“Link Document Field to External Taxonomy Data!”
4. Gem #1: External Taxonomy-like Document Picker
● External Document Picker Forge Plugin*:
○ Supports Tree List view as well as Flat List for backend data
since v4.0!
○ Concept: Separation of UI and Data Service.
■ Built-in UI Plugin, you don’t need to care of.
■ ExternalDocumentServiceFacade interface
● Configured for the UI Plugin; Invoked by the UI Plugin.
● All Data Handling under the hood against backend.
○ Title, icon and description for each external document.
○ Optionally, resolve parent-child relationships between items.
○ Store metadata of selected item(s) into Hippo document.
* More at https://onehippo-forge.github.io/external-document-picker/
6. ● New optional interface for tree view:
* More at https://onehippo-forge.github.io/external-document-picker/
Gem #1: External Taxonomy-like Document Picker (cont.)
public interface ExternalDocumentTreeService<T extends Serializable> {
default public boolean hasChildren(T doc) { return false; }
default public Iterator<T> getChildren(T doc) { /* ... */ }
default public T getParent(T doc) { return null; }
}
public interface ExternalDocumentServiceFacade<T extends Serializable>
extends ExternalDocumentSearchService<T>, ExternalDocumentFieldService<T>,
ExternalDocumentDisplayService<T>, ExternalDocumentTreeService<T>, IClusterable {
/* ... */
}
7. Gem #2: Copy or Move Folder
In CMS UI
“Why can’t editors copy or move a folder?”
8. Gem #2: Copy or Move Folder in CMS UI*
* More at https://onehippo-forge.github.io/folder-context-menus/
9. Gem #3: Remoting for Automation
via JCR WebDAV
“Automate deployments with updating JCR data!”
10. Gem #3: Remoting for Automation via JCR WebDAV
●
○
○
* More at https://onehippo-forge.github.io/hippo-jcr-over-webdav/
11. Gem #3: Remoting for Automation via JCR WebDAV (cont.)
$ curl --request MKCOL --data @editor.xml --user admin:admin
http://localhost:8080/cms/server/default/jcr:root/hippo:configuration/hippo:groups/editor
<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:sv="http://www.jcp.org/jcr/sv/1.0" sv:name="editor">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hipposys:group</sv:value>
</sv:property>
<sv:property sv:name="hipposys:members" sv:type="String" sv:multiple="true">
<sv:value>editor</sv:value><sv:value>john</sv:value>
</sv:property>
<sv:property sv:name="hipposys:securityprovider" sv:type="String">
<sv:value>internal</sv:value>
</sv:property>
</sv:node>
Creating or importing node
* More at https://onehippo-forge.github.io/hippo-jcr-over-webdav/cmd-examples.html and
http://woonsanko.blogspot.com/2017/05/remoting-for-automation-via-apache.html
Example: editor.xml
12. Gem #3: Remoting for Automation via JCR WebDAV (cont.)
$ curl --user admin:admin
http://localhost:8080/cms/server/default/jcr:root/hippo:configuration/hippo:groups/editor
<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:sv="http://www.jcp.org/jcr/sv/1.0" sv:name="editor">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>hipposys:group</sv:value>
</sv:property>
<sv:property sv:name="hipposys:members" sv:type="String" sv:multiple="true">
<sv:value>editor</sv:value><sv:value>john</sv:value>
</sv:property>
<sv:property sv:name="hipposys:securityprovider" sv:type="String">
<sv:value>internal</sv:value>
</sv:property>
</sv:node>
Reading node
* More at https://onehippo-forge.github.io/hippo-jcr-over-webdav/cmd-examples.html and
http://woonsanko.blogspot.com/2017/05/remoting-for-automation-via-apache.html
13. Gem #3: Remoting for Automation via JCR WebDAV (cont.)
$ curl --request PUT --header "Content-Type: jcr-value/string"
--user admin:admin
--data "ldap-localhost"
http://localhost:8080/cms/server/default/jcr:root/hippo:configuration/hippo:groups/editor/hipp
osys:securityprovider
Updating single valued property
* More at https://onehippo-forge.github.io/hippo-jcr-over-webdav/cmd-examples.html and
http://woonsanko.blogspot.com/2017/05/remoting-for-automation-via-apache.html
14. Gem #3: Remoting for Automation via JCR WebDAV (cont.)
$ curl --request PUT --header "Content-Type: jcr-value/undefined"
--user admin:admin
--data
"<values xmlns='http://www.day.com/jcr/webdav/1.0'>
<value>editor</value>
<value>john</value>
<value>jane</value>
</values>"
http://localhost:8080/cms/server/default/jcr:root/hippo:configuration/hippo:groups/editor/hipp
osys:members
Updating multiple valued property
* More at https://onehippo-forge.github.io/hippo-jcr-over-webdav/cmd-examples.html and
http://woonsanko.blogspot.com/2017/05/remoting-for-automation-via-apache.html
15. Gem #3: Remoting for Automation via JCR WebDAV (cont.)
$ curl --request DELETE
--user admin:admin
http://localhost:8080/cms/server/default/jcr:root/hippo:configuration/hippo:groups/editor/
Deleting a node or property
* More at https://onehippo-forge.github.io/hippo-jcr-over-webdav/cmd-examples.html and
http://woonsanko.blogspot.com/2017/05/remoting-for-automation-via-apache.html
16. Gem #4: Live Version As-Of
via HST Content Version Utils
“Show content which was live in the past
(e.g, live version as of April 1, 2017)!”
17. Gem #4: Live Version As-Of via HST Content Version Utils*
●
○
○
final HstRequestContext requestContext = RequestContextProvider.get();
// First, get the current live news document.
News curNewsDoc = requestContext.getContentBean();
// Then let’s get the live version of the current news document as of April 1, 2017 if any.
Calendar asOfDate = ISO8601.parse("2017-04-01T00:00:00-04:00");
News newsDocAsOf = HippoBeanVersionUtils.getVersionedBeanAsOf(news.getCanonicalHandlePath(),
News.class,
asOfDate);
request.setAttribute("document", newsDocAsOf);
* More at https://onehippo-forge.github.io/hst-content-version-utils/
18. Gem #4: Live Version As-Of via HST Content Version Utils
(cont.)
public class JcrVersionUtils {
public static List<Version> getAllLinearVersions(Node versionableNode) { /* ... */ }
public static Version getRootVersion(Node versionableNode, List<Version> linearVersions) {
/* ... */
}
public static Node getVersionableNode(Node handleNode) { /* ... */ }
public static Version getVersionAsOf(Node versionableNode, List<Version> linearVersions,
Calendar asOf) { /* ... */ }
}
* More at https://onehippo-forge.github.io/hst-content-version-utils/apidocs/index.html
public class FrozenNodeUtils {
public static Node getNonFrozenPretenderNode(Node versionableNode,
Calendar created, Calendar asOf) { /* ... */ }
}