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 2012/12/13 08:30:03 UTC
[17/58] [partial] ISIS-188: renaming packages in line with
groupId:artifactId
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorAnnotationFacetFactory.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorAnnotationFacetFactory.java
new file mode 100644
index 0000000..8976bd4
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorAnnotationFacetFactory.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.objectstore.jdo.metamodel.facets.object.discriminator;
+
+import javax.jdo.annotations.Discriminator;
+
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+public class JdoDiscriminatorAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public JdoDiscriminatorAnnotationFacetFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processClassContext) {
+
+ final Discriminator annotation = Annotations.getAnnotation(processClassContext.getCls(), Discriminator.class);
+ if (annotation == null) {
+ return;
+ }
+ final String annotationValueAttribute = annotation.value();
+
+ FacetUtil.addFacet(new ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation(annotationValueAttribute, processClassContext.getFacetHolder()));
+ FacetUtil.addFacet(new JdoDiscriminatorFacetDefault(annotationValueAttribute, processClassContext.getFacetHolder()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacet.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacet.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacet.java
new file mode 100644
index 0000000..bb3195a
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacet.java
@@ -0,0 +1,25 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.discriminator;
+
+import org.apache.isis.core.metamodel.facets.SingleValueFacet;
+
+public interface JdoDiscriminatorFacet extends SingleValueFacet<String> {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacetDefault.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacetDefault.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacetDefault.java
new file mode 100644
index 0000000..a1ef0b0
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/JdoDiscriminatorFacetDefault.java
@@ -0,0 +1,30 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.discriminator;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
+
+public class JdoDiscriminatorFacetDefault extends SingleValueFacetAbstract<String> implements JdoDiscriminatorFacet {
+
+ public JdoDiscriminatorFacetDefault(String value, FacetHolder holder) {
+ super(JdoDiscriminatorFacet.class, value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation.java
new file mode 100644
index 0000000..068152c
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation.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.objectstore.jdo.metamodel.facets.object.discriminator;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.objecttype.ObjectSpecIdFacetAbstract;
+
+
+public class ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation extends
+ ObjectSpecIdFacetAbstract {
+
+ public ObjectSpecIdFacetInferredFromJdoDiscriminatorValueAnnotation(final String value,
+ final FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/package-info.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/package-info.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/package-info.java
new file mode 100644
index 0000000..ec9f227
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/discriminator/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.isis.objectstore.jdo.metamodel.facets.object.discriminator;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyAnnotationFacetFactory.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyAnnotationFacetFactory.java
new file mode 100644
index 0000000..230b242
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyAnnotationFacetFactory.java
@@ -0,0 +1,53 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.embeddedonly;
+
+import javax.jdo.annotations.EmbeddedOnly;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+
+public class JdoEmbeddedOnlyAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public JdoEmbeddedOnlyAnnotationFacetFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processMethodContext) {
+ final EmbeddedOnly annotation = Annotations.getAnnotation(processMethodContext.getCls(), EmbeddedOnly.class);
+ if (annotation == null) {
+ return;
+ }
+
+ final FacetHolder facetHolder = processMethodContext.getFacetHolder();
+ FacetUtil
+ .addFacet(new ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation(
+ facetHolder));
+ FacetUtil.addFacet(new JdoEmbeddedOnlyFacetAnnotation(facetHolder));
+
+ return;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacet.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacet.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacet.java
new file mode 100644
index 0000000..4c4dd41
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacet.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.objectstore.jdo.metamodel.facets.object.embeddedonly;
+
+import org.apache.isis.core.metamodel.facets.MarkerFacet;
+
+/**
+ * Corresponds to annotating the class with {@link Embeddable}.
+ * <p>
+ * The JPA {@link Embeddable} annotation has no attributes. However, in addition
+ * to this facet it does also implicitly map to
+ * {@link ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation}.
+ */
+public interface JdoEmbeddedOnlyFacet extends MarkerFacet {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacetAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacetAnnotation.java
new file mode 100644
index 0000000..7e51d21
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/JdoEmbeddedOnlyFacetAnnotation.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.objectstore.jdo.metamodel.facets.object.embeddedonly;
+
+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 JdoEmbeddedOnlyFacetAnnotation extends FacetAbstract implements
+ JdoEmbeddedOnlyFacet {
+
+ public static Class<? extends Facet> type() {
+ return JdoEmbeddedOnlyFacet.class;
+ }
+
+ public JdoEmbeddedOnlyFacetAnnotation(final FacetHolder holder) {
+ super(JdoEmbeddedOnlyFacetAnnotation.type(), holder, Derivation.NOT_DERIVED);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation.java
new file mode 100644
index 0000000..830f3c7
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation.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.objectstore.jdo.metamodel.facets.object.embeddedonly;
+
+import javax.jdo.annotations.EmbeddedOnly;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.aggregated.ParentedFacetAbstract;
+
+/**
+ * Derived from being {@link EmbeddedOnly}.
+ */
+public class ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation extends
+ ParentedFacetAbstract {
+
+ public ParentedFacetDerivedFromJdoEmbeddedOnlyAnnotation(
+ final FacetHolder holder) {
+ super(holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/package-info.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/package-info.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/package-info.java
new file mode 100644
index 0000000..cb5e213
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/embeddedonly/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableAnnotationFacetFactory.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableAnnotationFacetFactory.java
new file mode 100644
index 0000000..2d68583
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableAnnotationFacetFactory.java
@@ -0,0 +1,58 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.persistencecapable;
+
+
+import javax.jdo.annotations.IdentityType;
+import javax.jdo.annotations.PersistenceCapable;
+
+import org.apache.isis.core.commons.lang.StringUtils;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+
+public class JdoPersistenceCapableAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public JdoPersistenceCapableAnnotationFacetFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processClassContext) {
+ final Class<?> cls = processClassContext.getCls();
+ final PersistenceCapable annotation = Annotations.getAnnotation(cls, PersistenceCapable.class);
+ if (annotation == null) {
+ return;
+ }
+ String annotationTableAttribute = annotation.table();
+ if (StringUtils.isNullOrEmpty(annotationTableAttribute)) {
+ annotationTableAttribute = cls.getSimpleName();
+ }
+
+ final IdentityType annotationIdentityType = annotation.identityType();
+
+ FacetUtil.addFacet(new JdoPersistenceCapableFacetAnnotation(
+ annotationTableAttribute, annotationIdentityType, processClassContext.getFacetHolder()));
+ return;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacet.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacet.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacet.java
new file mode 100644
index 0000000..2ed6d3f
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacet.java
@@ -0,0 +1,36 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.persistencecapable;
+
+
+import javax.jdo.annotations.IdentityType;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+
+/**
+ * Corresponds to annotating the class with the {@link PersistenceCapable} annotation.
+ */
+public interface JdoPersistenceCapableFacet extends Facet {
+
+ IdentityType getIdentityType();
+
+ String getTable();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAbstract.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAbstract.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAbstract.java
new file mode 100644
index 0000000..305d864
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAbstract.java
@@ -0,0 +1,51 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.persistencecapable;
+
+import javax.jdo.annotations.IdentityType;
+
+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 abstract class JdoPersistenceCapableFacetAbstract extends FacetAbstract implements
+ JdoPersistenceCapableFacet {
+
+ public static Class<? extends Facet> type() {
+ return JdoPersistenceCapableFacet.class;
+ }
+
+ private final String table;
+ private final IdentityType identityType;
+
+ public JdoPersistenceCapableFacetAbstract(final String table, IdentityType identityType, final FacetHolder holder) {
+ super(JdoPersistenceCapableFacetAbstract.type(), holder, Derivation.NOT_DERIVED);
+ this.table = table;
+ this.identityType = identityType;
+ }
+
+ public IdentityType getIdentityType() {
+ return identityType;
+ }
+
+ public String getTable() {
+ return table;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAnnotation.java
new file mode 100644
index 0000000..900b1ac
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetAnnotation.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.objectstore.jdo.metamodel.facets.object.persistencecapable;
+
+import javax.jdo.annotations.IdentityType;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JdoPersistenceCapableFacetAnnotation extends JdoPersistenceCapableFacetImpl {
+
+ public JdoPersistenceCapableFacetAnnotation(final String name, IdentityType identityType, final FacetHolder holder) {
+ super(name, identityType, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetImpl.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetImpl.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetImpl.java
new file mode 100644
index 0000000..a3fedec
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetImpl.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.objectstore.jdo.metamodel.facets.object.persistencecapable;
+
+import javax.jdo.annotations.IdentityType;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JdoPersistenceCapableFacetImpl extends JdoPersistenceCapableFacetAbstract {
+
+ public JdoPersistenceCapableFacetImpl(final String table, IdentityType identityType, final FacetHolder holder) {
+ super(table, identityType, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/package-info.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/package-info.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/package-info.java
new file mode 100644
index 0000000..ab49c39
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/persistencecapable/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoNamedQuery.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoNamedQuery.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoNamedQuery.java
new file mode 100644
index 0000000..652aaa0
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoNamedQuery.java
@@ -0,0 +1,100 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.query;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
+import javax.jdo.annotations.Query;
+
+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.jdo.annotations.Query}.
+ *
+ * @see {@link JdoQueryFacet}.
+ */
+public final class JdoNamedQuery {
+
+ private final String name;
+ private final String query;
+ private final ObjectSpecification objSpec;
+
+ public JdoNamedQuery(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.objSpec = noSpec;
+ }
+
+ public JdoNamedQuery(final Query jdoNamedQuery,
+ final ObjectSpecification objSpec) {
+ this(jdoNamedQuery.name(), jdoNamedQuery.value(), objSpec);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public ObjectSpecification getObjectSpecification() {
+ return objSpec;
+ }
+
+ @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 JdoNamedQuery other = (JdoNamedQuery) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueriesFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueriesFacetAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueriesFacetAnnotation.java
new file mode 100644
index 0000000..bc90eba
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueriesFacetAnnotation.java
@@ -0,0 +1,36 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.query;
+
+import javax.jdo.annotations.Query;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JdoQueriesFacetAnnotation extends JdoQueryFacetAbstract
+ implements JdoQueryFacet {
+
+ public JdoQueriesFacetAnnotation(final Query[] jdoNamedQueries,
+ final FacetHolder holder) {
+ super(holder);
+ add(jdoNamedQueries);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryAnnotationFacetFactory.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryAnnotationFacetFactory.java
new file mode 100644
index 0000000..d58a1f0
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryAnnotationFacetFactory.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.objectstore.jdo.metamodel.facets.object.query;
+
+import javax.jdo.annotations.Queries;
+import javax.jdo.annotations.Query;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+
+
+public class JdoQueryAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public JdoQueryAnnotationFacetFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processClassContext) {
+ final Class<?> cls = processClassContext.getCls();
+ final Queries namedQueriesAnnotation = Annotations.getAnnotation(cls, Queries.class);
+ final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+ if (namedQueriesAnnotation != null) {
+ FacetUtil.addFacet(new JdoQueriesFacetAnnotation(
+ namedQueriesAnnotation.value(), facetHolder));
+ return;
+ }
+
+ final Query namedQueryAnnotation = Annotations.getAnnotation(cls, Query.class);
+ if (namedQueryAnnotation != null) {
+ FacetUtil.addFacet(new JdoQueryFacetAnnotation(
+ namedQueryAnnotation, facetHolder));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacet.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacet.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacet.java
new file mode 100644
index 0000000..e6cd552
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacet.java
@@ -0,0 +1,59 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.query;
+
+import java.util.List;
+
+import javax.jdo.annotations.Query;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+
+/**
+ * In the standard JDO Model, corresponds to annotating the class with either
+ * {@link javax.jdo.annotations.Query} or
+ * {@link javax.jdo.annotations.Queries}.
+ * <p>
+ * For a {@link javax.jdo.annotations.Query}, returns a singleton list of
+ * {@link JdoNamedQuery}.
+ * For a {@link javax.jdo.annotations.Queries}, returns a list of
+ * {@link JdoNamedQuery}s.
+ * <p>
+ * In both cases, mapping is as follows
+ * <ul>
+ * <li>{@link javax.jdo.annotations.Query#name()} ->
+ * {@link JdoNamedQuery#getName()
+ * getName()} property of JDO Object Store's own
+ * {@link JdoNamedQuery} value object</li>
+ * <li>{@link javax.jdo.annotations.Query#value()} ->
+ * {@link JdoNamedQuery#getQuery()}
+ * property of JDO Object Store's own
+ * {@link JdoNamedQuery} value object</li>
+ * </ul>
+ *
+ * <p>
+ * Optional attributes of the {@link Query} annotation are not currently mapped.
+ */
+public interface JdoQueryFacet extends Facet {
+
+ /**
+ * Returns an immutable {@link List}.
+ */
+ List<JdoNamedQuery> getNamedQueries();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAbstract.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAbstract.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAbstract.java
new file mode 100644
index 0000000..dbce1c6
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAbstract.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.objectstore.jdo.metamodel.facets.object.query;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.jdo.annotations.Query;
+
+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 JdoQueryFacetAbstract extends FacetAbstract implements
+ JdoQueryFacet {
+
+ public static Class<? extends Facet> type() {
+ return JdoQueryFacet.class;
+ }
+
+ private final List<JdoNamedQuery> namedQueries = new ArrayList<JdoNamedQuery>();
+
+ public JdoQueryFacetAbstract(final FacetHolder holder) {
+ super(JdoQueryFacetAbstract.type(), holder, Derivation.NOT_DERIVED);
+ }
+
+ protected void add(final Query... jdoNamedQueries) {
+ final ObjectSpecification objSpec = (ObjectSpecification) getFacetHolder();
+ for (final Query jdoNamedQuery : jdoNamedQueries) {
+ namedQueries.add(new JdoNamedQuery(jdoNamedQuery, objSpec));
+ }
+ }
+
+ public List<JdoNamedQuery> getNamedQueries() {
+ return Collections.unmodifiableList(namedQueries);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAnnotation.java
new file mode 100644
index 0000000..c033939
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/object/query/JdoQueryFacetAnnotation.java
@@ -0,0 +1,36 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.object.query;
+
+import javax.jdo.annotations.Query;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JdoQueryFacetAnnotation extends JdoQueryFacetAbstract
+ implements JdoQueryFacet {
+
+ public JdoQueryFacetAnnotation(final Query jdoNamedQuery,
+ final FacetHolder holder) {
+ super(holder);
+ add(jdoNamedQuery);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java
new file mode 100644
index 0000000..0a133fa
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java
@@ -0,0 +1,36 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.members.disabled.DisabledFacetImpl;
+
+
+/**
+ * Derived from being {@link Transient}.
+ */
+public class DisabledFacetDerivedFromJdoPrimaryKeyAnnotation extends DisabledFacetImpl {
+
+ public DisabledFacetDerivedFromJdoPrimaryKeyAnnotation(final FacetHolder holder) {
+ super(When.ALWAYS, Where.ANYWHERE, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyAnnotationFacetFactory.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyAnnotationFacetFactory.java
new file mode 100644
index 0000000..0f7e73c
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyAnnotationFacetFactory.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import javax.jdo.annotations.PrimaryKey;
+
+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.FacetedMethod;
+
+
+public class JdoPrimaryKeyAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public JdoPrimaryKeyAnnotationFacetFactory() {
+ super(FeatureType.PROPERTIES_ONLY);
+ }
+
+ @Override
+ public void process(ProcessMethodContext processMethodContext) {
+ final PrimaryKey annotation = Annotations.getAnnotation(processMethodContext.getMethod(), PrimaryKey.class);
+ if (annotation == null) {
+ return;
+ }
+
+ final FacetedMethod holder = processMethodContext.getFacetHolder();
+ FacetUtil.addFacet(new JdoPrimaryKeyFacetAnnotation(holder));
+ FacetUtil.addFacet(new OptionalFacetDerivedFromJdoPrimaryKeyAnnotation(holder));
+ FacetUtil.addFacet(new DisabledFacetDerivedFromJdoPrimaryKeyAnnotation(holder));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacet.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacet.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacet.java
new file mode 100644
index 0000000..df63d00
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacet.java
@@ -0,0 +1,34 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import javax.jdo.annotations.PrimaryKey;
+
+import org.apache.isis.core.metamodel.facets.MarkerFacet;
+
+
+/**
+ * Corresponds to the property with the {@link PrimaryKey} annotation.
+ * <p>
+ * The JDO {@link PrimaryKey} annotation is used internally the JDO object store to
+ * create the {@link Oid}.
+ */
+public interface JdoPrimaryKeyFacet extends MarkerFacet {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAbstract.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAbstract.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAbstract.java
new file mode 100644
index 0000000..93d9064
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAbstract.java
@@ -0,0 +1,36 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+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 JdoPrimaryKeyFacetAbstract extends MarkerFacetAbstract implements
+ JdoPrimaryKeyFacet {
+
+ public static Class<? extends Facet> type() {
+ return JdoPrimaryKeyFacet.class;
+ }
+
+ public JdoPrimaryKeyFacetAbstract(final FacetHolder holder) {
+ super(JdoPrimaryKeyFacetAbstract.type(), holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAnnotation.java
new file mode 100644
index 0000000..f4517a5
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetAnnotation.java
@@ -0,0 +1,30 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JdoPrimaryKeyFacetAnnotation extends JdoPrimaryKeyFacetImpl {
+
+ public JdoPrimaryKeyFacetAnnotation(final FacetHolder holder) {
+ super(holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java
new file mode 100644
index 0000000..9a9080a
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/JdoPrimaryKeyFacetImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JdoPrimaryKeyFacetImpl extends JdoPrimaryKeyFacetAbstract {
+
+ public JdoPrimaryKeyFacetImpl(final FacetHolder holder) {
+ super(holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java
new file mode 100644
index 0000000..3bc5382
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/OptionalFacetDerivedFromJdoPrimaryKeyAnnotation.java
@@ -0,0 +1,50 @@
+/*
+ * 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.objectstore.jdo.metamodel.facets.prop.primarykey;
+
+import javax.jdo.annotations.PrimaryKey;
+
+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;
+
+
+/**
+ * Derived by presence of {@link PrimaryKey}.
+ *
+ * <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 PrimaryKey} property is left
+ * untouched by Isis.
+ */
+public class OptionalFacetDerivedFromJdoPrimaryKeyAnnotation extends
+ MandatoryFacetDefault {
+
+ public OptionalFacetDerivedFromJdoPrimaryKeyAnnotation(final FacetHolder holder) {
+ super(holder);
+ }
+
+ @Override
+ public boolean isInvertedSemantics() {
+ return true;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/package-info.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/package-info.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/package-info.java
new file mode 100644
index 0000000..5f7a574
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/facets/prop/primarykey/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * 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.
+ */
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+package org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
new file mode 100644
index 0000000..5db1f76
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/specloader/validator/JdoMetaModelValidator.java
@@ -0,0 +1,85 @@
+/*
+ * 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.objectstore.jdo.metamodel.specloader.validator;
+
+import javax.jdo.annotations.IdentityType;
+
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorVisiting;
+import org.apache.isis.core.metamodel.specloader.validator.ValidationFailures;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
+
+public class JdoMetaModelValidator extends MetaModelValidatorComposite {
+
+ public JdoMetaModelValidator() {
+ addValidatorToEnsurePersistenceCapables();
+
+ addValidatorToEnsureIdentityType();
+ }
+
+ private void addValidatorToEnsurePersistenceCapables() {
+ final MetaModelValidatorVisiting.SummarizingVisitor ensurePersistenceCapables = new MetaModelValidatorVisiting.SummarizingVisitor(){
+
+ private boolean found = false;
+ @Override
+ public boolean visit(ObjectSpecification objectSpec, ValidationFailures validationFailures) {
+ boolean containsFacet = objectSpec.containsFacet(JdoPersistenceCapableFacet.class);
+ if(containsFacet) {
+ found = true;
+ return false; // no need to keep searching
+ }
+ return true; // keep searching
+ }
+
+ @Override
+ public void summarize(ValidationFailures validationFailures) {
+ if(!found) {
+ validationFailures.add("DataNucleus object store: no @PersistenceCapable found. " +
+ "(Are the entities referenced by the registered services? " +
+ "are all services registered? " +
+ "are you using the JDO programming model facets?)");
+ }
+ }
+ };
+ add(new MetaModelValidatorVisiting(ensurePersistenceCapables));
+ }
+
+ private void addValidatorToEnsureIdentityType() {
+ MetaModelValidatorVisiting.Visitor ensureIdentityType = new MetaModelValidatorVisiting.Visitor(){
+ @Override
+ public boolean visit(ObjectSpecification objSpec, ValidationFailures validationFailures) {
+ final JdoPersistenceCapableFacet jpcf = objSpec.getFacet(JdoPersistenceCapableFacet.class);
+ if(jpcf == null) {
+ return true;
+ }
+ final IdentityType identityType = jpcf.getIdentityType();
+ if(identityType != IdentityType.DATASTORE && identityType != IdentityType.UNSPECIFIED) {
+ validationFailures.add("DataNucleus object store: %s must be annotated with @PersistenceCapable, with an identityType of either DATASTORE or UNSPECIFIED (has an identityType of %s)", objSpec.getFullIdentifier(), identityType);
+ }
+
+ return true;
+ // TODO: ensure that DATASTORE has recognised @DatastoreIdentity attribute
+ }};
+
+ add(new MetaModelValidatorVisiting(ensureIdentityType));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java
new file mode 100644
index 0000000..911ffd5
--- /dev/null
+++ b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/objectstore/jdo/metamodel/util/JdoPrimaryKeyPropertyFilter.java
@@ -0,0 +1,47 @@
+/*
+ * 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.objectstore.jdo.metamodel.util;
+
+
+import javax.jdo.annotations.PrimaryKey;
+
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.properties.modify.PropertySetterFacet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey.JdoPrimaryKeyFacet;
+
+/**
+ * Use to locate the property annotated with {@link PrimaryKey}.
+ * <p>
+ * In addition, must also be a {@link OneToOneAssociation}, and can be
+ * {@link PropertyAccessorFacet read}.
+ * <p>
+ * Note that it is NOT necessary for there to be a facet to
+ * {@link PropertySetterFacet set} the property.
+ */
+public final class JdoPrimaryKeyPropertyFilter implements Filter<ObjectAssociation> {
+ @Override
+ public boolean accept(final ObjectAssociation noa) {
+ return noa.isOneToOneAssociation() &&
+ noa.containsFacet(JdoPrimaryKeyFacet.class) &&
+ noa.containsFacet(PropertyOrCollectionAccessorFacet.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableAnnotationFacetFactory.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableAnnotationFacetFactory.java
deleted file mode 100644
index 4cc2912..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableAnnotationFacetFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable;
-
-
-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.runtimes.dflt.objectstores.jdo.applib.annotations.Auditable;
-
-
-public class AuditableAnnotationFacetFactory extends FacetFactoryAbstract {
-
- public AuditableAnnotationFacetFactory() {
- super(FeatureType.OBJECTS_ONLY);
- }
-
- @Override
- public void process(ProcessClassContext processClassContext) {
- final Class<?> cls = processClassContext.getCls();
- final Auditable annotation = Annotations.getAnnotation(cls, Auditable.class);
- if (annotation == null) {
- return;
- }
- FacetUtil.addFacet(new AuditableFacetAnnotation(
- processClassContext.getFacetHolder()));
- return;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacet.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacet.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacet.java
deleted file mode 100644
index 5e75f9c..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacet.java
+++ /dev/null
@@ -1,31 +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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable;
-
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.applib.annotations.Auditable;
-
-
-/**
- * Corresponds to annotating the class with the {@link Auditable} annotation.
- */
-public interface AuditableFacet extends Facet {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAbstract.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAbstract.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAbstract.java
deleted file mode 100644
index e67cc50..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAbstract.java
+++ /dev/null
@@ -1,39 +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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable;
-
-
-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 abstract class AuditableFacetAbstract extends FacetAbstract implements
- AuditableFacet {
-
-
- public static Class<? extends Facet> type() {
- return AuditableFacet.class;
- }
-
- public AuditableFacetAbstract(FacetHolder facetHolder) {
- super(AuditableFacetAbstract.type(), facetHolder, Derivation.NOT_DERIVED);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAnnotation.java b/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAnnotation.java
deleted file mode 100644
index 4ff066d..0000000
--- a/component/objectstore/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/auditable/AuditableFacetAnnotation.java
+++ /dev/null
@@ -1,31 +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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.auditable;
-
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-
-public class AuditableFacetAnnotation extends AuditableFacetImpl {
-
- public AuditableFacetAnnotation(FacetHolder facetHolder) {
- super(facetHolder);
- }
-
-}