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 2015/01/22 17:56:59 UTC
[31/50] [abbrv] isis git commit: ISIS-970: consolidating processing
into DomainObjectAnnotationFacetFactory, ActionAnnotationFF,
PropertyAnnotationFF, CollectionAnnotationFF
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
index 171e0a7..d480257 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
@@ -20,16 +20,54 @@
package org.apache.isis.core.metamodel.facets.properties.property;
import java.lang.reflect.Method;
+import org.apache.isis.applib.annotation.PostsPropertyChangedEvent;
import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.PropertyInteraction;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.Facet;
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.ContributeeMemberFacetFactory;
import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
+import org.apache.isis.core.metamodel.facets.object.regex.RegExFacet;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacet;
+import org.apache.isis.core.metamodel.facets.properties.property.disabled.DisabledFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyClearFacetForDomainEventAbstract;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyClearFacetForDomainEventFromDefault;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyClearFacetForDomainEventFromPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyClearFacetForPostsPropertyChangedEventAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyDomainEventFacet;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyDomainEventFacetAbstract;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyDomainEventFacetDefault;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyDomainEventFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertyDomainEventFacetForPropertyInteractionAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertySetterFacetForDomainEventAbstract;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertySetterFacetForDomainEventFromDefault;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertySetterFacetForDomainEventFromPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.modify.PropertySetterFacetForPostsPropertyChangedEventAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.hidden.HiddenFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.mandatory.MandatoryFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.maxlength.MaxLengthFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.mustsatisfy.MustSatisfySpecificationFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.notpersisted.NotPersistedFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.property.regex.RegExFacetForPropertyAnnotation;
+import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
+import org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet;
+import org.apache.isis.core.metamodel.facets.propparam.maxlen.MaxLengthFacet;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
+import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware {
+public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware, ContributeeMemberFacetFactory {
private ServicesInjector servicesInjector;
@@ -40,7 +78,7 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
@Override
public void process(final ProcessMethodContext processMethodContext) {
- processInteraction(processMethodContext);
+ processModify(processMethodContext);
processHidden(processMethodContext);
processEditing(processMethodContext);
processMaxLength(processMethodContext);
@@ -50,68 +88,171 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
processRegEx(processMethodContext);
}
- private void processInteraction(final ProcessMethodContext processMethodContext) {
+ void processModify(final ProcessMethodContext processMethodContext) {
- // interaction is handled by PropertyInteractionFacetFactory, because the
- // deprecated annotations must also be supported.
+ final Method method = processMethodContext.getMethod();
+ FacetedMethod holder = processMethodContext.getFacetHolder();
+
+ final PropertyOrCollectionAccessorFacet getterFacet = holder.getFacet(PropertyOrCollectionAccessorFacet.class);
+ if(getterFacet == null) {
+ return;
+ }
+
+ //
+ // Set up PropertyDomainEventFacet, which will act as the hiding/disabling/validating advisor
+ //
+ final Property property = Annotations.getAnnotation(method, Property.class);
+ final PropertyInteraction propertyInteraction = Annotations.getAnnotation(method, PropertyInteraction.class);
+ final Class<? extends PropertyDomainEvent<?, ?>> propertyDomainEventType;
+
+ final PropertyDomainEventFacetAbstract propertyDomainEventFacet;
+
+ // search for @PropertyInteraction(value=...)
+ if(propertyInteraction != null) {
+ propertyDomainEventType = propertyInteraction.value();
+ propertyDomainEventFacet = new PropertyDomainEventFacetForPropertyInteractionAnnotation(
+ propertyDomainEventType, getterFacet, servicesInjector, getSpecificationLoader(), holder);
+ } else
+ // search for @Property(domainEvent=...)
+ if(property != null && property.domainEvent() != null) {
+ propertyDomainEventType = property.domainEvent();
+ propertyDomainEventFacet = new PropertyDomainEventFacetForPropertyAnnotation(
+ propertyDomainEventType, getterFacet, servicesInjector, getSpecificationLoader(), holder);
+
+ } else
+ // else use default event type
+ {
+ propertyDomainEventType = PropertyDomainEvent.Default.class;
+ propertyDomainEventFacet = new PropertyDomainEventFacetDefault(
+ propertyDomainEventType, getterFacet, servicesInjector, getSpecificationLoader(), holder);
+ }
+ FacetUtil.addFacet(propertyDomainEventFacet);
+
+
+ //
+ // if the property is mutable, then replace the current setter and clear facets with equivalents that
+ // emit the appropriate domain event and then delegate onto the underlying
+ //
+
+
+ final PostsPropertyChangedEvent postsPropertyChangedEvent = Annotations.getAnnotation(method, PostsPropertyChangedEvent.class);
+ final PropertySetterFacet setterFacet = holder.getFacet(PropertySetterFacet.class);
+ if(setterFacet != null) {
+ // the current setter facet will end up as the underlying facet
+ final PropertySetterFacetForDomainEventAbstract replacementFacet;
+ // deprecated
+ if(postsPropertyChangedEvent != null) {
+ replacementFacet = new PropertySetterFacetForPostsPropertyChangedEventAnnotation(
+ postsPropertyChangedEvent.value(), getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
+ } else
+ // deprecated (but more recently)
+ if(propertyInteraction != null) {
+ replacementFacet = new PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation(
+ propertyDomainEventType, getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
+ } else
+ // current
+ if(property != null) {
+ replacementFacet = new PropertySetterFacetForDomainEventFromPropertyAnnotation(
+ propertyDomainEventType, getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
+ } else
+ // default
+ {
+ replacementFacet = new PropertySetterFacetForDomainEventFromDefault(
+ PropertyDomainEvent.Default.class, getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
+ }
+ FacetUtil.addFacet(replacementFacet);
+ }
+
+ final PropertyClearFacet clearFacet = holder.getFacet(PropertyClearFacet.class);
+ if(clearFacet != null) {
+ // the current clear facet will end up as the underlying facet
+ final PropertyClearFacetForDomainEventAbstract replacementFacet;
+
+ // deprecated
+ if(postsPropertyChangedEvent != null) {
+ replacementFacet = new PropertyClearFacetForPostsPropertyChangedEventAnnotation(
+ postsPropertyChangedEvent.value(), getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
+ } else
+ // deprecated (but more recently)
+ if(propertyInteraction != null) {
+ replacementFacet = new PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation(
+ propertyDomainEventType, getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
+ } else
+ // current
+ if(property != null) {
+ replacementFacet = new PropertyClearFacetForDomainEventFromPropertyAnnotation(
+ propertyDomainEventType, getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
+ } else
+ {
+ replacementFacet = new PropertyClearFacetForDomainEventFromDefault(
+ PropertyDomainEvent.Default.class, getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
+ }
+ FacetUtil.addFacet(replacementFacet);
+ }
}
- private void processHidden(final ProcessMethodContext processMethodContext) {
+ void processHidden(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
final Property property = Annotations.getAnnotation(method, Property.class);
final FacetHolder holder = processMethodContext.getFacetHolder();
- FacetUtil.addFacet(
- HiddenFacetForPropertyAnnotation.create(property, holder));
+ final HiddenFacet facet = HiddenFacetForPropertyAnnotation.create(property, holder);
+
+ FacetUtil.addFacet(facet);
}
- private void processEditing(final ProcessMethodContext processMethodContext) {
+ void processEditing(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
final Property property = Annotations.getAnnotation(method, Property.class);
final FacetHolder holder = processMethodContext.getFacetHolder();
- FacetUtil.addFacet(
- DisabledFacetForPropertyAnnotation.create(property, holder));
+ final DisabledFacet facet = DisabledFacetForPropertyAnnotation.create(property, holder);
+
+ FacetUtil.addFacet(facet);
}
- private void processMaxLength(final ProcessMethodContext processMethodContext) {
+ void processMaxLength(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
final Property property = Annotations.getAnnotation(method, Property.class);
final FacetHolder holder = processMethodContext.getFacetHolder();
- FacetUtil.addFacet(
- MaxLengthFacetForPropertyAnnotation.create(property, holder));
+ final MaxLengthFacet facet = MaxLengthFacetForPropertyAnnotation.create(property, holder);
+
+ FacetUtil.addFacet(facet);
}
- private void processMustSatisfy(final ProcessMethodContext processMethodContext) {
+ void processMustSatisfy(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
final Property property = Annotations.getAnnotation(method, Property.class);
final FacetHolder holder = processMethodContext.getFacetHolder();
- FacetUtil.addFacet(
- MustSatisfySpecificationFacetForPropertyAnnotation.create(property, holder));
+ final Facet facet = MustSatisfySpecificationFacetForPropertyAnnotation.create(property, holder);
+
+ FacetUtil.addFacet(facet);
}
- private void processNotPersisted(final ProcessMethodContext processMethodContext) {
+ void processNotPersisted(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
final Property property = Annotations.getAnnotation(method, Property.class);
final FacetHolder holder = processMethodContext.getFacetHolder();
- FacetUtil.addFacet(
- NotPersistedFacetForPropertyAnnotation.create(property, holder));
+ final NotPersistedFacet facet = NotPersistedFacetForPropertyAnnotation.create(property, holder);
+
+ FacetUtil.addFacet(facet);
}
- private void processOptional(final ProcessMethodContext processMethodContext) {
+ void processOptional(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
final Property property = Annotations.getAnnotation(method, Property.class);
final FacetHolder holder = processMethodContext.getFacetHolder();
- FacetUtil.addFacet(
- MandatoryFacetForPropertyAnnotation.create(property, method, holder));
+ final MandatoryFacet facet = MandatoryFacetForPropertyAnnotation.create(property, method, holder);
+
+ FacetUtil.addFacet(facet);
}
- private void processRegEx(final ProcessMethodContext processMethodContext) {
+ void processRegEx(final ProcessMethodContext processMethodContext) {
final Method method = processMethodContext.getMethod();
final Property property = Annotations.getAnnotation(method, Property.class);
final FacetHolder holder = processMethodContext.getFacetHolder();
@@ -121,8 +262,32 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
return;
}
- FacetUtil.addFacet(
- RegExFacetForPropertyAnnotation.create(property, holder));
+ final RegExFacet facet = RegExFacetForPropertyAnnotation.create(property, holder);
+
+ FacetUtil.addFacet(facet);
+ }
+
+
+ @Override
+ public void process(ContributeeMemberFacetFactory.ProcessContributeeMemberContext processMemberContext) {
+
+ final ObjectMember objectMember = processMemberContext.getFacetHolder();
+
+ //
+ // an enhancement would be to pick up a custom event, however the contributed property ultimately maps
+ // to an action on a service, and would therefore require a @Property(...) annotated on an action;
+ // would look rather odd
+ //
+
+ final PropertyOrCollectionAccessorFacet accessorFacet =
+ objectMember.getFacet(PropertyOrCollectionAccessorFacet.class);
+ if(accessorFacet != null) {
+ final PropertyDomainEventFacet facet = new PropertyDomainEventFacetDefault(
+ PropertyDomainEvent.Default.class, accessorFacet, servicesInjector, getSpecificationLoader(), objectMember);
+
+ FacetUtil.addFacet(facet);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java
deleted file mode 100644
index 0a8f872..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyInteractionFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,39 +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.properties.property;
-
-import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
-import org.apache.isis.core.metamodel.facets.properties.interaction.PropertyInteractionFacetAbstract;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-
-public class PropertyInteractionFacetForPropertyAnnotation extends PropertyInteractionFacetAbstract {
-
- public PropertyInteractionFacetForPropertyAnnotation(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final ServicesInjector servicesInjector, final SpecificationLoader specificationLoader, final FacetHolder holder) {
- super(eventType, getterFacet, holder, servicesInjector, specificationLoader);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.java
deleted file mode 100644
index 55e099d..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/RegExFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,68 +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.properties.property;
-
-import java.util.regex.Pattern;
-import org.apache.isis.applib.annotation.Property;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.regex.RegExFacet;
-import org.apache.isis.core.metamodel.facets.object.regex.RegExFacetAbstract;
-
-public class RegExFacetForPropertyAnnotation extends RegExFacetAbstract {
-
- private final Pattern pattern;
-
- static RegExFacet create(
- final Property property,
- final FacetHolder holder) {
-
- if (property == null) {
- return null;
- }
-
- final String pattern = property.regexPattern();
- final int patternFlags = property.regexPatternFlags();
-
- return new RegExFacetForPropertyAnnotation(pattern, patternFlags, holder);
- }
-
- private RegExFacetForPropertyAnnotation(final String pattern, final int patternFlags, final FacetHolder holder) {
- super(pattern, "", false, holder);
- this.pattern = Pattern.compile(pattern, patternFlags);
- }
-
- /**
- * Unused (for the TitledFacet)
- */
- @Override
- public String format(String text) {
- return text;
- }
-
- @Override
- public boolean doesNotMatch(final String text) {
- if (text == null) {
- return true;
- }
- return !pattern.matcher(text).matches();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/disabled/DisabledFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/disabled/DisabledFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/disabled/DisabledFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..3fda4be
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/disabled/DisabledFacetForPropertyAnnotation.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.core.metamodel.facets.properties.property.disabled;
+
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
+import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacetAbstractImpl;
+
+public class DisabledFacetForPropertyAnnotation extends DisabledFacetAbstractImpl {
+
+ public static DisabledFacet create(final Property property, final FacetHolder holder) {
+
+ if (property == null) {
+ return null;
+ }
+
+ final Editing editing = property.editing();
+ final String disabledReason = property.editingDisabledReason();
+
+ switch (editing) {
+ case AS_CONFIGURED:
+
+ // nothing needs to be done here; the DomainObjectFactory (processing @DomainObject annotation)
+ // will install an ImmutableFacetForDomainObjectAnnotation on the domain object and then a
+ // DisabledFacetOnPropertyDerivedFromImmutable facet will be installed.
+
+ return null;
+
+ case DISABLED:
+ return new DisabledFacetForPropertyAnnotation(disabledReason, holder);
+ case ENABLED:
+ return null;
+ }
+ return null;
+ }
+
+ private DisabledFacetForPropertyAnnotation(final String reason, final FacetHolder holder) {
+ super(When.ALWAYS, Where.EVERYWHERE, reason, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/hidden/HiddenFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/hidden/HiddenFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/hidden/HiddenFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..5597150
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/hidden/HiddenFacetForPropertyAnnotation.java
@@ -0,0 +1,58 @@
+/*
+ * 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.properties.property.hidden;
+
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract;
+
+public class HiddenFacetForPropertyAnnotation extends HiddenFacetAbstract {
+
+ public static HiddenFacet create(final Property property, final FacetHolder holder) {
+
+ if (property == null) {
+ return null;
+ }
+
+ final Where where = property.hidden();
+ if (where != null && where != Where.NOT_SPECIFIED) {
+ return new HiddenFacetForPropertyAnnotation(where, holder);
+ }
+
+ return null;
+ }
+
+ private HiddenFacetForPropertyAnnotation(final Where where, final FacetHolder holder) {
+ super(When.ALWAYS, where, holder);
+ }
+
+ @Override
+ public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) {
+ if(!where().includes(whereContext)) {
+ return null;
+ }
+ return "Hidden on " + where().getFriendlyName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mandatory/MandatoryFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mandatory/MandatoryFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mandatory/MandatoryFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..02cbc9c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mandatory/MandatoryFacetForPropertyAnnotation.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.core.metamodel.facets.properties.property.mandatory;
+
+import java.lang.reflect.Method;
+import org.apache.isis.applib.annotation.Optionality;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacet;
+import org.apache.isis.core.metamodel.facets.propparam.mandatory.MandatoryFacetAbstract;
+
+public abstract class MandatoryFacetForPropertyAnnotation extends MandatoryFacetAbstract {
+
+ public MandatoryFacetForPropertyAnnotation(final FacetHolder holder, final Semantics semantics) {
+ super(holder, semantics);
+ }
+
+ public static MandatoryFacet create(
+ final Property property,
+ final Method method,
+ final FacetHolder holder) {
+
+ if (property == null) {
+ return null;
+ }
+
+ final Class<?> returnType = method.getReturnType();
+ if (returnType.isPrimitive()) {
+ return new MandatoryFacetForPropertyAnnotation.Primitive(holder);
+ }
+
+ final Optionality optionality = property.optional();
+ switch (optionality) {
+ case DEFAULT:
+ // do nothing here; instead will rely on MandatoryFromJdoColumnAnnotationFacetFactory to perform
+ // the remaining processing
+ return null;
+ case FALSE:
+ return new MandatoryFacetForPropertyAnnotation.Required(holder);
+ case TRUE:
+ return new MandatoryFacetForPropertyAnnotation.Optional(holder);
+ }
+ return null;
+ }
+
+ public static class Primitive extends MandatoryFacetForPropertyAnnotation {
+ public Primitive(final FacetHolder holder) {
+ super(holder, Semantics.REQUIRED);
+ }
+ }
+
+ public static class Required extends MandatoryFacetForPropertyAnnotation {
+ public Required(final FacetHolder holder) {
+ super(holder, Semantics.REQUIRED);
+ }
+ }
+
+ public static class Optional extends MandatoryFacetForPropertyAnnotation {
+ public Optional(final FacetHolder holder) {
+ super(holder, Semantics.OPTIONAL);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/maxlength/MaxLengthFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/maxlength/MaxLengthFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/maxlength/MaxLengthFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..d648a29
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/maxlength/MaxLengthFacetForPropertyAnnotation.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.core.metamodel.facets.properties.property.maxlength;
+
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.maxlen.MaxLengthFacet;
+import org.apache.isis.core.metamodel.facets.propparam.maxlen.MaxLengthFacetAbstract;
+
+public class MaxLengthFacetForPropertyAnnotation extends MaxLengthFacetAbstract {
+
+ public static MaxLengthFacet create(
+ final Property property,
+ final FacetHolder holder) {
+
+ if (property == null) {
+ return null;
+ }
+ final int maxLength = property.maxLength();
+ return maxLength != -1
+ ? new MaxLengthFacetForPropertyAnnotation(maxLength, holder)
+ : null;
+ }
+
+ private MaxLengthFacetForPropertyAnnotation(final int value, final FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventAbstract.java
new file mode 100644
index 0000000..0674087
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventAbstract.java
@@ -0,0 +1,117 @@
+/*
+ * 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.properties.property.modify;
+
+import com.google.common.base.Objects;
+import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.InteractionHelper;
+import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public abstract class PropertyClearFacetForDomainEventAbstract
+ extends SingleValueFacetAbstract<Class<? extends PropertyDomainEvent<?,?>>>
+ implements PropertyClearFacet {
+
+
+ public static Class<? extends Facet> type() {
+ return PropertyClearFacet.class;
+ }
+
+ private final InteractionHelper interactionHelper;
+
+ private final PropertyOrCollectionAccessorFacet getterFacet;
+ private final PropertyClearFacet clearFacet;
+ private final PropertyDomainEventFacetAbstract propertyDomainEventFacet;
+
+ public PropertyClearFacetForDomainEventAbstract(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertyClearFacet clearFacet,
+ final PropertyDomainEventFacetAbstract propertyDomainEventFacet,
+ final ServicesInjector servicesInjector,
+ final FacetHolder holder) {
+ super(type(), eventType, holder);
+ this.getterFacet = getterFacet;
+ this.clearFacet = clearFacet;
+ this.propertyDomainEventFacet = propertyDomainEventFacet;
+ this.interactionHelper = new InteractionHelper(servicesInjector);
+ }
+
+ @Override
+ public void clearProperty(ObjectAdapter targetAdapter) {
+ if(clearFacet == null) {
+ return;
+ }
+
+ if(!interactionHelper.hasEventBusService()) {
+ clearFacet.clearProperty(targetAdapter);
+ return;
+ }
+
+
+ try {
+ // pick up existing event (saved in thread local during the validation phase)
+ final PropertyDomainEvent<?, ?> existingEvent = propertyDomainEventFacet.currentInteraction.get();
+
+ // ... post the executing event
+ final Object oldValue = getterFacet.getProperty(targetAdapter);
+ interactionHelper.postEventForProperty(
+ value(), existingEvent, AbstractDomainEvent.Phase.EXECUTING,
+ getIdentified(), targetAdapter, oldValue, null);
+
+ // ... perform the property clear
+ clearFacet.clearProperty(targetAdapter);
+
+ // reading the actual value from the target object, playing it safe...
+ final Object actualNewValue = getterFacet.getProperty(targetAdapter);
+ if(Objects.equal(oldValue, actualNewValue)) {
+ // do nothing.
+ return;
+ }
+
+ // ... and post the event (reusing existing event if available)
+ final PropertyDomainEvent<?, ?> event = propertyDomainEventFacet.currentInteraction.get();
+ interactionHelper.postEventForProperty(value(), verify(event), AbstractDomainEvent.Phase.EXECUTED, getIdentified(), targetAdapter, oldValue, actualNewValue);
+
+ } finally {
+ // clean up
+ propertyDomainEventFacet.currentInteraction.set(null);
+ }
+ }
+
+ /**
+ * Optional hook to allow the facet implementation for the deprecated {@link org.apache.isis.applib.annotation.PostsPropertyChangedEvent} annotation
+ * to discard the event if of a different type.
+ */
+ protected PropertyDomainEvent<?, ?> verify(PropertyDomainEvent<?, ?> event) {
+ return event;
+ }
+
+ private Class<? extends PropertyDomainEvent<?, ?>> eventType() {
+ return value();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromDefault.java
new file mode 100644
index 0000000..ce0c9b1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromDefault.java
@@ -0,0 +1,40 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public class PropertyClearFacetForDomainEventFromDefault
+ extends PropertyClearFacetForDomainEventAbstract {
+
+
+ public PropertyClearFacetForDomainEventFromDefault(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertyClearFacet clearFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, clearFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyAnnotation.java
new file mode 100644
index 0000000..226f6fd
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyAnnotation.java
@@ -0,0 +1,40 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public class PropertyClearFacetForDomainEventFromPropertyAnnotation
+ extends PropertyClearFacetForDomainEventAbstract {
+
+
+ public PropertyClearFacetForDomainEventFromPropertyAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertyClearFacet clearFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, clearFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation.java
new file mode 100644
index 0000000..c421278
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation.java
@@ -0,0 +1,44 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+/**
+ * @deprecated
+ */
+@Deprecated
+public class PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation
+ extends PropertyClearFacetForDomainEventAbstract {
+
+
+ public PropertyClearFacetForDomainEventFromPropertyInteractionAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertyClearFacet clearFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, clearFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java
new file mode 100644
index 0000000..5f32e82
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java
@@ -0,0 +1,51 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.clear.PropertyClearFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+/**
+ * @deprecated
+ */
+@Deprecated
+public class PropertyClearFacetForPostsPropertyChangedEventAnnotation
+ extends PropertyClearFacetForDomainEventAbstract {
+
+
+ public PropertyClearFacetForPostsPropertyChangedEventAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertyClearFacet clearFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, clearFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+
+ @Override
+ protected PropertyDomainEvent<?, ?> verify(final PropertyDomainEvent<?, ?> event) {
+ // will discard event if different type to that specified in the PostsPropertyChangedEvent annotation.
+ return event != null && value() == event.getClass() ? event : null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacet.java
new file mode 100644
index 0000000..6e0f1ea
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacet.java
@@ -0,0 +1,33 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacet;
+import org.apache.isis.core.metamodel.interactions.DisablingInteractionAdvisor;
+import org.apache.isis.core.metamodel.interactions.HidingInteractionAdvisor;
+import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
+
+/**
+ * Corresponds to <tt>@Property(domainEvent=...)</tt> annotation in the Isis programming model.
+ */
+public interface PropertyDomainEventFacet
+ extends SingleClassValueFacet, HidingInteractionAdvisor, DisablingInteractionAdvisor, ValidatingInteractionAdvisor {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetAbstract.java
new file mode 100644
index 0000000..803b801
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetAbstract.java
@@ -0,0 +1,129 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.events.UsabilityEvent;
+import org.apache.isis.applib.events.ValidityEvent;
+import org.apache.isis.applib.events.VisibilityEvent;
+import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.InteractionHelper;
+import org.apache.isis.core.metamodel.facets.SingleClassValueFacetAbstract;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.interactions.ProposedHolder;
+import org.apache.isis.core.metamodel.interactions.UsabilityContext;
+import org.apache.isis.core.metamodel.interactions.ValidityContext;
+import org.apache.isis.core.metamodel.interactions.VisibilityContext;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public abstract class PropertyDomainEventFacetAbstract
+ extends SingleClassValueFacetAbstract implements PropertyDomainEventFacet {
+
+ private final InteractionHelper interactionHelper;
+
+ final static ThreadLocal<PropertyDomainEvent<?,?>> currentInteraction = new ThreadLocal<PropertyDomainEvent<?,?>>();
+
+ private final PropertyOrCollectionAccessorFacet getterFacet;
+
+ public PropertyDomainEventFacetAbstract(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final FacetHolder holder,
+ final ServicesInjector servicesInjector,
+ final SpecificationLoader specificationLoader) {
+ super(PropertyDomainEventFacet.class, holder, eventType, specificationLoader);
+ this.getterFacet = getterFacet;
+ interactionHelper = new InteractionHelper(servicesInjector);
+ }
+
+ @Override
+ public String hides(VisibilityContext<? extends VisibilityEvent> ic) {
+ if(!interactionHelper.hasEventBusService()) {
+ return null;
+ }
+
+ // reset (belt-n-braces)
+ currentInteraction.set(null);
+
+ final PropertyDomainEvent<?, ?> event =
+ interactionHelper.postEventForProperty(
+ eventType(), null, AbstractDomainEvent.Phase.HIDE, getIdentified(), ic.getTarget(), null, null);
+ if (event != null && event.isHidden()) {
+ return "Hidden by subscriber";
+ }
+ return null;
+ }
+
+ @Override
+ public String disables(UsabilityContext<? extends UsabilityEvent> ic) {
+ if(!interactionHelper.hasEventBusService()) {
+ return null;
+ }
+
+ // reset (belt-n-braces)
+ currentInteraction.set(null);
+
+ final PropertyDomainEvent<?, ?> event =
+ interactionHelper.postEventForProperty(
+ eventType(), null, AbstractDomainEvent.Phase.DISABLE, getIdentified(), ic.getTarget(), null, null);
+ if (event != null && event.isDisabled()) {
+ return event.getDisabledReason();
+ }
+ return null;
+ }
+
+ @Override
+ public String invalidates(ValidityContext<? extends ValidityEvent> ic) {
+ if(!interactionHelper.hasEventBusService()) {
+ return null;
+ }
+
+ // reset (belt-n-braces)
+ currentInteraction.set(null);
+
+ final Object oldValue = getterFacet.getProperty(ic.getTarget());
+ final Object proposedValue = proposedFrom(ic);
+
+ final PropertyDomainEvent<?, ?> event =
+ interactionHelper.postEventForProperty(
+ eventType(), null, AbstractDomainEvent.Phase.VALIDATE, getIdentified(), ic.getTarget(), oldValue, proposedValue);
+ if (event != null && event.isInvalid()) {
+ return event.getInvalidityReason();
+ }
+
+ // make available for next phases (executing/executed)
+ currentInteraction.set(event);
+ return null;
+ }
+
+ private static Object proposedFrom(ValidityContext<? extends ValidityEvent> ic) {
+ final ProposedHolder ph = (ProposedHolder) ic;
+ final ObjectAdapter proposedAdapter = ph.getProposed();
+ return proposedAdapter != null? proposedAdapter.getObject(): null;
+ }
+
+ private Class<?> eventType() {
+ return value();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetDefault.java
new file mode 100644
index 0000000..1dcc524
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetDefault.java
@@ -0,0 +1,37 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class PropertyDomainEventFacetDefault extends PropertyDomainEventFacetAbstract {
+
+ public PropertyDomainEventFacetDefault(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final ServicesInjector servicesInjector, final SpecificationLoader specificationLoader, final FacetHolder holder) {
+ super(eventType, getterFacet, holder, servicesInjector, specificationLoader);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyAnnotation.java
new file mode 100644
index 0000000..381616e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyAnnotation.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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class PropertyDomainEventFacetForPropertyAnnotation extends PropertyDomainEventFacetAbstract {
+
+ public PropertyDomainEventFacetForPropertyAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final ServicesInjector servicesInjector, final SpecificationLoader specificationLoader, final FacetHolder holder) {
+ super(eventType, getterFacet, holder, servicesInjector, specificationLoader);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java
new file mode 100644
index 0000000..9d6ec19
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java
@@ -0,0 +1,37 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class PropertyDomainEventFacetForPropertyInteractionAnnotation extends PropertyDomainEventFacetAbstract {
+
+ public PropertyDomainEventFacetForPropertyInteractionAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final ServicesInjector servicesInjector, final SpecificationLoader specificationLoader, final FacetHolder holder) {
+ super(eventType, getterFacet, holder, servicesInjector, specificationLoader);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventAbstract.java
new file mode 100644
index 0000000..46e73de
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventAbstract.java
@@ -0,0 +1,112 @@
+/*
+ * 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.properties.property.modify;
+
+import com.google.common.base.Objects;
+import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.InteractionHelper;
+import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public abstract class PropertySetterFacetForDomainEventAbstract
+ extends SingleValueFacetAbstract<Class<? extends PropertyDomainEvent<?,?>>>
+ implements PropertySetterFacet {
+
+ public static Class<? extends Facet> type() {
+ return PropertySetterFacet.class;
+ }
+
+ private final InteractionHelper interactionHelper;
+
+ private final PropertyOrCollectionAccessorFacet getterFacet;
+ private final PropertySetterFacet setterFacet;
+ private final PropertyDomainEventFacetAbstract propertyDomainEventFacet;
+
+ public PropertySetterFacetForDomainEventAbstract(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertySetterFacet setterFacet,
+ final PropertyDomainEventFacetAbstract propertyDomainEventFacet,
+ final ServicesInjector servicesInjector,
+ final FacetHolder holder) {
+ super(type(), eventType, holder);
+ this.getterFacet = getterFacet;
+ this.setterFacet = setterFacet;
+ this.propertyDomainEventFacet = propertyDomainEventFacet;
+ this.interactionHelper = new InteractionHelper(servicesInjector);
+ }
+
+ @Override
+ public void setProperty(ObjectAdapter targetAdapter, ObjectAdapter newValueAdapter) {
+ if(setterFacet == null) {
+ return;
+ }
+ if(!interactionHelper.hasEventBusService()) {
+ setterFacet.setProperty(targetAdapter, newValueAdapter);
+ return;
+ }
+
+
+ try {
+ // pick up existing event (saved in thread local during the validation phase)
+ final PropertyDomainEvent<?, ?> existingEvent = propertyDomainEventFacet.currentInteraction.get();
+
+ // ... post the executing event
+ final Object oldValue = getterFacet.getProperty(targetAdapter);
+ final Object newValue = ObjectAdapter.Util.unwrap(newValueAdapter);
+
+ interactionHelper.postEventForProperty(
+ value(), existingEvent, AbstractDomainEvent.Phase.EXECUTING,
+ getIdentified(), targetAdapter, oldValue, newValue);
+
+ // ... perform the property modification
+ setterFacet.setProperty(targetAdapter, newValueAdapter);
+
+ // reading the actual value from the target object, playing it safe...
+ final Object actualNewValue = getterFacet.getProperty(targetAdapter);
+ if(Objects.equal(oldValue, actualNewValue)) {
+ return;
+ }
+
+ // ... post the executed event
+ final PropertyDomainEvent<?, ?> event = propertyDomainEventFacet.currentInteraction.get();
+ interactionHelper.postEventForProperty(value(), verify(event), AbstractDomainEvent.Phase.EXECUTED, getIdentified(), targetAdapter, oldValue, actualNewValue);
+
+ } finally {
+ // clean up
+ propertyDomainEventFacet.currentInteraction.set(null);
+ }
+ }
+
+ /**
+ * Optional hook to allow the facet implementation for the deprecated {@link org.apache.isis.applib.annotation.PostsPropertyChangedEvent} annotation
+ * to discard the event if of a different type.
+ */
+ protected PropertyDomainEvent<?, ?> verify(PropertyDomainEvent<?, ?> event) {
+ return event;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromDefault.java
new file mode 100644
index 0000000..25f4e5a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromDefault.java
@@ -0,0 +1,40 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public class PropertySetterFacetForDomainEventFromDefault
+ extends PropertySetterFacetForDomainEventAbstract {
+
+
+ public PropertySetterFacetForDomainEventFromDefault(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertySetterFacet setterFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, setterFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyAnnotation.java
new file mode 100644
index 0000000..10a80dd
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyAnnotation.java
@@ -0,0 +1,40 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+public class PropertySetterFacetForDomainEventFromPropertyAnnotation
+ extends PropertySetterFacetForDomainEventAbstract {
+
+
+ public PropertySetterFacetForDomainEventFromPropertyAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertySetterFacet setterFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, setterFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation.java
new file mode 100644
index 0000000..d7cb709
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation.java
@@ -0,0 +1,44 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+/**
+ * @deprecated
+ */
+@Deprecated
+public class PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation
+ extends PropertySetterFacetForDomainEventAbstract {
+
+
+ public PropertySetterFacetForDomainEventFromPropertyInteractionAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertySetterFacet setterFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, setterFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java
new file mode 100644
index 0000000..ec49a3a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java
@@ -0,0 +1,51 @@
+/*
+ * 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.properties.property.modify;
+
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+
+/**
+ * @deprecated
+ */
+@Deprecated
+public class PropertySetterFacetForPostsPropertyChangedEventAnnotation
+ extends PropertySetterFacetForDomainEventAbstract {
+
+
+ public PropertySetterFacetForPostsPropertyChangedEventAnnotation(
+ final Class<? extends PropertyDomainEvent<?, ?>> eventType,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final PropertySetterFacet setterFacet,
+ final PropertyDomainEventFacetAbstract propertyInteractionFacet,
+ final FacetHolder holder, final ServicesInjector servicesInjector) {
+ super(eventType, getterFacet, setterFacet, propertyInteractionFacet, servicesInjector, holder);
+ }
+
+ @Override
+ protected PropertyDomainEvent<?, ?> verify(final PropertyDomainEvent<?, ?> event) {
+ // will discard event if different type to that specified in the PostsPropertyChangedEvent annotation.
+ return event != null && value() == event.getClass() ? event : null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/Utils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/Utils.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/Utils.java
new file mode 100644
index 0000000..b3e2dbc
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/Utils.java
@@ -0,0 +1,23 @@
+/*
+ * 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.properties.property.modify;
+
+class Utils {
+ private Utils(){}
+}
\ No newline at end of file