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:28 UTC

[12/38] isis git commit: ISIS-970: further tidy up and refinements to the new annotations and enums. First-cut (untested) implementation of @DomainObject facet factory.

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/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
new file mode 100644
index 0000000..ab2c649
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/ViewModelFacetForDomainObjectAnnotation.java
@@ -0,0 +1,54 @@
+/*
+ *  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.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) {
+
+        final boolean viewModel = domainObject.viewModel();
+        if(!viewModel) {
+            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/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/BookmarkPolicyFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/BookmarkPolicyFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/BookmarkPolicyFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..afa34a2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/BookmarkPolicyFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainobjectlayout;
+
+
+import org.apache.isis.applib.annotation.BookmarkPolicy;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacet;
+import org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacetAbstract;
+
+
+public class BookmarkPolicyFacetForDomainObjectLayoutAnnotation extends BookmarkPolicyFacetAbstract {
+
+    public static BookmarkPolicyFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+        if(domainObjectLayout == null) {
+            return null;
+        }
+        final BookmarkPolicy bookmarkPolicy = domainObjectLayout.bookmarking();
+        return bookmarkPolicy != BookmarkPolicy.NEVER ? new BookmarkPolicyFacetForDomainObjectLayoutAnnotation(bookmarkPolicy, holder) : null;
+    }
+
+    private BookmarkPolicyFacetForDomainObjectLayoutAnnotation(BookmarkPolicy bookmarkPolicy, FacetHolder holder) {
+        super(holder, bookmarkPolicy);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..1f3b3bc
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainobjectlayout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+
+public class CssClassFacetForDomainObjectLayoutAnnotation extends CssClassFacetAbstract {
+
+    public static CssClassFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+        if(domainObjectLayout == null) {
+            return null;
+        }
+        final String cssClass = Strings.emptyToNull(domainObjectLayout.cssClass());
+        return cssClass != null ? new CssClassFacetForDomainObjectLayoutAnnotation(cssClass, holder) : null;
+    }
+
+    private CssClassFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+        super(value, holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DescribedAsFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..1d13c57
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainobjectlayout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+
+public class DescribedAsFacetForDomainObjectLayoutAnnotation extends DescribedAsFacetAbstract {
+
+    public static DescribedAsFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+        if(domainObjectLayout == null) {
+            return null;
+        }
+        final String describedAs = Strings.emptyToNull(domainObjectLayout.describedAs());
+        return describedAs != null ? new DescribedAsFacetForDomainObjectLayoutAnnotation(describedAs, holder) : null;
+    }
+
+    private DescribedAsFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+        super(value, holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactory.java
new file mode 100644
index 0000000..4e8314b
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactory.java
@@ -0,0 +1,54 @@
+/*
+ *  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.domainobjectlayout;
+
+
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+
+public class DomainObjectLayoutFactory extends FacetFactoryAbstract {
+
+    public DomainObjectLayoutFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(ProcessClassContext processClassContext) {
+        final Class<?> cls = processClassContext.getCls();
+        final DomainObjectLayout domainObjectLayout = Annotations.getAnnotation(cls, DomainObjectLayout.class);
+
+        final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+        FacetUtil.addFacet(CssClassFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+        FacetUtil.addFacet(DescribedAsFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+        FacetUtil.addFacet(NamedFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+        FacetUtil.addFacet(PagedFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+        FacetUtil.addFacet(PluralFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+        FacetUtil.addFacet(BookmarkPolicyFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
+
+        return;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/NamedFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/NamedFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/NamedFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..af22933
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/NamedFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainobjectlayout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+
+public class NamedFacetForDomainObjectLayoutAnnotation extends NamedFacetAbstract {
+
+    public static NamedFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+        if(domainObjectLayout == null) {
+            return null;
+        }
+        final String named = Strings.emptyToNull(domainObjectLayout.named());
+        return named != null ? new NamedFacetForDomainObjectLayoutAnnotation(named, holder) : null;
+    }
+
+    private NamedFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+        super(value, /*escaped*/ true, holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PagedFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PagedFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PagedFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..85f81fb
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PagedFacetForDomainObjectLayoutAnnotation.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.domainobjectlayout;
+
+
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet;
+import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract;
+
+
+public class PagedFacetForDomainObjectLayoutAnnotation extends PagedFacetAbstract {
+
+    public static PagedFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+        if(domainObjectLayout == null) {
+            return null;
+        }
+        final int paged = domainObjectLayout.paged();
+        return paged > 1 ? new PagedFacetForDomainObjectLayoutAnnotation(paged, holder) : null;
+    }
+
+    private PagedFacetForDomainObjectLayoutAnnotation(int value, FacetHolder holder) {
+        super(value, holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PluralFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PluralFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PluralFacetForDomainObjectLayoutAnnotation.java
new file mode 100644
index 0000000..4cb5dee
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/PluralFacetForDomainObjectLayoutAnnotation.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainobjectlayout;
+
+
+import com.google.common.base.Strings;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.plural.PluralFacet;
+import org.apache.isis.core.metamodel.facets.object.plural.PluralFacetAbstract;
+
+
+public class PluralFacetForDomainObjectLayoutAnnotation extends PluralFacetAbstract {
+
+    public static PluralFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
+        if(domainObjectLayout == null) {
+            return null;
+        }
+        final String plural = Strings.emptyToNull(domainObjectLayout.plural());
+        return plural != null ? new PluralFacetForDomainObjectLayoutAnnotation(plural, holder) : null;
+    }
+
+    private PluralFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
+        super(value, holder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java
deleted file mode 100644
index 30eda4e..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/CssClassFacetForDomainObjectLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +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.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
-
-
-public class CssClassFacetForDomainObjectLayoutAnnotation extends CssClassFacetAbstract {
-
-    public static CssClassFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
-        if(domainObjectLayout == null) {
-            return null;
-        }
-        final String cssClass = Strings.emptyToNull(domainObjectLayout.cssClass());
-        return cssClass != null ? new CssClassFacetForDomainObjectLayoutAnnotation(cssClass, holder) : null;
-    }
-
-    private CssClassFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
-        super(value, holder);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
deleted file mode 100644
index 0eed585..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DescribedAsFacetForDomainObjectLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +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.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
-import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
-
-
-public class DescribedAsFacetForDomainObjectLayoutAnnotation extends DescribedAsFacetAbstract {
-
-    public static DescribedAsFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
-        if(domainObjectLayout == null) {
-            return null;
-        }
-        final String describedAs = Strings.emptyToNull(domainObjectLayout.describedAs());
-        return describedAs != null ? new DescribedAsFacetForDomainObjectLayoutAnnotation(describedAs, holder) : null;
-    }
-
-    private DescribedAsFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
-        super(value, holder);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java
deleted file mode 100644
index ad99218..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/DomainObjectLayoutFactory.java
+++ /dev/null
@@ -1,53 +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.layout;
-
-
-import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-
-
-public class DomainObjectLayoutFactory extends FacetFactoryAbstract {
-
-    public DomainObjectLayoutFactory() {
-        super(FeatureType.OBJECTS_ONLY);
-    }
-
-    @Override
-    public void process(ProcessClassContext processClassContext) {
-        final Class<?> cls = processClassContext.getCls();
-        final DomainObjectLayout domainObjectLayout = Annotations.getAnnotation(cls, DomainObjectLayout.class);
-
-        final FacetHolder facetHolder = processClassContext.getFacetHolder();
-
-        FacetUtil.addFacet(CssClassFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
-        FacetUtil.addFacet(DescribedAsFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
-        FacetUtil.addFacet(NamedFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
-        FacetUtil.addFacet(PagedFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
-        FacetUtil.addFacet(PluralFacetForDomainObjectLayoutAnnotation.create(domainObjectLayout, facetHolder));
-
-        return;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java
deleted file mode 100644
index 10256c2..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/NamedFacetForDomainObjectLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +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.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
-import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
-
-
-public class NamedFacetForDomainObjectLayoutAnnotation extends NamedFacetAbstract {
-
-    public static NamedFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
-        if(domainObjectLayout == null) {
-            return null;
-        }
-        final String named = Strings.emptyToNull(domainObjectLayout.named());
-        return named != null ? new NamedFacetForDomainObjectLayoutAnnotation(named, holder) : null;
-    }
-
-    private NamedFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
-        super(value, /*escaped*/ true, holder);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.java
deleted file mode 100644
index 7d910da..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PagedFacetForDomainObjectLayoutAnnotation.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.layout;
-
-
-import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet;
-import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract;
-
-
-public class PagedFacetForDomainObjectLayoutAnnotation extends PagedFacetAbstract {
-
-    public static PagedFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
-        if(domainObjectLayout == null) {
-            return null;
-        }
-        final int paged = domainObjectLayout.paged();
-        return paged > 1 ? new PagedFacetForDomainObjectLayoutAnnotation(paged, holder) : null;
-    }
-
-    private PagedFacetForDomainObjectLayoutAnnotation(int value, FacetHolder holder) {
-        super(value, holder);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java
deleted file mode 100644
index f5499fd..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layout/PluralFacetForDomainObjectLayoutAnnotation.java
+++ /dev/null
@@ -1,42 +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.layout;
-
-
-import com.google.common.base.Strings;
-import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.object.plural.PluralFacet;
-import org.apache.isis.core.metamodel.facets.object.plural.PluralFacetAbstract;
-
-
-public class PluralFacetForDomainObjectLayoutAnnotation extends PluralFacetAbstract {
-
-    public static PluralFacet create(DomainObjectLayout domainObjectLayout, FacetHolder holder) {
-        if(domainObjectLayout == null) {
-            return null;
-        }
-        final String plural = Strings.emptyToNull(domainObjectLayout.plural());
-        return plural != null ? new PluralFacetForDomainObjectLayoutAnnotation(plural, holder) : null;
-    }
-
-    private PluralFacetForDomainObjectLayoutAnnotation(String value, FacetHolder holder) {
-        super(value, holder);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectFacetSpecIdAnnotationFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectFacetSpecIdAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectFacetSpecIdAnnotationFactory.java
deleted file mode 100644
index 5a43cbb..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectFacetSpecIdAnnotationFactory.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.object.objectspecid.annotation;
-
-import org.apache.isis.applib.annotation.ObjectType;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.object.objectspecid.ObjectSpecIdFacet;
-
-public class ObjectFacetSpecIdAnnotationFactory extends FacetFactoryAbstract {
-
-    public ObjectFacetSpecIdAnnotationFactory() {
-        super(FeatureType.OBJECTS_ONLY);
-    }
-
-    @Override
-    public void process(final ProcessClassContext processClassContext) {
-        final ObjectType annotation = Annotations.getAnnotation(processClassContext.getCls(), ObjectType.class);
-        FacetUtil.addFacet(create(annotation, processClassContext.getFacetHolder()));
-    }
-
-    private ObjectSpecIdFacet create(final ObjectType annotation, final FacetHolder holder) {
-        return annotation != null ? new ObjectSpecIdFacetAnnotation(annotation.value(), holder) : null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectSpecIdFacetAnnotationFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectSpecIdFacetAnnotationFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectSpecIdFacetAnnotationFactory.java
new file mode 100644
index 0000000..c33d7c2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/objectspecid/annotation/ObjectSpecIdFacetAnnotationFactory.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.object.objectspecid.annotation;
+
+import org.apache.isis.applib.annotation.ObjectType;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.object.objectspecid.ObjectSpecIdFacet;
+
+public class ObjectSpecIdFacetAnnotationFactory extends FacetFactoryAbstract {
+
+    public ObjectSpecIdFacetAnnotationFactory() {
+        super(FeatureType.OBJECTS_ONLY);
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final ObjectType annotation = Annotations.getAnnotation(processClassContext.getCls(), ObjectType.class);
+        FacetUtil.addFacet(create(annotation, processClassContext.getFacetHolder()));
+    }
+
+    private ObjectSpecIdFacet create(final ObjectType annotation, final FacetHolder holder) {
+        return annotation != null ? new ObjectSpecIdFacetAnnotation(annotation.value(), holder) : null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacetDeclarativeAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacetDeclarativeAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacetDeclarativeAbstract.java
new file mode 100644
index 0000000..43b385f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/ViewModelFacetDeclarativeAbstract.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.viewmodel;
+
+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 ViewModelFacetDeclarativeAbstract extends ViewModelFacetAbstract {
+
+    private final SpecificationLoader specificationLoader;
+    private final ServicesInjector servicesInjector;
+    private final AdapterManager adapterManager;
+
+    public ViewModelFacetDeclarativeAbstract(
+            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/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/annotation/ViewModelFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/annotation/ViewModelFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/annotation/ViewModelFacetAnnotation.java
index d5f00b4..a7f94d9 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/annotation/ViewModelFacetAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/viewmodel/annotation/ViewModelFacetAnnotation.java
@@ -19,137 +19,20 @@
 
 package org.apache.isis.core.metamodel.facets.object.viewmodel.annotation;
 
-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.object.viewmodel.ViewModelFacetAbstract;
-import org.apache.isis.core.metamodel.facets.properties.update.modify.PropertySetterFacet;
+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.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 class ViewModelFacetAnnotation extends ViewModelFacetAbstract {
-
-    private final SpecificationLoader specificationLoader;
-    private final ServicesInjector servicesInjector;
-    private final AdapterManager adapterManager;
+public class ViewModelFacetAnnotation extends ViewModelFacetDeclarativeAbstract {
 
     public ViewModelFacetAnnotation(
             final FacetHolder holder,
             final SpecificationLoader specificationLoader,
             final AdapterManager adapterManager,
             final ServicesInjector servicesInjector) {
-        super(holder);
-        this.specificationLoader = specificationLoader;
-        this.servicesInjector = servicesInjector;
-        this.adapterManager = adapterManager;
+        super(holder, specificationLoader, adapterManager, servicesInjector);
     }
 
-    @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/32a6e9fb/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
index febdc24..6e70284 100644
--- a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
+++ b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
@@ -116,7 +116,7 @@ import org.apache.isis.core.metamodel.facets.object.ignore.jdo.RemoveJdoEnhancem
 import org.apache.isis.core.metamodel.facets.object.ignore.jdo.RemoveJdoPrefixedMethodsFacetFactory;
 import org.apache.isis.core.metamodel.facets.object.immutable.immutableannot.ImmutableFacetAnnotationFactory;
 import org.apache.isis.core.metamodel.facets.object.immutable.immutablemarkerifc.ImmutableFacetMarkerInterfaceFactory;
-import org.apache.isis.core.metamodel.facets.object.layout.DomainObjectLayoutFactory;
+import org.apache.isis.core.metamodel.facets.object.domainobjectlayout.DomainObjectLayoutFactory;
 import org.apache.isis.core.metamodel.facets.object.mask.annotation.MaskFacetOnTypeAnnotationFactory;
 import org.apache.isis.core.metamodel.facets.object.maxlen.annotation.MaxLengthFacetOnTypeAnnotationFactory;
 import org.apache.isis.core.metamodel.facets.object.membergroups.annotprop.MemberGroupLayoutFacetFactory;
@@ -124,7 +124,7 @@ import org.apache.isis.core.metamodel.facets.object.multiline.annotation.MultiLi
 import org.apache.isis.core.metamodel.facets.object.named.annotation.NamedFacetOnTypeAnnotationFactory;
 import org.apache.isis.core.metamodel.facets.object.notpersistable.notpersistableannot.NotPersistableFacetAnnotationFactory;
 import org.apache.isis.core.metamodel.facets.object.notpersistable.notpersistablemarkerifc.NotPersistableFacetMarkerInterfaceFactory;
-import org.apache.isis.core.metamodel.facets.object.objectspecid.annotation.ObjectFacetSpecIdAnnotationFactory;
+import org.apache.isis.core.metamodel.facets.object.objectspecid.annotation.ObjectSpecIdFacetAnnotationFactory;
 import org.apache.isis.core.metamodel.facets.object.objectspecid.classname.ObjectSpecIdFacetDerivedFromClassNameFactory;
 import org.apache.isis.core.metamodel.facets.object.objectvalidprops.impl.ObjectValidPropertiesFacetImplFactory;
 import org.apache.isis.core.metamodel.facets.object.paged.annotation.PagedFacetOnTypeAnnotationFactory;
@@ -318,7 +318,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
         addFactory(RenderFacetOrResolveFactory.class);
 
         // objects
-        addFactory(ObjectFacetSpecIdAnnotationFactory.class);
+        addFactory(ObjectSpecIdFacetAnnotationFactory.class);
         addFactory(IconFacetMethodFactory.class);
         addFactory(CssClassFacetMethodFactory.class);
 

http://git-wip-us.apache.org/repos/asf/isis/blob/32a6e9fb/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/objectspecid/ObjectTypeAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/objectspecid/ObjectTypeAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/objectspecid/ObjectTypeAnnotationFacetFactoryTest.java
index ffabd9b..0610bab 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/objectspecid/ObjectTypeAnnotationFacetFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/objectspecid/ObjectTypeAnnotationFacetFactoryTest.java
@@ -29,18 +29,18 @@ import org.junit.Test;
 
 import org.apache.isis.applib.annotation.ObjectType;
 import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessClassContext;
-import org.apache.isis.core.metamodel.facets.object.objectspecid.annotation.ObjectFacetSpecIdAnnotationFactory;
+import org.apache.isis.core.metamodel.facets.object.objectspecid.annotation.ObjectSpecIdFacetAnnotationFactory;
 import org.apache.isis.core.metamodel.facets.object.objectspecid.annotation.ObjectSpecIdFacetAnnotation;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.facets.AbstractFacetFactoryJUnit4TestCase;
 
 public class ObjectTypeAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4TestCase {
 
-    private ObjectFacetSpecIdAnnotationFactory facetFactory;
+    private ObjectSpecIdFacetAnnotationFactory facetFactory;
 
     @Before
     public void setUp() throws Exception {
-        facetFactory = new ObjectFacetSpecIdAnnotationFactory();
+        facetFactory = new ObjectSpecIdFacetAnnotationFactory();
     }
 
     @Test