You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/01/25 15:41:13 UTC
[49/50] [abbrv] isis git commit: ISIS-993: metadata classes,
facet factory, starting on the wicket component
ISIS-993: metadata classes, facet factory, starting on the wicket component
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/99f808c1
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/99f808c1
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/99f808c1
Branch: refs/heads/ISIS-993
Commit: 99f808c1ddae5eeff63a57f8a2616d6e92b78957
Parents: 3fc1eb2
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Jan 6 08:59:52 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Jan 25 14:38:24 2016 +0000
----------------------------------------------------------------------
.../schema/applib/layout/layout-1.0.xsd | 210 +++++++++++++++++++
.../asciidoc/schema/applib/layout/layout.xsd | 210 +++++++++++++++++++
.../isis/applib/annotation/ActionLayout.java | 8 +
.../isis/applib/annotation/BookmarkPolicy.java | 5 +
.../applib/annotation/CollectionLayout.java | 4 +-
.../isis/applib/annotation/Contributed.java | 5 +
.../isis/applib/annotation/LabelPosition.java | 5 +
.../isis/applib/annotation/RenderType.java | 5 +
.../apache/isis/applib/annotation/Where.java | 5 +
.../isis/applib/annotation/package-info.java | 31 ---
.../apache/isis/applib/layout/v1_0/Action.java | 62 ++++++
.../isis/applib/layout/v1_0/ActionLayout.java | 161 ++++++++++++++
.../isis/applib/layout/v1_0/Collection.java | 79 +++++++
.../applib/layout/v1_0/CollectionLayout.java | 148 +++++++++++++
.../apache/isis/applib/layout/v1_0/Column.java | 76 +++++++
.../isis/applib/layout/v1_0/DomainObject.java | 69 ++++++
.../isis/applib/layout/v1_0/Property.java | 77 +++++++
.../isis/applib/layout/v1_0/PropertyGroup.java | 86 ++++++++
.../isis/applib/layout/v1_0/PropertyLayout.java | 147 +++++++++++++
.../org/apache/isis/applib/layout/v1_0/Tab.java | 81 +++++++
.../isis/applib/layout/v1_0/TabGroup.java | 46 ++++
.../isis/applib/layout/v1_0/package-info.java | 25 +++
.../jaxb/CatalogingSchemaOutputResolver.java | 83 ++++++++
.../isis/applib/services/jaxb/JaxbService.java | 152 +++++++++++++-
.../services/jaxb/StreamResultWithWriter.java | 45 ++++
.../DomainServiceLayoutFacetFactory.java | 84 ++++++++
.../DomainServiceLayoutFactory.java | 84 --------
.../facets/object/layoutxml/LayoutXmlFacet.java | 32 +++
.../object/layoutxml/LayoutXmlFacetDefault.java | 85 ++++++++
.../object/layoutxml/LayoutXmlFacetFactory.java | 98 +++++++++
.../dflt/ProgrammingModelFacetsJava5.java | 7 +-
.../DomainServiceLayoutFacetFactoryTest.java | 129 ++++++++++++
.../DomainServiceLayoutFactoryTest.java | 129 ------------
.../layoutxml/v1_0/DomainObjectTest.java | 101 +++++++++
.../jaxb/CatalogingSchemaOutputResolver.java | 85 --------
.../services/jaxb/JaxbServiceDefault.java | 111 +---------
.../services/jaxb/StreamResultWithWriter.java | 45 ----
.../ComponentFactoryRegistrarDefault.java | 28 ++-
.../entity/EntityComponentFactoryAbstract.java | 14 +-
.../entity/tabbed/EntityTabbedPanel.html | 27 +++
.../entity/tabbed/EntityTabbedPanel.java | 59 ++++++
.../entity/tabbed/EntityTabbedPanelFactory.java | 56 +++++
.../dom/simple/SimpleObject.layout.xml | 44 ++++
43 files changed, 2557 insertions(+), 486 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout-1.0.xsd
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout-1.0.xsd b/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout-1.0.xsd
new file mode 100644
index 0000000..97ab131
--- /dev/null
+++ b/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout-1.0.xsd
@@ -0,0 +1,210 @@
+<?xml version="1.0" standalone="yes"?>
+<xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="http://isis.apache.org/schema/applib/layout" xmlns:tns="http://isis.apache.org/schema/applib/layout" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="domainObject" type="tns:domainObject"/>
+
+ <xs:complexType name="domainObject">
+ <xs:sequence>
+ <xs:element name="actions">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="tabGroups">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="tabGroup" type="tns:tabGroup" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="action">
+ <xs:sequence>
+ <xs:element name="layout" type="tns:actionLayout"/>
+ </xs:sequence>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="actionLayout">
+ <xs:sequence>
+ <xs:element name="bookmarking" type="tns:bookmarkPolicy" default="NEVER" minOccurs="0"/>
+ <xs:element name="cssClass" type="xs:string" minOccurs="0"/>
+ <xs:element name="cssClassFa" type="xs:string" minOccurs="0"/>
+ <xs:element name="cssClassFaPosition" type="tns:cssClassFaPosition" minOccurs="0"/>
+ <xs:element name="describedAs" type="xs:string" minOccurs="0"/>
+ <xs:element name="hidden" type="tns:where" minOccurs="0"/>
+ <xs:element name="named" type="xs:string" minOccurs="0"/>
+ <xs:element name="namedEscaped" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="position" type="tns:position" default="BELOW"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="tabGroup">
+ <xs:sequence>
+ <xs:element name="tabs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="tab" type="tns:tab" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="tab">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="0"/>
+ <xs:element name="left" type="tns:column"/>
+ <xs:element name="middle" type="tns:column" minOccurs="0"/>
+ <xs:element name="right" type="tns:column" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="column">
+ <xs:sequence>
+ <xs:element name="span" type="xs:int" default="4"/>
+ <xs:element name="propertyGroups">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="propertyGroup" type="tns:propertyGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="collections">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="collection" type="tns:collection" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="propertyGroup">
+ <xs:sequence>
+ <xs:element name="actions">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="properties">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="property" type="tns:property" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="property">
+ <xs:sequence>
+ <xs:element name="layout" type="tns:propertyLayout"/>
+ <xs:element name="actions" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="propertyLayout">
+ <xs:sequence>
+ <xs:element name="cssClass" type="xs:string" minOccurs="0"/>
+ <xs:element name="describedAs" type="xs:string" minOccurs="0"/>
+ <xs:element name="hidden" type="tns:where" minOccurs="0"/>
+ <xs:element name="labelPosition" type="tns:labelPosition" default="LEFT"/>
+ <xs:element name="multiLine" type="xs:int" minOccurs="0"/>
+ <xs:element name="named" type="xs:string" minOccurs="0"/>
+ <xs:element name="namedEscaped" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="renderedAsDayBefore" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="typicalLength" type="xs:int" default="-1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="collection">
+ <xs:sequence>
+ <xs:element name="layout" type="tns:collectionLayout"/>
+ <xs:element name="actions">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="collectionLayout">
+ <xs:sequence>
+ <xs:element name="cssClass" type="xs:string" minOccurs="0"/>
+ <xs:element name="describedAs" type="xs:string" minOccurs="0"/>
+ <xs:element name="defaultView" type="xs:string" default="table"/>
+ <xs:element name="hidden" type="tns:where" minOccurs="0"/>
+ <xs:element name="named" type="xs:string" minOccurs="0"/>
+ <xs:element name="namedEscaped" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="paged" type="xs:int" minOccurs="0"/>
+ <xs:element name="sortedBy" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:simpleType name="bookmarkPolicy">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="AS_ROOT"/>
+ <xs:enumeration value="AS_CHILD"/>
+ <xs:enumeration value="NEVER"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="cssClassFaPosition">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="LEFT"/>
+ <xs:enumeration value="RIGHT"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="where">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="EVERYWHERE"/>
+ <xs:enumeration value="ANYWHERE"/>
+ <xs:enumeration value="OBJECT_FORMS"/>
+ <xs:enumeration value="REFERENCES_PARENT"/>
+ <xs:enumeration value="PARENTED_TABLES"/>
+ <xs:enumeration value="STANDALONE_TABLES"/>
+ <xs:enumeration value="ALL_TABLES"/>
+ <xs:enumeration value="ALL_EXCEPT_STANDALONE_TABLES"/>
+ <xs:enumeration value="NOWHERE"/>
+ <xs:enumeration value="NOT_SPECIFIED"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="position">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="BELOW"/>
+ <xs:enumeration value="RIGHT"/>
+ <xs:enumeration value="PANEL"/>
+ <xs:enumeration value="PANEL_DROPDOWN"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="labelPosition">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="DEFAULT"/>
+ <xs:enumeration value="LEFT"/>
+ <xs:enumeration value="RIGHT"/>
+ <xs:enumeration value="TOP"/>
+ <xs:enumeration value="NONE"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout.xsd
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout.xsd b/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout.xsd
new file mode 100644
index 0000000..97ab131
--- /dev/null
+++ b/adocs/documentation/src/main/asciidoc/schema/applib/layout/layout.xsd
@@ -0,0 +1,210 @@
+<?xml version="1.0" standalone="yes"?>
+<xs:schema elementFormDefault="qualified" version="1.0" targetNamespace="http://isis.apache.org/schema/applib/layout" xmlns:tns="http://isis.apache.org/schema/applib/layout" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="domainObject" type="tns:domainObject"/>
+
+ <xs:complexType name="domainObject">
+ <xs:sequence>
+ <xs:element name="actions">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="tabGroups">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="tabGroup" type="tns:tabGroup" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="action">
+ <xs:sequence>
+ <xs:element name="layout" type="tns:actionLayout"/>
+ </xs:sequence>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="actionLayout">
+ <xs:sequence>
+ <xs:element name="bookmarking" type="tns:bookmarkPolicy" default="NEVER" minOccurs="0"/>
+ <xs:element name="cssClass" type="xs:string" minOccurs="0"/>
+ <xs:element name="cssClassFa" type="xs:string" minOccurs="0"/>
+ <xs:element name="cssClassFaPosition" type="tns:cssClassFaPosition" minOccurs="0"/>
+ <xs:element name="describedAs" type="xs:string" minOccurs="0"/>
+ <xs:element name="hidden" type="tns:where" minOccurs="0"/>
+ <xs:element name="named" type="xs:string" minOccurs="0"/>
+ <xs:element name="namedEscaped" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="position" type="tns:position" default="BELOW"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="tabGroup">
+ <xs:sequence>
+ <xs:element name="tabs">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="tab" type="tns:tab" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="tab">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="0"/>
+ <xs:element name="left" type="tns:column"/>
+ <xs:element name="middle" type="tns:column" minOccurs="0"/>
+ <xs:element name="right" type="tns:column" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="column">
+ <xs:sequence>
+ <xs:element name="span" type="xs:int" default="4"/>
+ <xs:element name="propertyGroups">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="propertyGroup" type="tns:propertyGroup" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="collections">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="collection" type="tns:collection" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="propertyGroup">
+ <xs:sequence>
+ <xs:element name="actions">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="properties">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="property" type="tns:property" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="property">
+ <xs:sequence>
+ <xs:element name="layout" type="tns:propertyLayout"/>
+ <xs:element name="actions" minOccurs="0">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="propertyLayout">
+ <xs:sequence>
+ <xs:element name="cssClass" type="xs:string" minOccurs="0"/>
+ <xs:element name="describedAs" type="xs:string" minOccurs="0"/>
+ <xs:element name="hidden" type="tns:where" minOccurs="0"/>
+ <xs:element name="labelPosition" type="tns:labelPosition" default="LEFT"/>
+ <xs:element name="multiLine" type="xs:int" minOccurs="0"/>
+ <xs:element name="named" type="xs:string" minOccurs="0"/>
+ <xs:element name="namedEscaped" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="renderedAsDayBefore" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="typicalLength" type="xs:int" default="-1"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="collection">
+ <xs:sequence>
+ <xs:element name="layout" type="tns:collectionLayout"/>
+ <xs:element name="actions">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="action" type="tns:action" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="identifier" type="xs:string" use="required"/>
+ </xs:complexType>
+
+ <xs:complexType name="collectionLayout">
+ <xs:sequence>
+ <xs:element name="cssClass" type="xs:string" minOccurs="0"/>
+ <xs:element name="describedAs" type="xs:string" minOccurs="0"/>
+ <xs:element name="defaultView" type="xs:string" default="table"/>
+ <xs:element name="hidden" type="tns:where" minOccurs="0"/>
+ <xs:element name="named" type="xs:string" minOccurs="0"/>
+ <xs:element name="namedEscaped" type="xs:boolean" minOccurs="0"/>
+ <xs:element name="paged" type="xs:int" minOccurs="0"/>
+ <xs:element name="sortedBy" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:simpleType name="bookmarkPolicy">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="AS_ROOT"/>
+ <xs:enumeration value="AS_CHILD"/>
+ <xs:enumeration value="NEVER"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="cssClassFaPosition">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="LEFT"/>
+ <xs:enumeration value="RIGHT"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="where">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="EVERYWHERE"/>
+ <xs:enumeration value="ANYWHERE"/>
+ <xs:enumeration value="OBJECT_FORMS"/>
+ <xs:enumeration value="REFERENCES_PARENT"/>
+ <xs:enumeration value="PARENTED_TABLES"/>
+ <xs:enumeration value="STANDALONE_TABLES"/>
+ <xs:enumeration value="ALL_TABLES"/>
+ <xs:enumeration value="ALL_EXCEPT_STANDALONE_TABLES"/>
+ <xs:enumeration value="NOWHERE"/>
+ <xs:enumeration value="NOT_SPECIFIED"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="position">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="BELOW"/>
+ <xs:enumeration value="RIGHT"/>
+ <xs:enumeration value="PANEL"/>
+ <xs:enumeration value="PANEL_DROPDOWN"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="labelPosition">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="DEFAULT"/>
+ <xs:enumeration value="LEFT"/>
+ <xs:enumeration value="RIGHT"/>
+ <xs:enumeration value="TOP"/>
+ <xs:enumeration value="NONE"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:schema>
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
index 52a652f..d8255c5 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
@@ -25,6 +25,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import javax.xml.bind.annotation.XmlType;
+
/**
* Layout hints for actions.
*/
@@ -72,6 +74,9 @@ public @interface ActionLayout {
*/
CssClassFaPosition cssClassFaPosition() default CssClassFaPosition.LEFT;
+ @XmlType(
+ namespace = "http://isis.apache.org/schema/applib/layout"
+ )
enum CssClassFaPosition {
LEFT, RIGHT
}
@@ -109,6 +114,9 @@ public @interface ActionLayout {
*/
Position position() default Position.BELOW;
+ @XmlType(
+ namespace = "http://isis.apache.org/schema/applib/layout"
+ )
enum Position {
BELOW,
RIGHT,
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/BookmarkPolicy.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/BookmarkPolicy.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/BookmarkPolicy.java
index 83a90f3..b6b1fb3 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/BookmarkPolicy.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/BookmarkPolicy.java
@@ -19,6 +19,11 @@
package org.apache.isis.applib.annotation;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(
+ namespace = "http://isis.apache.org/schema/applib/layout"
+)
public enum BookmarkPolicy {
/**
* Can be bookmarked, and is a top-level 'root' (or parent) bookmark.
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
index 8216c66..d73f3c6 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionLayout.java
@@ -103,7 +103,7 @@ public @interface CollectionLayout {
* If annotated on a type, then the page size refers to standalone
* collections (eg as returned from a repository query).
*/
- public int paged() default -1;
+ int paged() default -1;
// //////////////////////////////////////
@@ -124,7 +124,7 @@ public @interface CollectionLayout {
* There is some similarity between this concept and that of eager-loading as supported by some object stores.
* </p>
*/
- public RenderType render() default RenderType.LAZILY;
+ RenderType render() default RenderType.LAZILY;
// //////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/Contributed.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Contributed.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Contributed.java
index 88c46ea..81821bb 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Contributed.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Contributed.java
@@ -19,9 +19,14 @@
package org.apache.isis.applib.annotation;
+import javax.xml.bind.annotation.XmlType;
+
/**
* The means by which a domain service action will be contributed to a domain object.
*/
+@XmlType(
+ namespace = "http://isis.apache.org/schema/applib/layout"
+)
public enum Contributed {
/**
* Default: contributed as both an action and also (if takes a single argument and has safe semantics) as an association
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/LabelPosition.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/LabelPosition.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/LabelPosition.java
index c4cdc10..a91d280 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/LabelPosition.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/LabelPosition.java
@@ -18,12 +18,17 @@
*/
package org.apache.isis.applib.annotation;
+import javax.xml.bind.annotation.XmlType;
+
/**
* The positioning of a label for a property or action parameter.
*
* @see org.apache.isis.applib.annotation.PropertyLayout
* @see org.apache.isis.applib.annotation.ParameterLayout
*/
+@XmlType(
+ namespace = "http://isis.apache.org/schema/applib/layout"
+)
public enum LabelPosition {
DEFAULT,
LEFT,
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/RenderType.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/RenderType.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/RenderType.java
index 776f8f6..5363b38 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/RenderType.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/RenderType.java
@@ -18,6 +18,11 @@
*/
package org.apache.isis.applib.annotation;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(
+ namespace = "http://isis.apache.org/schema/applib/layout"
+)
public enum RenderType {
EAGERLY,
LAZILY;
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/Where.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Where.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Where.java
index 5dbbded..e89403d 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Where.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Where.java
@@ -19,6 +19,8 @@
package org.apache.isis.applib.annotation;
+import javax.xml.bind.annotation.XmlType;
+
import org.apache.isis.applib.util.Enums;
/**
@@ -38,6 +40,9 @@ import org.apache.isis.applib.util.Enums;
* This enum is also used internally within the framework. When rendering an element,
* the framework developer should only use those values that represent concrete locations.
*/
+@XmlType(
+ namespace = "http://isis.apache.org/schema/applib/layout"
+)
public enum Where {
/**
* The member should be disabled/hidden everywhere.
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/annotation/package-info.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/package-info.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/package-info.java
deleted file mode 100644
index fbea3bc..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/package-info.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * This package defines all of the annotations that are recognized within
- * the default Isis programming model.
- *
- * <p>
- * For example, {@link org.apache.isis.applib.annotation.Optional} is used to
- * indicate that a property or a parameter is optional rather than mandatory.
- * The {@link org.apache.isis.applib.annotation.MaxLength} annotation is used
- * to indicate the maximum length allowable for a (string) property or
- * parameter, or to indicate the maximum length of a (string-based) value type.
- */
-package org.apache.isis.applib.annotation;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java
new file mode 100644
index 0000000..9037c04
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(
+ propOrder = {
+ "identifier"
+ , "layout"
+ }
+)
+public class Action {
+
+
+ private String identifier;
+ /**
+ * Method name.
+ *
+ * <p>
+ * Overloaded methods are not supported.
+ * </p>
+ */
+ @XmlAttribute(required = true)
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+
+
+ private ActionLayout layout = new ActionLayout();
+ @XmlElement(required = true)
+ public ActionLayout getLayout() {
+ return layout;
+ }
+
+ public void setLayout(ActionLayout layout) {
+ this.layout = layout;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/ActionLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/ActionLayout.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/ActionLayout.java
new file mode 100644
index 0000000..4fb4934
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/ActionLayout.java
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.isis.applib.annotation.BookmarkPolicy;
+import org.apache.isis.applib.annotation.Where;
+
+/**
+ * Broadly corresponds to {@link org.apache.isis.applib.annotation.ActionLayout}.
+ *
+ * <p>
+ * Note that {@link org.apache.isis.applib.annotation.ActionLayout#contributed()} is omitted because this only applies
+ * to domain services.
+ * </p>
+ */
+@XmlType(
+ propOrder = {
+ "bookmarking"
+ , "cssClass"
+ , "cssClassFa"
+ , "cssClassFaPosition"
+ , "describedAs"
+ , "hidden"
+ , "named"
+ , "namedEscaped"
+ , "position"
+ }
+)
+public class ActionLayout {
+
+ private BookmarkPolicy bookmarking = BookmarkPolicy.NEVER;
+
+ @XmlElement(required = false, defaultValue = "NEVER")
+ public BookmarkPolicy getBookmarking() {
+ return bookmarking;
+ }
+
+ public void setBookmarking(BookmarkPolicy bookmarking) {
+ this.bookmarking = bookmarking;
+ }
+
+
+ private String cssClass;
+
+ @XmlElement(required = false)
+ public String getCssClass() {
+ return cssClass;
+ }
+
+ public void setCssClass(String cssClass) {
+ this.cssClass = cssClass;
+ }
+
+
+ private String cssClassFa;
+
+ @XmlElement(required = false)
+ public String getCssClassFa() {
+ return cssClassFa;
+ }
+
+ public void setCssClassFa(String cssClassFa) {
+ this.cssClassFa = cssClassFa;
+ }
+
+
+
+ private org.apache.isis.applib.annotation.ActionLayout.CssClassFaPosition cssClassFaPosition;
+
+ @XmlElement(required = false)
+ public org.apache.isis.applib.annotation.ActionLayout.CssClassFaPosition getCssClassFaPosition() {
+ return cssClassFaPosition;
+ }
+
+ public void setCssClassFaPosition(org.apache.isis.applib.annotation.ActionLayout.CssClassFaPosition cssClassFaPosition) {
+ this.cssClassFaPosition = cssClassFaPosition;
+ }
+
+
+ private String describedAs;
+
+ @XmlElement(required = false)
+ public String getDescribedAs() {
+ return describedAs;
+ }
+
+ public void setDescribedAs(String describedAs) {
+ this.describedAs = describedAs;
+ }
+
+
+
+ private Where hidden;
+
+ @XmlElement(required = false)
+ public Where getHidden() {
+ return hidden;
+ }
+
+ public void setHidden(Where hidden) {
+ this.hidden = hidden;
+ }
+
+
+
+ private String named;
+
+ @XmlElement(required = false)
+ public String getNamed() {
+ return named;
+ }
+
+ public void setNamed(String named) {
+ this.named = named;
+ }
+
+
+
+ private Boolean namedEscaped;
+
+ @XmlElement(required = false)
+ public Boolean getNamedEscaped() {
+ return namedEscaped;
+ }
+
+ public void setNamedEscaped(Boolean namedEscaped) {
+ this.namedEscaped = namedEscaped;
+ }
+
+
+
+ private org.apache.isis.applib.annotation.ActionLayout.Position position = org.apache.isis.applib.annotation.ActionLayout.Position.BELOW;
+
+ @XmlElement(required = true, defaultValue = "BELOW")
+ public org.apache.isis.applib.annotation.ActionLayout.Position getPosition() {
+ return position;
+ }
+
+ public void setPosition(org.apache.isis.applib.annotation.ActionLayout.Position position) {
+ this.position = position;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java
new file mode 100644
index 0000000..3796f5f
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+import com.google.common.collect.Lists;
+
+@XmlType(
+ propOrder = {
+ "identifier"
+ , "layout"
+ , "actions"
+ }
+)
+public class Collection {
+
+ private String identifier;
+
+ /**
+ * Collection identifier, being the getter method without "get" prefix, first letter lower cased.
+ */
+ @XmlAttribute(required = true)
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+
+
+ private CollectionLayout layout = new CollectionLayout();
+
+ @XmlElement(required = true)
+ public CollectionLayout getLayout() {
+ return layout;
+ }
+
+ public void setLayout(CollectionLayout layout) {
+ this.layout = layout;
+ }
+
+
+
+ private List<Action> actions = Lists.newArrayList();
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "action", required = false)
+ public List<Action> getActions() {
+ return actions;
+ }
+
+ public void setActions(List<Action> actions) {
+ this.actions = actions;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/CollectionLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/CollectionLayout.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/CollectionLayout.java
new file mode 100644
index 0000000..21c9273
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/CollectionLayout.java
@@ -0,0 +1,148 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.isis.applib.annotation.Where;
+
+/**
+ * Broadly corresponds to the {@link org.apache.isis.applib.annotation.CollectionLayout} annotation.
+ *
+ * <p>
+ * Note that {@link org.apache.isis.applib.annotation.CollectionLayout#render()} is omitted because
+ * {@link #defaultView} is its replacement.
+ * </p>
+ */
+@XmlType(
+ propOrder = {
+ "cssClass"
+ ,"describedAs"
+ ,"defaultView"
+ ,"hidden"
+ ,"named"
+ ,"namedEscaped"
+ ,"paged"
+ ,"sortedBy"
+ }
+)
+public class CollectionLayout {
+
+ private String cssClass;
+
+ @XmlElement(required = false)
+ public String getCssClass() {
+ return cssClass;
+ }
+
+ public void setCssClass(String cssClass) {
+ this.cssClass = cssClass;
+ }
+
+
+
+ private String describedAs;
+
+ @XmlElement(required = false)
+ public String getDescribedAs() {
+ return describedAs;
+ }
+
+ public void setDescribedAs(String describedAs) {
+ this.describedAs = describedAs;
+ }
+
+
+
+ private String defaultView = "table";
+
+ /**
+ * Typically <code>table</code> or <code>hidden</code>, but could be any other named view that is configured and
+ * appropriate, eg <code>gmap3</code> or <code>fullcalendar2</code>.
+ */
+ @XmlElement(required = true, defaultValue = "table")
+ public String getDefaultView() {
+ return defaultView;
+ }
+
+ public void setDefaultView(String defaultView) {
+ this.defaultView = defaultView;
+ }
+
+
+ private Where hidden;
+
+ @XmlElement(required = false)
+ public Where getHidden() {
+ return hidden;
+ }
+
+ public void setHidden(Where hidden) {
+ this.hidden = hidden;
+ }
+
+
+ private String named;
+
+ @XmlElement(required = false)
+ public String getNamed() {
+ return named;
+ }
+
+ public void setNamed(String named) {
+ this.named = named;
+ }
+
+
+ private Boolean namedEscaped;
+
+ @XmlElement(required = false)
+ public Boolean getNamedEscaped() {
+ return namedEscaped;
+ }
+
+ public void setNamedEscaped(Boolean namedEscaped) {
+ this.namedEscaped = namedEscaped;
+ }
+
+
+ private Integer paged;
+
+ @XmlElement(required = false)
+ public Integer getPaged() {
+ return paged;
+ }
+
+ public void setPaged(Integer paged) {
+ this.paged = paged;
+ }
+
+
+
+ private String sortedBy;
+
+ @XmlElement(required = false)
+ public String getSortedBy() {
+ return sortedBy;
+ }
+
+ public void setSortedBy(String sortedBy) {
+ this.sortedBy = sortedBy;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java
new file mode 100644
index 0000000..84534c0
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+import com.google.common.collect.Lists;
+
+@XmlType(
+ propOrder = {
+ "span"
+ , "propertyGroups"
+ , "collections"
+ }
+)
+public class Column {
+
+ private int span = 4;
+
+ @XmlElement(required = true, defaultValue = "4")
+ public int getSpan() {
+ return span;
+ }
+
+ public void setSpan(final int span) {
+ this.span = span;
+ }
+
+
+
+ private List<PropertyGroup> propertyGroups = Lists.newArrayList();
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "propertyGroup", required = false)
+ public List<PropertyGroup> getPropertyGroups() {
+ return propertyGroups;
+ }
+
+ public void setPropertyGroups(List<PropertyGroup> propertyGroups) {
+ this.propertyGroups = propertyGroups;
+ }
+
+
+
+ private List<Collection> collections = Lists.newArrayList();
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "collection", required = false)
+ public List<Collection> getCollections() {
+ return collections;
+ }
+
+ public void setCollections(List<Collection> collections) {
+ this.collections = collections;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java
new file mode 100644
index 0000000..2ac2e54
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.applib.services.dto.Dto;
+
+@XmlRootElement
+@XmlType(
+ propOrder = {
+ "actions"
+ , "tabGroups"
+ }
+)
+public class DomainObject implements Dto {
+
+ private List<Action> actions = Lists.newArrayList();
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "action", required = false)
+ public List<Action> getActions() {
+ return actions;
+ }
+
+ public void setActions(List<Action> actions) {
+ this.actions = actions;
+ }
+
+
+ // must have at least one tab group
+ private List<TabGroup> tabGroups = new ArrayList<TabGroup>() {{
+ add(new TabGroup());
+ }};
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "tabGroup", required = true)
+ public List<TabGroup> getTabGroups() {
+ return tabGroups;
+ }
+
+ public void setTabGroups(List<TabGroup> tabGroups) {
+ this.tabGroups = tabGroups;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java
new file mode 100644
index 0000000..ed08541
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+import com.google.common.collect.Lists;
+
+@XmlType(
+ propOrder = {
+ "identifier"
+ , "layout"
+ , "actions"
+ }
+)
+public class Property {
+
+ private String identifier;
+
+ /**
+ * Property identifier, being the getter method without "get" or "is" prefix, first letter lower cased.
+ */
+ @XmlAttribute(required = true)
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+
+ private PropertyLayout layout = new PropertyLayout();
+
+ @XmlElement(required = true)
+ public PropertyLayout getLayout() {
+ return layout;
+ }
+
+ public void setLayout(PropertyLayout layout) {
+ this.layout = layout;
+ }
+
+
+ private List<Action> actions = Lists.newArrayList();
+
+ @XmlElementWrapper(required = false)
+ @XmlElement(name = "action", required = true)
+ public List<Action> getActions() {
+ return actions;
+ }
+
+ public void setActions(List<Action> actions) {
+ this.actions = actions;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java
new file mode 100644
index 0000000..f62c316
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.applib.annotation.MemberOrder;
+
+@XmlType(
+ propOrder = {
+ "name"
+ , "actions"
+ , "properties"
+ }
+)
+public class PropertyGroup {
+
+ private String name;
+
+ /**
+ * Corresponds to the {@link MemberOrder#name()} (when applied to properties).
+ */
+ @XmlAttribute(required = true)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+
+ private List<Action> actions = Lists.newArrayList();
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "action", required = false)
+ public List<Action> getActions() {
+ return actions;
+ }
+
+ public void setActions(List<Action> actions) {
+ this.actions = actions;
+ }
+
+
+
+ // must be at least one property in the property group
+ private List<Property> properties = new ArrayList<Property>() {{
+ add(new Property());
+ }};
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "property", required = true)
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(List<Property> properties) {
+ this.properties = properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyLayout.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyLayout.java
new file mode 100644
index 0000000..0728c1f
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyLayout.java
@@ -0,0 +1,147 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.isis.applib.annotation.LabelPosition;
+import org.apache.isis.applib.annotation.Where;
+
+@XmlType(
+ propOrder = {
+ "cssClass"
+ , "describedAs"
+ , "hidden"
+ , "labelPosition"
+ , "multiLine"
+ , "named"
+ , "namedEscaped"
+ , "renderedAsDayBefore"
+ , "typicalLength"
+ }
+)
+public class PropertyLayout {
+
+ private String cssClass;
+
+ @XmlElement(required = false)
+ public String getCssClass() {
+ return cssClass;
+ }
+
+ public void setCssClass(String cssClass) {
+ this.cssClass = cssClass;
+ }
+
+
+ private String describedAs;
+
+ @XmlElement(required = false)
+ public String getDescribedAs() {
+ return describedAs;
+ }
+
+ public void setDescribedAs(String describedAs) {
+ this.describedAs = describedAs;
+ }
+
+
+ private Where hidden;
+
+ @XmlElement(required = false)
+ public Where getHidden() {
+ return hidden;
+ }
+
+ public void setHidden(Where hidden) {
+ this.hidden = hidden;
+ }
+
+
+ private LabelPosition labelPosition = LabelPosition.LEFT;
+
+ @XmlElement(required = true, defaultValue = "LEFT")
+ public LabelPosition getLabelPosition() {
+ return labelPosition;
+ }
+
+ public void setLabelPosition(LabelPosition labelPosition) {
+ this.labelPosition = labelPosition;
+ }
+
+
+ private Integer multiLine;
+
+ @XmlElement(required = false)
+ public Integer getMultiLine() {
+ return multiLine;
+ }
+
+ public void setMultiLine(Integer multiLine) {
+ this.multiLine = multiLine;
+ }
+
+
+ private String named;
+
+ @XmlElement(required = false)
+ public String getNamed() {
+ return named;
+ }
+
+ public void setNamed(String named) {
+ this.named = named;
+ }
+
+
+ private Boolean namedEscaped;
+
+ @XmlElement(required = false)
+ public Boolean getNamedEscaped() {
+ return namedEscaped;
+ }
+
+ public void setNamedEscaped(Boolean namedEscaped) {
+ this.namedEscaped = namedEscaped;
+ }
+
+
+ private Boolean renderedAsDayBefore;
+
+ @XmlElement(required = false)
+ public Boolean getRenderedAsDayBefore() {
+ return renderedAsDayBefore;
+ }
+
+ public void setRenderedAsDayBefore(Boolean renderedAsDayBefore) {
+ this.renderedAsDayBefore = renderedAsDayBefore;
+ }
+
+
+ private Integer typicalLength = -1;
+
+ @XmlElement(required = true, defaultValue = "-1")
+ public Integer getTypicalLength() {
+ return typicalLength;
+ }
+
+ public void setTypicalLength(Integer typicalLength) {
+ this.typicalLength = typicalLength;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Tab.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Tab.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Tab.java
new file mode 100644
index 0000000..b8b311a
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Tab.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(
+ propOrder = {
+ "name"
+ , "left"
+ , "middle"
+ , "right"
+ }
+)
+public class Tab {
+
+ private String name;
+
+ @XmlElement(required = false)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+
+ private Column left = new Column();
+
+ @XmlElement(required = true)
+ public Column getLeft() {
+ return left;
+ }
+
+ public void setLeft(final Column left) {
+ this.left = left;
+ }
+
+
+ private Column middle;
+
+ @XmlElement(required = false)
+ public Column getMiddle() {
+ return middle;
+ }
+
+ public void setMiddle(final Column middle) {
+ this.middle = middle;
+ }
+
+
+ private Column right;
+
+ @XmlElement(required = false)
+ public Column getRight() {
+ return right;
+ }
+
+ public void setRight(final Column right) {
+ this.right = right;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/TabGroup.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/TabGroup.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/TabGroup.java
new file mode 100644
index 0000000..3d57c19
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/TabGroup.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.v1_0;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlType(
+ propOrder = {"tabs"}
+) public class TabGroup {
+
+ // must be at least one tab.
+ private List<Tab> tabs = new ArrayList<Tab>(){{
+ add(new Tab());
+ }};
+
+ @XmlElementWrapper(required = true)
+ @XmlElement(name = "tab", required = true)
+ public List<Tab> getTabs() {
+ return tabs;
+ }
+
+ public void setTabs(List<Tab> tabs) {
+ this.tabs = tabs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/package-info.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/package-info.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/package-info.java
new file mode 100644
index 0000000..f187ff2
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/package-info.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+@javax.xml.bind.annotation.XmlSchema(
+ namespace = "http://isis.apache.org/schema/applib/layout",
+ elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED
+ // specifying the location seems to cause JaxbService#toXsd() to not generate the schema; not sure why...
+ //, location = "http://isis.apache.org/schema/metamodel/layout/layout-1.0.xsd"
+)
+package org.apache.isis.applib.layout.v1_0;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/CatalogingSchemaOutputResolver.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/CatalogingSchemaOutputResolver.java b/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/CatalogingSchemaOutputResolver.java
new file mode 100644
index 0000000..5d16c95
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/CatalogingSchemaOutputResolver.java
@@ -0,0 +1,83 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.applib.services.jaxb;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * An implementation of {@link SchemaOutputResolver} that keeps track of all the schemas for which it has
+ * {@link #createOutput(String, String) created} an output {@link StreamResult} containing the content of the schema.
+ */
+class CatalogingSchemaOutputResolver extends SchemaOutputResolver
+{
+ private final JaxbService.IsisSchemas isisSchemas;
+ private List<String> namespaceUris = Lists.newArrayList();
+
+ public CatalogingSchemaOutputResolver(final JaxbService.IsisSchemas isisSchemas) {
+ this.isisSchemas = isisSchemas;
+ }
+
+ public List<String> getNamespaceUris() {
+ return namespaceUris;
+ }
+
+ private Map<String, StreamResultWithWriter> schemaResultByNamespaceUri = Maps.newLinkedHashMap();
+
+ public String getSchemaTextFor(final String namespaceUri) {
+ final StreamResultWithWriter streamResult = schemaResultByNamespaceUri.get(namespaceUri);
+ return streamResult != null? streamResult.asString(): null;
+ }
+
+ @Override
+ public Result createOutput(
+ final String namespaceUri, final String suggestedFileName) throws IOException {
+
+ final StreamResultWithWriter result = new StreamResultWithWriter();
+
+ result.setSystemId(namespaceUri);
+
+ if (isisSchemas.shouldIgnore(namespaceUri)) {
+ // skip
+ } else {
+ namespaceUris.add(namespaceUri);
+ schemaResultByNamespaceUri.put(namespaceUri, result);
+ }
+
+ return result;
+ }
+
+ public Map<String, String> asMap() {
+ final Map<String,String> map = Maps.newLinkedHashMap();
+ final List<String> namespaceUris = getNamespaceUris();
+
+ for (String namespaceUri : namespaceUris) {
+ map.put(namespaceUri, getSchemaTextFor(namespaceUri));
+ }
+
+ return Collections.unmodifiableMap(map);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/JaxbService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/JaxbService.java b/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/JaxbService.java
index ed42609..ae0be24 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/JaxbService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/JaxbService.java
@@ -16,8 +16,27 @@
*/
package org.apache.isis.applib.services.jaxb;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.reflect.Method;
+import java.util.List;
import java.util.Map;
+import javax.inject.Inject;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.ApplicationException;
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.NonRecoverableException;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.services.dto.Dto_downloadXsd;
@@ -26,7 +45,14 @@ public interface JaxbService {
@Programmatic
<T> T fromXml(Class<T> domainClass, String xml);
- @Programmatic String toXml(final Object domainObject);
+ @Programmatic
+ <T> T fromXml(Class<T> domainClass, String xml, Map<String,Object> unmarshallerProperties);
+
+ @Programmatic
+ String toXml(final Object domainObject);
+
+ @Programmatic
+ String toXml(final Object domainObject, Map<String,Object> marshallerProperties);
/**
@@ -60,4 +86,128 @@ public interface JaxbService {
@Programmatic
Map<String, String> toXsd(final Object domainObject, final IsisSchemas isisSchemas);
+
+
+ public static class Simple implements JaxbService {
+
+ @Override
+ public <T> T fromXml(final Class<T> domainClass, final String xml) {
+ return fromXml(domainClass, xml, Maps.<String,Object>newHashMap());
+ }
+ @Override
+ public <T> T fromXml(final Class<T> domainClass, final String xml, final Map<String, Object> unmarshallerProperties) {
+ try {
+ final JAXBContext context = JAXBContext.newInstance(domainClass);
+
+ final Unmarshaller unmarshaller = context.createUnmarshaller();
+
+ for (Map.Entry<String, Object> entry : unmarshallerProperties.entrySet()) {
+ unmarshaller.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ configure(unmarshaller);
+
+ final Object unmarshal = unmarshaller.unmarshal(new StringReader(xml));
+ return (T) unmarshal;
+
+ } catch (final JAXBException ex) {
+ throw new NonRecoverableException("Error unmarshalling domain object from XML; domain object class is '" + domainClass.getName() + "'", ex);
+ }
+ }
+
+ @Override
+ public String toXml(final Object domainObject) {
+ return toXml(domainObject, Maps.<String,Object>newHashMap());
+ }
+
+ @Override
+ public String toXml(final Object domainObject, final Map<String, Object> marshallerProperties) {
+
+ final Class<?> domainClass = domainObject.getClass();
+ try {
+ final JAXBContext context = JAXBContext.newInstance(domainClass);
+
+ final Marshaller marshaller = context.createMarshaller();
+
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ for (Map.Entry<String, Object> entry : marshallerProperties.entrySet()) {
+ marshaller.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ configure(marshaller);
+
+ final StringWriter sw = new StringWriter();
+ marshaller.marshal(domainObject, sw);
+ final String xml = sw.toString();
+
+ return xml;
+
+ } catch (final JAXBException ex) {
+ final Class<? extends JAXBException> exClass = ex.getClass();
+
+ final String name = exClass.getName();
+ if(name.equals("com.sun.xml.bind.v2.runtime.IllegalAnnotationsException")) {
+ // report a better error if possible
+ // this is done reflectively so as to not have to bring in a new Maven dependency
+ List<? extends Exception> errors = null;
+ String annotationExceptionMessages = null;
+ try {
+ final Method getErrorsMethod = exClass.getMethod("getErrors");
+ errors = (List<? extends Exception>) getErrorsMethod.invoke(ex);
+ annotationExceptionMessages = ": " + Joiner.on("; ").join(
+ Iterables.transform(errors, new Function<Exception, String>() {
+ @Override public String apply(final Exception e) {
+ return e.getMessage();
+ }
+ }));
+ } catch (Exception e) {
+ // fall through if we hit any snags, and instead throw the more generic error message.
+ }
+ if(errors != null) {
+ throw new NonRecoverableException(
+ "Error marshalling domain object to XML, due to illegal annotations on domain object class '"
+ + domainClass.getName() + "'; " + errors.size() + " error"
+ + (errors.size() == 1? "": "s")
+ + " reported" + (!errors
+ .isEmpty() ? annotationExceptionMessages : ""), ex);
+ }
+ }
+
+ throw new NonRecoverableException("Error marshalling domain object to XML; domain object class is '" + domainClass.getName() + "'", ex);
+ }
+ }
+
+ /**
+ * Optional hook
+ */
+ protected void configure(final Unmarshaller unmarshaller) {
+ }
+
+ /**
+ * Optional hook
+ */
+ protected void configure(final Marshaller marshaller) {
+ }
+
+ public Map<String,String> toXsd(final Object domainObject, final IsisSchemas isisSchemas) {
+
+ try {
+ final Class<?> domainClass = domainObject.getClass();
+ final JAXBContext context = JAXBContext.newInstance(domainClass);
+
+ final CatalogingSchemaOutputResolver outputResolver = new CatalogingSchemaOutputResolver(isisSchemas);
+ context.generateSchema(outputResolver);
+
+ return outputResolver.asMap();
+ } catch (final JAXBException | IOException ex) {
+ throw new ApplicationException(ex);
+ }
+ }
+
+
+ @Inject
+ DomainObjectContainer container;
+ }
+
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/StreamResultWithWriter.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/StreamResultWithWriter.java b/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/StreamResultWithWriter.java
new file mode 100644
index 0000000..40db209
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/jaxb/StreamResultWithWriter.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.applib.services.jaxb;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+
+/**
+ * A {@link StreamResult} that contains its own writer.
+ *
+ * <p>
+ * The point is that the writer is only ever queried lazily AFTER the result has been generated.
+ * </p>
+ */
+class StreamResultWithWriter extends StreamResult {
+ private final StringWriter writer;
+
+ public StreamResultWithWriter() {
+ this(new StringWriter());
+ }
+
+ private StreamResultWithWriter(StringWriter writer) {
+ super(writer);
+ this.writer = writer;
+ }
+
+ public String asString() {
+ return writer.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetFactory.java
new file mode 100644
index 0000000..f9d75a4
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFacetFactory.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainservicelayout;
+
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.object.domainservicelayout.annotation.DomainServiceLayoutFacetAnnotation;
+
+
+public class DomainServiceLayoutFacetFactory extends FacetFactoryAbstract {
+
+ public DomainServiceLayoutFacetFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processClassContext) {
+ final Class<?> cls = processClassContext.getCls();
+
+ final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+ final DomainService domainService = Annotations.getAnnotation(cls, DomainService.class);
+ final DomainServiceLayout domainServiceLayout = Annotations.getAnnotation(cls, DomainServiceLayout.class);
+
+ if (domainService == null && domainServiceLayout == null) {
+ return;
+ }
+
+ final String domainServiceMenuOrder =
+ domainService != null && !domainService.menuOrder().equals("" + Integer.MAX_VALUE)
+ ? domainService.menuOrder()
+ : null;
+ final String domainServiceLayoutMenuOrder =
+ domainServiceLayout != null && !domainServiceLayout.menuOrder().equals("" + Integer.MAX_VALUE)
+ ? domainServiceLayout.menuOrder()
+ : null;
+ final String menuOrder = coalesce(domainServiceLayoutMenuOrder, domainServiceMenuOrder);
+
+ DomainServiceLayout.MenuBar menuBar =
+ domainServiceLayout != null
+ ? domainServiceLayout.menuBar()
+ : DomainServiceLayout.MenuBar.PRIMARY;
+
+ FacetUtil.addFacet(
+ new DomainServiceLayoutFacetAnnotation(
+ facetHolder,
+ menuBar, menuOrder));
+
+ FacetUtil.addFacet(NamedFacetForDomainServiceLayoutAnnotation.create(domainServiceLayout, facetHolder));
+ }
+
+
+ private static String coalesce(final String... reasons) {
+ for (final String reason : reasons) {
+ if(reason != null) {
+ return reason;
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99f808c1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.java
deleted file mode 100644
index 9803198..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainservicelayout/DomainServiceLayoutFactory.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.core.metamodel.facets.object.domainservicelayout;
-
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.DomainServiceLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.object.domainservicelayout.annotation.DomainServiceLayoutFacetAnnotation;
-
-
-public class DomainServiceLayoutFactory extends FacetFactoryAbstract {
-
- public DomainServiceLayoutFactory() {
- super(FeatureType.OBJECTS_ONLY);
- }
-
- @Override
- public void process(ProcessClassContext processClassContext) {
- final Class<?> cls = processClassContext.getCls();
-
- final FacetHolder facetHolder = processClassContext.getFacetHolder();
-
- final DomainService domainService = Annotations.getAnnotation(cls, DomainService.class);
- final DomainServiceLayout domainServiceLayout = Annotations.getAnnotation(cls, DomainServiceLayout.class);
-
- if (domainService == null && domainServiceLayout == null) {
- return;
- }
-
- final String domainServiceMenuOrder =
- domainService != null && !domainService.menuOrder().equals("" + Integer.MAX_VALUE)
- ? domainService.menuOrder()
- : null;
- final String domainServiceLayoutMenuOrder =
- domainServiceLayout != null && !domainServiceLayout.menuOrder().equals("" + Integer.MAX_VALUE)
- ? domainServiceLayout.menuOrder()
- : null;
- final String menuOrder = coalesce(domainServiceLayoutMenuOrder, domainServiceMenuOrder);
-
- DomainServiceLayout.MenuBar menuBar =
- domainServiceLayout != null
- ? domainServiceLayout.menuBar()
- : DomainServiceLayout.MenuBar.PRIMARY;
-
- FacetUtil.addFacet(
- new DomainServiceLayoutFacetAnnotation(
- facetHolder,
- menuBar, menuOrder));
-
- FacetUtil.addFacet(NamedFacetForDomainServiceLayoutAnnotation.create(domainServiceLayout, facetHolder));
- }
-
-
- private static String coalesce(final String... reasons) {
- for (final String reason : reasons) {
- if(reason != null) {
- return reason;
- }
- }
- return null;
- }
-
-}