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 2020/06/21 12:58:29 UTC
[isis] 01/01: ISIS-2222: fleshes out a PrimitiveChar demo
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-2222
in repository https://gitbox.apache.org/repos/asf/isis.git
commit 8860e540d8ae3ea2f79676b011c60be97037f837
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Jun 21 13:57:56 2020 +0100
ISIS-2222: fleshes out a PrimitiveChar demo
---
.../HasAsciiDocDescription_description.java | 3 +-
.../HasAsciiDocDescription_sources.java | 3 +-
.../domain/src/main/java/demoapp/dom/package.jdo | 6 +-
.../java/demoapp/dom/types/FeaturedTypesMenu.java | 7 ++
.../chars/PrimitiveChars-description.adoc | 10 +++
.../dom/types/primitive/chars/PrimitiveChars.java | 84 ++++++++++++++++++++++
.../primitive/chars/PrimitiveChars.layout.xml | 42 +++++++++++
.../chars/jdo/PrimitiveCharJdoEntities.java | 26 +++++++
.../jdo/PrimitiveCharJdoEntity-description.adoc | 3 +
.../chars/jdo/PrimitiveCharJdoEntity.java | 82 +++++++++++++++++++++
.../chars/jdo/PrimitiveCharJdoEntity.layout.xml | 43 +++++++++++
.../jdo/PrimitiveCharJdoEntitySeedService.java} | 14 ++--
.../vm/PrimitiveCharViewModel-description.adoc | 3 +
.../primitive/chars/vm/PrimitiveCharViewModel.java | 74 +++++++++++++++++++
.../chars/vm/PrimitiveCharViewModel.layout.xml | 43 +++++++++++
.../viewmodels/jaxbrefentity/ChildEntities.java | 36 ----------
.../viewmodels/jaxbrefentity/ChildJdoEntities.java | 26 +++++++
.../{ChildEntity.java => ChildJdoEntity.java} | 4 +-
...Service.java => ChildJdoEntitySeedService.java} | 12 ++--
.../StatefulViewModelJaxbRefsEntity.java | 17 +++--
.../main/java/demoapp/webapp/menubars.layout.xml | 3 +
.../adoc/modules/ROOT/pages/ro-spec.adoc | 2 +-
22 files changed, 478 insertions(+), 65 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_description.java b/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_description.java
index 7e2e35f..79804bb 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_description.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_description.java
@@ -24,6 +24,7 @@ import org.apache.isis.applib.annotation.LabelPosition;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.applib.annotation.Where;
import org.apache.isis.valuetypes.asciidoc.applib.value.AsciiDoc;
import lombok.RequiredArgsConstructor;
@@ -37,7 +38,7 @@ public class HasAsciiDocDescription_description {
private final HasAsciiDocDescription hasAsciiDocDescription;
- @PropertyLayout(labelPosition = LabelPosition.NONE)
+ @PropertyLayout(labelPosition = LabelPosition.NONE, hidden = Where.ALL_TABLES)
@MemberOrder(name = "description", sequence = "1")
public AsciiDoc prop() {
return asciiDocReaderService.readFor(hasAsciiDocDescription, "description");
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_sources.java b/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_sources.java
index 98074b4..a6ded09 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_sources.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/_infra/asciidocdesc/HasAsciiDocDescription_sources.java
@@ -24,6 +24,7 @@ import org.apache.isis.applib.annotation.LabelPosition;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.applib.annotation.Where;
import org.apache.isis.valuetypes.asciidoc.applib.value.AsciiDoc;
import lombok.RequiredArgsConstructor;
@@ -37,7 +38,7 @@ public class HasAsciiDocDescription_sources {
private final HasAsciiDocDescription hasAsciiDocDescription;
- @PropertyLayout(labelPosition = LabelPosition.NONE)
+ @PropertyLayout(labelPosition = LabelPosition.NONE, hidden = Where.ALL_TABLES)
@MemberOrder(name = "sources", sequence = "1")
public AsciiDoc prop() {
val packageName = hasAsciiDocDescription.getClass().getPackage().getName();
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/package.jdo b/examples/demo/domain/src/main/java/demoapp/dom/package.jdo
index b85747b..566f564 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/package.jdo
+++ b/examples/demo/domain/src/main/java/demoapp/dom/package.jdo
@@ -14,7 +14,11 @@
</package>
<package name="demoapp.dom.viewmodels.jaxbrefentity">
- <class name="ChildEntity" />
+ <class name="ChildJdoEntity" />
+ </package>
+
+ <package name="demoapp.dom.types.primitive.chars.jdo">
+ <class name="PrimitiveCharJdoEntity" />
</package>
</jdo>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/FeaturedTypesMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/types/FeaturedTypesMenu.java
index c57e013..43be66e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/FeaturedTypesMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/FeaturedTypesMenu.java
@@ -49,6 +49,7 @@ import demoapp.dom.types.blob.BlobDemo;
import demoapp.dom.types.clob.ClobDemo;
import demoapp.dom.types.markup.MarkupDemo;
import demoapp.dom.types.primitive.PrimitivesDemo;
+import demoapp.dom.types.primitive.chars.PrimitiveChars;
import demoapp.dom.types.text.TextDemo;
import demoapp.dom.types.time.TemporalDemo;
import demoapp.dom.types.uuid.UuidDemo;
@@ -159,4 +160,10 @@ public class FeaturedTypesMenu {
return demo;
}
+ @Action
+ @ActionLayout(cssClassFa="fa-code")
+ public PrimitiveChars primitiveChars(){
+ return factoryService.viewModel(PrimitiveChars.class);
+ }
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars-description.adoc
new file mode 100644
index 0000000..644fa50
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars-description.adoc
@@ -0,0 +1,10 @@
+The framework has built-in support for all of the primitive data types, including `char`.
+
+From this page you can:
+
+* open a view model that uses the `char` datatype
+* navigate to an entity that uses the `char` datatype
+
+These pages also have actions that demonstrate the use of `char` as a parameter and as a return type.
+
+Because `char` is a primitive value, the properties are mandatory.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars.java
new file mode 100644
index 0000000..e72f578
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars.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 demoapp.dom.types.primitive.chars;
+
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.Collection;
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Nature;
+import org.apache.isis.applib.annotation.PromptStyle;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.services.factory.FactoryService;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.val;
+import lombok.extern.log4j.Log4j2;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom.types.primitive.chars.jdo.PrimitiveCharJdoEntities;
+import demoapp.dom.types.primitive.chars.jdo.PrimitiveCharJdoEntity;
+import demoapp.dom.types.primitive.chars.vm.PrimitiveCharViewModel;
+
+@XmlRootElement(name = "Demo")
+@XmlType
+@XmlAccessorType(XmlAccessType.FIELD)
+@DomainObject(nature=Nature.VIEW_MODEL, objectType = "demoapp.PrimitiveChars", editing=Editing.ENABLED)
+@Log4j2
+public class PrimitiveChars implements HasAsciiDocDescription {
+
+ public String title() {
+ return "char (primitive) data type";
+ }
+
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(promptStyle = PromptStyle.DIALOG_MODAL)
+ public PrimitiveCharViewModel openViewModel(char initialValue) {
+ val viewModel = factoryService.viewModel(PrimitiveCharViewModel.class);
+ viewModel.setReadWriteProperty(initialValue);
+ return viewModel;
+ }
+
+ @Collection
+ public List<PrimitiveCharJdoEntity> getEntities() {
+ return entities.all();
+ }
+
+ @Inject
+ @XmlTransient
+ PrimitiveCharJdoEntities entities;
+
+ @Inject
+ @XmlTransient
+ FactoryService factoryService;
+
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars.layout.xml
new file mode 100644
index 0000000..fe46634
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/PrimitiveChars.layout.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<bs3:grid
+ xsi:schemaLocation="http://isis.apache.org/applib/layout/component http://isis.apache.org/applib/layout/component/component.xsd http://isis.apache.org/applib/layout/grid/bootstrap3 http://isis.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd"
+ xmlns:bs3="http://isis.apache.org/applib/layout/grid/bootstrap3"
+ xmlns:cpt="http://isis.apache.org/applib/layout/component"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <bs3:row>
+ <bs3:col span="10" unreferencedActions="true">
+ <cpt:domainObject />
+ </bs3:col>
+ <bs3:col span="2">
+ <cpt:fieldSet name="" id="sources" />
+ </bs3:col>
+ </bs3:row>
+
+ <bs3:row>
+ <bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="entities"/>
+ </bs3:col>
+ </bs3:row>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ <bs3:col span="6">
+ <cpt:fieldSet name="Description" id="description" >
+ <cpt:action id="clearHints" position="PANEL" />
+ <cpt:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
+ <cpt:action id="rebuildMetamodel" position="PANEL"/>
+ <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
+ <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
+ <cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
+ <cpt:property id="description"/>
+ </cpt:fieldSet>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12" unreferencedCollections="true"/>
+ </bs3:row>
+
+</bs3:grid>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntities.java
new file mode 100644
index 0000000..c41e8f5
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntities.java
@@ -0,0 +1,26 @@
+package demoapp.dom.types.primitive.chars.jdo;
+
+import java.util.List;
+import java.util.Optional;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.services.repository.RepositoryService;
+
+@Service
+public class PrimitiveCharJdoEntities {
+
+ public Optional<PrimitiveCharJdoEntity> find(final char readOnlyProperty) {
+ return repositoryService.firstMatch(PrimitiveCharJdoEntity.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ }
+
+ public List<PrimitiveCharJdoEntity> all() {
+ return repositoryService.allInstances(PrimitiveCharJdoEntity.class);
+ }
+
+ @Inject
+ RepositoryService repositoryService;
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity-description.adoc
new file mode 100644
index 0000000..ef897f8
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity-description.adoc
@@ -0,0 +1,3 @@
+== char datatype
+
+TODO
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity.java
new file mode 100644
index 0000000..4090c7e
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity.java
@@ -0,0 +1,82 @@
+/*
+ * 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 demoapp.dom.types.primitive.chars.jdo;
+
+import javax.jdo.annotations.Column;
+import javax.jdo.annotations.DatastoreIdentity;
+import javax.jdo.annotations.IdGeneratorStrategy;
+import javax.jdo.annotations.IdentityType;
+import javax.jdo.annotations.PersistenceCapable;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.Bounding;
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Nature;
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.annotation.Title;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+
+@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
+@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
+@DomainObject(bounding = Bounding.BOUNDED)
+@Log4j2
+public class PrimitiveCharJdoEntity implements HasAsciiDocDescription {
+
+ public PrimitiveCharJdoEntity(char initialValue) {
+ this.readOnlyProperty = initialValue;
+ this.readWriteProperty = initialValue;
+ }
+
+ @Getter
+ @Title
+ private char readOnlyProperty = 'c';
+
+ @Getter @Setter
+ @Property(editing = Editing.ENABLED)
+ private char readWriteProperty;
+
+ @Action(
+ semantics = SemanticsOf.IDEMPOTENT,
+ associateWith = "readOnlyProperty",
+ associateWithSequence = "1"
+ )
+ public PrimitiveCharJdoEntity updateReadOnlyProperty(char newValue) {
+ this.readOnlyProperty = newValue;
+ return this;
+ }
+
+ @Action(semantics = SemanticsOf.SAFE)
+ public char actionReturning() {
+ return readOnlyProperty;
+ }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity.layout.xml
new file mode 100644
index 0000000..856b5d6
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntity.layout.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<bs3:grid
+ xsi:schemaLocation="http://isis.apache.org/applib/layout/component http://isis.apache.org/applib/layout/component/component.xsd http://isis.apache.org/applib/layout/grid/bootstrap3 http://isis.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd"
+ xmlns:bs3="http://isis.apache.org/applib/layout/grid/bootstrap3"
+ xmlns:cpt="http://isis.apache.org/applib/layout/component"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <bs3:row>
+ <bs3:col span="10" unreferencedActions="true">
+ <cpt:domainObject />
+ </bs3:col>
+ <bs3:col span="2">
+ <cpt:fieldSet name="" id="sources" />
+ </bs3:col>
+ </bs3:row>
+
+ <bs3:row>
+ <bs3:col span="6">
+ <cpt:fieldSet name="Demo" id="general">
+ <cpt:action id="actionReturning" position="PANEL"/>
+ <cpt:property id="readOnlyProperty" labelPosition="LEFT"/>
+ <cpt:property id="readWriteProperty" labelPosition="LEFT"/>
+ <cpt:property id="readWriteOptionalProperty" labelPosition="LEFT"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ <bs3:col span="6">
+ <cpt:fieldSet name="Description" id="description" >
+ <cpt:action id="clearHints" position="PANEL" />
+ <cpt:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
+ <cpt:action id="rebuildMetamodel" position="PANEL"/>
+ <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
+ <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
+ <cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
+ <cpt:property id="description"/>
+ </cpt:fieldSet>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12" unreferencedCollections="true"/>
+ </bs3:row>
+
+</bs3:grid>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/fixtures/ChildEntitySeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntitySeedService.java
similarity index 71%
copy from examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/fixtures/ChildEntitySeedService.java
copy to examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntitySeedService.java
index 2a5ce01..1b94a31 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/fixtures/ChildEntitySeedService.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/jdo/PrimitiveCharJdoEntitySeedService.java
@@ -1,4 +1,4 @@
-package demoapp.dom.viewmodels.jaxbrefentity.fixtures;
+package demoapp.dom.types.primitive.chars.jdo;
import java.util.stream.Stream;
@@ -12,28 +12,28 @@ import org.apache.isis.core.runtime.events.app.AppLifecycleEvent;
import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScript;
import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScripts;
-import demoapp.dom.viewmodels.jaxbrefentity.ChildEntity;
+import demoapp.dom.viewmodels.jaxbrefentity.ChildJdoEntity;
@Service
-public class ChildEntitySeedService {
+public class PrimitiveCharJdoEntitySeedService {
@EventListener(AppLifecycleEvent.class)
public void onAppLifecycleEvent(AppLifecycleEvent event) {
if (event.getEventType() == AppLifecycleEvent.EventType.appPostMetamodel) {
- fixtureScripts.run(new ChildEntityFixture());
+ fixtureScripts.run(new PrimitiveCharJdoEntityFixture());
}
}
@Inject
FixtureScripts fixtureScripts;
- static class ChildEntityFixture extends FixtureScript {
+ static class PrimitiveCharJdoEntityFixture extends FixtureScript {
@Override
protected void execute(ExecutionContext executionContext) {
- Stream.of("Fred", "Mary", "Joe")
- .map(ChildEntity::new)
+ Stream.of('a', 'b', 'c')
+ .map(PrimitiveCharJdoEntity::new)
.forEach(repositoryService::persist);
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel-description.adoc
new file mode 100644
index 0000000..ef897f8
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel-description.adoc
@@ -0,0 +1,3 @@
+== char datatype
+
+TODO
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel.java b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel.java
new file mode 100644
index 0000000..5506bd8
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel.java
@@ -0,0 +1,74 @@
+/*
+ * 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 demoapp.dom.types.primitive.chars.vm;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Nature;
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.SemanticsOf;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.log4j.Log4j2;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+
+@XmlRootElement(name = "Demo")
+@XmlType
+@XmlAccessorType(XmlAccessType.FIELD)
+@DomainObject(nature=Nature.VIEW_MODEL, objectType = "demoapp.PrimitiveCharJaxbViewModel", editing=Editing.ENABLED)
+@Log4j2
+public class PrimitiveCharViewModel implements HasAsciiDocDescription {
+
+ public String title() {
+ return "Char Demo";
+ }
+
+ @Getter
+ private char readOnlyProperty = 'c';
+
+ @Getter @Setter
+ @Property(editing = Editing.ENABLED)
+ private char readWriteProperty;
+
+ @Action(
+ semantics = SemanticsOf.IDEMPOTENT,
+ associateWith = "readOnlyProperty",
+ associateWithSequence = "1"
+ )
+ public PrimitiveCharViewModel updateReadOnlyProperty(char newValue) {
+ this.readOnlyProperty = newValue;
+ return this;
+ }
+
+ @Action(semantics = SemanticsOf.SAFE)
+ public char actionReturning() {
+ return readOnlyProperty;
+ }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel.layout.xml
new file mode 100644
index 0000000..856b5d6
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/primitive/chars/vm/PrimitiveCharViewModel.layout.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<bs3:grid
+ xsi:schemaLocation="http://isis.apache.org/applib/layout/component http://isis.apache.org/applib/layout/component/component.xsd http://isis.apache.org/applib/layout/grid/bootstrap3 http://isis.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd"
+ xmlns:bs3="http://isis.apache.org/applib/layout/grid/bootstrap3"
+ xmlns:cpt="http://isis.apache.org/applib/layout/component"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <bs3:row>
+ <bs3:col span="10" unreferencedActions="true">
+ <cpt:domainObject />
+ </bs3:col>
+ <bs3:col span="2">
+ <cpt:fieldSet name="" id="sources" />
+ </bs3:col>
+ </bs3:row>
+
+ <bs3:row>
+ <bs3:col span="6">
+ <cpt:fieldSet name="Demo" id="general">
+ <cpt:action id="actionReturning" position="PANEL"/>
+ <cpt:property id="readOnlyProperty" labelPosition="LEFT"/>
+ <cpt:property id="readWriteProperty" labelPosition="LEFT"/>
+ <cpt:property id="readWriteOptionalProperty" labelPosition="LEFT"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ <bs3:col span="6">
+ <cpt:fieldSet name="Description" id="description" >
+ <cpt:action id="clearHints" position="PANEL" />
+ <cpt:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
+ <cpt:action id="rebuildMetamodel" position="PANEL"/>
+ <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
+ <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
+ <cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
+ <cpt:property id="description"/>
+ </cpt:fieldSet>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12" unreferencedCollections="true"/>
+ </bs3:row>
+
+</bs3:grid>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildEntities.java
deleted file mode 100644
index 0534bf6..0000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildEntities.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package demoapp.dom.viewmodels.jaxbrefentity;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Stream;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Service;
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.OrderPrecedence;
-import org.apache.isis.applib.services.repository.RepositoryService;
-import org.apache.isis.core.metamodel.facets.object.objectspecid.ObjectSpecIdFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
-
-import demoapp.dom.events.EventLogEntry;
-
-@Service
-public class ChildEntities {
-
- public Optional<ChildEntity> find(final String name) {
- return repositoryService.firstMatch(ChildEntity.class, x -> x.getName().equals(name));
- }
-
- public List<ChildEntity> all(final String name) {
- return repositoryService.allInstances(ChildEntity.class);
- }
-
- @Inject
- RepositoryService repositoryService;
-
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntities.java
new file mode 100644
index 0000000..164d942
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntities.java
@@ -0,0 +1,26 @@
+package demoapp.dom.viewmodels.jaxbrefentity;
+
+import java.util.List;
+import java.util.Optional;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.services.repository.RepositoryService;
+
+@Service
+public class ChildJdoEntities {
+
+ public Optional<ChildJdoEntity> find(final String name) {
+ return repositoryService.firstMatch(ChildJdoEntity.class, x -> x.getName().equals(name));
+ }
+
+ public List<ChildJdoEntity> all() {
+ return repositoryService.allInstances(ChildJdoEntity.class);
+ }
+
+ @Inject
+ RepositoryService repositoryService;
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntity.java
similarity index 94%
rename from examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildEntity.java
rename to examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntity.java
index e259b74..5cab845 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntity.java
@@ -23,9 +23,9 @@ import lombok.Setter;
@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
@DomainObject(bounding = Bounding.BOUNDED)
@XmlJavaTypeAdapter(PersistentEntityAdapter.class)
-public class ChildEntity {
+public class ChildJdoEntity {
- public ChildEntity(String name) {
+ public ChildJdoEntity(String name) {
this.name = name;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/fixtures/ChildEntitySeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntitySeedService.java
similarity index 76%
rename from examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/fixtures/ChildEntitySeedService.java
rename to examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntitySeedService.java
index 2a5ce01..52f62fa 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/fixtures/ChildEntitySeedService.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/ChildJdoEntitySeedService.java
@@ -1,4 +1,4 @@
-package demoapp.dom.viewmodels.jaxbrefentity.fixtures;
+package demoapp.dom.viewmodels.jaxbrefentity;
import java.util.stream.Stream;
@@ -12,28 +12,26 @@ import org.apache.isis.core.runtime.events.app.AppLifecycleEvent;
import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScript;
import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScripts;
-import demoapp.dom.viewmodels.jaxbrefentity.ChildEntity;
-
@Service
-public class ChildEntitySeedService {
+public class ChildJdoEntitySeedService {
@EventListener(AppLifecycleEvent.class)
public void onAppLifecycleEvent(AppLifecycleEvent event) {
if (event.getEventType() == AppLifecycleEvent.EventType.appPostMetamodel) {
- fixtureScripts.run(new ChildEntityFixture());
+ fixtureScripts.run(new ChildJdoEntityFixture());
}
}
@Inject
FixtureScripts fixtureScripts;
- static class ChildEntityFixture extends FixtureScript {
+ static class ChildJdoEntityFixture extends FixtureScript {
@Override
protected void execute(ExecutionContext executionContext) {
Stream.of("Fred", "Mary", "Joe")
- .map(ChildEntity::new)
+ .map(ChildJdoEntity::new)
.forEach(repositoryService::persist);
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
index b972a32..0d55b11 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/viewmodels/jaxbrefentity/StatefulViewModelJaxbRefsEntity.java
@@ -39,7 +39,6 @@ import org.apache.isis.applib.annotation.SemanticsOf;
import lombok.Getter;
import lombok.Setter;
-import lombok.val;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
@@ -66,15 +65,15 @@ public class StatefulViewModelJaxbRefsEntity implements HasAsciiDocDescription {
@Getter @Setter
@Property(editing = Editing.DISABLED, optionality = Optionality.OPTIONAL)
@XmlElement(required = false)
- private ChildEntity favoriteChild = null;
+ private ChildJdoEntity favoriteChild = null;
@Action(semantics = SemanticsOf.IDEMPOTENT, associateWith = "favoriteChild", associateWithSequence = "1")
- public StatefulViewModelJaxbRefsEntity changeFavoriteChild(ChildEntity newFavorite) {
+ public StatefulViewModelJaxbRefsEntity changeFavoriteChild(ChildJdoEntity newFavorite) {
favoriteChild = newFavorite;
return this;
}
- public List<ChildEntity> choices0ChangeFavoriteChild() {
- ArrayList<ChildEntity> children = new ArrayList<>(getChildren());
+ public List<ChildJdoEntity> choices0ChangeFavoriteChild() {
+ ArrayList<ChildJdoEntity> children = new ArrayList<>(getChildren());
children.remove(getFavoriteChild());
return children;
}
@@ -98,10 +97,10 @@ public class StatefulViewModelJaxbRefsEntity implements HasAsciiDocDescription {
@Collection
@XmlElementWrapper(name = "children")
@XmlElement(name = "child")
- private List<ChildEntity> children = new ArrayList<>();
+ private List<ChildJdoEntity> children = new ArrayList<>();
@Action(associateWith = "children", associateWithSequence = "1", semantics = SemanticsOf.NON_IDEMPOTENT)
- public StatefulViewModelJaxbRefsEntity addChild(final ChildEntity child) {
+ public StatefulViewModelJaxbRefsEntity addChild(final ChildJdoEntity child) {
children.add(child);
if(children.size() == 1) {
setFavoriteChild(child);
@@ -110,11 +109,11 @@ public class StatefulViewModelJaxbRefsEntity implements HasAsciiDocDescription {
}
@Action(associateWith = "children", associateWithSequence = "2", semantics = SemanticsOf.IDEMPOTENT)
- public StatefulViewModelJaxbRefsEntity removeChild(final ChildEntity child) {
+ public StatefulViewModelJaxbRefsEntity removeChild(final ChildJdoEntity child) {
children.remove(child);
return this;
}
- public List<ChildEntity> choices0RemoveChild() { return getChildren(); }
+ public List<ChildJdoEntity> choices0RemoveChild() { return getChildren(); }
public String disableRemoveChild() {
return choices0RemoveChild().isEmpty()? "No children to remove" : null;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/webapp/menubars.layout.xml b/examples/demo/domain/src/main/java/demoapp/webapp/menubars.layout.xml
index 51ba930..4903dbb 100644
--- a/examples/demo/domain/src/main/java/demoapp/webapp/menubars.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/webapp/menubars.layout.xml
@@ -16,6 +16,9 @@
<mb3:menu>
<mb3:named>Featured Types</mb3:named>
<mb3:section>
+ <mb3:serviceAction objectType="demo.FeaturedTypesMenu" id="primitiveChars"/>
+ </mb3:section>
+ <mb3:section>
<mb3:serviceAction objectType="demo.FeaturedTypesMenu" id="text">
<cpt:named>Text</cpt:named>
</mb3:serviceAction>
diff --git a/viewers/restfulobjects/adoc/modules/ROOT/pages/ro-spec.adoc b/viewers/restfulobjects/adoc/modules/ROOT/pages/ro-spec.adoc
index 528fe30..17615ad 100644
--- a/viewers/restfulobjects/adoc/modules/ROOT/pages/ro-spec.adoc
+++ b/viewers/restfulobjects/adoc/modules/ROOT/pages/ro-spec.adoc
@@ -128,7 +128,7 @@ For example, using this feature one can load a grid of data in a single call.
(That said, the xref:vro:ROOT:simplified-representations.adoc[simplified representations]
supported by Restful Objects viewer also support this use case, albeit in way that deviates from the RO spec).
-This link:https://www.youtube.com/watch?v=hSKnqqBQ7Zo[screencast] demonstrates the Restful Object viewer's support for `x-ro-follow-links` parameter, using the link:http://github.com/apache/isis-app-kitchensink[Isis addons' kitchensink] app as the example, This app contains three entities, `Grandparent`, `Parent` and `ChildEntity` that define a hierarchy of 1:m relationships.
+This link:https://www.youtube.com/watch?v=hSKnqqBQ7Zo[screencast] demonstrates the Restful Object viewer's support for `x-ro-follow-links` parameter, using the link:http://github.com/apache/isis-app-kitchensink[Isis addons' kitchensink] app as the example, This app contains three entities, `Grandparent`, `Parent` and `ChildJdoEntity` that define a hierarchy of 1:m relationships.
The queries that are shown in the screencast include: