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/20 07:48:54 UTC

[38/38] isis git commit: ISIS-970: working on ViewModelFacet, renamed to RecreatableObjectFacet (to support the generalization of this concept for domain objects with nature=EXTERNAL_ENTITY etc)

ISIS-970: working on ViewModelFacet, renamed to RecreatableObjectFacet  (to support the generalization of this concept for domain objects with nature=EXTERNAL_ENTITY etc)

Specifically:
- renamed ViewModelFacet to RecreatableObjectFacet, along with immediate subclasses
- introduced new RecreatableDomainObject interface in applib, equivalent to the ViewModel interface
- unified the two ViewModelXxxFacetFactory into one for two styles of facets for @ViewModel and ViewModel iface, extended to create facet for RecreatableDomainObject iface (called RecreatableObjectFacetFactory)
- added metamodel validator logic in RecreatableObjectFacetFactory such that cannot have two contradictory implementations of the RecreatableObjectFacet installed on an object spec
- update DomainObjectAnnotationFacetFactory to handle nature

Also:
- added the @ViewModelLayout as a clone of @DomainObjectLayout
- extended the Nature enum to include "NOT_SPECIFIED" and "INMEMORY_ENTITY"


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/cc3c5431
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/cc3c5431
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/cc3c5431

Branch: refs/heads/ISIS-970
Commit: cc3c5431a37630e1100649549935963f13c45e0e
Parents: 9124c99
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Jan 15 07:52:14 2015 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Jan 19 08:34:09 2015 +0000

----------------------------------------------------------------------
 .../viewer/wicket/model/models/EntityModel.java |  12 +-
 .../isis/applib/RecreatableDomainObject.java    |  57 +++++++
 .../java/org/apache/isis/applib/ViewModel.java  |   6 +-
 .../isis/applib/annotation/DomainObject.java    |   4 +-
 .../apache/isis/applib/annotation/Nature.java   |  20 +++
 .../isis/applib/annotation/ViewModel.java       |   4 -
 .../isis/applib/annotation/ViewModelLayout.java | 102 ++++++++++++
 .../applib/services/command/CommandDefault.java |   4 +-
 .../metamodel/adapter/mgr/AdapterManager.java   |   4 +-
 .../MethodPrefixBasedFacetFactoryAbstract.java  |  12 +-
 ...onInvocationFacetForInteractionAbstract.java |   4 +-
 .../DomainObjectAnnotationFacetFactory.java     |   6 +-
 ...bleObjectFacetForDomainObjectAnnotation.java |  71 +++++++++
 ...ViewModelFacetForDomainObjectAnnotation.java |  59 -------
 ...nCollectionDerivedFromRecreatableObject.java |  41 +++++
 ...erivedFromRecreatableObjectFacetFactory.java |  48 ++++++
 ...tOnPropertyDerivedFromRecreatableObject.java |  41 +++++
 ...erivedFromRecreatableObjectFacetFactory.java |  48 ++++++
 .../recreatable/RecreatableObjectFacet.java     |  43 ++++++
 .../RecreatableObjectFacetAbstract.java         |  49 ++++++
 ...creatableObjectFacetDeclarativeAbstract.java | 154 +++++++++++++++++++
 .../RecreatableObjectFacetFactory.java          | 116 ++++++++++++++
 ...acetForRecreatableDomainObjectInterface.java |  43 ++++++
 ...atableObjectFacetForViewModelAnnotation.java |  37 +++++
 ...eatableObjectFacetForViewModelInterface.java |  43 ++++++
 ...edFacetOnCollectionDerivedFromViewModel.java |  41 -----
 ...lectionDerivedFromViewModelFacetFactory.java |  48 ------
 ...bledFacetOnPropertyDerivedFromViewModel.java |  41 -----
 ...ropertyDerivedFromViewModelFacetFactory.java |  48 ------
 .../facets/object/viewmodel/ViewModelFacet.java |  43 ------
 .../viewmodel/ViewModelFacetAbstract.java       |  49 ------
 .../ViewModelFacetDeclarativeAbstract.java      | 154 -------------------
 .../annotation/ViewModelFacetAnnotation.java    |  38 -----
 .../ViewModelFacetAnnotationFactory.java        |  62 --------
 .../iface/ViewModelFacetInterface.java          |  44 ------
 .../iface/ViewModelFacetInterfaceFactory.java   |  45 ------
 .../container/DomainObjectContainerDefault.java |   4 +-
 .../dflt/ObjectSpecificationDefault.java        |   6 +-
 .../dflt/ProgrammingModelFacetsJava5.java       |  14 +-
 .../RecreatableObjectFacetFactoryTest.java      |  67 ++++++++
 .../ViewModelInteraceFacetFactoryTest.java      |  69 ---------
 .../adaptermanager/PojoRecreatorDefault.java    |   6 +-
 .../IdentifierGeneratorForDataNucleus.java      |  14 +-
 .../system/persistence/OidGenerator.java        |   6 +-
 .../system/persistence/PersistenceSession.java  |   4 +-
 .../restfulobjects/server/util/OidUtils.java    |   4 +-
 46 files changed, 1036 insertions(+), 799 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index e293e9b..cd0fb5d 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -35,7 +35,7 @@ import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.consent.Consent;
 import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
 import org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacet;
