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:54:00 UTC
[45/52] [abbrv] isis git commit: ISIS-970: unit testing of @Action
annotation
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetAbstractImpl.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetAbstractImpl.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetAbstractImpl.java
index 386f56c..bd8a15d 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetAbstractImpl.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetAbstractImpl.java
@@ -22,12 +22,20 @@ package org.apache.isis.core.metamodel.facets.members.hidden;
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.Facet;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
public abstract class HiddenFacetAbstractImpl extends HiddenFacetAbstract {
+ public HiddenFacetAbstractImpl(final Class<? extends Facet> facetType, final When when, Where where, final FacetHolder holder) {
+ super(facetType, when, where, holder);
+ }
+
+ /**
+ * For testing only.
+ */
public HiddenFacetAbstractImpl(final When when, Where where, final FacetHolder holder) {
- super(when, where, holder);
+ super(HiddenFacetAbstractImpl.class, when, where, holder);
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetFromLayoutPropertiesAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetFromLayoutPropertiesAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetFromLayoutPropertiesAbstract.java
new file mode 100644
index 0000000..4c57da2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/HiddenFacetFromLayoutPropertiesAbstract.java
@@ -0,0 +1,53 @@
+/*
+ * 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.members.hidden;
+
+import java.util.Properties;
+import com.google.common.base.Strings;
+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;
+
+public abstract class HiddenFacetFromLayoutPropertiesAbstract extends HiddenFacetAbstract {
+
+ protected static Where hidden(final Properties properties) {
+ if(properties == null) {
+ return null;
+ }
+ final String hidden = Strings.emptyToNull(properties.getProperty("hidden"));
+ if(hidden == null) {
+ return null;
+ }
+ return Where.valueOf(hidden);
+ }
+
+ protected HiddenFacetFromLayoutPropertiesAbstract(final Where where, final FacetHolder holder) {
+ super(HiddenFacetFromLayoutPropertiesAbstract.class, 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/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberAnnotation.java
index 76b9ab4..c51c59a 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberAnnotation.java
@@ -27,7 +27,7 @@ import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstractI
public class HiddenFacetOnMemberAnnotation extends HiddenFacetAbstractImpl {
public HiddenFacetOnMemberAnnotation(final When when, Where where, final FacetHolder holder) {
- super(when, where, holder);
+ super(HiddenFacetOnMemberAnnotation.class, when, where, holder);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberFromProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberFromProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberFromProperties.java
index 5ddc964..6fc91d0 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberFromProperties.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/annotprop/HiddenFacetOnMemberFromProperties.java
@@ -29,11 +29,11 @@ import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstractI
public class HiddenFacetOnMemberFromProperties extends HiddenFacetAbstractImpl {
public HiddenFacetOnMemberFromProperties(final When when, Where where, final FacetHolder holder) {
- super(when, where, holder);
+ super(HiddenFacetOnMemberFromProperties.class, when, where, holder);
}
public HiddenFacetOnMemberFromProperties(Properties properties, FacetHolder holder) {
- super(hiddenWhenFrom(properties), hiddenWhereFrom(properties), holder);
+ super(HiddenFacetOnMemberFromProperties.class, hiddenWhenFrom(properties), hiddenWhereFrom(properties), holder);
}
private static When hiddenWhenFrom(Properties properties) {
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/staticmethod/HiddenFacetOnStaticMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/staticmethod/HiddenFacetOnStaticMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/staticmethod/HiddenFacetOnStaticMethod.java
index b2f25a8..8b300d6 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/staticmethod/HiddenFacetOnStaticMethod.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/hidden/staticmethod/HiddenFacetOnStaticMethod.java
@@ -25,7 +25,7 @@ import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstractA
public class HiddenFacetOnStaticMethod extends HiddenFacetAbstractAlwaysEverywhere {
public HiddenFacetOnStaticMethod(final FacetHolder holder) {
- super(holder);
+ super(HiddenFacetOnStaticMethod.class, holder);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/hidden/annotation/HiddenFacetOnTypeAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/hidden/annotation/HiddenFacetOnTypeAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/hidden/annotation/HiddenFacetOnTypeAnnotation.java
index 983503c..5535b75 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/hidden/annotation/HiddenFacetOnTypeAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/hidden/annotation/HiddenFacetOnTypeAnnotation.java
@@ -27,7 +27,7 @@ import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstractI
public class HiddenFacetOnTypeAnnotation extends HiddenFacetAbstractImpl {
public HiddenFacetOnTypeAnnotation(final When when, final FacetHolder holder) {
- super(when, Where.ANYWHERE, holder);
+ super(HiddenFacetOnTypeAnnotation.class, when, Where.ANYWHERE, holder);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/publishedobject/PublishedObjectFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/publishedobject/PublishedObjectFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/publishedobject/PublishedObjectFacetAbstract.java
index 60f32fd..ac85e68 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/publishedobject/PublishedObjectFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/publishedobject/PublishedObjectFacetAbstract.java
@@ -41,7 +41,10 @@ public abstract class PublishedObjectFacetAbstract extends SingleValueFacetAbstr
this(legacyPayloadFactoryFor(publishingPayloadFactory), holder);
}
- protected static PublishedObject.PayloadFactory legacyPayloadFactoryFor(final PublishingPayloadFactoryForObject publishingPayloadFactory) {
+ static PublishedObject.PayloadFactory legacyPayloadFactoryFor(final PublishingPayloadFactoryForObject publishingPayloadFactory) {
+ if(publishingPayloadFactory == null) {
+ return null;
+ }
if(publishingPayloadFactory instanceof PublishingPayloadFactoryForObject.Adapter) {
final PublishingPayloadFactoryForObject.Adapter adapter = (PublishingPayloadFactoryForObject.Adapter) publishingPayloadFactory;
return adapter.getPayloadFactory();
@@ -64,7 +67,6 @@ public abstract class PublishedObjectFacetAbstract extends SingleValueFacetAbstr
/**
* For testing only.
- * @return
*/
public PublishingPayloadFactoryForObject getPayloadFactory() {
return payloadFactory;
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/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
index 5597150..33f5796 100644
--- 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
@@ -44,7 +44,7 @@ public class HiddenFacetForPropertyAnnotation extends HiddenFacetAbstract {
}
private HiddenFacetForPropertyAnnotation(final Where where, final FacetHolder holder) {
- super(When.ALWAYS, where, holder);
+ super(HiddenFacetForPropertyAnnotation.class, When.ALWAYS, where, holder);
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/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
index 0674087..05fdd6f 100644
--- 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
@@ -25,7 +25,7 @@ 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.DomainEventHelper;
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;
@@ -40,7 +40,7 @@ public abstract class PropertyClearFacetForDomainEventAbstract
return PropertyClearFacet.class;
}
- private final InteractionHelper interactionHelper;
+ private final DomainEventHelper domainEventHelper;
private final PropertyOrCollectionAccessorFacet getterFacet;
private final PropertyClearFacet clearFacet;
@@ -57,7 +57,7 @@ public abstract class PropertyClearFacetForDomainEventAbstract
this.getterFacet = getterFacet;
this.clearFacet = clearFacet;
this.propertyDomainEventFacet = propertyDomainEventFacet;
- this.interactionHelper = new InteractionHelper(servicesInjector);
+ this.domainEventHelper = new DomainEventHelper(servicesInjector);
}
@Override
@@ -66,7 +66,7 @@ public abstract class PropertyClearFacetForDomainEventAbstract
return;
}
- if(!interactionHelper.hasEventBusService()) {
+ if(!domainEventHelper.hasEventBusService()) {
clearFacet.clearProperty(targetAdapter);
return;
}
@@ -78,7 +78,7 @@ public abstract class PropertyClearFacetForDomainEventAbstract
// ... post the executing event
final Object oldValue = getterFacet.getProperty(targetAdapter);
- interactionHelper.postEventForProperty(
+ domainEventHelper.postEventForProperty(
value(), existingEvent, AbstractDomainEvent.Phase.EXECUTING,
getIdentified(), targetAdapter, oldValue, null);
@@ -94,7 +94,7 @@ public abstract class PropertyClearFacetForDomainEventAbstract
// ... 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);
+ domainEventHelper.postEventForProperty(value(), verify(event), AbstractDomainEvent.Phase.EXECUTED, getIdentified(), targetAdapter, oldValue, actualNewValue);
} finally {
// clean up
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/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
index 803b801..305ed55 100644
--- 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
@@ -26,7 +26,7 @@ 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.DomainEventHelper;
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;
@@ -39,7 +39,7 @@ import org.apache.isis.core.metamodel.spec.SpecificationLoader;
public abstract class PropertyDomainEventFacetAbstract
extends SingleClassValueFacetAbstract implements PropertyDomainEventFacet {
- private final InteractionHelper interactionHelper;
+ private final DomainEventHelper domainEventHelper;
final static ThreadLocal<PropertyDomainEvent<?,?>> currentInteraction = new ThreadLocal<PropertyDomainEvent<?,?>>();
@@ -53,12 +53,12 @@ public abstract class PropertyDomainEventFacetAbstract
final SpecificationLoader specificationLoader) {
super(PropertyDomainEventFacet.class, holder, eventType, specificationLoader);
this.getterFacet = getterFacet;
- interactionHelper = new InteractionHelper(servicesInjector);
+ domainEventHelper = new DomainEventHelper(servicesInjector);
}
@Override
public String hides(VisibilityContext<? extends VisibilityEvent> ic) {
- if(!interactionHelper.hasEventBusService()) {
+ if(!domainEventHelper.hasEventBusService()) {
return null;
}
@@ -66,7 +66,7 @@ public abstract class PropertyDomainEventFacetAbstract
currentInteraction.set(null);
final PropertyDomainEvent<?, ?> event =
- interactionHelper.postEventForProperty(
+ domainEventHelper.postEventForProperty(
eventType(), null, AbstractDomainEvent.Phase.HIDE, getIdentified(), ic.getTarget(), null, null);
if (event != null && event.isHidden()) {
return "Hidden by subscriber";
@@ -76,7 +76,7 @@ public abstract class PropertyDomainEventFacetAbstract
@Override
public String disables(UsabilityContext<? extends UsabilityEvent> ic) {
- if(!interactionHelper.hasEventBusService()) {
+ if(!domainEventHelper.hasEventBusService()) {
return null;
}
@@ -84,7 +84,7 @@ public abstract class PropertyDomainEventFacetAbstract
currentInteraction.set(null);
final PropertyDomainEvent<?, ?> event =
- interactionHelper.postEventForProperty(
+ domainEventHelper.postEventForProperty(
eventType(), null, AbstractDomainEvent.Phase.DISABLE, getIdentified(), ic.getTarget(), null, null);
if (event != null && event.isDisabled()) {
return event.getDisabledReason();
@@ -94,7 +94,7 @@ public abstract class PropertyDomainEventFacetAbstract
@Override
public String invalidates(ValidityContext<? extends ValidityEvent> ic) {
- if(!interactionHelper.hasEventBusService()) {
+ if(!domainEventHelper.hasEventBusService()) {
return null;
}
@@ -105,7 +105,7 @@ public abstract class PropertyDomainEventFacetAbstract
final Object proposedValue = proposedFrom(ic);
final PropertyDomainEvent<?, ?> event =
- interactionHelper.postEventForProperty(
+ domainEventHelper.postEventForProperty(
eventType(), null, AbstractDomainEvent.Phase.VALIDATE, getIdentified(), ic.getTarget(), oldValue, proposedValue);
if (event != null && event.isInvalid()) {
return event.getInvalidityReason();
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/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
index 46e73de..19c3676 100644
--- 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
@@ -25,7 +25,7 @@ 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.DomainEventHelper;
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;
@@ -39,7 +39,7 @@ public abstract class PropertySetterFacetForDomainEventAbstract
return PropertySetterFacet.class;
}
- private final InteractionHelper interactionHelper;
+ private final DomainEventHelper domainEventHelper;
private final PropertyOrCollectionAccessorFacet getterFacet;
private final PropertySetterFacet setterFacet;
@@ -56,7 +56,7 @@ public abstract class PropertySetterFacetForDomainEventAbstract
this.getterFacet = getterFacet;
this.setterFacet = setterFacet;
this.propertyDomainEventFacet = propertyDomainEventFacet;
- this.interactionHelper = new InteractionHelper(servicesInjector);
+ this.domainEventHelper = new DomainEventHelper(servicesInjector);
}
@Override
@@ -64,7 +64,7 @@ public abstract class PropertySetterFacetForDomainEventAbstract
if(setterFacet == null) {
return;
}
- if(!interactionHelper.hasEventBusService()) {
+ if(!domainEventHelper.hasEventBusService()) {
setterFacet.setProperty(targetAdapter, newValueAdapter);
return;
}
@@ -78,7 +78,7 @@ public abstract class PropertySetterFacetForDomainEventAbstract
final Object oldValue = getterFacet.getProperty(targetAdapter);
final Object newValue = ObjectAdapter.Util.unwrap(newValueAdapter);
- interactionHelper.postEventForProperty(
+ domainEventHelper.postEventForProperty(
value(), existingEvent, AbstractDomainEvent.Phase.EXECUTING,
getIdentified(), targetAdapter, oldValue, newValue);
@@ -93,7 +93,7 @@ public abstract class PropertySetterFacetForDomainEventAbstract
// ... post the executed event
final PropertyDomainEvent<?, ?> event = propertyDomainEventFacet.currentInteraction.get();
- interactionHelper.postEventForProperty(value(), verify(event), AbstractDomainEvent.Phase.EXECUTED, getIdentified(), targetAdapter, oldValue, actualNewValue);
+ domainEventHelper.postEventForProperty(value(), verify(event), AbstractDomainEvent.Phase.EXECUTED, getIdentified(), targetAdapter, oldValue, actualNewValue);
} finally {
// clean up
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java
index 0ee0b82..f01a022 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutAnnotation.java
@@ -38,7 +38,7 @@ public class HiddenFacetForPropertyLayoutAnnotation extends HiddenFacetAbstract
}
private HiddenFacetForPropertyLayoutAnnotation(final Where where, final FacetHolder holder) {
- super(When.ALWAYS, where, holder);
+ super(HiddenFacetForPropertyLayoutAnnotation.class, When.ALWAYS, where, holder);
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java
index 3fb9354..8cddc94 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetOnPropertyFromLayoutProperties.java
@@ -20,41 +20,20 @@
package org.apache.isis.core.metamodel.facets.properties.propertylayout;
import java.util.Properties;
-import com.google.common.base.Strings;
-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;
+import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetFromLayoutPropertiesAbstract;
-public class HiddenFacetOnPropertyFromLayoutProperties extends HiddenFacetAbstract {
+public class HiddenFacetOnPropertyFromLayoutProperties extends HiddenFacetFromLayoutPropertiesAbstract {
- public static HiddenFacet create(Properties properties, FacetHolder holder) {
+ public static HiddenFacet create(final Properties properties, final FacetHolder holder) {
final Where where = hidden(properties);
return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetOnPropertyFromLayoutProperties(where, holder): null;
}
- private static Where hidden(Properties properties) {
- if(properties == null) {
- return null;
- }
- String hidden = Strings.emptyToNull(properties.getProperty("hidden"));
- if(hidden == null) {
- return null;
- }
- return Where.valueOf(hidden);
+ private HiddenFacetOnPropertyFromLayoutProperties(final Where where, final FacetHolder holder) {
+ super(where, holder);
}
- private HiddenFacetOnPropertyFromLayoutProperties(Where where, FacetHolder holder) {
- super(When.ALWAYS, where, holder);
- }
-
- @Override
- public String hiddenReason(final ObjectAdapter targetAdapter, Where whereContext) {
- if(!where().includes(whereContext)) {
- return null;
- }
- return "Hidden on " + where().getFriendlyName();
- }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
index 46b1b08..602e87f 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
@@ -81,11 +81,11 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
- public Properties asProperties(Class<?> domainClass) {
- LayoutMetadata metadata;
+ public Properties asProperties(final Class<?> domainClass) {
+ final LayoutMetadata metadata;
try {
metadata = readMetadata(domainClass);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new ReaderException("Failed to locate/parse " + domainClass.getName() + ".layout.json file (" + e.getMessage() + ")", e);
}
if(metadata.getColumns() == null || metadata.getColumns().size() != 4) {
@@ -99,7 +99,7 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
setMemberGroupLayoutColumnLists(metadata, 1, "middle", props);
setMemberGroupLayoutColumnLists(metadata, 2, "right", props);
- int[] memberSeq = {0};
+ final int[] memberSeq = {0};
setProperties(metadata, props, memberSeq);
setCollections(metadata, props, memberSeq);
setFreestandingActions(metadata, props);
@@ -107,24 +107,24 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
return props;
}
- private static void setMemberGroupLayoutColumnSpans(LayoutMetadata metadata, final Properties props) {
+ private static void setMemberGroupLayoutColumnSpans(final LayoutMetadata metadata, final Properties props) {
final List<ColumnRepr> columns = metadata.getColumns();
final String columnSpansStr = Joiner.on(",").join(Iterables.transform(columns, new Function<ColumnRepr,Integer>(){
@Override
- public Integer apply(ColumnRepr input) {
+ public Integer apply(final ColumnRepr input) {
return input.span;
}}));
props.setProperty("class.memberGroupLayout.columnSpans", columnSpansStr);
}
- private static void setMemberGroupLayoutColumnLists(LayoutMetadata metadata, int colIdx, String propkey, Properties props) {
+ private static void setMemberGroupLayoutColumnLists(final LayoutMetadata metadata, final int colIdx, final String propkey, final Properties props) {
final ColumnRepr column = metadata.getColumns().get(colIdx);
final Map<String, MemberGroupRepr> memberGroups = column.memberGroups;
final String val = memberGroups != null ? Joiner.on(",").join(memberGroups.keySet()) : "";
props.setProperty("class.memberGroupLayout." + propkey, val);
}
- private static void setProperties(LayoutMetadata metadata, Properties props, int[] memberSeq) {
+ private static void setProperties(final LayoutMetadata metadata, final Properties props, final int[] memberSeq) {
final List<ColumnRepr> columns = metadata.getColumns();
for (final ColumnRepr columnRepr : columns) {
final Map<String, MemberGroupRepr> memberGroups = columnRepr.memberGroups;
@@ -145,13 +145,13 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
}
}
- private static void setCollections(LayoutMetadata metadata, Properties props, int[] memberSeq) {
+ private static void setCollections(final LayoutMetadata metadata, final Properties props, final int[] memberSeq) {
final ColumnRepr columnRepr = metadata.getColumns().get(3);
final Map<String, MemberRepr> collections = columnRepr.collections;
setMembersAndAssociatedActions(props, null, collections, memberSeq);
}
- private static void setMembersAndAssociatedActions(Properties props, final String memberGroupName, final Map<String, MemberRepr> members, int[] memberSeq) {
+ private static void setMembersAndAssociatedActions(final Properties props, final String memberGroupName, final Map<String, MemberRepr> members, final int[] memberSeq) {
for(final String memberName: members.keySet()) {
props.setProperty("member." + memberName + ".memberOrder.sequence", ""+ ++memberSeq[0]);
if(memberGroupName != null) {
@@ -167,7 +167,7 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
int actSeq = 0;
for(final String actionName: actions.keySet()) {
final ActionRepr actionRepr = actions.get(actionName);
- String nameKey = "action." + actionName + ".memberOrder.name";
+ final String nameKey = "action." + actionName + ".memberOrder.name";
props.setProperty(nameKey, memberName);
setRemainingActionProperties(props, "action", actionName, actionRepr, ++actSeq);
}
@@ -304,7 +304,7 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
}
}
- private static void setFreestandingActions(LayoutMetadata metadata, Properties props) {
+ private static void setFreestandingActions(final LayoutMetadata metadata, final Properties props) {
if(metadata.getActions() == null) {
return;
}
@@ -380,7 +380,7 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
}
}
- public LayoutMetadata asLayoutMetadata(Class<?> domainClass) throws ReaderException {
+ public LayoutMetadata asLayoutMetadata(final Class<?> domainClass) throws ReaderException {
try {
return readMetadata(domainClass);
} catch (IOException | RuntimeException e) {
@@ -390,7 +390,7 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
// //////////////////////////////////////
- private LayoutMetadata readMetadata(Class<?> domainClass) throws IOException {
+ private LayoutMetadata readMetadata(final Class<?> domainClass) throws IOException {
final String content = ClassExtensions.resourceContent(domainClass, ".layout.json");
return readMetadata(content);
}
@@ -407,14 +407,14 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
/**
* not API
*/
- public String asJson(ObjectSpecification objectSpec) {
+ public String asJson(final ObjectSpecification objectSpec) {
final LayoutMetadata metadata = new LayoutMetadata();
metadata.setColumns(Lists.<ColumnRepr>newArrayList());
final MemberGroupLayoutFacet mglf = objectSpec.getFacet(MemberGroupLayoutFacet.class);
final ColumnSpans columnSpans = mglf.getColumnSpans();
- Set<String> actionIdsForAssociations = Sets.newTreeSet();
+ final Set<String> actionIdsForAssociations = Sets.newTreeSet();
ColumnRepr columnRepr;
@@ -436,14 +436,14 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
return gson.toJson(metadata);
}
- private static void updateColumnMemberGroups(ObjectSpecification objectSpec, final MemberGroupLayoutHint hint, ColumnRepr columnRepr, Set<String> actionIdsForAssociations) {
+ private static void updateColumnMemberGroups(final ObjectSpecification objectSpec, final MemberGroupLayoutHint hint, final ColumnRepr columnRepr, final Set<String> actionIdsForAssociations) {
final List<ObjectAssociation> objectAssociations = propertiesOf(objectSpec);
final Map<String, List<ObjectAssociation>> associationsByGroup = ObjectAssociation.Util.groupByMemberOrderName(objectAssociations);
final List<String> groupNames = ObjectSpecifications.orderByMemberGroups(objectSpec, associationsByGroup.keySet(), hint);
columnRepr.memberGroups = Maps.newLinkedHashMap();
- for (String groupName : groupNames) {
+ for (final String groupName : groupNames) {
final MemberGroupRepr memberGroupRepr = new MemberGroupRepr();
columnRepr.memberGroups.put(groupName, memberGroupRepr);
final List<ObjectAssociation> associationsInGroup = associationsByGroup.get(groupName);
@@ -451,39 +451,39 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
if(associationsInGroup == null) {
continue;
}
- for (ObjectAssociation assoc : associationsInGroup) {
+ for (final ObjectAssociation assoc : associationsInGroup) {
final MemberRepr memberRepr = newMemberRepr(objectSpec, assoc, actionIdsForAssociations);
memberGroupRepr.members.put(assoc.getId(), memberRepr);
}
}
}
- private static void addActions(ObjectSpecification objectSpec, final LayoutMetadata metadata, Set<String> actionIdsForAssociations) {
- Map<String, ActionRepr> actions = Maps.newLinkedHashMap();
+ private static void addActions(final ObjectSpecification objectSpec, final LayoutMetadata metadata, final Set<String> actionIdsForAssociations) {
+ final Map<String, ActionRepr> actions = Maps.newLinkedHashMap();
final List<ObjectAction> actionsOf = actionsOf(objectSpec, actionIdsForAssociations);
- for(ObjectAction action: actionsOf) {
+ for(final ObjectAction action: actionsOf) {
actions.put(action.getId(), newActionRepr(objectSpec, action));
}
metadata.setActions(actions);
}
- private static ActionRepr newActionRepr(ObjectSpecification objectSpec, ObjectAction action) {
- ActionRepr actionRepr = new ActionRepr();
+ private static ActionRepr newActionRepr(final ObjectSpecification objectSpec, final ObjectAction action) {
+ final ActionRepr actionRepr = new ActionRepr();
- CssClassFacet cssClassFacet = action.getFacet(CssClassFacet.class);
+ final CssClassFacet cssClassFacet = action.getFacet(CssClassFacet.class);
if(cssClassFacet != null && !cssClassFacet.isNoop()) {
- CssClassFacetRepr cssClassFacetRepr = new CssClassFacetRepr();
+ final CssClassFacetRepr cssClassFacetRepr = new CssClassFacetRepr();
cssClassFacetRepr.value = cssClassFacet.cssClass(null);
actionRepr.cssClass = cssClassFacetRepr;
}
- DescribedAsFacet describedAsFacet = action.getFacet(DescribedAsFacet.class);
+ final DescribedAsFacet describedAsFacet = action.getFacet(DescribedAsFacet.class);
if(describedAsFacet != null && !describedAsFacet.isNoop() && !Strings.isNullOrEmpty(describedAsFacet.value())) {
- DescribedAsFacetRepr describedAsFacetRepr = new DescribedAsFacetRepr();
+ final DescribedAsFacetRepr describedAsFacetRepr = new DescribedAsFacetRepr();
describedAsFacetRepr.value = describedAsFacet.value();
actionRepr.describedAs = describedAsFacetRepr;
}
- NamedFacet namedFacet = action.getFacet(NamedFacet.class);
+ final NamedFacet namedFacet = action.getFacet(NamedFacet.class);
if(namedFacet != null && !namedFacet.isNoop()) {
- NamedFacetRepr namedFacetRepr = new NamedFacetRepr();
+ final NamedFacetRepr namedFacetRepr = new NamedFacetRepr();
namedFacetRepr.value = namedFacet.value();
actionRepr.named = namedFacetRepr;
}
@@ -491,76 +491,77 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
return actionRepr;
}
- private static void updateCollectionColumnRepr(ObjectSpecification objectSpec, ColumnRepr columnRepr, Set<String> actionIdsOfAssociations) {
+ private static void updateCollectionColumnRepr(final ObjectSpecification objectSpec, final ColumnRepr columnRepr, final Set<String> actionIdsOfAssociations) {
final List<ObjectAssociation> objectAssociations = collectionsOf(objectSpec);
columnRepr.collections = Maps.newLinkedHashMap();
- for(ObjectAssociation assoc: objectAssociations) {
+ for(final ObjectAssociation assoc: objectAssociations) {
final MemberRepr memberRepr = newMemberRepr(objectSpec, assoc, actionIdsOfAssociations);
columnRepr.collections.put(assoc.getId(), memberRepr);
}
}
- private static MemberRepr newMemberRepr(ObjectSpecification objectSpec, ObjectAssociation assoc, Set<String> actionIdsForAssociations) {
+ private static MemberRepr newMemberRepr(final ObjectSpecification objectSpec, final ObjectAssociation assoc, final Set<String> actionIdsForAssociations) {
final MemberRepr memberRepr = new MemberRepr();
- CssClassFacet cssClassFacet = assoc.getFacet(CssClassFacet.class);
+ final CssClassFacet cssClassFacet = assoc.getFacet(CssClassFacet.class);
if(cssClassFacet != null && !cssClassFacet.isNoop()) {
- CssClassFacetRepr cssClassFacetRepr = new CssClassFacetRepr();
+ final CssClassFacetRepr cssClassFacetRepr = new CssClassFacetRepr();
cssClassFacetRepr.value = cssClassFacet.cssClass(null);
memberRepr.cssClass = cssClassFacetRepr;
}
- DescribedAsFacet describedAsFacet = assoc.getFacet(DescribedAsFacet.class);
+ final DescribedAsFacet describedAsFacet = assoc.getFacet(DescribedAsFacet.class);
if(describedAsFacet != null && !describedAsFacet.isNoop() && !Strings.isNullOrEmpty(describedAsFacet.value())) {
- DescribedAsFacetRepr describedAsFacetRepr = new DescribedAsFacetRepr();
+ final DescribedAsFacetRepr describedAsFacetRepr = new DescribedAsFacetRepr();
describedAsFacetRepr.value = describedAsFacet.value();
memberRepr.describedAs = describedAsFacetRepr;
}
- NamedFacet namedFacet = assoc.getFacet(NamedFacet.class);
+ final NamedFacet namedFacet = assoc.getFacet(NamedFacet.class);
if(namedFacet != null && !namedFacet.isNoop()) {
- NamedFacetRepr namedFacetRepr = new NamedFacetRepr();
+ final NamedFacetRepr namedFacetRepr = new NamedFacetRepr();
namedFacetRepr.value = namedFacet.value();
memberRepr.named = namedFacetRepr;
}
- DisabledFacet disabledFacet = assoc.getFacet(DisabledFacet.class);
+ final DisabledFacet disabledFacet = assoc.getFacet(DisabledFacet.class);
if(disabledFacet != null && !disabledFacet.isNoop()) {
- DisabledFacetRepr disabledFacetRepr = new DisabledFacetRepr();
+ final DisabledFacetRepr disabledFacetRepr = new DisabledFacetRepr();
if(disabledFacet instanceof DisabledFacetAbstractImpl) {
- DisabledFacetAbstractImpl disabledFacetImpl = (DisabledFacetAbstractImpl) disabledFacet;
+ final DisabledFacetAbstractImpl disabledFacetImpl = (DisabledFacetAbstractImpl) disabledFacet;
disabledFacetRepr.reason = Strings.emptyToNull(disabledFacetImpl.getReason());
}
disabledFacetRepr.when = whenAlwaysToNull(disabledFacet.when());
disabledFacetRepr.where = whereAnywhereToNull(disabledFacet.where());
memberRepr.disabled = disabledFacetRepr;
}
- HiddenFacet hiddenFacet = assoc.getFacet(HiddenFacet.class);
+ // relies on the fact that HiddenFacetAbstract is multi-typed
+ final HiddenFacet hiddenFacet = assoc.getFacet(HiddenFacet.class);
if(hiddenFacet != null && !hiddenFacet.isNoop()) {
- HiddenFacetRepr hiddenFacetRepr = new HiddenFacetRepr();
+ final HiddenFacetRepr hiddenFacetRepr = new HiddenFacetRepr();
hiddenFacetRepr.when = whenAlwaysToNull(hiddenFacet.when());
hiddenFacetRepr.where = whereAnywhereToNull(hiddenFacet.where());
memberRepr.hidden = hiddenFacetRepr;
}
- MultiLineFacet multiLineFacet = assoc.getFacet(MultiLineFacet.class);
+ final MultiLineFacet multiLineFacet = assoc.getFacet(MultiLineFacet.class);
if(multiLineFacet != null && !multiLineFacet.isNoop()) {
- MultiLineFacetRepr multiLineFacetRepr = new MultiLineFacetRepr();
+ final MultiLineFacetRepr multiLineFacetRepr = new MultiLineFacetRepr();
multiLineFacetRepr.numberOfLines = multiLineFacet.numberOfLines();
memberRepr.multiLine = multiLineFacetRepr;
}
- PagedFacet pagedFacet = assoc.getFacet(PagedFacet.class);
+ final PagedFacet pagedFacet = assoc.getFacet(PagedFacet.class);
if(pagedFacet != null && !pagedFacet.isNoop()) {
- PagedFacetRepr pagedFacetRepr = new PagedFacetRepr();
+ final PagedFacetRepr pagedFacetRepr = new PagedFacetRepr();
pagedFacetRepr.value = pagedFacet.value();
memberRepr.paged = pagedFacetRepr;
}
- RenderFacet renderFacet = assoc.getFacet(RenderFacet.class);
+ final RenderFacet renderFacet = assoc.getFacet(RenderFacet.class);
if(renderFacet != null && !renderFacet.isNoop()) {
- RenderFacetRepr renderFacetRepr = new RenderFacetRepr();
+ final RenderFacetRepr renderFacetRepr = new RenderFacetRepr();
renderFacetRepr.value = renderFacet.value();
memberRepr.render = renderFacetRepr;
}
- TypicalLengthFacet typicalLengthFacet = assoc.getFacet(TypicalLengthFacet.class);
+ final TypicalLengthFacet typicalLengthFacet = assoc.getFacet(TypicalLengthFacet.class);
if(typicalLengthFacet != null && !typicalLengthFacet.isNoop()) {
- TypicalLengthFacetRepr typicalLengthFacetRepr = new TypicalLengthFacetRepr();
+ final TypicalLengthFacetRepr typicalLengthFacetRepr = new TypicalLengthFacetRepr();
typicalLengthFacetRepr.value = typicalLengthFacet.value();
memberRepr.typicalLength = typicalLengthFacetRepr;
}
@@ -581,11 +582,11 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
return memberRepr;
}
- private static Where whereAnywhereToNull(Where where) {
+ private static Where whereAnywhereToNull(final Where where) {
return where != Where.ANYWHERE? where: null;
}
- private static When whenAlwaysToNull(When when) {
+ private static When whenAlwaysToNull(final When when) {
return when != When.ALWAYS? when: null;
}
@@ -593,7 +594,7 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
Collections.sort(actions, new Comparator<ObjectAction>() {
@Override
- public int compare(ObjectAction o1, ObjectAction o2) {
+ public int compare(final ObjectAction o1, final ObjectAction o2) {
final MemberOrderFacet m1 = o1.getFacet(MemberOrderFacet.class);
final MemberOrderFacet m2 = o2.getFacet(MemberOrderFacet.class);
return memberOrderFacetComparator.compare(m1, m2);
@@ -622,7 +623,7 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
private static Filter<ObjectAction> excluding(final Set<String> excludedActionIds) {
return new Filter<ObjectAction>(){
@Override
- public boolean accept(ObjectAction t) {
+ public boolean accept(final ObjectAction t) {
return !excludedActionIds.contains(t.getId());
}
};
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
index 3ec0bdf..6cea2c8 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
@@ -28,7 +28,6 @@ import org.apache.isis.applib.Identifier;
import org.apache.isis.applib.annotation.ActionLayout;
import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.Bulk;
-import org.apache.isis.applib.annotation.When;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.filter.Filter;
import org.apache.isis.applib.value.Blob;
@@ -42,7 +41,6 @@ import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.FacetFilters;
import org.apache.isis.core.metamodel.facets.actions.bulk.BulkFacet;
import org.apache.isis.core.metamodel.facets.actions.position.ActionPositionFacet;
-import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFacet;
@@ -281,9 +279,6 @@ public interface ObjectAction extends ObjectMember {
private Predicates(){}
- public static final Predicate<ObjectAction> VISIBLE_AT_LEAST_SOMETIMES =
- org.apache.isis.applib.filter.Filters.asPredicate(Filters.VISIBLE_AT_LEAST_SOMETIMES);
-
public static Predicate<ObjectAction> dynamicallyVisible(final AuthenticationSession session, final ObjectAdapter target, final Where where) {
return org.apache.isis.applib.filter.Filters.asPredicate(Filters.dynamicallyVisible(session, target, where));
}
@@ -327,18 +322,6 @@ public interface ObjectAction extends ObjectMember {
* @deprecated -use {@link com.google.common.base.Predicate equivalent}
*/
@Deprecated
- public static final Filter<ObjectAction> VISIBLE_AT_LEAST_SOMETIMES = new Filter<ObjectAction>() {
- @Override
- public boolean accept(final ObjectAction action) {
- final HiddenFacet hiddenFacet = action.getFacet(HiddenFacet.class);
- return hiddenFacet == null || hiddenFacet.when() != When.ALWAYS || hiddenFacet.where() != Where.ANYWHERE;
- }
- };
-
- /**
- * @deprecated -use {@link com.google.common.base.Predicate equivalent}
- */
- @Deprecated
public static Filter<ObjectAction> dynamicallyVisible(final AuthenticationSession session, final ObjectAdapter target, final Where where) {
return new Filter<ObjectAction>() {
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
index 1aa3729..9970867 100644
--- a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
+++ b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
@@ -20,7 +20,6 @@
package org.apache.isis.progmodels.dflt;
import org.apache.isis.core.metamodel.facets.actions.action.ActionAnnotationFacetFactory;
-import org.apache.isis.core.metamodel.facets.actions.bulk.annotation.BulkFacetAnnotationFactory;
import org.apache.isis.core.metamodel.facets.actions.debug.annotation.DebugFacetAnnotationFactory;
import org.apache.isis.core.metamodel.facets.actions.defaults.method.ActionDefaultsFacetViaMethodFactory;
import org.apache.isis.core.metamodel.facets.actions.exploration.annotation.ExplorationFacetAnnotationFactory;
@@ -32,10 +31,6 @@ import org.apache.isis.core.metamodel.facets.actions.notinservicemenu.annotation
import org.apache.isis.core.metamodel.facets.actions.notinservicemenu.method.NotInServiceMenuFacetViaMethodFactory;
import org.apache.isis.core.metamodel.facets.actions.paged.annotation.PagedFacetOnActionFactory;
import org.apache.isis.core.metamodel.facets.actions.prototype.annotation.PrototypeFacetAnnotationFactory;
-import org.apache.isis.core.metamodel.facets.actions.semantics.annotations.actionsemantics.ActionSemanticsFacetAnnotationFactory;
-import org.apache.isis.core.metamodel.facets.actions.semantics.annotations.idempotent.IdempotentFacetAnnotationFactory;
-import org.apache.isis.core.metamodel.facets.actions.semantics.annotations.queryonly.QueryOnlyFacetAnnotationFactory;
-import org.apache.isis.core.metamodel.facets.actions.semantics.fallback.ActionSemanticsFacetFallbackToNonIdempotentFactory;
import org.apache.isis.core.metamodel.facets.actions.validate.method.ActionValidationFacetViaMethodFactory;
import org.apache.isis.core.metamodel.facets.actions.validating.maxlenannot.MaxLengthFacetOnActionAnnotationFactory;
import org.apache.isis.core.metamodel.facets.collections.accessor.CollectionAccessorFacetViaAccessorFactory;
@@ -296,10 +291,6 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
addFactory(ActionParameterAutoCompleteFacetViaMethodFactory.class);
addFactory(ActionDefaultsFacetViaMethodFactory.class);
addFactory(ActionParameterDefaultsFacetViaMethodFactory.class);
- addFactory(QueryOnlyFacetAnnotationFactory.class);
- addFactory(IdempotentFacetAnnotationFactory.class);
- addFactory(ActionSemanticsFacetAnnotationFactory.class);
- addFactory(ActionSemanticsFacetFallbackToNonIdempotentFactory.class);
// members in general
addFactory(NamedFacetStaticMethodFactory.class);
@@ -362,7 +353,6 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
addFactory(NotContributedFacetAnnotationFactory.class);
addFactory(NotInServiceMenuFacetAnnotationFactory.class);
addFactory(NotInServiceMenuFacetViaMethodFactory.class);
- addFactory(BulkFacetAnnotationFactory.class);
addFactory(HiddenFacetOnTypeAnnotationFactory.class);
// must come after the TitleAnnotationFacetFactory, because can act as an override
@@ -403,10 +393,11 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
// must come after the property/collection accessor+mutator facet factories
// (nb actions domain events are conflated with the action invocation).
+ // nb: all must come after HiddenFacetOnMemberFactory
addFactory(PropertyAnnotationFacetFactory.class);
addFactory(CollectionAnnotationFacetFactory.class);
-
addFactory(ActionAnnotationFacetFactory.class);
+
addFactory(ParameterAnnotationFacetFactory.class);
// must come after DomainObjectAnnotationFacetFactory
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java
new file mode 100644
index 0000000..59b52c4
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.core.metamodel.facets;
+
+import org.junit.Test;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
+import org.apache.isis.applib.services.eventbus.ActionInvokedEvent;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class DomainEventHelperTest_newActionInteractionEvent {
+
+ public static class SomeDomainObject {
+ public String foo(final int x, final String y) { return null; }
+ }
+
+ public static class SomeDomainObjectFooInvokedEvent extends ActionDomainEvent<SomeDomainObject> {
+ private static final long serialVersionUID = 1L;
+ public SomeDomainObjectFooInvokedEvent(final SomeDomainObject source, final Identifier identifier, final Object... arguments) {
+ super(source, identifier, arguments);
+ }
+ }
+
+ @Test
+ public void defaultEventType() throws Exception {
+ final SomeDomainObject sdo = new SomeDomainObject();
+ final Identifier identifier = Identifier.actionIdentifier(SomeDomainObject.class, "foo", new Class[]{int.class, String.class});
+
+ final ActionDomainEvent<Object> ev = new DomainEventHelper(null).newActionDomainEvent(
+ ActionDomainEvent.Default.class, identifier, sdo, new Object[]{1, "bar"});
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getArguments(), is(not(nullValue())));
+ assertThat(ev.getArguments().get(0), is((Object)Integer.valueOf(1)));
+ assertThat(ev.getArguments().get(1), is((Object)"bar"));
+ }
+
+ @Test
+ public void actionInvokedEventDefaultEventType() throws Exception {
+ final SomeDomainObject sdo = new SomeDomainObject();
+ final Identifier identifier = Identifier.actionIdentifier(SomeDomainObject.class, "foo", new Class[]{int.class, String.class});
+
+ final ActionDomainEvent<Object> ev = new DomainEventHelper(null).newActionDomainEvent(
+ ActionInvokedEvent.Default.class, identifier, sdo, new Object[]{1, "bar"});
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getArguments(), is(not(nullValue())));
+ assertThat(ev.getArguments().get(0), is((Object)Integer.valueOf(1)));
+ assertThat(ev.getArguments().get(1), is((Object)"bar"));
+ }
+
+ @Test
+ public void customEventType() throws Exception {
+ final SomeDomainObject sdo = new SomeDomainObject();
+ final Identifier identifier = Identifier.actionIdentifier(SomeDomainObject.class, "foo", new Class[]{int.class, String.class});
+
+ final ActionDomainEvent<SomeDomainObject> ev = new DomainEventHelper(null).newActionDomainEvent(
+ SomeDomainObjectFooInvokedEvent.class, identifier, sdo, new Object[]{1, "bar"});
+ assertThat((SomeDomainObject)ev.getSource(), is(sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getArguments(), is(not(nullValue())));
+ assertThat(ev.getArguments().get(0), is((Object)Integer.valueOf(1)));
+ assertThat(ev.getArguments().get(1), is((Object)"bar"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
new file mode 100644
index 0000000..cd5e37a
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
@@ -0,0 +1,85 @@
+/**
+ * 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;
+
+import java.util.Set;
+import org.junit.Test;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
+import org.apache.isis.applib.services.eventbus.CollectionAddedToEvent;
+import org.apache.isis.applib.services.eventbus.CollectionDomainEvent;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
+
+ public static class SomeDomainObject {
+ public Set<SomeReferencedObject> getReferences() { return null; }
+ }
+ public static class SomeReferencedObject {}
+
+ public static class SomeDomainObjectCollectionEvent extends CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> {
+ private static final long serialVersionUID = 1L;
+ public SomeDomainObjectCollectionEvent(SomeDomainObject source, Identifier identifier, Of of, SomeReferencedObject value) {
+ super(source, identifier, of, value);
+ }
+ }
+
+ @Test
+ public void defaultEventType() throws Exception {
+ final SomeDomainObject sdo = new SomeDomainObject();
+ final SomeReferencedObject other = new SomeReferencedObject();
+ final Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
+
+ final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
+ CollectionDomainEvent.Default.class, null, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
+ assertThat(ev.getValue(), is((Object)other));
+ }
+
+ @Test
+ public void collectionAddedToDefaultEventType() throws Exception {
+ final SomeDomainObject sdo = new SomeDomainObject();
+ final SomeReferencedObject other = new SomeReferencedObject();
+ final Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
+
+ final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
+ CollectionAddedToEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
+ assertThat(ev.getValue(), is((Object)other));
+ }
+
+ @Test
+ public void customEventType() throws Exception {
+ final SomeDomainObject sdo = new SomeDomainObject();
+ final SomeReferencedObject other = new SomeReferencedObject();
+ final Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
+
+ final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = new DomainEventHelper(null).newCollectionDomainEvent(
+ SomeDomainObjectCollectionEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
+ assertThat(ev.getSource(), is(sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
+ assertThat(ev.getValue(), is(other));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
new file mode 100644
index 0000000..f3f9bdf
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
@@ -0,0 +1,85 @@
+/**
+ * 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;
+
+import java.util.Set;
+import org.junit.Test;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
+import org.apache.isis.applib.services.eventbus.CollectionDomainEvent;
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
+
+ public static class SomeDomainObject {
+ public Set<SomeReferencedObject> getReferences() { return null; }
+ }
+ public static class SomeReferencedObject {}
+
+ public static class SomeDomainObjectCollectionRemovedFromEvent extends CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> {
+ private static final long serialVersionUID = 1L;
+ public SomeDomainObjectCollectionRemovedFromEvent(SomeDomainObject source, Identifier identifier, Of of, SomeReferencedObject value) {
+ super(source, identifier, of, value);
+ }
+ }
+
+ @Test
+ public void defaultEventType() throws Exception {
+ SomeDomainObject sdo = new SomeDomainObject();
+ SomeReferencedObject other = new SomeReferencedObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
+
+ final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
+ CollectionRemovedFromEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
+ assertThat(ev.getValue(), is((Object)other));
+ }
+
+ @Test
+ public void collectionRemovedFromDefaultEventType() throws Exception {
+ SomeDomainObject sdo = new SomeDomainObject();
+ SomeReferencedObject other = new SomeReferencedObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
+
+ final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
+ CollectionRemovedFromEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
+ assertThat(ev.getValue(), is((Object)other));
+ }
+
+ @Test
+ public void customEventType() throws Exception {
+ SomeDomainObject sdo = new SomeDomainObject();
+ SomeReferencedObject other = new SomeReferencedObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
+
+ final CollectionDomainEvent<SomeDomainObject, SomeReferencedObject> ev = new DomainEventHelper(null).newCollectionDomainEvent(
+ SomeDomainObjectCollectionRemovedFromEvent.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
+ assertThat(ev.getSource(), is(sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
+ assertThat(ev.getValue(), is(other));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java
new file mode 100644
index 0000000..2615194
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java
@@ -0,0 +1,72 @@
+/**
+ * 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;
+
+import org.joda.time.LocalDate;
+import org.junit.Test;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class DomainEventHelperTest_newPropertyDomainEvent_forClear {
+
+ public static class SomeDomainObject {}
+
+ public static class SomeDatePropertyChangedEvent extends PropertyDomainEvent<SomeDomainObject, LocalDate> {
+ private static final long serialVersionUID = 1L;
+ public SomeDatePropertyChangedEvent(SomeDomainObject source, Identifier identifier, LocalDate oldValue, LocalDate newValue) {
+ super(source, identifier, oldValue, newValue);
+ }
+ }
+
+ @Test
+ public void defaultEventType() throws Exception {
+
+ SomeDomainObject sdo = new SomeDomainObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
+ LocalDate oldValue = new LocalDate(2013,4,1);
+ LocalDate newValue = null;
+
+ final PropertyDomainEvent<Object, Object> ev =
+ new DomainEventHelper(null).newPropertyDomainEvent(PropertyDomainEvent.Default.class, identifier, sdo, oldValue, newValue);
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOldValue(), is((Object)oldValue));
+ assertThat(ev.getNewValue(), is((Object)newValue));
+ }
+
+
+ @Test
+ public void customEventType() throws Exception {
+
+ SomeDomainObject sdo = new SomeDomainObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
+ LocalDate oldValue = new LocalDate(2013,4,1);
+ LocalDate newValue = null;
+
+ final PropertyDomainEvent<SomeDomainObject, LocalDate> ev =
+ new DomainEventHelper(null).newPropertyDomainEvent(SomeDatePropertyChangedEvent.class, identifier, sdo, oldValue, newValue);
+ assertThat(ev.getSource(), is(sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOldValue(), is(oldValue));
+ assertThat(ev.getNewValue(), is(nullValue()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forModify.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forModify.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forModify.java
new file mode 100644
index 0000000..bea8c40
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forModify.java
@@ -0,0 +1,71 @@
+/**
+ * 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;
+
+import org.joda.time.LocalDate;
+import org.junit.Test;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class DomainEventHelperTest_newPropertyDomainEvent_forModify {
+
+ public static class SomeDomainObject {}
+
+ public static class SomeDatePropertyChangedEvent extends PropertyDomainEvent<SomeDomainObject, LocalDate> {
+ private static final long serialVersionUID = 1L;
+ public SomeDatePropertyChangedEvent(SomeDomainObject source, Identifier identifier, LocalDate oldValue, LocalDate newValue) {
+ super(source, identifier, oldValue, newValue);
+ }
+ }
+
+ @Test
+ public void defaultEventType() throws Exception {
+
+ SomeDomainObject sdo = new SomeDomainObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
+ LocalDate oldValue = new LocalDate(2013,4,1);
+ LocalDate newValue = new LocalDate(2013,5,2);
+
+ final PropertyDomainEvent<Object, Object> ev =
+ new DomainEventHelper(null).newPropertyDomainEvent(PropertyDomainEvent.Default.class, identifier, sdo, oldValue, newValue);
+ assertThat(ev.getSource(), is((Object)sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOldValue(), is((Object)oldValue));
+ assertThat(ev.getNewValue(), is((Object)newValue));
+ }
+
+
+ @Test
+ public void customEventType() throws Exception {
+
+ SomeDomainObject sdo = new SomeDomainObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "someDateProperty");
+ LocalDate oldValue = new LocalDate(2013,4,1);
+ LocalDate newValue = new LocalDate(2013,5,2);
+
+ final PropertyDomainEvent<SomeDomainObject, LocalDate> ev =
+ new DomainEventHelper(null).newPropertyDomainEvent(SomeDatePropertyChangedEvent.class, identifier, sdo, oldValue, newValue);
+ assertThat(ev.getSource(), is(sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getOldValue(), is(oldValue));
+ assertThat(ev.getNewValue(), is(newValue));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/432ec3f1/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/InteractionHelper_newActionInteractionEvent.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/InteractionHelper_newActionInteractionEvent.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/InteractionHelper_newActionInteractionEvent.java
deleted file mode 100644
index 7192d53..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/InteractionHelper_newActionInteractionEvent.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.isis.core.metamodel.facets;
-
-import org.junit.Test;
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
-import org.apache.isis.applib.services.eventbus.ActionInvokedEvent;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class InteractionHelper_newActionInteractionEvent {
-
- public static class SomeDomainObject {
- public String foo(int x, String y) { return null; }
- }
-
- public static class SomeDomainObjectFooInvokedEvent extends ActionDomainEvent<SomeDomainObject> {
- private static final long serialVersionUID = 1L;
- public SomeDomainObjectFooInvokedEvent(SomeDomainObject source, Identifier identifier, Object... arguments) {
- super(source, identifier, arguments);
- }
- }
-
- @Test
- public void defaultEventType() throws Exception {
- SomeDomainObject sdo = new SomeDomainObject();
- Identifier identifier = Identifier.actionIdentifier(SomeDomainObject.class, "foo", new Class[]{int.class, String.class});
-
- final ActionDomainEvent<Object> ev = new InteractionHelper(null).newActionDomainEvent(
- ActionDomainEvent.Default.class, identifier, sdo, new Object[]{1, "bar"});
- assertThat(ev.getSource(), is((Object)sdo));
- assertThat(ev.getIdentifier(), is(identifier));
- assertThat(ev.getArguments(), is(not(nullValue())));
- assertThat(ev.getArguments().get(0), is((Object)Integer.valueOf(1)));
- assertThat(ev.getArguments().get(1), is((Object)"bar"));
- }
-
- @Test
- public void actionInvokedEventDefaultEventType() throws Exception {
- SomeDomainObject sdo = new SomeDomainObject();
- Identifier identifier = Identifier.actionIdentifier(SomeDomainObject.class, "foo", new Class[]{int.class, String.class});
-
- final ActionDomainEvent<Object> ev = new InteractionHelper(null).newActionDomainEvent(
- ActionInvokedEvent.Default.class, identifier, sdo, new Object[]{1, "bar"});
- assertThat(ev.getSource(), is((Object)sdo));
- assertThat(ev.getIdentifier(), is(identifier));
- assertThat(ev.getArguments(), is(not(nullValue())));
- assertThat(ev.getArguments().get(0), is((Object)Integer.valueOf(1)));
- assertThat(ev.getArguments().get(1), is((Object)"bar"));
- }
-
- @Test
- public void customEventType() throws Exception {
- SomeDomainObject sdo = new SomeDomainObject();
- Identifier identifier = Identifier.actionIdentifier(SomeDomainObject.class, "foo", new Class[]{int.class, String.class});
-
- final ActionDomainEvent<SomeDomainObject> ev = new InteractionHelper(null).newActionDomainEvent(
- SomeDomainObjectFooInvokedEvent.class, identifier, sdo, new Object[]{1, "bar"});
- assertThat((SomeDomainObject)ev.getSource(), is(sdo));
- assertThat(ev.getIdentifier(), is(identifier));
- assertThat(ev.getArguments(), is(not(nullValue())));
- assertThat(ev.getArguments().get(0), is((Object)Integer.valueOf(1)));
- assertThat(ev.getArguments().get(1), is((Object)"bar"));
- }
-
-}