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 2017/09/14 17:46:35 UTC

[13/13] isis git commit: ISIS-1616: adds documentation and DataNucleus support

ISIS-1616: adds documentation and DataNucleus support


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2ba098ce
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2ba098ce
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2ba098ce

Branch: refs/heads/master
Commit: 2ba098ce91a1f3cd596cc3b65167f7a55050e240
Parents: 4de5824
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 14 18:43:47 2017 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 14 18:43:47 2017 +0100

----------------------------------------------------------------------
 .../rgcms/_rgcms_classes_value-types.adoc       | 125 +++++++------------
 .../_rgcms_classes_value-types_Markup.adoc      |  44 +++++++
 .../guides/rgcms/images/value-types/markup.png  | Bin 0 -> 19232 bytes
 .../typeconverters/IsisMarkupConverter.java     |  43 +++++++
 core/runtime/src/main/resources/plugin.xml      |  18 +++
 5 files changed, 147 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/2ba098ce/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types.adoc b/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types.adoc
index 4093814..e2a1dcd 100644
--- a/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types.adoc
@@ -4,116 +4,75 @@
 :_basedir: ../../
 :_imagesdir: images/
 
-NOTE: FIXME
 
+Apache Isis can render and persist all of the JDK primitives and wrapper classes, and a number of other JDK (7.x) classes that represent value types.
 
+It also supports some of the link:http://www.joda.org/joda-time/[Joda-Time] datatypes, and a number of value types that are shipped by the framework itself.
 
-.JDK Classes
-[cols="1,1", options="header"]
-|===
+In addition to primitives, the JDK Classes supported are:
 
-|Type
-|Description
+* the wrapper classes:
 
-|`java.lang.Boolean`
-|
+** `java.lang.Boolean`
+** `java.lang.Character`
+**`java.lang.Double`
+**`java.lang.Float`
+**`java.lang.Integer`
+**`java.lang.Long`
+**`java.lang.Short`
 
-|`java.lang.Character`
-|
+* `java.lang.String`
 
-|`java.lang.Double`
-|
+* numeric data types:
 
-|`java.lang.Float`
-|
+** `java.math.BigDecimal`
+** `java.math.BigInteger`
 
-|`java.lang.Integer`
-|
+* date types:
 
-|`java.lang.Long`
-|
+** `java.sql.Date`
+** `java.sql.Time`
+** `java.sql.Timestamp`
+** `java.util.Date`
 
-|`java.lang.Short`
-|
+It supports these Joda-Time classes:
 
-|`java.lang.String`
-|
+* `org.joda.time.DateTime`
+* `org.joda.time.LocalDateTime`
+* `org.joda.time.LocalDate`
 
-|`java.math.BigDecimal`
-|
 
-|`java.math.BigInteger`
-|
+The value types defined by the framework itself (in the applib) are:
 
-|`java.sql.Date`
-|
+* `o.a.i.applib.value.Blob`
++
+binary large object, eg PDFs or images
 
-|`java.sql.Time`
-|
+* `o.a.i.applib.value.Clob`
 
-|`java.sql.Timestamp`
-|
++
+character large objects, eg XML
 
-|`java.util.Date`
-|
+* `o.a.i.applib.value.Money`
 
-|===
++
+A currency and amount
 
+* `o.a.i.applib.value.Password`
 
-.JodaTime classes
-[cols="1,1", options="header"]
-|===
++
+A simple wrapper around a string, but never shown in plain-text.
 
-|Type
-|Description
+* `o.a.i.applib.value.Markup`
 
-|`org.joda.time.DateTime`
-|
-
-|`org.joda.time.LocalDateTime`
-|
-
-|`org.joda.time.LocalDate`
-|
-
-|===
-
-
-
-
-.Isis Applib classes
-[cols="1,1", options="header"]
-|===
-
-|Type
-|Description
-
-|`o.a.i.applib.value.` +
-`Blob`
-|
-
-|`o.a.i.applib.value.` +
-`Clob`
-|
-
-|`o.a.i.applib.value.` +
-`Color`
-|
-
-|`o.a.i.applib.value.` +
-`Money`
-|
-
-|`o.a.i.applib.value.` +
-`Password`
-|
-
-|===
++
+(As of `1.15.1-SNAPSHOT`), intended for use as a read-only property to display arbitrary HTML.
 
 
 
 include::_rgcms_classes_value-types_Blob.adoc[leveloffset=+1]
 include::_rgcms_classes_value-types_Clob.adoc[leveloffset=+1]
-include::_rgcms_classes_value-types_Color.adoc[leveloffset=+1]
+//include::_rgcms_classes_value-types_Color.adoc[leveloffset=+1]
 include::_rgcms_classes_value-types_Money.adoc[leveloffset=+1]
 include::_rgcms_classes_value-types_Password.adoc[leveloffset=+1]