-import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
+import org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.ObjectSpecifications.MemberGroupLayoutHint;
@@ -493,7 +493,7 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> {
     /**
      * Apply changes to the underlying adapter (possibly returning a new adapter).
      *
-     * @return adapter, which may be different from the original (if a {@link org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet#isCloneable(Object) cloneable} view model, for example.
+     * @return adapter, which may be different from the original (if a {@link org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacet#isCloneable(Object) cloneable} view model, for example.
      */
     public ObjectAdapter apply() {
         ObjectAdapter adapter = getObjectAdapterMemento().getObjectAdapter(ConcurrencyChecking.CHECK);
@@ -530,12 +530,12 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> {
             property.set(adapter, associate);
         }
 
-        final ViewModelFacet viewModelFacet = adapter.getSpecification().getFacet(ViewModelFacet.class);
-        if(viewModelFacet != null) {
+        final RecreatableObjectFacet recreatableObjectFacet = adapter.getSpecification().getFacet(RecreatableObjectFacet.class);
+        if(recreatableObjectFacet != null) {
             final Object viewModel = adapter.getObject();
-            final boolean cloneable = viewModelFacet.isCloneable(viewModel);
+            final boolean cloneable = recreatableObjectFacet.isCloneable(viewModel);
             if(cloneable) {
-                final Object newViewModel = viewModelFacet.clone(viewModel);
+                final Object newViewModel = recreatableObjectFacet.clone(viewModel);
                 adapter = getAdapterManager().adapterFor(newViewModel);
             }
         }

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/applib/src/main/java/org/apache/isis/applib/RecreatableDomainObject.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/RecreatableDomainObject.java b/core/applib/src/main/java/org/apache/isis/applib/RecreatableDomainObject.java
new file mode 100644
index 0000000..6663f36
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/RecreatableDomainObject.java
@@ -0,0 +1,57 @@
+/*
+ *  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.applib;
+
+import org.apache.isis.applib.annotation.Hidden;
+
+
+/**
+ * Indicates that the domain object can be recreated from a string.
+ *
+ *
+ * <p>
+ *      Objects that are view models (logically belonging to the UI/application layer) should instead implement
+ *      {@link org.apache.isis.applib.ViewModel}.
+ * </p>
+
+ */
+public interface RecreatableDomainObject {
+
+    /**
+     * Obtain a memento of the recreatable object.
+     *
+     * <p>
+     * Typically this will be the identifier of a backing domain entity, but it could also be an arbitrary string,
+     * for example a bunch of JSON.
+     * 
+     * <p>
+     * This method is called by the framework in order that the view model may be recreated subsequently
+     * through {@link #__isis_recreate(String)}.
+     */
+    @Hidden
+    public String __isis_memento();
+    
+    /**
+     * Used to recreate a recreatable object with a memento obtained from {@link #__isis_recreate(String)}.
+     */
+    @Hidden
+    public void __isis_recreate(String memento);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/applib/src/main/java/org/apache/isis/applib/ViewModel.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/ViewModel.java b/core/applib/src/main/java/org/apache/isis/applib/ViewModel.java
index 15e7e70..01630eb 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/ViewModel.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/ViewModel.java
@@ -23,7 +23,11 @@ import org.apache.isis.applib.annotation.Hidden;
 
 
 /**
- * Indicates that a domain object is intended to be used as a view model.
+ * Indicates that an object belongs to the UI/application layer, and is intended to be used as a view model.
+ *
+ * <p>
+ *     Objects that are part of the domain object layer should instead implement {@link RecreatableDomainObject}.
+ * </p>
  */
 public interface ViewModel {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
index 83c4ce2..2cf0cc2 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/DomainObject.java
@@ -33,7 +33,7 @@ import java.lang.annotation.Target;
 public @interface DomainObject {
 
     /**
-     * Whether the entity should be audited (note: does not apply to {@link #viewModel() view model}s.
+     * Whether the entity should be audited (note: does not apply to view models or other recreatable objects.
      *
      * <p>
      * Requires that an implementation of the {@link org.apache.isis.applib.services.audit.AuditingService3} is
@@ -135,6 +135,6 @@ public @interface DomainObject {
     /**
      * The nature of this domain object.
      */
-    Nature nature() default Nature.JDO_ENTITY;
+    Nature nature() default Nature.NOT_SPECIFIED;
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/applib/src/main/java/org/apache/isis/applib/annotation/Nature.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Nature.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Nature.java
index 42c8d8b..ac36b36 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Nature.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Nature.java
@@ -27,6 +27,12 @@ package org.apache.isis.applib.annotation;
  * </p>
  */
 public enum Nature {
+
+    /**
+     * The default.
+     */
+    NOT_SPECIFIED,
+
     /**
      * A domain entity whose persistence is managed internally by Isis, using JDO as the persistence implementation.
      * Domain entities are considered to be part of the domain model layer.
@@ -34,6 +40,10 @@ public enum Nature {
      * <p>
      *     Domain entities are considered to be part of the domain model layer.
      * </p>
+     *
+     * <p>
+     *    Currently implies no additional semantics other than documentation.
+     * </p>
      */
     JDO_ENTITY,
     /**
@@ -47,6 +57,16 @@ public enum Nature {
      */
     EXTERNAL_ENTITY,
     /**
+     * A domain entity that is a wrapper/proxy/stub to a &quot;synthetic&quot; entity, for example one that is
+     * constructed from some sort of internal memory data structure.
+     *
+     * <p>
+     *     As for a {@link #EXTERNAL_ENTITY}, the identity of a synthetic entity is determined solely by the state of
+     *     entity's properties (that have not been set to be ignored using {@link org.apache.isis.applib.annotation.Property#notPersisted()}).
+     * </p>
+     */
+    INMEMORY_ENTITY,
+    /**
      * An object that is conceptually part of the application layer, and which surfaces behaviour and/or state that
      * is aggregate of one or more domain entity.
      *

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModel.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModel.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModel.java
index 388bf56..6b18150 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModel.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModel.java
@@ -21,10 +21,6 @@ package org.apache.isis.applib.annotation;
 
 import java.lang.annotation.*;
 
-/**
- * @deprecated - use {@link DomainObject#viewModel()} instead.
- */
-@Deprecated
 @Inherited
 @Target({ ElementType.TYPE })
 @Retention(RetentionPolicy.RUNTIME)

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModelLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModelLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModelLayout.java
new file mode 100644
index 0000000..df60382
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/ViewModelLayout.java
@@ -0,0 +1,102 @@
+/*
+ *  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.applib.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Layout hints for view models.
+ *
+ * <p>
+ *     This is intended for use with UI/application-layer view models that are specified as such through either
+ *     the {@link org.apache.isis.applib.annotation.ViewModel} annotation or by implementing the
+ *     {@link org.apache.isis.applib.ViewModel} interface.
+ * </p>
+ *
+ * <p>
+ *      Note that the attributes are the same as {@link org.apache.isis.applib.annotation.DomainObjectLayout}; it
+ *      captures the same information.  This annotation is provided for symmetry; most view models will be annotated
+ *      with just <tt>@ViewModel</tt> and <tt>@ViewModelLayout</tt>.
+ * </p>
+ */
+@Inherited
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ViewModelLayout {
+
+
+    /**
+     * Indicates the css class that a domain class (type) should have.
+     */
+    String cssClass() default "";
+
+
+    // //////////////////////////////////////
+
+    /**
+     * Description of this class, eg to be rendered in a tooltip.
+     */
+    String describedAs() default "";
+
+
+    // //////////////////////////////////////
+
+    /**
+     * Name of this class (overriding the name derived from its name in code).
+     */
+    String named() default "";
+
+
+    // //////////////////////////////////////
+
+    /**
+     * The page size for instances of this class when rendered within
+     * a table.
+     *
+     * <p>
+     * If annotated on a collection, then the page size refers to
+     * parented collections (eg <tt>Order#lineItems</tt>).
+     *
+     * <p>
+     * If annotated on a type, then the page size refers to standalone
+     * collections (eg as returned from a repository query).
+     */
+    public int paged() default -1;
+
+
+    // //////////////////////////////////////
+
+    /**
+     * The plural name of the class.
+     */
+    String plural() default "";
+
+    // //////////////////////////////////////
+
+    /**
+     * Whether (and how) this domain object can be bookmarked in the UI.
+     */
+    BookmarkPolicy bookmarking() default BookmarkPolicy.NEVER;
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
index 357e780..ce0cdd4 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
@@ -196,7 +196,7 @@ public class CommandDefault implements Command2, Command3 {
     @Override
     public ActionInteractionEvent<?> peekActionInteractionEvent() {
         final ActionDomainEvent<?> actionDomainEvent = peekActionDomainEvent();
-        if (!(actionDomainEvent instanceof ActionInteractionEvent)) {
+        if (actionDomainEvent != null && !(actionDomainEvent instanceof ActionInteractionEvent)) {
             throw new IllegalStateException("Most recently pushed event was not an instance of ActionInteractionEvent; use either ActionDomainEvent or the (deprecated) ActionInteractionEvent consistently");
         }
         return (ActionInteractionEvent<?>) actionDomainEvent;
@@ -212,7 +212,7 @@ public class CommandDefault implements Command2, Command3 {
     @Override
     public ActionInteractionEvent popActionInteractionEvent() {
         final ActionDomainEvent<?> actionDomainEvent = popActionDomainEvent();
-        if (!(actionDomainEvent instanceof ActionInteractionEvent)) {
+        if (actionDomainEvent != null  && !(actionDomainEvent instanceof ActionInteractionEvent)) {
             throw new IllegalStateException("Most recently pushed event was not an instance of ActionInteractionEvent; use either ActionDomainEvent or the (deprecated) ActionInteractionEvent consistently");
         }
         return (ActionInteractionEvent<?>) actionDomainEvent;

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
index 8ebae19..50ba736 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
@@ -203,12 +203,12 @@ public interface AdapterManager extends Injectable {
 
 
     /**
-     * Enable viewModelFacetAnnotation to 'temporarily' map an existing pojo to an oid.
+     * Enable RecreatableObjectFacet to 'temporarily' map an existing pojo to an oid.
      */
     ObjectAdapter mapRecreatedPojo(Oid oid, Object recreatedPojo);
 
     /**
-     * Enable viewModelFacetAnnotation to remove a 'temporarily' mapped an adapter for a pojo.
+     * Enable RecreatableObjectFacet to remove a 'temporarily' mapped an adapter for a pojo.
      */
     void removeAdapter(ObjectAdapter adapter);
 

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java
index 676dcc2..1adf62e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/MethodPrefixBasedFacetFactoryAbstract.java
@@ -46,7 +46,7 @@ public abstract class MethodPrefixBasedFacetFactoryAbstract extends FacetFactory
         DONT_VALIDATE
     }
     
-    public MethodPrefixBasedFacetFactoryAbstract(final List<FeatureType> featureTypes, OrphanValidation orphanValidation, final String... prefixes) {
+    public MethodPrefixBasedFacetFactoryAbstract(final List<FeatureType> featureTypes, final OrphanValidation orphanValidation, final String... prefixes) {
         super(featureTypes);
         this.orphanValidation = orphanValidation;
         this.prefixes = Collections.unmodifiableList(Arrays.asList(prefixes));
@@ -58,17 +58,17 @@ public abstract class MethodPrefixBasedFacetFactoryAbstract extends FacetFactory
     }
 
     @Override
-    public void refineMetaModelValidator(MetaModelValidatorComposite metaModelValidator, IsisConfiguration configuration) {
+    public void refineMetaModelValidator(final MetaModelValidatorComposite metaModelValidator, final IsisConfiguration configuration) {
         if(orphanValidation == OrphanValidation.DONT_VALIDATE) {
             return;
         }
         metaModelValidator.add(new MetaModelValidatorVisiting(new MetaModelValidatorVisiting.Visitor() {
 
             @Override
-            public boolean visit(ObjectSpecification objectSpec, ValidationFailures validationFailures) {
-                List<ObjectAction> objectActions = objectSpec.getObjectActions(Contributed.EXCLUDED);
-                for (ObjectAction objectAction : objectActions) {
-                    for (String prefix : prefixes) {
+            public boolean visit(final ObjectSpecification objectSpec, final ValidationFailures validationFailures) {
+                final List<ObjectAction> objectActions = objectSpec.getObjectActions(Contributed.EXCLUDED);
+                for (final ObjectAction objectAction : objectActions) {
+                    for (final String prefix : prefixes) {
                         final String actionId = objectAction.getId();
                         if (actionId.startsWith(prefix) && prefix.length() < actionId.length()) {
                             validationFailures.add("Method '%s#%s' has prefix %s, is probably a supporting method for a property, collection or action.  If the method is intended to be an action, then rename and use @ActionLayout(named=\"...\") or ignore completely using @Programmatic", objectSpec.getIdentifier().getClassName(), actionId, prefix);

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForInteractionAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForInteractionAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForInteractionAbstract.java
index 1fdcf19..7fcc32e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForInteractionAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForInteractionAbstract.java
@@ -52,7 +52,7 @@ import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
 import org.apache.isis.core.metamodel.facets.actions.bulk.BulkFacet;
 import org.apache.isis.core.metamodel.facets.actions.command.CommandFacet;
 import org.apache.isis.core.metamodel.facets.actions.publish.PublishedActionFacet;
-import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
+import org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacet;
 import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
 import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -358,7 +358,7 @@ public abstract class ActionInvocationFacetForInteractionAbstract
                 resultAdapter.setElementSpecificationProvider(ElementSpecificationProviderFromTypeOfFacet.createFrom(typeOfFacet));
 
                 if(command != null) {
-                    if(!resultAdapter.getSpecification().containsDoOpFacet(ViewModelFacet.class)) {
+                    if(!resultAdapter.getSpecification().containsDoOpFacet(RecreatableObjectFacet.class)) {
                         final Bookmark bookmark = CommandUtil.bookmarkFor(resultAdapter);
                         command.setResult(bookmark);
                     }

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
index 18a37d3..e583b9b 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
@@ -63,7 +63,7 @@ public class DomainObjectAnnotationFacetFactory extends FacetFactoryAbstract imp
         processBounded(processClassContext);
         processEditing(processClassContext);
         processObjectType(processClassContext);
-        processViewModel(processClassContext);
+        processNature(processClassContext);
     }
 
     private void processAuditing(final ProcessClassContext processClassContext) {
@@ -163,13 +163,13 @@ public class DomainObjectAnnotationFacetFactory extends FacetFactoryAbstract imp
                 ObjectSpecIdFacetForDomainObjectAnnotation.create(domainObject, facetHolder));
     }
 
-    private void processViewModel(final ProcessClassContext processClassContext) {
+    private void processNature(final ProcessClassContext processClassContext) {
         final Class<?> cls = processClassContext.getCls();
         final DomainObject domainObject = Annotations.getAnnotation(cls, DomainObject.class);
         final FacetHolder facetHolder = processClassContext.getFacetHolder();
 
         FacetUtil.addFacet(
-                ViewModelFacetForDomainObjectAnnotation.create(
+                RecreatableObjectFacetForDomainObjectAnnotation.create(
                         domainObject, getSpecificationLoader(), adapterManager, servicesInjector, facetHolder));
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/RecreatableObjectFacetForDomainObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/RecreatableObjectFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/RecreatableObjectFacetForDomainObjectAnnotation.java
new file mode 100644
index 0000000..3d37944
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/RecreatableObjectFacetForDomainObjectAnnotation.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.object.domainobject;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Nature;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacet;
+import org.apache.isis.core.metamodel.facets.object.recreatable.RecreatableObjectFacetDeclarativeAbstract;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class RecreatableObjectFacetForDomainObjectAnnotation extends RecreatableObjectFacetDeclarativeAbstract {
+
+    public static RecreatableObjectFacet create(
+            final DomainObject domainObject,
+            final SpecificationLoader specificationLoader,
+            final AdapterManager adapterManager,
+            final ServicesInjector servicesInjector,
+            final FacetHolder holder) {
+
+        if(domainObject == null) {
+            return null;
+        }
+
+        final Nature nature = domainObject.nature();
+
+        if(nature == null || nature == Nature.JDO_ENTITY) {
+            return null;
+        }
+        switch (nature)
+        {
+            case NOT_SPECIFIED:
+            case JDO_ENTITY:
+                return null;
+            case VIEW_MODEL:
+            case EXTERNAL_ENTITY:
+            case INMEMORY_ENTITY:
+                return new RecreatableObjectFacetForDomainObjectAnnotation(holder, specificationLoader, adapterManager, servicesInjector);
+        }
+        // shouldn't happen, the above switch should match all cases.
+        throw new IllegalArgumentException("nature of '" + nature + "' not recognized");
+    }
+
+    private RecreatableObjectFacetForDomainObjectAnnotation(
+            final FacetHolder holder,
+            final SpecificationLoader specificationLoader,
+            final AdapterManager adapterManager,
+            final ServicesInjector servicesInjector) {
+        super(holder, specificationLoader, adapterManager, servicesInjector);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/ViewModelFacetForDomainObjectAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/ViewModelFacetForDomainObjectAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/ViewModelFacetForDomainObjectAnnotation.java
deleted file mode 100644
index 3f1f6bf..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/ViewModelFacetForDomainObjectAnnotation.java
+++ /dev/null
@@ -1,59 +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.object.domainobject;
-
-import org.apache.isis.applib.annotation.DomainObject;
-import org.apache.isis.applib.annotation.Nature;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
-import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacetDeclarativeAbstract;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-
-public class ViewModelFacetForDomainObjectAnnotation extends ViewModelFacetDeclarativeAbstract {
-
-    public static ViewModelFacet create(
-            final DomainObject domainObject,
-            final SpecificationLoader specificationLoader,
-            final AdapterManager adapterManager,
-            final ServicesInjector servicesInjector,
-            final FacetHolder holder) {
-
-        if(domainObject == null) {
-            return null;
-        }
-
-        final Nature nature = domainObject.nature();
-        if(nature == null || nature == Nature.JDO_ENTITY) {
-            return null;
-        }
-        return new ViewModelFacetForDomainObjectAnnotation(holder, specificationLoader, adapterManager, servicesInjector);
-    }
-
-    private ViewModelFacetForDomainObjectAnnotation(
-            final FacetHolder holder,
-            final SpecificationLoader specificationLoader,
-            final AdapterManager adapterManager,
-            final ServicesInjector servicesInjector) {
-        super(holder, specificationLoader, adapterManager, servicesInjector);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObject.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObject.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObject.java
new file mode 100644
index 0000000..9db0ba4
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObject.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.recreatable;
+
+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.members.disabled.DisabledFacetAbstract;
+
+public class DisabledFacetOnCollectionDerivedFromRecreatableObject extends DisabledFacetAbstract {
+
+    public DisabledFacetOnCollectionDerivedFromRecreatableObject(final FacetHolder holder) {
+        super(When.ALWAYS, Where.ANYWHERE, holder);
+    }
+
+    @Override
+    public String disabledReason(final ObjectAdapter target) {
+        final RecreatableObjectFacet facet = target.getSpecification().getFacet(RecreatableObjectFacet.class);
+        final boolean cloneable = facet.isCloneable(target.getObject());
+        return !cloneable ? "Non-cloneable view models are read-only" : null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObjectFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObjectFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObjectFacetFactory.java
new file mode 100644
index 0000000..a6223f9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnCollectionDerivedFromRecreatableObjectFacetFactory.java
@@ -0,0 +1,48 @@
+/*
+ *  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.object.recreatable;
+
+import java.lang.reflect.Method;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class DisabledFacetOnCollectionDerivedFromRecreatableObjectFacetFactory extends FacetFactoryAbstract {
+
+    public DisabledFacetOnCollectionDerivedFromRecreatableObjectFacetFactory() {
+        super(FeatureType.COLLECTIONS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Class<?> declaringClass = method.getDeclaringClass();
+        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(declaringClass);
+
+        if (!spec.containsDoOpFacet(RecreatableObjectFacet.class)) {
+            return;
+        }
+        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new DisabledFacetOnCollectionDerivedFromRecreatableObject(facetHolder));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObject.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObject.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObject.java
new file mode 100644
index 0000000..1dd8ae6
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObject.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.recreatable;
+
+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.members.disabled.DisabledFacetAbstract;
+
+public class DisabledFacetOnPropertyDerivedFromRecreatableObject extends DisabledFacetAbstract {
+
+    public DisabledFacetOnPropertyDerivedFromRecreatableObject(final FacetHolder holder) {
+        super(When.ALWAYS, Where.ANYWHERE, holder);
+    }
+
+    @Override
+    public String disabledReason(final ObjectAdapter target) {
+        final RecreatableObjectFacet facet = target.getSpecification().getFacet(RecreatableObjectFacet.class);
+        final boolean cloneable = facet.isCloneable(target.getObject());
+        return !cloneable ? "Non-cloneable view models are read-only" : null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObjectFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObjectFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObjectFacetFactory.java
new file mode 100644
index 0000000..0525faa
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/DisabledFacetOnPropertyDerivedFromRecreatableObjectFacetFactory.java
@@ -0,0 +1,48 @@
+/*
+ *  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.object.recreatable;
+
+import java.lang.reflect.Method;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class DisabledFacetOnPropertyDerivedFromRecreatableObjectFacetFactory extends FacetFactoryAbstract {
+
+    public DisabledFacetOnPropertyDerivedFromRecreatableObjectFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final Class<?> declaringClass = method.getDeclaringClass();
+        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(declaringClass);
+
+        if (!spec.containsDoOpFacet(RecreatableObjectFacet.class)) {
+            return;
+        }
+        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new DisabledFacetOnPropertyDerivedFromRecreatableObject(facetHolder));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacet.java
new file mode 100644
index 0000000..10c5834
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacet.java
@@ -0,0 +1,43 @@
+/*
+ *  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.object.recreatable;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+/**
+ * Indicates that this class is either a view model (for the UI/application layer) or a recreatable domain object of some sort (for the domain layer, that is: an external or synthetic entity).
+ * 
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to
+ * applying either {@link org.apache.isis.applib.annotation.ViewModel} annotation or {@link org.apache.isis.applib.ViewModel} interface (for a view model), or by annotating
+ */
+public interface RecreatableObjectFacet extends Facet {
+
+    void initialize(Object pojo, String memento);
+
+    String memento(Object pojo);
+
+    /**
+     * Whether {@link #clone(Object)} can be called.
+     */
+    boolean isCloneable(Object pojo);
+
+    Object clone(Object pojo);
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java
new file mode 100644
index 0000000..007283e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetAbstract.java
@@ -0,0 +1,49 @@
+/*
+ *  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.object.recreatable;
+
+import org.apache.isis.applib.ViewModel;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.MarkerFacetAbstract;
+
+public abstract class RecreatableObjectFacetAbstract extends MarkerFacetAbstract implements RecreatableObjectFacet {
+
+    public static Class<? extends Facet> type() {
+        return RecreatableObjectFacet.class;
+    }
+
+    public RecreatableObjectFacetAbstract(final FacetHolder holder) {
+        super(type(), holder);
+    }
+
+    @Override
+    public boolean isCloneable(Object pojo) {
+        return pojo != null && pojo instanceof ViewModel.Cloneable;
+    }
+
+    @Override
+    public Object clone(Object pojo) {
+        ViewModel.Cloneable viewModelCloneable = (ViewModel.Cloneable) pojo;
+        return viewModelCloneable.clone();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java
new file mode 100644
index 0000000..a51df9d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetDeclarativeAbstract.java
@@ -0,0 +1,154 @@
+/*
+ *  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.object.recreatable;
+
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.services.memento.MementoService;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+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.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+
+public abstract class RecreatableObjectFacetDeclarativeAbstract extends RecreatableObjectFacetAbstract {
+
+    private final SpecificationLoader specificationLoader;
+    private final ServicesInjector servicesInjector;
+    private final AdapterManager adapterManager;
+
+    public RecreatableObjectFacetDeclarativeAbstract(
+            final FacetHolder holder,
+            final SpecificationLoader specificationLoader,
+            final AdapterManager adapterManager,
+            final ServicesInjector servicesInjector) {
+        super(holder);
+        this.specificationLoader = specificationLoader;
+        this.servicesInjector = servicesInjector;
+        this.adapterManager = adapterManager;
+    }
+
+    @Override
+    public void initialize(Object viewModelPojo, String mementoStr) {
+
+        final MementoService mementoService = servicesInjector.lookupService(MementoService.class);
+        final BookmarkService bookmarkService = servicesInjector.lookupService(BookmarkService.class);
+
+        final MementoService.Memento memento = mementoService.parse(mementoStr);
+
+        final Set<String> mementoKeys = memento.keySet();
+
+        // manually recreate the adapter in order to be able to query state via the metamodel
+        ObjectAdapter viewModelAdapter = adapterManager.getAdapterFor(viewModelPojo);
+        if(viewModelAdapter == null) {
+            final ObjectSpecification objectSpecification = specificationLoader.loadSpecification(viewModelPojo.getClass());
+            final ObjectSpecId objectSpecId = objectSpecification.getSpecId();
+            viewModelAdapter = adapterManager.mapRecreatedPojo(new RootOidDefault(objectSpecId, mementoStr, Oid.State.VIEWMODEL), viewModelPojo);
+        }
+
+        final ObjectSpecification spec = viewModelAdapter.getSpecification();
+        final List<OneToOneAssociation> properties = spec.getProperties(Contributed.EXCLUDED);
+        for (OneToOneAssociation property : properties) {
+            final String propertyId = property.getId();
+
+            Object propertyValue = null;
+
+            if(mementoKeys.contains(propertyId)) {
+                final Class<?> propertyType = property.getSpecification().getCorrespondingClass();
+                propertyValue = memento.get(propertyId, propertyType);
+            } else if(mementoKeys.contains(propertyId + ".bookmark")) {
+                final Bookmark propertyValueBookmark = memento.get(propertyId + ".bookmark", Bookmark.class);
+                propertyValue = bookmarkService.lookup(propertyValueBookmark);
+            }
+
+            if(propertyValue != null) {
+                property.set(viewModelAdapter, adapterManager.adapterFor(propertyValue));
+            }
+        }
+    }
+    
+    @Override
+    public String memento(Object viewModelPojo) {
+
+        final MementoService mementoService = servicesInjector.lookupService(MementoService.class);
+        final BookmarkService bookmarkService = servicesInjector.lookupService(BookmarkService.class);
+
+        final MementoService.Memento memento = mementoService.create();
+
+        // this is horrible, but there's a catch-22 here...
+        // we need an adapter in order to query the state of the object via the metamodel, on the other hand
+        // we can't create an adapter without the identifier, which is what we're trying to derive
+        // so... we create a temporary transient adapter, use it to wrap this adapter and interrogate this pojo,
+        // then throw away that adapter (remove from the adapter map)
+        boolean createdTemporaryAdapter = false;
+        ObjectAdapter viewModelAdapter = adapterManager.getAdapterFor(viewModelPojo);
+        if(viewModelAdapter == null) {
+            final ObjectSpecification objectSpecification = specificationLoader.loadSpecification(viewModelPojo.getClass());
+            final ObjectSpecId objectSpecId = objectSpecification.getSpecId();
+            viewModelAdapter = adapterManager.mapRecreatedPojo(RootOidDefault.create(objectSpecId, UUID.randomUUID().toString()), viewModelPojo);
+
+            createdTemporaryAdapter = true;
+        }
+
+        try {
+            final ObjectSpecification spec = viewModelAdapter.getSpecification();
+            final List<OneToOneAssociation> properties = spec.getProperties(Contributed.EXCLUDED);
+            for (OneToOneAssociation property : properties) {
+                // ignore read-only
+                if(!property.containsDoOpFacet(PropertySetterFacet.class)) {
+                    continue;
+                }
+                // ignore those explicitly annotated as @NotPersisted
+                if(property.isNotPersisted()) {
+                    continue;
+                }
+
+                // otherwise, include
+                final ObjectAdapter propertyValueAdapter = property.get(adapterManager.adapterFor(viewModelPojo));
+                if(propertyValueAdapter != null) {
+                    final Object propertyValue = propertyValueAdapter.getObject();
+                    if(mementoService.canSet(propertyValue)) {
+                        memento.set(property.getId(), propertyValue);
+                    } else {
+                        final Bookmark propertyValueBookmark = bookmarkService.bookmarkFor(propertyValue);
+                        memento.set(property.getId() + ".bookmark", propertyValueBookmark);
+                    }
+                }
+            }
+            return memento.asString();
+        } finally {
+            if(createdTemporaryAdapter) {
+                adapterManager.removeAdapter(viewModelAdapter);
+            }
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java
new file mode 100644
index 0000000..ef09a9e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetFactory.java
@@ -0,0 +1,116 @@
+/*
+ *  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.object.recreatable;
+
+import org.apache.isis.applib.RecreatableDomainObject;
+import org.apache.isis.applib.ViewModel;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facetapi.MetaModelValidatorRefiner;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+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.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorVisiting;
+import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
+
+public class RecreatableObjectFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware, AdapterManagerAware, MetaModelValidatorRefiner {
+
+    private ServicesInjector servicesInjector;
+    private AdapterManager adapterManager;
+
+    public RecreatableObjectFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    /**
+     * We simply attach all facets we can find; the {@link #refineMetaModelValidator(org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite, org.apache.isis.core.commons.config.IsisConfiguration) meta-model validation} will detect if multiple interfaces/annotations have
+     * been attached.
+     */
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+
+        // ViewModel interface
+        if (ViewModel.class.isAssignableFrom(processClassContext.getCls())) {
+            FacetUtil.addFacet(new RecreatableObjectFacetForViewModelInterface(processClassContext.getFacetHolder()));
+        }
+
+        // ViewModel annotation
+        final org.apache.isis.applib.annotation.ViewModel annotation = Annotations.getAnnotation(processClassContext.getCls(), org.apache.isis.applib.annotation.ViewModel.class);
+        FacetUtil.addFacet(create(annotation, processClassContext.getFacetHolder()));
+
+        // RecreatableDomainObject interface
+        if (RecreatableDomainObject.class.isAssignableFrom(processClassContext.getCls())) {
+            FacetUtil.addFacet(new RecreatableObjectFacetForRecreatableDomainObjectInterface(processClassContext.getFacetHolder()));
+        }
+
+        // DomainObject(nature=VIEW_MODEL) is managed by the DomainObjectFacetFactory
+    }
+
+    private RecreatableObjectFacet create(final org.apache.isis.applib.annotation.ViewModel annotation, final FacetHolder holder) {
+        return annotation != null ? new RecreatableObjectFacetForViewModelAnnotation(holder, getSpecificationLoader(), adapterManager, servicesInjector) : null;
+    }
+
+    // //////////////////////////////////////
+
+    @Override
+    public void refineMetaModelValidator(final MetaModelValidatorComposite metaModelValidator, final IsisConfiguration configuration) {
+        metaModelValidator.add(new MetaModelValidatorVisiting(new MetaModelValidatorVisiting.Visitor() {
+
+            @Override
+            public boolean visit(final ObjectSpecification objectSpec, final ValidationFailures validationFailures) {
+                final RecreatableObjectFacet facet = objectSpec.getFacet(RecreatableObjectFacet.class);
+                final Facet underlyingFacet = facet != null ? facet.getUnderlyingFacet() : null;
+                if(underlyingFacet != null) {
+                    validationFailures.add(
+                            "Class '%s' has multiple incompatible annotations/interfaces indicating that " +
+                                    "it is a recreatable object of some sort (%s and %s)",
+                            objectSpec.getFullIdentifier(),
+                            facet.getClass().getSimpleName(),
+                            underlyingFacet.getClass().getSimpleName());
+                }
+                return true;
+            }
+        }));
+    }
+
+
+    // //////////////////////////////////////
+
+
+
+    @Override
+    public void setServicesInjector(ServicesInjector servicesInjector) {
+        this.servicesInjector = servicesInjector;
+    }
+
+    @Override
+    public void setAdapterManager(AdapterManager adapterManager) {
+        this.adapterManager = adapterManager;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java
new file mode 100644
index 0000000..147e2ed
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForRecreatableDomainObjectInterface.java
@@ -0,0 +1,43 @@
+/*
+ *  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.object.recreatable;
+
+import org.apache.isis.applib.RecreatableDomainObject;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+public class RecreatableObjectFacetForRecreatableDomainObjectInterface extends RecreatableObjectFacetAbstract {
+
+    public RecreatableObjectFacetForRecreatableDomainObjectInterface(final FacetHolder holder) {
+        super(holder);
+    }
+
+    @Override
+    public void initialize(final Object pojo, final String memento) {
+        final RecreatableDomainObject viewModel = (RecreatableDomainObject)pojo;
+        viewModel.__isis_recreate(memento);
+    }
+    
+    @Override
+    public String memento(final Object pojo) {
+        final RecreatableDomainObject viewModel = (RecreatableDomainObject)pojo;
+        return viewModel.__isis_memento();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelAnnotation.java
new file mode 100644
index 0000000..d85718b
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelAnnotation.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.recreatable;
+
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class RecreatableObjectFacetForViewModelAnnotation extends RecreatableObjectFacetDeclarativeAbstract {
+
+    public RecreatableObjectFacetForViewModelAnnotation(
+            final FacetHolder holder,
+            final SpecificationLoader specificationLoader,
+            final AdapterManager adapterManager,
+            final ServicesInjector servicesInjector) {
+        super(holder, specificationLoader, adapterManager, servicesInjector);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelInterface.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelInterface.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelInterface.java
new file mode 100644
index 0000000..2c9ff3c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/recreatable/RecreatableObjectFacetForViewModelInterface.java
@@ -0,0 +1,43 @@
+/*
+ *  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.object.recreatable;
+
+import org.apache.isis.applib.ViewModel;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+public class RecreatableObjectFacetForViewModelInterface extends RecreatableObjectFacetAbstract {
+
+    public RecreatableObjectFacetForViewModelInterface(final FacetHolder holder) {
+        super(holder);
+    }
+
+    @Override
+    public void initialize(Object pojo, String memento) {
+        final ViewModel viewModel = (ViewModel)pojo;
+        viewModel.viewModelInit(memento);
+    }
+    
+    @Override
+    public String memento(Object pojo) {
+        final ViewModel viewModel = (ViewModel)pojo;
+        return viewModel.viewModelMemento();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModel.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModel.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModel.java
deleted file mode 100644
index 0c65e9d..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModel.java
+++ /dev/null
@@ -1,41 +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.object.viewmodel;
-
-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.members.disabled.DisabledFacetAbstract;
-
-public class DisabledFacetOnCollectionDerivedFromViewModel extends DisabledFacetAbstract {
-
-    public DisabledFacetOnCollectionDerivedFromViewModel(final FacetHolder holder) {
-        super(When.ALWAYS, Where.ANYWHERE, holder);
-    }
-
-    @Override
-    public String disabledReason(final ObjectAdapter target) {
-        final ViewModelFacet facet = target.getSpecification().getFacet(ViewModelFacet.class);
-        final boolean cloneable = facet.isCloneable(target.getObject());
-        return !cloneable ? "Non-cloneable view models are read-only" : null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModelFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModelFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModelFacetFactory.java
deleted file mode 100644
index 175e3ec..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnCollectionDerivedFromViewModelFacetFactory.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.object.viewmodel;
-
-import java.lang.reflect.Method;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.FacetedMethod;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public class DisabledFacetOnCollectionDerivedFromViewModelFacetFactory extends FacetFactoryAbstract {
-
-    public DisabledFacetOnCollectionDerivedFromViewModelFacetFactory() {
-        super(FeatureType.COLLECTIONS_ONLY);
-    }
-
-    @Override
-    public void process(final ProcessMethodContext processMethodContext) {
-        final Method method = processMethodContext.getMethod();
-        final Class<?> declaringClass = method.getDeclaringClass();
-        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(declaringClass);
-
-        if (!spec.containsDoOpFacet(ViewModelFacet.class)) {
-            return;
-        }
-        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
-        FacetUtil.addFacet(new DisabledFacetOnCollectionDerivedFromViewModel(facetHolder));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModel.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModel.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModel.java
deleted file mode 100644
index 0e2fcbe..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModel.java
+++ /dev/null
@@ -1,41 +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.object.viewmodel;
-
-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.members.disabled.DisabledFacetAbstract;
-
-public class DisabledFacetOnPropertyDerivedFromViewModel extends DisabledFacetAbstract {
-
-    public DisabledFacetOnPropertyDerivedFromViewModel(final FacetHolder holder) {
-        super(When.ALWAYS, Where.ANYWHERE, holder);
-    }
-
-    @Override
-    public String disabledReason(final ObjectAdapter target) {
-        final ViewModelFacet facet = target.getSpecification().getFacet(ViewModelFacet.class);
-        final boolean cloneable = facet.isCloneable(target.getObject());
-        return !cloneable ? "Non-cloneable view models are read-only" : null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModelFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModelFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModelFacetFactory.java
deleted file mode 100644
index 1020f01..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/DisabledFacetOnPropertyDerivedFromViewModelFacetFactory.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.object.viewmodel;
-
-import java.lang.reflect.Method;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.FacetedMethod;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public class DisabledFacetOnPropertyDerivedFromViewModelFacetFactory extends FacetFactoryAbstract {
-
-    public DisabledFacetOnPropertyDerivedFromViewModelFacetFactory() {
-        super(FeatureType.PROPERTIES_ONLY);
-    }
-
-    @Override
-    public void process(final ProcessMethodContext processMethodContext) {
-        final Method method = processMethodContext.getMethod();
-        final Class<?> declaringClass = method.getDeclaringClass();
-        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(declaringClass);
-
-        if (!spec.containsDoOpFacet(ViewModelFacet.class)) {
-            return;
-        }
-        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
-        FacetUtil.addFacet(new DisabledFacetOnPropertyDerivedFromViewModel(facetHolder));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/cc3c5431/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacet.java
deleted file mode 100644
index f923d84..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacet.java
+++ /dev/null
@@ -1,43 +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.object.viewmodel;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-
-/**
- * Indicates that this class is a view model.
- * 
- * <p>
- * In the standard Apache Isis Programming Model, typically corresponds to
- * applying the <tt>@ViewModel</tt> annotation at the class level.
- */
-public interface ViewModelFacet extends Facet {
-
-    void initialize(Object pojo, String memento);
-
-    String memento(Object pojo);
-
-    /**
-     * Whether {@link #clone(Object)} can be called.
-     */
-    boolean isCloneable(Object pojo);
-
-    Object clone(Object pojo);
-}