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:53:50 UTC
[35/52] [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/interaction/PropertyClearFacetForInteractionAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForInteractionAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForInteractionAbstract.java
deleted file mode 100644
index 234e415..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForInteractionAbstract.java
+++ /dev/null
@@ -1,117 +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.interaction;
-
-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 PropertyClearFacetForInteractionAbstract
- 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 PropertyInteractionFacetAbstract propertyDomainEventFacet;
-
- public PropertyClearFacetForInteractionAbstract(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertyClearFacet clearFacet,
- final PropertyInteractionFacetAbstract 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/interaction/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java
deleted file mode 100644
index accedd5..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPostsPropertyChangedEventAnnotation.java
+++ /dev/null
@@ -1,47 +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.interaction;
-
-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 PropertyClearFacetForPostsPropertyChangedEventAnnotation
- extends PropertyClearFacetForInteractionAbstract {
-
-
- public PropertyClearFacetForPostsPropertyChangedEventAnnotation(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertyClearFacet clearFacet,
- final PropertyInteractionFacetAbstract 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/interaction/PropertyClearFacetForPropertyInteractionAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPropertyInteractionAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPropertyInteractionAnnotation.java
deleted file mode 100644
index 1be3fd6..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPropertyInteractionAnnotation.java
+++ /dev/null
@@ -1,40 +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.interaction;
-
-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 PropertyClearFacetForPropertyInteractionAnnotation
- extends PropertyClearFacetForInteractionAbstract {
-
-
- public PropertyClearFacetForPropertyInteractionAnnotation(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertyClearFacet clearFacet,
- final PropertyInteractionFacetAbstract 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/interaction/PropertyClearFacetForPropertyInteractionDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPropertyInteractionDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPropertyInteractionDefault.java
deleted file mode 100644
index 42372d9..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyClearFacetForPropertyInteractionDefault.java
+++ /dev/null
@@ -1,40 +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.interaction;
-
-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 PropertyClearFacetForPropertyInteractionDefault
- extends PropertyClearFacetForInteractionAbstract {
-
-
- public PropertyClearFacetForPropertyInteractionDefault(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertyClearFacet clearFacet,
- final PropertyInteractionFacetAbstract 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/interaction/PropertyInteractionFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacet.java
deleted file mode 100644
index 939fe62..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacet.java
+++ /dev/null
@@ -1,33 +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.interaction;
-
-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>@PropertyInteraction</tt> annotation in the Isis programming model.
- */
-public interface PropertyInteractionFacet
- 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/interaction/PropertyInteractionFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetAbstract.java
deleted file mode 100644
index 0911633..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetAbstract.java
+++ /dev/null
@@ -1,129 +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.interaction;
-
-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 PropertyInteractionFacetAbstract
- extends SingleClassValueFacetAbstract implements PropertyInteractionFacet {
-
- private final InteractionHelper interactionHelper;
-
- final static ThreadLocal<PropertyDomainEvent<?,?>> currentInteraction = new ThreadLocal<PropertyDomainEvent<?,?>>();
-
- private final PropertyOrCollectionAccessorFacet getterFacet;
-
- public PropertyInteractionFacetAbstract(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final FacetHolder holder,
- final ServicesInjector servicesInjector,
- final SpecificationLoader specificationLoader) {
- super(PropertyInteractionFacet.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/interaction/PropertyInteractionFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetAnnotation.java
deleted file mode 100644
index 368149d..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetAnnotation.java
+++ /dev/null
@@ -1,37 +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.interaction;
-
-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 PropertyInteractionFacetAnnotation extends PropertyInteractionFacetAbstract {
-
- public PropertyInteractionFacetAnnotation(
- 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/interaction/PropertyInteractionFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetDefault.java
deleted file mode 100644
index f34ba96..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetDefault.java
+++ /dev/null
@@ -1,37 +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.interaction;
-
-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 PropertyInteractionFacetDefault extends PropertyInteractionFacetAbstract {
-
- public PropertyInteractionFacetDefault(
- 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/interaction/PropertyInteractionFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetFactory.java
deleted file mode 100644
index 1b33d3c..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertyInteractionFacetFactory.java
+++ /dev/null
@@ -1,174 +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.interaction;
-
-import java.lang.reflect.Method;
-import java.util.Comparator;
-import java.util.List;
-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.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facetapi.MetaModelValidatorRefiner;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.FacetedMethod;
-import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacet;
-import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
-import org.apache.isis.core.metamodel.facets.properties.property.PropertyInteractionFacetForPropertyAnnotation;
-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.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
-import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorVisiting;
-import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorVisiting.Visitor;
-import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
-
-public class PropertyInteractionFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware, MetaModelValidatorRefiner {
-
- private ServicesInjector servicesInjector;
-
- public PropertyInteractionFacetFactory() {
- super(FeatureType.PROPERTIES_ONLY);
- }
-
- @Override
- public void process(final ProcessMethodContext processMethodContext) {
-
- final Method method = processMethodContext.getMethod();
- FacetedMethod holder = processMethodContext.getFacetHolder();
-
- final PropertyOrCollectionAccessorFacet getterFacet = holder.getFacet(PropertyOrCollectionAccessorFacet.class);
- if(getterFacet == null) {
- return;
- }
-
- //
- // Set up PropertyInteractionFacet, 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 PropertyInteractionFacetAbstract propertyInteractionFacet;
- if(property != null && property.domainEvent() != null) {
- propertyDomainEventType = property.domainEvent();
- propertyInteractionFacet = new PropertyInteractionFacetForPropertyAnnotation(
- propertyDomainEventType, getterFacet, servicesInjector, getSpecificationLoader(), holder);
-
- } else if(propertyInteraction != null) {
- propertyDomainEventType = propertyInteraction.value();
- propertyInteractionFacet = new PropertyInteractionFacetAnnotation(
- propertyDomainEventType, getterFacet, servicesInjector, getSpecificationLoader(), holder);
- } else {
- propertyDomainEventType = PropertyDomainEvent.Default.class;
- propertyInteractionFacet = new PropertyInteractionFacetDefault(
- propertyDomainEventType, getterFacet, servicesInjector, getSpecificationLoader(), holder);
- }
- FacetUtil.addFacet(propertyInteractionFacet);
-
-
- //
- // if the property is mutable, then replace the existing setter and clear facets with equivalents that
- // also post to the event bus.
- //
- // here we support the deprecated annotations
- //
-
-
- 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 PropertySetterFacetForInteractionAbstract replacementFacet;
- if(propertyInteraction != null) {
- replacementFacet = new PropertySetterFacetForPropertyInteractionAnnotation(
- propertyDomainEventType, getterFacet, setterFacet, propertyInteractionFacet, holder, servicesInjector);
- } else if(postsPropertyChangedEvent != null) {
- replacementFacet = new PropertySetterFacetForPostsPropertyChangedEventAnnotation(
- postsPropertyChangedEvent.value(), getterFacet, setterFacet, propertyInteractionFacet, holder, servicesInjector);
- } else {
- replacementFacet = new PropertySetterFacetForPropertyInteractionDefault(
- PropertyDomainEvent.Default.class, getterFacet, setterFacet, propertyInteractionFacet, 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 PropertyClearFacetForInteractionAbstract replacementFacet;
- if(propertyInteraction != null) {
- replacementFacet = new PropertyClearFacetForPropertyInteractionAnnotation(
- propertyDomainEventType, getterFacet, clearFacet, propertyInteractionFacet, holder, servicesInjector);
- } else if(postsPropertyChangedEvent != null) {
- replacementFacet = new PropertyClearFacetForPostsPropertyChangedEventAnnotation(
- postsPropertyChangedEvent.value(), getterFacet, clearFacet, propertyInteractionFacet, holder, servicesInjector);
- } else {
- replacementFacet = new PropertyClearFacetForPropertyInteractionDefault(
- PropertyDomainEvent.Default.class, getterFacet, clearFacet, propertyInteractionFacet, holder, servicesInjector);
- }
- FacetUtil.addFacet(replacementFacet);
- }
- }
-
- // //////////////////////////////////////
-
- @Override
- public void refineMetaModelValidator(MetaModelValidatorComposite metaModelValidator, IsisConfiguration configuration) {
- metaModelValidator.add(new MetaModelValidatorVisiting(newValidatorVisitor()));
- }
-
- protected Visitor newValidatorVisitor() {
- return new MetaModelValidatorVisiting.Visitor() {
-
- @Override
- public boolean visit(ObjectSpecification objectSpec, ValidationFailures validationFailures) {
- List<OneToManyAssociation> objectCollections = objectSpec.getCollections(Contributed.EXCLUDED);
- for (OneToManyAssociation objectCollection : objectCollections) {
- final SortedByFacet facet = objectCollection.getFacet(SortedByFacet.class);
- if(facet != null) {
- final Class<? extends Comparator<?>> cls = facet.value();
- if(!Comparator.class.isAssignableFrom(cls)) {
- validationFailures.add("%s#%s is annotated with @SortedBy, but the class specified '%s' is not a Comparator", objectSpec.getIdentifier().getClassName(), objectCollection.getId(), facet.value().getName());
- }
- }
- }
- return true;
- }
- };
- }
-
- // //////////////////////////////////////
-
- @Override
- public void setServicesInjector(ServicesInjector servicesInjector) {
- this.servicesInjector = servicesInjector;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForInteractionAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForInteractionAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForInteractionAbstract.java
deleted file mode 100644
index 74cc0d5..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForInteractionAbstract.java
+++ /dev/null
@@ -1,112 +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.interaction;
-
-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 PropertySetterFacetForInteractionAbstract
- 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 PropertyInteractionFacetAbstract propertyDomainEventFacet;
-
- public PropertySetterFacetForInteractionAbstract(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertySetterFacet setterFacet,
- final PropertyInteractionFacetAbstract 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/interaction/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java
deleted file mode 100644
index df33d5c..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPostsPropertyChangedEventAnnotation.java
+++ /dev/null
@@ -1,47 +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.interaction;
-
-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 PropertySetterFacetForPostsPropertyChangedEventAnnotation
- extends PropertySetterFacetForInteractionAbstract {
-
-
- public PropertySetterFacetForPostsPropertyChangedEventAnnotation(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertySetterFacet setterFacet,
- final PropertyInteractionFacetAbstract 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/interaction/PropertySetterFacetForPropertyInteractionAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPropertyInteractionAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPropertyInteractionAnnotation.java
deleted file mode 100644
index 9adb8f1..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPropertyInteractionAnnotation.java
+++ /dev/null
@@ -1,40 +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.interaction;
-
-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 PropertySetterFacetForPropertyInteractionAnnotation
- extends PropertySetterFacetForInteractionAbstract {
-
-
- public PropertySetterFacetForPropertyInteractionAnnotation(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertySetterFacet setterFacet,
- final PropertyInteractionFacetAbstract 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/interaction/PropertySetterFacetForPropertyInteractionDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPropertyInteractionDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPropertyInteractionDefault.java
deleted file mode 100644
index badc292..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/PropertySetterFacetForPropertyInteractionDefault.java
+++ /dev/null
@@ -1,40 +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.interaction;
-
-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 PropertySetterFacetForPropertyInteractionDefault
- extends PropertySetterFacetForInteractionAbstract {
-
-
- public PropertySetterFacetForPropertyInteractionDefault(
- final Class<? extends PropertyDomainEvent<?, ?>> eventType,
- final PropertyOrCollectionAccessorFacet getterFacet,
- final PropertySetterFacet setterFacet,
- final PropertyInteractionFacetAbstract 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/interaction/Utils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/Utils.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/Utils.java
deleted file mode 100644
index b039cac..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/interaction/Utils.java
+++ /dev/null
@@ -1,23 +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.interaction;
-
-class Utils {
- private Utils(){}
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/6de787ad/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.java
deleted file mode 100644
index ae2000b..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/DisabledFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,62 +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.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/HiddenFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/HiddenFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/HiddenFacetForPropertyAnnotation.java
deleted file mode 100644
index f78da2d..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/HiddenFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,58 +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.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/MandatoryFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MandatoryFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MandatoryFacetForPropertyAnnotation.java
deleted file mode 100644
index f36a871..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MandatoryFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,81 +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.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);
- }
-
- 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/MaxLengthFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MaxLengthFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MaxLengthFacetForPropertyAnnotation.java
deleted file mode 100644
index fbe29f5..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MaxLengthFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,46 +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.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/MustSatisfySpecificationFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MustSatisfySpecificationFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MustSatisfySpecificationFacetForPropertyAnnotation.java
deleted file mode 100644
index 374d302..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/MustSatisfySpecificationFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,56 +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.List;
-import com.google.common.collect.Lists;
-import org.apache.isis.applib.annotation.Property;
-import org.apache.isis.applib.spec.Specification;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.propparam.mustsatisfyspec.MustSatisfySpecificationFacetAbstract;
-
-public class MustSatisfySpecificationFacetForPropertyAnnotation extends MustSatisfySpecificationFacetAbstract {
-
- static Facet create(
- final Property property,
- final FacetHolder holder) {
-
- if (property == null) {
- return null;
- }
-
- final Class<?>[] values = property.mustSatisfy();
- final List<Specification> specifications = Lists.newArrayList();
- for (final Class<?> value : values) {
- final Specification specification = newSpecificationElseNull(value);
- if (specification != null) {
- specifications.add(specification);
- }
- }
- return specifications.size() > 0 ? new MustSatisfySpecificationFacetForPropertyAnnotation(specifications, holder) : null;
- }
-
-
- private MustSatisfySpecificationFacetForPropertyAnnotation(final List<Specification> specifications, final FacetHolder holder) {
- super(specifications, 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/NotPersistedFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/NotPersistedFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/NotPersistedFacetForPropertyAnnotation.java
deleted file mode 100644
index 011a0c6..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/NotPersistedFacetForPropertyAnnotation.java
+++ /dev/null
@@ -1,48 +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.annotation.Property;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacet;
-import org.apache.isis.core.metamodel.facets.propcoll.notpersisted.NotPersistedFacetAbstract;
-
-public class NotPersistedFacetForPropertyAnnotation extends NotPersistedFacetAbstract {
-
- public NotPersistedFacetForPropertyAnnotation(final FacetHolder holder) {
- super(holder);
- }
-
- static NotPersistedFacet create(
- final Property property,
- final FacetHolder holder) {
-
- if (property == null) {
- return null;
- }
-
- final boolean notPersisted = property.notPersisted();
- final boolean persisted = !notPersisted;
- if(persisted) {
- return null;
- }
- return new NotPersistedFacetForPropertyAnnotation(holder);
- }
-}