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/08/15 09:30:50 UTC
[isis] 02/02: ISIS-2222: wip Property#command
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 acaa9dc14ce4a3e9fa43001196c6426581733633
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Aug 15 10:30:21 2020 +0100
ISIS-2222: wip Property#command
---
.../core/metamodel/IsisModuleCoreMetamodel.java | 6 +-
.../facets/schema/InteractionDtoValueFacet.java | 30 ++++++
...DtoValueFacetUsingSemanticsProviderFactory.java | 41 ++++++++
.../InteractionDtoValueSemanticsProvider.java | 107 ++++++++++++++++++++
.../facets/schema/IsisSchemaMetaModelRefiner.java | 38 +++++++
.../facets/schema/IsisSchemaValueTypeProvider.java | 42 ++++++++
.../dom/annotDomain/Property/PropertyMenu.java | 10 ++
.../dom/annotDomain/Property/publishing/.gitkeep | 0
.../PropertyPublishingJdo-description.adoc | 74 ++++++++++++++
.../Property/publishing/PropertyPublishingJdo.java | 111 +++++++++++++++++++++
.../publishing/PropertyPublishingJdo.layout.xml | 57 +++++++++++
.../publishing/PropertyPublishingJdoEntities.java | 31 ++++++
.../PropertyPublishingJdoSeedService.java | 39 ++++++++
.../PublishingDisabledMetaAnnotation.java | 22 ++++
.../PublishingEnabledMetaAnnotation.java | 23 +++++
...ropertyPublishingJdo_interactionExecutions.java | 30 ++++++
.../PropertyPublishingJdo_publishedObjects.java | 32 ++++++
.../spiimpl/PublisherServiceSpiForProperties.java | 49 +++++++++
.../src/main/java/demoapp/dom/menubars.layout.xml | 3 +-
.../strings/jdo/JavaLangStringJdoEntities.java | 3 +-
20 files changed, 745 insertions(+), 3 deletions(-)
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java
index 3b34bde..1e2b3af 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/IsisModuleCoreMetamodel.java
@@ -24,6 +24,8 @@ import org.springframework.context.annotation.Import;
import org.apache.isis.applib.IsisModuleApplib;
import org.apache.isis.core.config.IsisModuleCoreConfig;
import org.apache.isis.core.metamodel.context.MetaModelContexts;
+import org.apache.isis.core.metamodel.facets.schema.IsisSchemaMetaModelRefiner;
+import org.apache.isis.core.metamodel.facets.schema.IsisSchemaValueTypeProvider;
import org.apache.isis.core.metamodel.inspect.IsisModuleCoreMetamodelInspection;
import org.apache.isis.core.metamodel.objectmanager.ObjectManagerDefault;
import org.apache.isis.core.metamodel.progmodel.ProgrammingModelInitFilterDefault;
@@ -99,7 +101,9 @@ import org.apache.isis.core.security.IsisModuleCoreSecurity;
// @Repository's
ApplicationFeatureRepositoryDefault.class,
-
+
+ IsisSchemaMetaModelRefiner.class,
+ IsisSchemaValueTypeProvider.class,
})
public class IsisModuleCoreMetamodel {
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueFacet.java
new file mode 100644
index 0000000..056a421
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueFacet.java
@@ -0,0 +1,30 @@
+/*
+ * 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.schema;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.spec.ManagedObject;
+
+public interface InteractionDtoValueFacet extends Facet {
+
+ String interactionDtoValue(ManagedObject object);
+ ManagedObject createValue(ManagedObject object, String xml);
+
+}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueFacetUsingSemanticsProviderFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueFacetUsingSemanticsProviderFactory.java
new file mode 100644
index 0000000..d7b76bf
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueFacetUsingSemanticsProviderFactory.java
@@ -0,0 +1,41 @@
+/*
+ * 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.schema;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueFacetUsingSemanticsProviderFactory;
+import org.apache.isis.schema.ixn.v2.InteractionDto;
+
+import lombok.val;
+
+public class InteractionDtoValueFacetUsingSemanticsProviderFactory extends ValueFacetUsingSemanticsProviderFactory<InteractionDto> {
+
+ @Override
+ public void process(final ProcessClassContext processClassContext) {
+ final Class<?> type = processClassContext.getCls();
+ final FacetHolder holder = processClassContext.getFacetHolder();
+
+ if (!(InteractionDto.class.isAssignableFrom(type))) {
+ return;
+ }
+ val provider = new InteractionDtoValueSemanticsProvider(holder);
+ addFacets(provider);
+ }
+}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueSemanticsProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueSemanticsProvider.java
new file mode 100644
index 0000000..aae5938
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/InteractionDtoValueSemanticsProvider.java
@@ -0,0 +1,107 @@
+/*
+ * 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.schema;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.applib.util.schema.InteractionDtoUtils;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.value.vsp.ValueSemanticsProviderAndFacetAbstract;
+import org.apache.isis.core.metamodel.spec.ManagedObject;
+import org.apache.isis.schema.ixn.v2.InteractionDto;
+
+public class InteractionDtoValueSemanticsProvider
+extends ValueSemanticsProviderAndFacetAbstract<InteractionDto>
+implements InteractionDtoValueFacet {
+
+ private static final int TYPICAL_LENGTH = 0;
+
+ private static Class<? extends Facet> type() {
+ return InteractionDtoValueFacet.class;
+ }
+
+ private static final InteractionDto DEFAULT_VALUE = null;
+
+ /**
+ * Required because implementation of {@link Parser} and
+ * {@link EncoderDecoder}.
+ */
+ public InteractionDtoValueSemanticsProvider() {
+ this(null);
+ }
+
+ public InteractionDtoValueSemanticsProvider(final FacetHolder holder) {
+ super(type(), holder, InteractionDto.class, TYPICAL_LENGTH, -1, Immutability.IMMUTABLE, EqualByContent.NOT_HONOURED, DEFAULT_VALUE);
+ }
+
+
+ @Override
+ protected InteractionDto doParse(final Object context, final String str) {
+ return doRestore(str);
+ }
+
+ @Override
+ public String titleString(final Object object) {
+ if (object == null) return "[null]";
+ final InteractionDto interactionDto = (InteractionDto) object;
+ return InteractionDtoUtils.toXml(interactionDto);
+ }
+
+ @Override
+ public String titleStringWithMask(final Object value, final String usingMask) {
+ return titleString(value);
+ }
+
+
+ @Override
+ public String interactionDtoValue(final ManagedObject object) {
+ if (object == null) {
+ return "";
+ }
+ final InteractionDto interactionDto = (InteractionDto) object.getPojo();
+ return InteractionDtoUtils.toXml(interactionDto);
+ }
+
+ @Override
+ public ManagedObject createValue(final ManagedObject object, final String xml) {
+ final InteractionDto interactionDto = InteractionDtoUtils.fromXml(xml);
+ return getObjectManager().adapt(interactionDto);
+ }
+
+
+ @Override
+ protected String doEncode(final Object object) {
+ InteractionDto interactionDto = (InteractionDto) object;
+ return InteractionDtoUtils.toXml(interactionDto);
+ }
+
+ @Override
+ protected InteractionDto doRestore(final String xml) {
+ return InteractionDtoUtils.fromXml(xml);
+ }
+
+
+ @Override
+ public String toString() {
+ return "InteractionDtoValueSemanticsProvider";
+ }
+
+}
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/IsisSchemaMetaModelRefiner.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/IsisSchemaMetaModelRefiner.java
new file mode 100644
index 0000000..dc97220
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/IsisSchemaMetaModelRefiner.java
@@ -0,0 +1,38 @@
+/*
+ * 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.schema;
+
+import javax.inject.Named;
+
+import org.springframework.stereotype.Component;
+
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+
+@Component
+@Named("isisMetaModel.isisSchema.MetaModelRefiner")
+public class IsisSchemaMetaModelRefiner implements MetaModelRefiner {
+ @Override
+ public void refineProgrammingModel(ProgrammingModel programmingModel) {
+ programmingModel.addFactory(
+ ProgrammingModel.FacetProcessingOrder.G1_VALUE_TYPES,
+ InteractionDtoValueFacetUsingSemanticsProviderFactory.class);
+ }
+}
+
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/IsisSchemaValueTypeProvider.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/IsisSchemaValueTypeProvider.java
new file mode 100644
index 0000000..b5f51bb
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/schema/IsisSchemaValueTypeProvider.java
@@ -0,0 +1,42 @@
+/*
+ * 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.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.inject.Named;
+
+import org.springframework.stereotype.Component;
+
+import org.apache.isis.core.metamodel.valuetypes.ValueTypeDefinition;
+import org.apache.isis.core.metamodel.valuetypes.ValueTypeProvider;
+import org.apache.isis.schema.common.v2.ValueType;
+import org.apache.isis.schema.ixn.v2.InteractionDto;
+import org.apache.isis.schema.ixn.v2.PropertyEditDto;
+
+@Component
+@Named("isisMetaModel.isisSchema.ValueTypeProvider")
+public class IsisSchemaValueTypeProvider implements ValueTypeProvider {
+ @Override
+ public Collection<ValueTypeDefinition> definitions() {
+ return Collections.singletonList(
+ ValueTypeDefinition.of(InteractionDto.class, ValueType.STRING));
+ }
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/PropertyMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/PropertyMenu.java
index 814f1d3..b97d5c3 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/PropertyMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/PropertyMenu.java
@@ -41,6 +41,8 @@ import demoapp.dom.annotDomain.Property.hidden.child.PropertyHiddenChildVm;
import demoapp.dom.annotDomain.Property.maxLength.PropertyMaxLengthVm;
import demoapp.dom.annotDomain.Property.mustSatisfy.PropertyMustSatisfyVm;
import demoapp.dom.annotDomain.Property.optionality.PropertyOptionalityVm;
+import demoapp.dom.annotDomain.Property.publishing.PropertyPublishingJdo;
+import demoapp.dom.annotDomain.Property.publishing.PropertyPublishingJdoEntities;
import demoapp.dom.annotDomain.Property.regexPattern.PropertyRegexPatternVm;
import demoapp.dom.types.Samples;
@@ -127,6 +129,12 @@ public class PropertyMenu {
}
@Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(cssClassFa="fa-book", describedAs = "Property changed events as XML")
+ public PropertyPublishingJdo publishing(){
+ return propertyPublishingJdoEntities.first();
+ }
+
+ @Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-equals", describedAs = "Regular expressions, such as email")
public PropertyRegexPatternVm regexPattern(){
val vm = new PropertyRegexPatternVm();
@@ -154,5 +162,7 @@ public class PropertyMenu {
Samples<Blob> blobSamples;
@Inject
Samples<Clob> clobSamples;
+ @Inject
+ PropertyPublishingJdoEntities propertyPublishingJdoEntities;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/.gitkeep b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo-description.adoc
new file mode 100644
index 0000000..c62d177
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo-description.adoc
@@ -0,0 +1,74 @@
+CAUTION: todo - to update.
+
+//The `editing` semantic specifies that a property's value can be changed through the UI:
+//
+//* for properties, the semantic can be specified using either the `@Property` annotation, or a meta-annotation
+//
+//There is no corresponding semantic for parameters, parameters are implicitly editable.
+//
+//== Class Level
+//
+//Usually editing of properties is discouraged; it is usually better to modify state through an explicit action instead.
+//For that reason, editing of properties is disabled by default (though that can be changed globally if necessary using the `isis.applib.annotation.domain-object.editing` configuration property).
+//
+//Editing can also be specified at the class level.
+//This will override any configured defaults, but just for the properties of that class:
+//
+//[source,java,indent=0]
+//----
+//include::PropertyEditingVm.java[tags=class]
+//----
+//
+//The property-level semantic can, in turn, overrides the configured or class-level default.
+//
+//
+//== Annotated
+//
+//The `editing` semantic can be specified explicitly using an annotation:
+//
+//* for properties, using `@Property#editing()`:
+//+
+//[source,java,indent=0]
+//----
+//include::PropertyEditingVm.java[tags=annotation]
+//----
+//<.> explicitly specifies the maximum length that can be entered for the property
+//
+//The annotation could also be applied to a mixin, but would have little effect because mixin properties are always read-only.
+//
+//== Meta-annotated
+//
+//The `editing` semantic can also be specified using a custom meta-annotation:
+//
+//* the meta-annotation is defined as:
+//+
+//[source,java]
+//----
+//include::EditingEnabledMetaAnnotation.java[tags=class]
+//----
+//<.> annotated for a property
+//<.> annotation can be applied to a property (either its getter or the field directly)
+//
+//* and can be applied to a property:
+//+
+//[source,java,indent=0]
+//----
+//include::PropertyEditingVm.java[tags=meta-annotated]
+//----
+//<.> semantic is inherited from the meta-annotation
+//
+//
+//
+//=== Meta-annotated Overridden
+//
+//The meta-annotation can itself be overridden:
+//
+//* in a property:
+//+
+//[source,java,indent=0]
+//----
+//include::PropertyEditingVm.java[tags=meta-annotated-overridden]
+//----
+//<.> semantic from meta-annotation ...
+//<.> \... is overridden by the `@Property` annotation
+//
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo.java
new file mode 100644
index 0000000..ae84079
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo.java
@@ -0,0 +1,111 @@
+/*
+ * 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.annotDomain.Property.publishing;
+
+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.DomainObject;
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Nature;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyLayout;
+import org.apache.isis.applib.annotation.Publishing;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+
+//tag::class[]
+@PersistenceCapable(identityType = IdentityType.DATASTORE, schema = "demo")
+@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
+@DomainObject(
+ nature=Nature.JDO_ENTITY
+ , objectType = "demo.PropertyPublishingJdo"
+ , editing = Editing.ENABLED
+ , publishing = Publishing.DISABLED // <.>
+)
+public class PropertyPublishingJdo implements HasAsciiDocDescription {
+ // ...
+//end::class[]
+
+ public PropertyPublishingJdo(String initialValue) {
+ this.propertyUsingAnnotation = initialValue;
+ this.propertyUsingMetaAnnotation = initialValue;
+ this.propertyUsingMetaAnnotationButOverridden = initialValue;
+ }
+
+ public String title() {
+ return "Property#publishing";
+ }
+
+//tag::annotation[]
+ @Property(
+ publishing = Publishing.ENABLED // <.>
+ )
+ @PropertyLayout(
+ describedAs =
+ "@Property(publishing = ENABLED)"
+ )
+ @MemberOrder(name = "annotation", sequence = "1")
+ @XmlElement(required = true)
+ @Getter @Setter
+ private String propertyUsingAnnotation;
+//end::annotation[]
+
+//tag::meta-annotated[]
+ @Property()
+ @PublishingEnabledMetaAnnotation // <.>
+ @PropertyLayout(
+ describedAs = "@PublishingEnabledMetaAnnotation"
+ )
+ @MemberOrder(name = "meta-annotated", sequence = "1")
+ @XmlElement(required = true)
+ @Getter @Setter
+ private String propertyUsingMetaAnnotation;
+//end::meta-annotated[]
+
+//tag::meta-annotated-overridden[]
+ @PublishingEnabledMetaAnnotation // <.>
+ @Property(
+ publishing = Publishing.DISABLED // <.>
+ )
+ @PropertyLayout(
+ describedAs =
+ "@PublishingEnabledMetaAnnotation " +
+ "@PropertyLayout(publishing = DISABLED)"
+ )
+ @MemberOrder(name = "meta-annotated-overridden", sequence = "1")
+ @XmlElement(required = false)
+ @Getter @Setter
+ private String propertyUsingMetaAnnotationButOverridden;
+//end::meta-annotated-overridden[]
+
+//tag::class[]
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo.layout.xml
new file mode 100644
index 0000000..f3edfb0
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdo.layout.xml
@@ -0,0 +1,57 @@
+<?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 />
+ <cpt:action id="rebuildMetamodel"/>
+ </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:fieldSet name="Annotated" id="annotation"/>
+ <cpt:fieldSet name="Contributed" id="contributed"/>
+ <cpt:fieldSet name="Meta-annotated" id="meta-annotated"/>
+ <cpt:fieldSet name="Meta-annotated Overridden" id="meta-annotated-overridden"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="interactionExecutions"/>
+ <cpt:collection id="publishedObjects"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
+ </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_DROPDOWN"/>
+ <cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
+ <cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
+ <cpt:action id="downloadJdoMetadata" 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/annotDomain/Property/publishing/PropertyPublishingJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdoEntities.java
new file mode 100644
index 0000000..192c9d3
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdoEntities.java
@@ -0,0 +1,31 @@
+package demoapp.dom.annotDomain.Property.publishing;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.services.repository.RepositoryService;
+
+@Service
+public class PropertyPublishingJdoEntities {
+
+ public Optional<PropertyPublishingJdo> find(final String value) {
+ return repositoryService.firstMatch(PropertyPublishingJdo.class, x -> Objects.equals(x.getPropertyUsingAnnotation(), value));
+ }
+
+ public List<PropertyPublishingJdo> all() {
+ return repositoryService.allInstances(PropertyPublishingJdo.class);
+ }
+
+ public PropertyPublishingJdo first() {
+ return all().stream().findFirst().get();
+ }
+
+ @Inject
+ RepositoryService repositoryService;
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdoSeedService.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdoSeedService.java
new file mode 100644
index 0000000..c45cd79
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PropertyPublishingJdoSeedService.java
@@ -0,0 +1,39 @@
+package demoapp.dom.annotDomain.Property.publishing;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.services.repository.RepositoryService;
+import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScript;
+
+import demoapp.dom._infra.seed.SeedServiceAbstract;
+import demoapp.dom.types.Samples;
+
+@Service
+public class PropertyPublishingJdoSeedService extends SeedServiceAbstract {
+
+ public PropertyPublishingJdoSeedService() {
+ super(PropertyPublishingJdoEntityFixture::new);
+ }
+
+ static class PropertyPublishingJdoEntityFixture extends FixtureScript {
+
+ @Override
+ protected void execute(ExecutionContext executionContext) {
+ samples.stream()
+ .map(PropertyPublishingJdo::new)
+ .forEach(domainObject -> {
+ repositoryService.persist(domainObject);
+ executionContext.addResult(this, domainObject);
+ });
+
+ }
+
+ @Inject
+ RepositoryService repositoryService;
+
+ @Inject
+ Samples<String> samples;
+ }
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PublishingDisabledMetaAnnotation.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PublishingDisabledMetaAnnotation.java
new file mode 100644
index 0000000..4b7705a
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PublishingDisabledMetaAnnotation.java
@@ -0,0 +1,22 @@
+package demoapp.dom.annotDomain.Property.publishing;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.Publishing;
+
+//tag::class[]
+@Property(publishing = Publishing.DISABLED) // <.>
+@Inherited
+@Target({
+ ElementType.METHOD, ElementType.FIELD // <.>
+})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PublishingDisabledMetaAnnotation {
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PublishingEnabledMetaAnnotation.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PublishingEnabledMetaAnnotation.java
new file mode 100644
index 0000000..ce7c42a
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/PublishingEnabledMetaAnnotation.java
@@ -0,0 +1,23 @@
+package demoapp.dom.annotDomain.Property.publishing;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.Publishing;
+
+//tag::class[]
+@Property(publishing = Publishing.ENABLED) // <.>
+@Inherited
+@Target({
+ ElementType.METHOD, ElementType.FIELD // <.>
+})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PublishingEnabledMetaAnnotation {
+
+}
+//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PropertyPublishingJdo_interactionExecutions.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PropertyPublishingJdo_interactionExecutions.java
new file mode 100644
index 0000000..98ad7f9
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PropertyPublishingJdo_interactionExecutions.java
@@ -0,0 +1,30 @@
+package demoapp.dom.annotDomain.Property.publishing.spiimpl;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Collection;
+import org.apache.isis.schema.ixn.v2.InteractionDto;
+
+import demoapp.dom.annotDomain.Property.publishing.PropertyPublishingJdo;
+
+@Collection
+public class PropertyPublishingJdo_interactionExecutions {
+
+ private final PropertyPublishingJdo propertyPublishingJdo;
+
+ public PropertyPublishingJdo_interactionExecutions(PropertyPublishingJdo propertyPublishingJdo) {
+ this.propertyPublishingJdo = propertyPublishingJdo;
+ }
+
+ public List<InteractionDto> coll() {
+ return publisherServiceSpiForProperties
+ .streamInteractionDtos()
+ .collect(Collectors.toList());
+ }
+
+ @Inject
+ private PublisherServiceSpiForProperties publisherServiceSpiForProperties;
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PropertyPublishingJdo_publishedObjects.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PropertyPublishingJdo_publishedObjects.java
new file mode 100644
index 0000000..da19d5a
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PropertyPublishingJdo_publishedObjects.java
@@ -0,0 +1,32 @@
+package demoapp.dom.annotDomain.Property.publishing.spiimpl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.Collection;
+import org.apache.isis.schema.chg.v2.ChangesDto;
+
+import demoapp.dom.annotDomain.Property.publishing.PropertyPublishingJdo;
+
+@Collection
+public class PropertyPublishingJdo_publishedObjects {
+
+ private final PropertyPublishingJdo propertyPublishingJdo;
+ public PropertyPublishingJdo_publishedObjects(PropertyPublishingJdo propertyPublishingJdo) {
+ this.propertyPublishingJdo = propertyPublishingJdo;
+ }
+
+ public List<String> coll() {
+ return new ArrayList<>();
+// return publisherServiceSpiForProperties
+// .streamPublishedObjects()
+// .collect(Collectors.toList());
+ }
+
+ @Inject
+ private PublisherServiceSpiForProperties publisherServiceSpiForProperties;
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PublisherServiceSpiForProperties.java b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PublisherServiceSpiForProperties.java
new file mode 100644
index 0000000..4f92964
--- /dev/null
+++ b/examples/demo/domain/src/main/java/demoapp/dom/annotDomain/Property/publishing/spiimpl/PublisherServiceSpiForProperties.java
@@ -0,0 +1,49 @@
+package demoapp.dom.annotDomain.Property.publishing.spiimpl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.springframework.stereotype.Service;
+
+import org.apache.isis.applib.services.iactn.Interaction;
+import org.apache.isis.applib.services.publish.PublishedObjects;
+import org.apache.isis.applib.services.publish.PublisherService;
+import org.apache.isis.applib.util.schema.InteractionDtoUtils;
+import org.apache.isis.schema.chg.v2.ChangesDto;
+import org.apache.isis.schema.ixn.v2.InteractionDto;
+
+@Service
+public class PublisherServiceSpiForProperties implements PublisherService {
+
+ private final List<InteractionDto> executions = new ArrayList<>();
+ private final List<ChangesDto> publishedObjects = new ArrayList<ChangesDto>();
+
+ @Override
+ public void publish(Interaction.Execution<?, ?> execution) {
+
+ final InteractionDto dto =
+ InteractionDtoUtils.newInteractionDto(execution, InteractionDtoUtils.Strategy.DEEP);
+
+ executions.add(dto);
+ }
+
+ @Override
+ public void publish(PublishedObjects publishedObjects) {
+ final ChangesDto dto = publishedObjects.getDto();
+ this.publishedObjects.add(dto);
+ }
+
+ public Stream<InteractionDto> streamInteractionDtos() {
+ return executions.stream();
+ }
+
+ public Stream<ChangesDto> streamPublishedObjects() {
+ return publishedObjects.stream();
+ }
+
+ public void clear() {
+ executions.clear();
+ }
+
+}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
index db3a222..a992119 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/menubars.layout.xml
@@ -15,10 +15,10 @@ as a replacement for
<mb3:named>Basic Types</mb3:named>
<mb3:section>
<mb3:named>Primitives</mb3:named>
- <mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="bytes"/>
<mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="shorts"/>
<mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="ints"/>
<mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="longs"/>
+ <mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="bytes"/>
<mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="floats"/>
<mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="doubles"/>
<mb3:serviceAction objectType="demo.PrimitiveTypesMenu" id="chars"/>
@@ -122,6 +122,7 @@ as a replacement for
<mb3:serviceAction objectType="demo.PropertyMenu" id="maxLength"/>
<mb3:serviceAction objectType="demo.PropertyMenu" id="mustSatisfy"/>
<mb3:serviceAction objectType="demo.PropertyMenu" id="optionality"/>
+ <mb3:serviceAction objectType="demo.PropertyMenu" id="publishing"/>
<mb3:serviceAction objectType="demo.PropertyMenu" id="regexPattern"/>
</mb3:section>
</mb3:menu>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/jdo/JavaLangStringJdoEntities.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/jdo/JavaLangStringJdoEntities.java
index 01e63f5..a3769d7 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/jdo/JavaLangStringJdoEntities.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/strings/jdo/JavaLangStringJdoEntities.java
@@ -1,6 +1,7 @@
package demoapp.dom.types.javalang.strings.jdo;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
import javax.inject.Inject;
@@ -13,7 +14,7 @@ import org.apache.isis.applib.services.repository.RepositoryService;
public class JavaLangStringJdoEntities {
public Optional<JavaLangStringJdo> find(final String readOnlyProperty) {
- return repositoryService.firstMatch(JavaLangStringJdo.class, x -> x.getReadOnlyProperty() == readOnlyProperty);
+ return repositoryService.firstMatch(JavaLangStringJdo.class, x -> Objects.equals(x.getReadOnlyProperty(), readOnlyProperty));
}
public List<JavaLangStringJdo> all() {