+include::_rgcms_classes_value-types_Markup.adoc[leveloffset=+1]

http://git-wip-us.apache.org/repos/asf/isis/blob/2ba098ce/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types_Markup.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types_Markup.adoc b/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types_Markup.adoc
new file mode 100644
index 0000000..679bf4d
--- /dev/null
+++ b/adocs/documentation/src/main/asciidoc/guides/rgcms/_rgcms_classes_value-types_Markup.adoc
@@ -0,0 +1,44 @@
+[[_rgcms_classes_value-types_Markup]]
+= `Markup`
+:Notice: 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.
+:_basedir: ../../
+:_imagesdir: images/
+
+
+The `Markup` value type (introduced in `1.15.1-SNAPSHOT`) is intended to be used as a read-only property, to render arbitrary markup into the user interface.
+
+For example:
+
+image::{_imagesdir}value-types/markup.png[width="px",link="{_imagesdir}value-types/markup/.png"]
+
+Corresponds to:
+
+[source,java]
+----
+@javax.jdo.annotations.Persistent
+@javax.jdo.annotations.Column(allowsNull = "true", length = 4000)
+@lombok.Getter @lombok.Setter
+@Property(optionality=Optionality.OPTIONAL, editing = Editing.DISABLED)
+private Markup someMarkup;
+
+public BlobClobObject updateSomeMarkup(Markup markup) {
+    setSomeMarkup(markup);
+    return this;
+}
+public Markup defaultUpdate0SomeMarkup(String markup) {
+    return getSomeMarkup();
+}
+----
+
+with this corresponding `layout.xml`:
+
+[source,xml]
+----
+<cpt:fieldSet name="Markup" id="markup">
+    <cpt:action id="updateSomeMarkup"/>
+    <cpt:property id="someMarkup" labelPosition="NONE">
+    </cpt:property>
+</cpt:fieldSet>
+----
+
+If the property is also editable then an text edit box is also displayed - unlikely to be the desired effect.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/2ba098ce/adocs/documentation/src/main/asciidoc/guides/rgcms/images/value-types/markup.png
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/rgcms/images/value-types/markup.png b/adocs/documentation/src/main/asciidoc/guides/rgcms/images/value-types/markup.png
new file mode 100644
index 0000000..3f6ef43
Binary files /dev/null and b/adocs/documentation/src/main/asciidoc/guides/rgcms/images/value-types/markup.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/2ba098ce/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/typeconverters/IsisMarkupConverter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/typeconverters/IsisMarkupConverter.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/typeconverters/IsisMarkupConverter.java
new file mode 100644
index 0000000..f709ec9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/typeconverters/IsisMarkupConverter.java
@@ -0,0 +1,43 @@
+/*
+ *  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.objectstore.jdo.datanucleus.typeconverters;
+
+import org.datanucleus.store.types.converters.TypeConverter;
+
+import org.apache.isis.applib.value.Markup;
+
+public class IsisMarkupConverter implements TypeConverter<Markup, String>{
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public String toDatastoreType(final Markup memberValue) {
+        return memberValue != null
+                ? memberValue.asString()
+                : null;
+    }
+
+    @Override
+    public Markup toMemberType(final String datastoreValue) {
+        return datastoreValue != null
+                ? new Markup(datastoreValue)
+                : null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2ba098ce/core/runtime/src/main/resources/plugin.xml
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/resources/plugin.xml b/core/runtime/src/main/resources/plugin.xml
index ffbcff1..24c94e3 100644
--- a/core/runtime/src/main/resources/plugin.xml
+++ b/core/runtime/src/main/resources/plugin.xml
@@ -68,6 +68,13 @@
                 converter-name="isis.password-string" />
     </extension>
 
+    <extension point="org.datanucleus.java_type">
+        <java-type
+                name="org.apache.isis.applib.value.Markup"
+                dfg="true"
+                converter-name="isis.markup-string" />
+    </extension>
+
     <!--
     http://www.datanucleus.org/extensions/type_converter.html
     -->
@@ -79,4 +86,15 @@
                 converter-class="org.apache.isis.objectstore.jdo.datanucleus.typeconverters.IsisPasswordConverter"/>
     </extension>
 
+    <!--
+    http://www.datanucleus.org/extensions/type_converter.html
+    -->
+    <extension point="org.datanucleus.type_converter">
+        <type-converter
+                name="isis.markup-string"
+                member-type="org.apache.isis.applib.value.Markup"
+                datastore-type="java.lang.String"
+                converter-class="org.apache.isis.objectstore.jdo.datanucleus.typeconverters.IsisMarkupConverter"/>
+    </extension>
+
 </plugin>