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 2013/02/15 14:53:25 UTC
[1/2] git commit: ISIS-343: adding Render annotation
ISIS-343: adding Render annotation
* and updated ToDoItem example
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/ff4ecbbb
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/ff4ecbbb
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/ff4ecbbb
Branch: refs/heads/master
Commit: ff4ecbbb149498ee8473a636855f803cda18e5f7
Parents: 33077ba
Author: Dan Haywood <da...@apache.org>
Authored: Fri Feb 15 13:32:30 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Fri Feb 15 13:32:30 2013 +0000
----------------------------------------------------------------------
.../CollectionContentsLinksSelectorPanel.java | 6 +-
.../dropdown/DropDownSelectorPanelAbstract.java | 6 +-
.../org/apache/isis/applib/annotation/Render.java | 70 +++++++
.../org/apache/isis/applib/annotation/Resolve.java | 42 ++---
.../facets/members/resolve/RenderFacet.java | 35 +++
.../members/resolve/RenderFacetAbstract.java | 37 ++++
.../facets/members/resolve/ResolveFacet.java | 34 ---
.../members/resolve/ResolveFacetAbstract.java | 38 ----
.../members/resolve/RenderFacetAnnotation.java | 33 +++
.../resolve/RenderFacetViaResolveAnnotation.java | 32 +++
.../RenderOrResolveAnnotationFacetFactory.java | 55 +++++
.../resolve/ResolveAnnotationFacetFactory.java | 46 ----
.../members/resolve/ResolveFacetAnnotation.java | 32 ---
.../dflt/ProgrammingModelFacetsJava5.java | 4 +-
...ationFacetFactoryTest_withRenderAnnotation.java | 161 +++++++++++++++
...tionFacetFactoryTest_withResolveAnnotation.java | 158 ++++++++++++++
.../resolve/ResolveAnnotationFacetFactoryTest.java | 155 --------------
.../dom/src/main/java/dom/todo/ToDoItem.java | 41 +---
.../src/main/webapp/WEB-INF/isis.properties | 4 +-
19 files changed, 615 insertions(+), 374 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index 62296a9..43c7fda 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -21,8 +21,8 @@ package org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.
import java.util.List;
-import org.apache.isis.applib.annotation.Resolve.Type;
-import org.apache.isis.core.metamodel.facets.members.resolve.ResolveFacet;
+import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.core.metamodel.facets.members.resolve.RenderFacet;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
@@ -86,7 +86,7 @@ public class CollectionContentsLinksSelectorPanel extends LinksSelectorPanelAbst
final OneToManyAssociation collection =
entityCollectionModel.getCollectionMemento().getCollection();
- ResolveFacet resolveFacet = collection.getFacet(ResolveFacet.class);
+ RenderFacet resolveFacet = collection.getFacet(RenderFacet.class);
return resolveFacet != null && resolveFacet.value() == Type.EAGERLY;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/dropdown/DropDownSelectorPanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/dropdown/DropDownSelectorPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/dropdown/DropDownSelectorPanelAbstract.java
index ff2608d..938fa14 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/dropdown/DropDownSelectorPanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/dropdown/DropDownSelectorPanelAbstract.java
@@ -21,8 +21,8 @@ package org.apache.isis.viewer.wicket.ui.selector.dropdown;
import java.util.List;
-import org.apache.isis.applib.annotation.Resolve.Type;
-import org.apache.isis.core.metamodel.facets.members.resolve.ResolveFacet;
+import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.core.metamodel.facets.members.resolve.RenderFacet;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
@@ -100,7 +100,7 @@ public abstract class DropDownSelectorPanelAbstract<T extends IModel<?>> extends
final OneToManyAssociation collection =
entityCollectionModel.getCollectionMemento().getCollection();
- ResolveFacet resolveFacet = collection.getFacet(ResolveFacet.class);
+ RenderFacet resolveFacet = collection.getFacet(RenderFacet.class);
return resolveFacet != null && resolveFacet.value() == Type.EAGERLY;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/applib/src/main/java/org/apache/isis/applib/annotation/Render.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Render.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Render.java
new file mode 100644
index 0000000..6d20c2f
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Render.java
@@ -0,0 +1,70 @@
+/*
+ * 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;
+
+/**
+ * Indicates that the rendering of a collection should be performed lazily or eagerly.
+ *
+ * <p>
+ * By default, collections and reference properties are rendered
+ * lazily, meaning that their contents is not shown automatically; value properties
+ * on the other hand are rendered eagerly (the title at least is shown).
+ *
+ * <p>
+ * Using this annotation, an <tt>Order#lineItems</tt> collection might be
+ * rendered eagerly. A viewer might use this hint to "open"
+ * the collection automatically so that the user could see a list of
+ * line items immediately when the order is rendered.
+ *
+ * <p>
+ * Or, a reference property containing an <tt>Address</tt> might be shown
+ * address as an embedded property.
+ *
+ * <p>
+ * Or, a value property might be annotated to render lazily; this would be
+ * suitable for handling of BLOBs and CLOBs.
+ *
+ * <p>
+ * For properties and collections there is some similarity between this concept
+ * and that of eager-loading as supported by some object stores. Indeed, some
+ * object stores may choose use their own specific annotations (eg a JDO default
+ * fetch group) in order to infer this semantic.
+ */
+@Inherited
+@Target( ElementType.METHOD )
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Render {
+
+ public enum Type {
+ EAGERLY,
+ LAZILY
+ }
+
+ /**
+ * How to resolve; by default {@value Type#EAGERLY}.
+ */
+ Type value() default Type.EAGERLY;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/applib/src/main/java/org/apache/isis/applib/annotation/Resolve.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Resolve.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Resolve.java
index d612191..55a7cc0 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Resolve.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Resolve.java
@@ -26,41 +26,27 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Indicates that the resolving (loading from the datastore) of
- * a property or collection should be performed lazily or eagerly.
- *
- * <p>
- * By default, collections and reference properties are resolved
- * lazily, while value properties are resolved eagerly.
- *
- * <p>
- * Using this annotation, an <tt>Order#lineItems</tt> collection might be
- * resolved eagerly. A viewer might use this hint to "open"
- * the collection automatically so that the user could see a list of
- * line items immediately when the order is rendered.
- *
- * <p>
- * Or, a reference property containing an <tt>Address</tt> might be shown
- * address as an embedded property.
- *
- * <p>
- * Or, a value property might be annotated to resolve lazily; this would be
- * suitable for handling of BLOBs and CLOBs.
- *
- * <p>
- * For properties and collections there is some similarity between this concept
- * and that of eager-loading as supported by some object stores. Indeed, some
- * object stores may choose use their own specific annotations (eg a JDO default
- * fetch group) in order to infer this semantic.
+ * @see Render - use instead
*/
+@Deprecated
@Inherited
@Target( ElementType.METHOD )
@Retention(RetentionPolicy.RUNTIME)
public @interface Resolve {
public enum Type {
- EAGERLY,
- LAZILY
+ EAGERLY(Render.Type.EAGERLY),
+ LAZILY(Render.Type.LAZILY);
+
+ private final org.apache.isis.applib.annotation.Render.Type renderType;
+
+ private Type(Render.Type renderType) {
+ this.renderType = renderType;
+ }
+
+ public org.apache.isis.applib.annotation.Render.Type getRenderType() {
+ return renderType;
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacet.java
new file mode 100644
index 0000000..3f382de
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacet.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.members.resolve;
+
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.Resolve;
+import org.apache.isis.core.metamodel.facets.SingleValueFacet;
+
+/**
+ * Indicates that a class member should be rendered eagerly/lazily and so should
+ * be presented in the viewer in an appropriate manner.
+ *
+ * <p>
+ * @see Resolve
+ */
+public interface RenderFacet extends SingleValueFacet<Render.Type> {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacetAbstract.java
new file mode 100644
index 0000000..ba2274a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/RenderFacetAbstract.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.members.resolve;
+
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
+
+public abstract class RenderFacetAbstract extends SingleValueFacetAbstract<Render.Type> implements RenderFacet {
+
+ public static Class<? extends Facet> type() {
+ return RenderFacet.class;
+ }
+
+ public RenderFacetAbstract(Render.Type value, final FacetHolder holder) {
+ super(type(), value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacet.java
deleted file mode 100644
index b919476..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacet.java
+++ /dev/null
@@ -1,34 +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.members.resolve;
-
-import org.apache.isis.applib.annotation.Resolve;
-import org.apache.isis.core.metamodel.facets.SingleValueFacet;
-
-/**
- * Indicates that a class member should be resolved eagerly/lazily and so should
- * be presented in the viewer in an appropriate manner.
- *
- * <p>
- * @see Resolve
- */
-public interface ResolveFacet extends SingleValueFacet<Resolve.Type> {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacetAbstract.java
deleted file mode 100644
index 0c4f0a6..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/resolve/ResolveFacetAbstract.java
+++ /dev/null
@@ -1,38 +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.members.resolve;
-
-import org.apache.isis.applib.annotation.Resolve;
-import org.apache.isis.applib.annotation.Resolve.Type;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
-
-public abstract class ResolveFacetAbstract extends SingleValueFacetAbstract<Resolve.Type> implements ResolveFacet {
-
- public static Class<? extends Facet> type() {
- return ResolveFacet.class;
- }
-
- public ResolveFacetAbstract(Type value, final FacetHolder holder) {
- super(type(), value, holder);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetAnnotation.java
new file mode 100644
index 0000000..21b7a54
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetAnnotation.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.members.resolve;
+
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.Resolve;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.resolve.RenderFacetAbstract;
+
+public class RenderFacetAnnotation extends RenderFacetAbstract {
+
+ public RenderFacetAnnotation(final FacetHolder holder, Render.Type value) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetViaResolveAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetViaResolveAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetViaResolveAnnotation.java
new file mode 100644
index 0000000..a8f5072
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderFacetViaResolveAnnotation.java
@@ -0,0 +1,32 @@
+/*
+ * 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.progmodel.facets.members.resolve;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.resolve.RenderFacetAbstract;
+
+public class RenderFacetViaResolveAnnotation extends RenderFacetAbstract {
+
+ @SuppressWarnings("deprecation")
+ public RenderFacetViaResolveAnnotation(final FacetHolder holder, org.apache.isis.applib.annotation.Resolve.Type value) {
+ super(value.getRenderType(), holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactory.java
new file mode 100644
index 0000000..bf401d4
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactory.java
@@ -0,0 +1,55 @@
+/*
+ * 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.progmodel.facets.members.resolve;
+
+import org.apache.isis.applib.annotation.Render;
+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.members.resolve.RenderFacet;
+
+public class RenderOrResolveAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public RenderOrResolveAnnotationFacetFactory() {
+ super(FeatureType.MEMBERS);
+ }
+
+ @Override
+ public void process(final ProcessMethodContext processMethodContext) {
+ final Render renderAnnotation = Annotations.getAnnotation(processMethodContext.getMethod(), Render.class);
+ FacetUtil.addFacet(create(renderAnnotation, processMethodContext.getFacetHolder()));
+
+ @SuppressWarnings("deprecation")
+ final org.apache.isis.applib.annotation.Resolve resolveAnnotation = Annotations.getAnnotation(processMethodContext.getMethod(), org.apache.isis.applib.annotation.Resolve.class);
+ FacetUtil.addFacet(create(resolveAnnotation, processMethodContext.getFacetHolder()));
+ }
+
+ private RenderFacet create(final Render annotation, final FacetHolder holder) {
+ return annotation == null ? null : new RenderFacetAnnotation(holder, annotation.value());
+ }
+
+ @SuppressWarnings("deprecation")
+ private RenderFacet create(final org.apache.isis.applib.annotation.Resolve annotation, final FacetHolder holder) {
+ return annotation == null ? null : new RenderFacetViaResolveAnnotation(holder, annotation.value());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactory.java
deleted file mode 100644
index bba5cb9..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactory.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.progmodel.facets.members.resolve;
-
-import org.apache.isis.applib.annotation.Resolve;
-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.members.resolve.ResolveFacet;
-
-public class ResolveAnnotationFacetFactory extends FacetFactoryAbstract {
-
- public ResolveAnnotationFacetFactory() {
- super(FeatureType.MEMBERS);
- }
-
- @Override
- public void process(final ProcessMethodContext processMethodContext) {
- final Resolve annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Resolve.class);
- FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
- }
-
- private ResolveFacet create(final Resolve annotation, final FacetHolder holder) {
- return annotation == null ? null : new ResolveFacetAnnotation(holder, annotation.value());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveFacetAnnotation.java
deleted file mode 100644
index 71c1383..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveFacetAnnotation.java
+++ /dev/null
@@ -1,32 +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.progmodel.facets.members.resolve;
-
-import org.apache.isis.applib.annotation.Resolve;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.members.resolve.ResolveFacetAbstract;
-
-public class ResolveFacetAnnotation extends ResolveFacetAbstract {
-
- public ResolveFacetAnnotation(final FacetHolder holder, Resolve.Type value) {
- super(value, holder);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/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 d92f62a..71af1c1 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
@@ -60,7 +60,7 @@ import org.apache.isis.core.progmodel.facets.members.hidden.staticmethod.HiddenF
import org.apache.isis.core.progmodel.facets.members.named.annotation.NamedAnnotationOnMemberFacetFactory;
import org.apache.isis.core.progmodel.facets.members.named.staticmethod.NamedFacetViaNameMethodFacetFactory;
import org.apache.isis.core.progmodel.facets.members.order.MemberOrderAnnotationFacetFactory;
-import org.apache.isis.core.progmodel.facets.members.resolve.ResolveAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.resolve.RenderOrResolveAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.object.aggregated.annotation.AggregatedAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.object.autocomplete.annotation.AutoCompleteAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.object.bounded.annotation.BoundedAnnotationFacetFactory;
@@ -268,7 +268,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
addFactory(HiddenFacetViaHideForSessionMethodFacetFactory.class);
addFactory(HiddenFacetViaAlwaysHideMethodFacetFactory.class);
addFactory(HiddenFacetViaHideMethodFacetFactory.class);
- addFactory(ResolveAnnotationFacetFactory.class);
+ addFactory(RenderOrResolveAnnotationFacetFactory.class);
// objects
addFactory(ObjectSpecIdAnnotationFacetFactory.class);
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withRenderAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withRenderAnnotation.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withRenderAnnotation.java
new file mode 100644
index 0000000..06177aa
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withRenderAnnotation.java
@@ -0,0 +1,161 @@
+/*
+ * 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.progmodel.facets.members.resolve;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.members.resolve.RenderFacet;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+
+public class RenderOrResolveAnnotationFacetFactoryTest_withRenderAnnotation extends AbstractFacetFactoryTest {
+
+ private RenderOrResolveAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new RenderOrResolveAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testAnnotationWithNoHintPickedUpOnProperty() {
+
+ class Customer {
+ @SuppressWarnings("unused")
+ @Render
+ public int getNumberOfOrders() {
+ return 0;
+ }
+ }
+
+ facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof RenderFacetAnnotation);
+ RenderFacet resolveFacet = (RenderFacet) facet;
+ assertThat(resolveFacet.value(), is(Render.Type.EAGERLY));
+
+ assertNoMethodsRemoved();
+ }
+
+ public void testAnnotationWithEagerlyHintPickedUpOnProperty() {
+
+ class Customer {
+ @SuppressWarnings("unused")
+ @Render(Type.EAGERLY)
+ public int getNumberOfOrders() {
+ return 0;
+ }
+ }
+
+ facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.EAGERLY));
+ }
+
+ public void testAnnotationForLazilyPickedUpOnProperty() {
+
+ class Customer {
+ @SuppressWarnings("unused")
+ @Render(Type.LAZILY)
+ public int getNumberOfOrders() {
+ return 0;
+ }
+ }
+
+ facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.LAZILY));
+ }
+
+ public void testAnnotationNoHintPickedUpOnCollection() {
+ class Customer {
+ @SuppressWarnings("unused")
+ @Render
+ public Collection<?> getOrders() {
+ return null;
+ }
+ }
+ facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof RenderFacetAnnotation);
+ RenderFacet resolveFacet = (RenderFacet) facet;
+ assertThat(resolveFacet.value(), is(Render.Type.EAGERLY));
+
+ assertNoMethodsRemoved();
+ }
+
+ public void testAnnotationEagerlyHintPickedUpOnCollection() {
+ class Customer {
+ @SuppressWarnings("unused")
+ @Render(Type.EAGERLY)
+ public Collection<?> getOrders() {
+ return null;
+ }
+ }
+ facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.EAGERLY));
+ }
+
+ public void testAnnotationWithLazilyHintPickedUpOnCollection() {
+ class Customer {
+ @SuppressWarnings("unused")
+ @Render(Type.LAZILY)
+ public Collection<?> getOrders() {
+ return null;
+ }
+ }
+ facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.LAZILY));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withResolveAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withResolveAnnotation.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withResolveAnnotation.java
new file mode 100644
index 0000000..ef99aae
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/RenderOrResolveAnnotationFacetFactoryTest_withResolveAnnotation.java
@@ -0,0 +1,158 @@
+/*
+ * 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.progmodel.facets.members.resolve;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Collection;
+
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+import org.apache.isis.core.metamodel.facets.members.resolve.RenderFacet;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+
+public class RenderOrResolveAnnotationFacetFactoryTest_withResolveAnnotation extends AbstractFacetFactoryTest {
+
+ private RenderOrResolveAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new RenderOrResolveAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testAnnotationWithNoHintPickedUpOnProperty() {
+
+ class Customer {
+ @SuppressWarnings({ "deprecation", "unused" })
+ @org.apache.isis.applib.annotation.Resolve
+ public int getNumberOfOrders() {
+ return 0;
+ }
+ }
+
+ facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof RenderFacetViaResolveAnnotation);
+ RenderFacet resolveFacet = (RenderFacet) facet;
+ assertThat(resolveFacet.value(), is(Render.Type.EAGERLY));
+
+ assertNoMethodsRemoved();
+ }
+
+ public void testAnnotationWithEagerlyHintPickedUpOnProperty() {
+
+ class Customer {
+ @SuppressWarnings({ "deprecation", "unused" })
+ @org.apache.isis.applib.annotation.Resolve(org.apache.isis.applib.annotation.Resolve.Type.EAGERLY)
+ public int getNumberOfOrders() {
+ return 0;
+ }
+ }
+
+ facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.EAGERLY));
+ }
+
+ public void testAnnotationForLazilyPickedUpOnProperty() {
+
+ class Customer {
+ @SuppressWarnings({ "deprecation", "unused" })
+ @org.apache.isis.applib.annotation.Resolve(org.apache.isis.applib.annotation.Resolve.Type.LAZILY)
+ public int getNumberOfOrders() {
+ return 0;
+ }
+ }
+
+ facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.LAZILY));
+ }
+
+ public void testAnnotationNoHintPickedUpOnCollection() {
+ class Customer {
+ @SuppressWarnings({ "deprecation", "unused" })
+ @org.apache.isis.applib.annotation.Resolve
+ public Collection<?> getOrders() {
+ return null;
+ }
+ }
+ facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof RenderFacetViaResolveAnnotation);
+ RenderFacet resolveFacet = (RenderFacet) facet;
+ assertThat(resolveFacet.value(), is(Render.Type.EAGERLY));
+
+ assertNoMethodsRemoved();
+ }
+
+ public void testAnnotationEagerlyHintPickedUpOnCollection() {
+ class Customer {
+ @SuppressWarnings({ "deprecation", "unused" })
+ @org.apache.isis.applib.annotation.Resolve(org.apache.isis.applib.annotation.Resolve.Type.EAGERLY)
+ public Collection<?> getOrders() {
+ return null;
+ }
+ }
+ facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.EAGERLY));
+ }
+
+ public void testAnnotationWithLazilyHintPickedUpOnCollection() {
+ class Customer {
+ @SuppressWarnings({ "deprecation", "unused" })
+ @org.apache.isis.applib.annotation.Resolve(org.apache.isis.applib.annotation.Resolve.Type.LAZILY)
+ public Collection<?> getOrders() {
+ return null;
+ }
+ }
+ facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
+ facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
+
+ final RenderFacet facet = facetedMethod.getFacet(RenderFacet.class);
+ assertThat(facet.value(), is(Render.Type.LAZILY));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactoryTest.java
deleted file mode 100644
index ad7b1a5..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/resolve/ResolveAnnotationFacetFactoryTest.java
+++ /dev/null
@@ -1,155 +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.progmodel.facets.members.resolve;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.assertThat;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-import org.apache.isis.applib.annotation.Resolve;
-import org.apache.isis.applib.annotation.Disabled;
-import org.apache.isis.applib.annotation.Resolve.Type;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
-import org.apache.isis.core.metamodel.facets.FacetedMethod;
-import org.apache.isis.core.metamodel.facets.members.resolve.ResolveFacet;
-import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
-
-public class ResolveAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
-
- private ResolveAnnotationFacetFactory facetFactory;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- facetFactory = new ResolveAnnotationFacetFactory();
- }
-
- @Override
- protected void tearDown() throws Exception {
- facetFactory = null;
- super.tearDown();
- }
-
- public void testAnnotationWithNoHintPickedUpOnProperty() {
-
- class Customer {
- @Resolve
- public int getNumberOfOrders() {
- return 0;
- }
- }
-
- facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
- facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
-
- final Facet facet = facetedMethod.getFacet(ResolveFacet.class);
- assertNotNull(facet);
- assertTrue(facet instanceof ResolveFacetAnnotation);
- ResolveFacet resolveFacet = (ResolveFacet) facet;
- assertThat(resolveFacet.value(), is(Resolve.Type.EAGERLY));
-
- assertNoMethodsRemoved();
- }
-
- public void testAnnotationWithEagerlyHintPickedUpOnProperty() {
-
- class Customer {
- @Resolve(Type.EAGERLY)
- public int getNumberOfOrders() {
- return 0;
- }
- }
-
- facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
- facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
-
- final ResolveFacet facet = facetedMethod.getFacet(ResolveFacet.class);
- assertThat(facet.value(), is(Resolve.Type.EAGERLY));
- }
-
- public void testAnnotationForLazilyPickedUpOnProperty() {
-
- class Customer {
- @Resolve(Type.LAZILY)
- public int getNumberOfOrders() {
- return 0;
- }
- }
-
- facetedMethod = FacetedMethod.createForProperty(Customer.class, "numberOfOrders");
- facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
-
- final ResolveFacet facet = facetedMethod.getFacet(ResolveFacet.class);
- assertThat(facet.value(), is(Resolve.Type.LAZILY));
- }
-
- public void testAnnotationNoHintPickedUpOnCollection() {
- class Customer {
- @Resolve
- public Collection<?> getOrders() {
- return null;
- }
- }
- facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
- facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
-
- final Facet facet = facetedMethod.getFacet(ResolveFacet.class);
- assertNotNull(facet);
- assertTrue(facet instanceof ResolveFacetAnnotation);
- ResolveFacet resolveFacet = (ResolveFacet) facet;
- assertThat(resolveFacet.value(), is(Resolve.Type.EAGERLY));
-
- assertNoMethodsRemoved();
- }
-
- public void testAnnotationEagerlyHintPickedUpOnCollection() {
- class Customer {
- @Resolve(Type.EAGERLY)
- public Collection<?> getOrders() {
- return null;
- }
- }
- facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
- facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
-
- final ResolveFacet facet = facetedMethod.getFacet(ResolveFacet.class);
- assertThat(facet.value(), is(Resolve.Type.EAGERLY));
- }
-
- public void testAnnotationWithLazilyHintPickedUpOnCollection() {
- class Customer {
- @Resolve(Type.LAZILY)
- public Collection<?> getOrders() {
- return null;
- }
- }
- facetedMethod = FacetedMethod.createForCollection(Customer.class, "orders");
- facetFactory.process(new ProcessMethodContext(Customer.class, facetedMethod.getMethod(), methodRemover, facetedMethod));
-
- final ResolveFacet facet = facetedMethod.getFacet(ResolveFacet.class);
- assertThat(facet.value(), is(Resolve.Type.LAZILY));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
index efaa2d8..c3e3a5a 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
@@ -18,17 +18,12 @@
*/
package dom.todo;
-import java.math.BigDecimal;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.jdo.JDOHelper;
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.Element;
import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.Join;
-import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.VersionStrategy;
import javax.jdo.spi.PersistenceCapable;
@@ -49,8 +44,8 @@ import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.PublishedAction;
import org.apache.isis.applib.annotation.PublishedObject;
import org.apache.isis.applib.annotation.RegEx;
-import org.apache.isis.applib.annotation.Resolve;
-import org.apache.isis.applib.annotation.Resolve.Type;
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.Render.Type;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.filter.Filter;
@@ -127,9 +122,9 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// }}
// {{ DueBy (property)
+ @javax.jdo.annotations.Persistent(defaultFetchGroup="true")
private LocalDate dueBy;
- @javax.jdo.annotations.Persistent
@MemberOrder(name="Detail", sequence = "3")
@Optional
public LocalDate getDueBy() {
@@ -214,9 +209,10 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// {{ Attachment (property)
private Blob attachment;
- @Persistent
+ @javax.jdo.annotations.Persistent(defaultFetchGroup="false")
@Optional
@MemberOrder(name="Detail", sequence = "7")
+ @Hidden(where=Where.STANDALONE_TABLES)
public Blob getAttachment() {
return attachment;
}
@@ -280,14 +276,14 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// {{ dependencies (Collection)
- @Persistent(table="TODO_DEPENDENCIES")
- @Join(column="DEPENDING_TODO_ID")
- @Element(column="DEPENDENT_TODO_ID")
+ @javax.jdo.annotations.Persistent(table="TODO_DEPENDENCIES")
+ @javax.jdo.annotations.Join(column="DEPENDING_TODO_ID")
+ @javax.jdo.annotations.Element(column="DEPENDENT_TODO_ID")
private SortedSet<ToDoItem> dependencies = new TreeSet<ToDoItem>();
@Disabled
@MemberOrder(sequence = "1")
- @Resolve(Type.EAGERLY)
+ @Render(Type.EAGERLY)
public SortedSet<ToDoItem> getDependencies() {
return dependencies;
}
@@ -380,7 +376,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// {{ SimilarItems (derived collection)
@MemberOrder(sequence = "5")
@NotPersisted
- @Resolve(Type.LAZILY)
+ @Render(Type.LAZILY)
public List<ToDoItem> getSimilarItems() {
return toDoItems.similarTo(this);
}
@@ -466,24 +462,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// }}
- // {{ Cost (property)
-
- private BigDecimal cost;
- @Optional
- @Column(scale=4)
- @MemberOrder(sequence = "99")
- public BigDecimal getCost() {
- return cost;
- }
-
- public void setCost(final BigDecimal cost) {
- this.cost = cost;
- }
- // }}
-
-
-
// {{ injected: DomainObjectContainer
@SuppressWarnings("unused")
private DomainObjectContainer container;
http://git-wip-us.apache.org/repos/asf/isis/blob/ff4ecbbb/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
index 2cde3a3..a013d8b 100644
--- a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/src/main/webapp/WEB-INF/isis.properties
@@ -81,7 +81,7 @@ isis.persistor=datanucleus
# default is file in SERVER mode, none in SERVER_EXPLORATION. Derived from wicket mode
#isis.authentication=bypass
-isis.authentication=org.apache.isis.security.shiro.authentication.ShiroAuthenticationManagerInstaller
+isis.authentication=shiro
#
# configure authorization mechanism to use
@@ -95,7 +95,7 @@ isis.authentication=org.apache.isis.security.shiro.authentication.ShiroAuthentic
# default is file in SERVER mode, none in SERVER_EXPLORATION. Derived from wicket mode
#isis.authorization=file
-isis.authorization=org.apache.isis.security.shiro.authorization.ShiroAuthorizationManagerInstaller
+isis.authorization=shiro
#