incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1300890 [2/5] - in /incubator/isis/trunk/framework: ./ core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/objecttype/ core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/ core/webapp/src/main/java/org/...
Date Thu, 15 Mar 2012 10:37:49 GMT
Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacet.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacet.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacet.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,40 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+
+/**
+ * In the standard JPA Model, corresponds to annotating the class with either
+ * {@link javax.persistence.NamedQuery} or
+ * {@link javax.persistence.NamedQueries}.
+ * <p>
+ * For a {@link javax.persistence.NamedQuery}, returns a singleton list of
+ * {@link org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery}.
+ * For a {@link javax.persistence.NamedQueries}, returns a list of
+ * {@link org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery}s.
+ * <p>
+ * In both cases, mapping is as follows
+ * <ul>
+ * <li>{@link javax.persistence.NamedQuery#name()} ->
+ * {@link org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery#getName()
+ * getName()} property of JPA Object Store's own
+ * {@link org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery
+ * NamedQuery} value object</li>
+ * <li>{@link javax.persistence.NamedQuery#query()} ->
+ * {@link org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery#getQuery()}
+ * property of JPA Object Store's own
+ * {@link org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery
+ * NamedQuery} value object</li>
+ * <li>{@link javax.persistence.NamedQuery#hints()} -> (no corresponding
+ * attribute or facet)</li>
+ * </ul>
+ */
+public interface JpaNamedQueryFacet extends Facet {
+
+    /**
+     * Returns an immutable {@link List}.
+     */
+    List<org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery> getNamedQueries();
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAbstract.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAbstract.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAbstract.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,37 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+
+public class JpaNamedQueryFacetAbstract extends FacetAbstract implements
+        JpaNamedQueryFacet {
+
+    public static Class<? extends Facet> type() {
+        return JpaNamedQueryFacet.class;
+    }
+
+    private final List<NamedQuery> namedQueries = new ArrayList<NamedQuery>();
+
+    public JpaNamedQueryFacetAbstract(final FacetHolder holder) {
+        super(JpaNamedQueryFacetAbstract.type(), holder, false);
+    }
+
+    protected void add(final javax.persistence.NamedQuery... jpaNamedQueries) {
+        final ObjectSpecification objSpec = (ObjectSpecification) getFacetHolder();
+        for (final javax.persistence.NamedQuery jpaNamedQuery : jpaNamedQueries) {
+            namedQueries.add(new NamedQuery(jpaNamedQuery, objSpec));
+        }
+    }
+
+    public List<NamedQuery> getNamedQueries() {
+        return Collections.unmodifiableList(namedQueries);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAbstract.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,18 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery;
+
+import javax.persistence.NamedQuery;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaNamedQueryFacetAnnotation extends JpaNamedQueryFacetAbstract
+        implements JpaNamedQueryFacet {
+
+    public JpaNamedQueryFacetAnnotation(final NamedQuery namedQuery,
+            final FacetHolder holder) {
+        super(holder);
+        add(namedQuery);
+    }
+
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/JpaNamedQueryFacetAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/NamedQuery.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/NamedQuery.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/NamedQuery.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/NamedQuery.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,81 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
+import org.apache.isis.core.commons.ensure.Ensure;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+/**
+ * Value object that represents the information of a
+ * {@link javax.persistence.NamedQuery}.
+ * 
+ * @see {@link JpaNamedQueryFacet}.
+ */
+public final class NamedQuery {
+
+    private final String name;
+    private final String query;
+    private final ObjectSpecification noSpec;
+
+    public NamedQuery(final String name, final String query,
+            final ObjectSpecification noSpec) {
+        Ensure.ensureThatArg(name, is(not(nullValue())));
+        Ensure.ensureThatArg(query, is(not(nullValue())));
+        Ensure.ensureThatArg(noSpec, is(not(nullValue())));
+
+        this.name = name;
+        this.query = query;
+        this.noSpec = noSpec;
+    }
+
+    public NamedQuery(final javax.persistence.NamedQuery jpaNamedQuery,
+            final ObjectSpecification objSpec) {
+        this(jpaNamedQuery.name(), jpaNamedQuery.query(), objSpec);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getQuery() {
+        return query;
+    }
+
+    public ObjectSpecification getObjectSpecification() {
+        return noSpec;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final NamedQuery other = (NamedQuery) obj;
+        if (name == null) {
+            if (other.name != null) {
+                return false;
+            }
+        } else if (!name.equals(other.name)) {
+            return false;
+        }
+        return true;
+    }
+
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/object/namedquery/NamedQuery.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicAnnotationFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicAnnotationFacetFactory.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicAnnotationFacetFactory.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicAnnotationFacetFactory.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,41 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.basic;
+
+import javax.persistence.Basic;
+
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+
+
+public class JpaBasicAnnotationFacetFactory extends
+        AnnotationBasedFacetFactoryAbstract {
+
+    public JpaBasicAnnotationFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        
+        final Basic annotation = getAnnotation(processMethodContext.getMethod(), Basic.class);
+        if (annotation == null) {
+            return ;
+        }
+        
+        final FacetedMethod holder = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new JpaBasicFacetAnnotation(holder));
+        if (annotation.optional()) {
+            // ie, a MandatoryFacet implementation with inverted semantics
+            FacetUtil.addFacet(new OptionalFacetDerivedFromJpaBasicAnnotation(
+                    holder));
+        } else {
+            FacetUtil.addFacet(new MandatoryFacetDerivedFromJpaBasicAnnotation(
+                    holder));
+        }
+        FacetUtil.addFacet(new JpaFetchTypeFacetDerivedFromJpaBasicAnnotation(
+                holder, annotation.fetch()));
+    }
+
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicAnnotationFacetFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacet.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacet.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacet.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,22 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.basic;
+
+import javax.persistence.Basic;
+
+import org.apache.isis.core.metamodel.facets.MarkerFacet;
+
+
+/**
+ * Corresponds to the property with the {@link Basic} annotation.
+ * <p>
+ * Maps onto the information in {@link Basic} as follows:
+ * <ul>
+ * <li>{@link Basic#fetch()} ->
+ * {@link JpaFetchTypeFacetDerivedFromJpaBasicAnnotation}</li>
+ * <li>{@link Basic#optional()} ->
+ * {@link OptionalFacetDerivedFromJpaBasicAnnotation} or
+ * {@link MandatoryFacetDerivedFromJpaBasicAnnotation}</li>
+ * </ul>
+ */
+public interface JpaBasicFacet extends MarkerFacet {
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacetAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacetAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacetAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,19 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.basic;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaBasicFacetAnnotation extends FacetAbstract implements
+        JpaBasicFacet {
+
+    public static Class<? extends Facet> type() {
+        return JpaBasicFacet.class;
+    }
+
+    public JpaBasicFacetAnnotation(final FacetHolder holder) {
+        super(JpaBasicFacetAnnotation.type(), holder, false);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaBasicFacetAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaFetchTypeFacetDerivedFromJpaBasicAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaFetchTypeFacetDerivedFromJpaBasicAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaFetchTypeFacetDerivedFromJpaBasicAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaFetchTypeFacetDerivedFromJpaBasicAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,17 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.basic;
+
+import javax.persistence.FetchType;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.extensions.jpa.metamodel.facets.JpaFetchTypeFacetAbstract;
+
+
+public class JpaFetchTypeFacetDerivedFromJpaBasicAnnotation extends
+        JpaFetchTypeFacetAbstract {
+
+    public JpaFetchTypeFacetDerivedFromJpaBasicAnnotation(
+            final FacetHolder holder, final FetchType fetchType) {
+        super(holder, fetchType);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/JpaFetchTypeFacetDerivedFromJpaBasicAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/MandatoryFacetDerivedFromJpaBasicAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/MandatoryFacetDerivedFromJpaBasicAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/MandatoryFacetDerivedFromJpaBasicAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/MandatoryFacetDerivedFromJpaBasicAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,24 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.basic;
+
+import javax.persistence.Basic;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+
+
+/**
+ * Derived by presence of {@link Basic#optional()} set to <tt>false</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is mandatory.
+ */
+public class MandatoryFacetDerivedFromJpaBasicAnnotation extends
+        MandatoryFacetDefault {
+
+    public MandatoryFacetDerivedFromJpaBasicAnnotation(final FacetHolder holder) {
+        super(holder);
+    }
+
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/MandatoryFacetDerivedFromJpaBasicAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/OptionalFacetDerivedFromJpaBasicAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/OptionalFacetDerivedFromJpaBasicAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/OptionalFacetDerivedFromJpaBasicAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/OptionalFacetDerivedFromJpaBasicAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,37 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.basic;
+
+import javax.persistence.Basic;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+
+/**
+ * Derived by presence of {@link Basic#optional()} set to <tt>true</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i>
+ * mandatory, as per {@link #isInvertedSemantics()}.
+ */
+public class OptionalFacetDerivedFromJpaBasicAnnotation extends
+        MandatoryFacetAbstract {
+
+    public OptionalFacetDerivedFromJpaBasicAnnotation(final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in
+     * fact optional.
+     */
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/basic/OptionalFacetDerivedFromJpaBasicAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnAnnotationFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnAnnotationFacetFactory.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnAnnotationFacetFactory.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnAnnotationFacetFactory.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,30 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.column;
+
+import javax.persistence.Column;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+
+public class JpaColumnAnnotationFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public JpaColumnAnnotationFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        final FacetedMethod holder = processMethodContext.getFacetHolder();
+        final Column annotation = getAnnotation(processMethodContext.getMethod(), Column.class);
+        if (annotation == null) {
+            return;
+        }
+        FacetUtil.addFacet(new JpaColumnFacetAnnotation(annotation.name(), holder));
+        final Facet facet = annotation.nullable() ? new OptionalFacetDerivedFromJpaColumnAnnotation(holder) : new MandatoryFacetDerivedFromJpaColumnAnnotation(holder);
+        FacetUtil.addFacet(facet);
+        FacetUtil.addFacet(new MaxLengthFacetDerivedFromJpaColumnAnnotation(annotation.length(), holder));
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnAnnotationFacetFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacet.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacet.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacet.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,35 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.column;
+
+import javax.persistence.Column;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.named.NamedFacet;
+
+/**
+ * Corresponds to a property with the {@link Column} annotation.
+ * <p>
+ * Maps onto the information in {@link Column} as follows:
+ * <ul>
+ * <li>{@link Column#name()} -> {@link #name()}. Note: not mapped onto a
+ * {@link NamedFacet} subclass because this is a physical name, not a logical
+ * name.</li>
+ * <li>{@link Column#unique()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link Column#nullable()} ->
+ * {@link MandatoryFacetDerivedFromJpaColumnAnnotation} or
+ * {@link OptionalFacetDerivedFromJpaColumnAnnotation}</li>
+ * <li>{@link Column#insertable()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link Column#updatable()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link Column#columnDefinition()} -> (no corresponding attribute or
+ * facet)</li>
+ * <li>{@link Column#table()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link Column#length()} ->
+ * {@link MaxLengthFacetDerivedFromJpaColumnAnnotation}</li>
+ * <li>{@link Column#precision()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link Column#scale()} -> (no corresponding attribute or facet)</li>
+ * </ul>
+ */
+public interface JpaColumnFacet extends Facet {
+
+    String name();
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacetAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacetAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacetAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,26 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.column;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaColumnFacetAnnotation extends FacetAbstract implements
+        JpaColumnFacet {
+
+    public static Class<? extends Facet> type() {
+        return JpaColumnFacet.class;
+    }
+
+    private final String name;
+
+    public JpaColumnFacetAnnotation(final String name, final FacetHolder holder) {
+        super(JpaColumnFacetAnnotation.type(), holder, false);
+        this.name = name;
+    }
+
+    public String name() {
+        return name;
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/JpaColumnFacetAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MandatoryFacetDerivedFromJpaColumnAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MandatoryFacetDerivedFromJpaColumnAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MandatoryFacetDerivedFromJpaColumnAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MandatoryFacetDerivedFromJpaColumnAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,23 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.column;
+
+import javax.persistence.Column;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+
+
+/**
+ * Derived by presence of {@link Column#nullable()} set to <tt>false</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is mandatory.
+ */
+public class MandatoryFacetDerivedFromJpaColumnAnnotation extends
+        MandatoryFacetDefault {
+
+    public MandatoryFacetDerivedFromJpaColumnAnnotation(final FacetHolder holder) {
+        super(holder);
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MandatoryFacetDerivedFromJpaColumnAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MaxLengthFacetDerivedFromJpaColumnAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MaxLengthFacetDerivedFromJpaColumnAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MaxLengthFacetDerivedFromJpaColumnAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MaxLengthFacetDerivedFromJpaColumnAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,22 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.column;
+
+import javax.persistence.Column;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.maxlen.MaxLengthFacetAbstract;
+
+
+/**
+ * Derived from {@link Column#length()}.
+ */
+public class MaxLengthFacetDerivedFromJpaColumnAnnotation extends
+        MaxLengthFacetAbstract {
+
+    public MaxLengthFacetDerivedFromJpaColumnAnnotation(final int value,
+            final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/MaxLengthFacetDerivedFromJpaColumnAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/OptionalFacetDerivedFromJpaColumnAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/OptionalFacetDerivedFromJpaColumnAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/OptionalFacetDerivedFromJpaColumnAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/OptionalFacetDerivedFromJpaColumnAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,37 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.column;
+
+import javax.persistence.Column;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+
+/**
+ * Derived by presence of {@link Column#nullable()} set to <tt>true</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i>
+ * mandatory, as per {@link #isInvertedSemantics()}.
+ */
+public class OptionalFacetDerivedFromJpaColumnAnnotation extends
+        MandatoryFacetAbstract {
+
+    public OptionalFacetDerivedFromJpaColumnAnnotation(final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in
+     * fact optional.
+     */
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/column/OptionalFacetDerivedFromJpaColumnAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/DisabledFacetDerivedFromJpaIdAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/DisabledFacetDerivedFromJpaIdAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/DisabledFacetDerivedFromJpaIdAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/DisabledFacetDerivedFromJpaIdAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,19 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.id;
+
+import javax.persistence.Transient;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.When;
+import org.apache.isis.core.progmodel.facets.members.disable.DisabledFacetImpl;
+
+
+/**
+ * Derived from being {@link Transient}.
+ */
+public class DisabledFacetDerivedFromJpaIdAnnotation extends DisabledFacetImpl {
+
+    public DisabledFacetDerivedFromJpaIdAnnotation(final FacetHolder holder) {
+        super(When.ALWAYS, holder);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/DisabledFacetDerivedFromJpaIdAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdAnnotationFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdAnnotationFacetFactory.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdAnnotationFacetFactory.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdAnnotationFacetFactory.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,31 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.id;
+
+import javax.persistence.Id;
+
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+
+
+public class JpaIdAnnotationFacetFactory extends
+        AnnotationBasedFacetFactoryAbstract {
+
+    public JpaIdAnnotationFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        final Id annotation = getAnnotation(processMethodContext.getMethod(), Id.class);
+        if (annotation == null) {
+            return;
+        }
+
+        final FacetedMethod holder = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new JpaIdFacetAnnotation(holder));
+        FacetUtil.addFacet(new OptionalFacetDerivedFromJpaIdAnnotation(holder));
+        FacetUtil.addFacet(new DisabledFacetDerivedFromJpaIdAnnotation(holder));
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdAnnotationFacetFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacet.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacet.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacet.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,17 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.id;
+
+import javax.persistence.Id;
+
+import org.apache.isis.core.metamodel.facets.MarkerFacet;
+
+
+/**
+ * Corresponds to the property with the {@link Id} annotation.
+ * <p>
+ * The JPA {@link Id} annotation has no attributes, and no other NOF metadata is
+ * derived from it. Internally the JPA object store does use the <tt>Id</tt> to
+ * create the {@link Oid}.
+ */
+public interface JpaIdFacet extends MarkerFacet {
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAbstract.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAbstract.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAbstract.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,18 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.id;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.MarkerFacetAbstract;
+
+
+public abstract class JpaIdFacetAbstract extends MarkerFacetAbstract implements
+        JpaIdFacet {
+
+    public static Class<? extends Facet> type() {
+        return JpaIdFacet.class;
+    }
+
+    public JpaIdFacetAbstract(final FacetHolder holder) {
+        super(JpaIdFacetAbstract.type(), holder);
+    }
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAbstract.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,14 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.id;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaIdFacetAnnotation extends JpaIdFacetImpl {
+
+    public JpaIdFacetAnnotation(final FacetHolder holder) {
+        super(holder);
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetImpl.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetImpl.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetImpl.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,14 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.id;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaIdFacetImpl extends JpaIdFacetAbstract {
+
+    public JpaIdFacetImpl(final FacetHolder holder) {
+        super(holder);
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/JpaIdFacetImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/OptionalFacetDerivedFromJpaIdAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/OptionalFacetDerivedFromJpaIdAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/OptionalFacetDerivedFromJpaIdAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/OptionalFacetDerivedFromJpaIdAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,37 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.id;
+
+import javax.persistence.Id;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+import org.apache.isis.core.metamodel.facets.properties.defaults.PropertyDefaultFacet;
+import org.apache.isis.extensions.jpa.metamodel.facets.prop.version.OptionalFacetDerivedFromJpaVersionAnnotation;
+
+
+/**
+ * Derived by presence of {@link Id}; optional to allow Hibernate to detect
+ * transient objects.
+ * <p>
+ * By default mandatory properties are initialized using the
+ * {@link PropertyDefaultFacet} facet. We don't want this, so this facet marks
+ * the property as optional, meaning that the {@link Id} property is left
+ * untouched by Naked Objects.
+ * 
+ * @see OptionalFacetDerivedFromJpaVersionAnnotation
+ */
+public class OptionalFacetDerivedFromJpaIdAnnotation extends
+        MandatoryFacetDefault {
+
+    public OptionalFacetDerivedFromJpaIdAnnotation(final FacetHolder holder) {
+        super(holder);
+    }
+
+    @Override
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/id/OptionalFacetDerivedFromJpaIdAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnAnnotationFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnAnnotationFacetFactory.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnAnnotationFacetFactory.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnAnnotationFacetFactory.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,31 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.joincolumn;
+
+import java.lang.reflect.Method;
+
+import javax.persistence.JoinColumn;
+
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+
+public class JpaJoinColumnAnnotationFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public JpaJoinColumnAnnotationFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final JoinColumn annotation = getAnnotation(method, JoinColumn.class);
+        if (annotation == null) {
+            return;
+        }
+        final FacetedMethod holder = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new JpaJoinColumnFacetAnnotation(annotation.name(), holder));
+        FacetUtil.addFacet(annotation.nullable() ? new OptionalFacetDerivedFromJpaJoinColumnAnnotation(holder) : new MandatoryFacetDerivedFromJpaJoinColumnAnnotation(holder));
+        return;
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnAnnotationFacetFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacet.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacet.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacet.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,31 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.joincolumn;
+
+import javax.persistence.JoinColumn;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.named.NamedFacet;
+
+/**
+ * Corresponds to a property with the {@link JoinColumn} annotation.
+ * <p>
+ * Maps onto the information in {@link JoinColumn} as follows:
+ * <ul>
+ * <li>{@link JoinColumn#name()} -> {@link #name()}. Note: not mapped onto a
+ * {@link NamedFacet} subclass because this is a physical name, not a logical
+ * name.</li>
+ * <li>{@link JoinColumn#referencedColumnName()} -> (no corresponding facet)</li>
+ * <li>{@link JoinColumn#unique()} -> (no corresponding facet)</li>
+ * <li>{@link JoinColumn#nullable()} ->
+ * {@link MandatoryFacetDerivedFromJpaJoinColumnAnnotation} or
+ * {@link OptionalFacetDerivedFromJpaJoinColumnAnnotation}</li>
+ * <li>{@link JoinColumn#insertable()} -> (no corresponding facet)</li>
+ * <li>{@link JoinColumn#updatable()} -> (no corresponding facet)</li>
+ * <li>{@link JoinColumn#columnDefinition()} -> (no corresponding facet)</li>
+ * <li>{@link JoinColumn#table()} -> (no corresponding facet)</li>
+ * </ul>
+ */
+public interface JpaJoinColumnFacet extends Facet {
+
+    String name();
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacetAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacetAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacetAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,27 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.joincolumn;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaJoinColumnFacetAnnotation extends FacetAbstract implements
+        JpaJoinColumnFacet {
+
+    public static Class<? extends Facet> type() {
+        return JpaJoinColumnFacet.class;
+    }
+
+    private final String name;
+
+    public JpaJoinColumnFacetAnnotation(final String name,
+            final FacetHolder holder) {
+        super(JpaJoinColumnFacetAnnotation.type(), holder, false);
+        this.name = name;
+    }
+
+    public String name() {
+        return name;
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/JpaJoinColumnFacetAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/MandatoryFacetDerivedFromJpaJoinColumnAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/MandatoryFacetDerivedFromJpaJoinColumnAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/MandatoryFacetDerivedFromJpaJoinColumnAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/MandatoryFacetDerivedFromJpaJoinColumnAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,24 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.joincolumn;
+
+import javax.persistence.Basic;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+
+
+/**
+ * Derived by presence of {@link Basic#optional()} set to <tt>false</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is mandatory.
+ */
+public class MandatoryFacetDerivedFromJpaJoinColumnAnnotation extends
+        MandatoryFacetDefault {
+
+    public MandatoryFacetDerivedFromJpaJoinColumnAnnotation(
+            final FacetHolder holder) {
+        super(holder);
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/MandatoryFacetDerivedFromJpaJoinColumnAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/OptionalFacetDerivedFromJpaJoinColumnAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/OptionalFacetDerivedFromJpaJoinColumnAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/OptionalFacetDerivedFromJpaJoinColumnAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/OptionalFacetDerivedFromJpaJoinColumnAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,38 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.joincolumn;
+
+import javax.persistence.Basic;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+
+/**
+ * Derived by presence of {@link Basic#optional()} set to <tt>true</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i>
+ * mandatory, as per {@link #isInvertedSemantics()}.
+ */
+public class OptionalFacetDerivedFromJpaJoinColumnAnnotation extends
+        MandatoryFacetAbstract {
+
+    public OptionalFacetDerivedFromJpaJoinColumnAnnotation(
+            final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in
+     * fact optional.
+     */
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/joincolumn/OptionalFacetDerivedFromJpaJoinColumnAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,17 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.manytoone;
+
+import javax.persistence.FetchType;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.extensions.jpa.metamodel.facets.JpaFetchTypeFacetAbstract;
+
+
+public class JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation extends
+        JpaFetchTypeFacetAbstract {
+
+    public JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation(
+            final FetchType fetchType, final FacetHolder holder) {
+        super(holder, fetchType);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneAnnotationFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneAnnotationFacetFactory.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneAnnotationFacetFactory.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneAnnotationFacetFactory.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,31 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.manytoone;
+
+import java.lang.reflect.Method;
+
+import javax.persistence.ManyToOne;
+
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+
+public class JpaManyToOneAnnotationFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public JpaManyToOneAnnotationFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final ManyToOne annotation = getAnnotation(method, ManyToOne.class);
+        if (annotation == null) {
+            return;
+        }
+        final FacetedMethod holder = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new JpaManyToOneFacetAnnotation(holder));
+        FacetUtil.addFacet(annotation.optional() ? new OptionalFacetDerivedFromJpaManyToOneAnnotation(holder) : new MandatoryFacetDerivedFromJpaManyToOneAnnotation(holder));
+        FacetUtil.addFacet(new JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation(annotation.fetch(), holder));
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneAnnotationFacetFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacet.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacet.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacet.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,25 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.manytoone;
+
+import javax.persistence.ManyToOne;
+
+import org.apache.isis.core.metamodel.facets.MarkerFacet;
+
+
+/**
+ * Corresponds to the property with the {@link ManyToOne} annotation.
+ * <p>
+ * Maps onto the information in {@link ManyToOne} as follows:
+ * <ul>
+ * <li>{@link ManyToOne#targetEntity()} -> (no corresponding attribute or facet)
+ * </li>
+ * <li>{@link ManyToOne#cascade()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link ManyToOne#fetch()} ->
+ * {@link JpaFetchTypeFacetDerivedFromJpaManyToOneAnnotation}</li>
+ * <li>{@link ManyToOne#optional()} ->
+ * {@link MandatoryFacetDerivedFromJpaManyToOneAnnotation} or
+ * {@link MandatoryFacetDerivedFromJpaManyToOneAnnotation}</li>
+ * </ul>
+ */
+public interface JpaManyToOneFacet extends MarkerFacet {
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacetAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacetAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacetAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,19 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.manytoone;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaManyToOneFacetAnnotation extends FacetAbstract implements
+        JpaManyToOneFacet {
+
+    public static Class<? extends Facet> type() {
+        return JpaManyToOneFacet.class;
+    }
+
+    public JpaManyToOneFacetAnnotation(final FacetHolder holder) {
+        super(JpaManyToOneFacetAnnotation.type(), holder, false);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/JpaManyToOneFacetAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/MandatoryFacetDerivedFromJpaManyToOneAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/MandatoryFacetDerivedFromJpaManyToOneAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/MandatoryFacetDerivedFromJpaManyToOneAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/MandatoryFacetDerivedFromJpaManyToOneAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,24 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.manytoone;
+
+import javax.persistence.ManyToOne;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+
+
+/**
+ * Derived by presence of {@link ManyToOne#optional()} set to
+ * <tt>false</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is mandatory.
+ */
+public class MandatoryFacetDerivedFromJpaManyToOneAnnotation extends
+        MandatoryFacetDefault {
+
+    public MandatoryFacetDerivedFromJpaManyToOneAnnotation(
+            final FacetHolder holder) {
+        super(holder);
+    }
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/MandatoryFacetDerivedFromJpaManyToOneAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/OptionalFacetDerivedFromJpaManyToOneAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/OptionalFacetDerivedFromJpaManyToOneAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/OptionalFacetDerivedFromJpaManyToOneAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/OptionalFacetDerivedFromJpaManyToOneAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,39 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.manytoone;
+
+import javax.persistence.ManyToOne;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+
+/**
+ * Derived by presence of {@link ManyToOne#optional()} set to <tt>true</tt>
+ * .
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i>
+ * mandatory, as per {@link #isInvertedSemantics()}.
+ */
+public class OptionalFacetDerivedFromJpaManyToOneAnnotation extends
+        MandatoryFacetAbstract {
+
+    public OptionalFacetDerivedFromJpaManyToOneAnnotation(
+            final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in
+     * fact optional.
+     */
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/manytoone/OptionalFacetDerivedFromJpaManyToOneAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,17 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.onetoone;
+
+import javax.persistence.FetchType;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.extensions.jpa.metamodel.facets.JpaFetchTypeFacetAbstract;
+
+
+public class JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation extends
+        JpaFetchTypeFacetAbstract {
+
+    public JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation(
+            final FetchType fetchType, final FacetHolder holder) {
+        super(holder, fetchType);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneAnnotationFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneAnnotationFacetFactory.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneAnnotationFacetFactory.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneAnnotationFacetFactory.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,31 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.onetoone;
+
+import java.lang.reflect.Method;
+
+import javax.persistence.OneToOne;
+
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethod;
+
+public class JpaOneToOneAnnotationFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public JpaOneToOneAnnotationFacetFactory() {
+        super(FeatureType.PROPERTIES_ONLY);
+    }
+
+    @Override
+    public void process(ProcessMethodContext processMethodContext) {
+        final Method method = processMethodContext.getMethod();
+        final OneToOne annotation = getAnnotation(method, OneToOne.class);
+        if (annotation == null) {
+            return;
+        }
+        final FacetedMethod holder = processMethodContext.getFacetHolder();
+        FacetUtil.addFacet(new JpaOneToOneFacetAnnotation(holder));
+        FacetUtil.addFacet(annotation.optional() ? new OptionalFacetDerivedFromJpaOneToOneAnnotation(holder) : new MandatoryFacetDerivedFromJpaOneToOneAnnotation(holder));
+        FacetUtil.addFacet(new JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation(annotation.fetch(), holder));
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneAnnotationFacetFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacet.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacet.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacet.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,27 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.onetoone;
+
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+
+import org.apache.isis.core.metamodel.facets.MarkerFacet;
+
+
+/**
+ * Corresponds to the property with the {@link ManyToOne} annotation.
+ * <p>
+ * Maps onto the information in {@link ManyToOne} as follows:
+ * <ul>
+ * <li>{@link OneToOne#targetEntity()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link OneToOne#cascade()} -> (no corresponding attribute or facet)</li>
+ * <li>{@link OneToOne#fetch()} ->
+ * {@link JpaFetchTypeFacetDerivedFromJpaOneToOneAnnotation}</li>
+ * <li>{@link OneToOne#optional()} ->
+ * {@link MandatoryFacetDerivedFromJpaOneToOneAnnotation} or
+ * {@link OptionalFacetDerivedFromJpaOneToOneAnnotation}</li>
+ * <li>{@link OneToOne#mappedBy()} -> (no corresponding attribute or facet)</li>
+ * </ul>
+ */
+public interface JpaOneToOneFacet extends MarkerFacet {
+
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacetAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacetAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacetAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,19 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.onetoone;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JpaOneToOneFacetAnnotation extends FacetAbstract implements
+        JpaOneToOneFacet {
+
+    public static Class<? extends Facet> type() {
+        return JpaOneToOneFacet.class;
+    }
+
+    public JpaOneToOneFacetAnnotation(final FacetHolder holder) {
+        super(JpaOneToOneFacetAnnotation.type(), holder, false);
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/JpaOneToOneFacetAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/MandatoryFacetDerivedFromJpaOneToOneAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/MandatoryFacetDerivedFromJpaOneToOneAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/MandatoryFacetDerivedFromJpaOneToOneAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/MandatoryFacetDerivedFromJpaOneToOneAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,24 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.onetoone;
+
+import javax.persistence.OneToOne;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+
+
+/**
+ * Derived by presence of {@link OneToOne#optional()} set to <tt>false</tt>
+ * .
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is mandatory.
+ */
+public class MandatoryFacetDerivedFromJpaOneToOneAnnotation extends
+        MandatoryFacetDefault {
+
+    public MandatoryFacetDerivedFromJpaOneToOneAnnotation(
+            final FacetHolder holder) {
+        super(holder);
+    }
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/MandatoryFacetDerivedFromJpaOneToOneAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/OptionalFacetDerivedFromJpaOneToOneAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/OptionalFacetDerivedFromJpaOneToOneAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/OptionalFacetDerivedFromJpaOneToOneAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/OptionalFacetDerivedFromJpaOneToOneAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,38 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.onetoone;
+
+import javax.persistence.OneToOne;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+
+/**
+ * Derived by presence of {@link OneToOne#optional()} set to <tt>true</tt>.
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i>
+ * mandatory, as per {@link #isInvertedSemantics()}.
+ */
+public class OptionalFacetDerivedFromJpaOneToOneAnnotation extends
+        MandatoryFacetAbstract {
+
+    public OptionalFacetDerivedFromJpaOneToOneAnnotation(
+            final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in
+     * fact optional.
+     */
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/onetoone/OptionalFacetDerivedFromJpaOneToOneAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/transience/DerivedFacetDerivedFromJpaTransientAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/transience/DerivedFacetDerivedFromJpaTransientAnnotation.java?rev=1300890&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/transience/DerivedFacetDerivedFromJpaTransientAnnotation.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/transience/DerivedFacetDerivedFromJpaTransientAnnotation.java Thu Mar 15 10:37:43 2012
@@ -0,0 +1,29 @@
+package org.apache.isis.extensions.jpa.metamodel.facets.prop.transience;
+
+import javax.persistence.Transient;
+
+import org.apache.isis.applib.events.UsabilityEvent;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.notpersisted.NotPersistedFacetAbstract;
+import org.apache.isis.core.metamodel.interactions.UsabilityContext;
+
+
+/**
+ * Derived from being {@link Transient}.
+ */
+public class DerivedFacetDerivedFromJpaTransientAnnotation extends
+		NotPersistedFacetAbstract {
+
+    public DerivedFacetDerivedFromJpaTransientAnnotation(
+            final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <i>Derived</i>.
+     */
+    public String disables(final UsabilityContext<? extends UsabilityEvent> ic) {
+        return "JPA transient";
+    }
+
+}

Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-metamodel/src/main/java/org/apache/isis/extensions/jpa/metamodel/facets/prop/transience/DerivedFacetDerivedFromJpaTransientAnnotation.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message