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/04 23:31:00 UTC
[35/47] ISIS-188: normalizing file endings throughout
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
index b91b1a1..101ad9b 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryFindUsingApplibQueryProcessor.java
@@ -16,82 +16,82 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-
-import com.google.common.collect.Maps;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
-import org.apache.isis.core.metamodel.spec.ObjectAdapterUtils;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusObjectStore;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.metamodel.JdoPropertyUtils;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer;
-import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindUsingApplibQueryDefault;
-
-public class PersistenceQueryFindUsingApplibQueryProcessor extends PersistenceQueryProcessorAbstract<PersistenceQueryFindUsingApplibQueryDefault> {
-
- public PersistenceQueryFindUsingApplibQueryProcessor(final PersistenceManager persistenceManager, final FrameworkSynchronizer frameworkSynchronizer) {
- super(persistenceManager, frameworkSynchronizer);
- }
-
- public List<ObjectAdapter> process(final PersistenceQueryFindUsingApplibQueryDefault persistenceQuery) {
- final String queryName = persistenceQuery.getQueryName();
- final Map<String, Object> map = unwrap(persistenceQuery.getArgumentsAdaptersByParameterName());
- final QueryCardinality cardinality = persistenceQuery.getCardinality();
- final ObjectSpecification objectSpec = persistenceQuery.getSpecification();
-
- final List<?> results;
- if((objectSpec.getFullIdentifier() + "#pk").equals(queryName)) {
- // special case handling
- final Class<?> cls = objectSpec.getCorrespondingClass();
- if(!JdoPropertyUtils.hasPrimaryKeyProperty(objectSpec)) {
- throw new UnsupportedOperationException("cannot search by primary key for DataStore-assigned entities");
- }
- final OneToOneAssociation pkOtoa = JdoPropertyUtils.getPrimaryKeyPropertyFor(objectSpec);
- String pkOtoaId = pkOtoa.getId();
- final String filter = pkOtoaId + "==" + map.get(pkOtoaId);
- final Query jdoQuery = getPersistenceManager().newQuery(cls, filter);
- results = (List<?>) jdoQuery.execute();
- } else {
- results = getResults(objectSpec, queryName, map, cardinality);
- }
-
- return loadAdapters(objectSpec, results);
- }
-
- private List<?> getResults(ObjectSpecification objectSpec, final String queryName, final Map<String, Object> argumentsByParameterName, final QueryCardinality cardinality) {
-
- final PersistenceManager persistenceManager = getJdoObjectStore().getPersistenceManager();
- final Class<?> cls = objectSpec.getCorrespondingClass();
- final Query jdoQuery = persistenceManager.newNamedQuery(cls, queryName);
-
- final List<?> results = (List<?>) jdoQuery.executeWithMap(argumentsByParameterName);
- if (cardinality == QueryCardinality.MULTIPLE) {
- return results;
- }
- return results.isEmpty()?Collections.emptyList():results.subList(0, 1);
- }
-
- private static Map<String, Object> unwrap(final Map<String, ObjectAdapter> argumentAdaptersByParameterName) {
- final Map<String, Object> argumentsByParameterName = Maps.newHashMap();
- for (final String parameterName : argumentAdaptersByParameterName.keySet()) {
- final ObjectAdapter argumentAdapter = argumentAdaptersByParameterName.get(parameterName);
- final Object argument = ObjectAdapterUtils.unwrapObject(argumentAdapter);
- argumentsByParameterName.put(parameterName, argument);
- }
- return argumentsByParameterName;
- }
-
-
-}
-
-// Copyright (c) Naked Objects Group Ltd.
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
+import org.apache.isis.core.metamodel.spec.ObjectAdapterUtils;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusObjectStore;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.metamodel.JdoPropertyUtils;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer;
+import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindUsingApplibQueryDefault;
+
+public class PersistenceQueryFindUsingApplibQueryProcessor extends PersistenceQueryProcessorAbstract<PersistenceQueryFindUsingApplibQueryDefault> {
+
+ public PersistenceQueryFindUsingApplibQueryProcessor(final PersistenceManager persistenceManager, final FrameworkSynchronizer frameworkSynchronizer) {
+ super(persistenceManager, frameworkSynchronizer);
+ }
+
+ public List<ObjectAdapter> process(final PersistenceQueryFindUsingApplibQueryDefault persistenceQuery) {
+ final String queryName = persistenceQuery.getQueryName();
+ final Map<String, Object> map = unwrap(persistenceQuery.getArgumentsAdaptersByParameterName());
+ final QueryCardinality cardinality = persistenceQuery.getCardinality();
+ final ObjectSpecification objectSpec = persistenceQuery.getSpecification();
+
+ final List<?> results;
+ if((objectSpec.getFullIdentifier() + "#pk").equals(queryName)) {
+ // special case handling
+ final Class<?> cls = objectSpec.getCorrespondingClass();
+ if(!JdoPropertyUtils.hasPrimaryKeyProperty(objectSpec)) {
+ throw new UnsupportedOperationException("cannot search by primary key for DataStore-assigned entities");
+ }
+ final OneToOneAssociation pkOtoa = JdoPropertyUtils.getPrimaryKeyPropertyFor(objectSpec);
+ String pkOtoaId = pkOtoa.getId();
+ final String filter = pkOtoaId + "==" + map.get(pkOtoaId);
+ final Query jdoQuery = getPersistenceManager().newQuery(cls, filter);
+ results = (List<?>) jdoQuery.execute();
+ } else {
+ results = getResults(objectSpec, queryName, map, cardinality);
+ }
+
+ return loadAdapters(objectSpec, results);
+ }
+
+ private List<?> getResults(ObjectSpecification objectSpec, final String queryName, final Map<String, Object> argumentsByParameterName, final QueryCardinality cardinality) {
+
+ final PersistenceManager persistenceManager = getJdoObjectStore().getPersistenceManager();
+ final Class<?> cls = objectSpec.getCorrespondingClass();
+ final Query jdoQuery = persistenceManager.newNamedQuery(cls, queryName);
+
+ final List<?> results = (List<?>) jdoQuery.executeWithMap(argumentsByParameterName);
+ if (cardinality == QueryCardinality.MULTIPLE) {
+ return results;
+ }
+ return results.isEmpty()?Collections.emptyList():results.subList(0, 1);
+ }
+
+ private static Map<String, Object> unwrap(final Map<String, ObjectAdapter> argumentAdaptersByParameterName) {
+ final Map<String, Object> argumentsByParameterName = Maps.newHashMap();
+ for (final String parameterName : argumentAdaptersByParameterName.keySet()) {
+ final ObjectAdapter argumentAdapter = argumentAdaptersByParameterName.get(parameterName);
+ final Object argument = ObjectAdapterUtils.unwrapObject(argumentAdapter);
+ argumentsByParameterName.put(parameterName, argument);
+ }
+ return argumentsByParameterName;
+ }
+
+
+}
+
+// Copyright (c) Naked Objects Group Ltd.
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessor.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessor.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessor.java
index ab445de..7e1c768 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessor.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessor.java
@@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceQuery;
-
-public interface PersistenceQueryProcessor<T extends PersistenceQuery> {
- List<ObjectAdapter> process(T query);
-}
-
-// Copyright (c) Naked Objects Group Ltd.
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceQuery;
+
+public interface PersistenceQueryProcessor<T extends PersistenceQuery> {
+ List<ObjectAdapter> process(T query);
+}
+
+// Copyright (c) Naked Objects Group Ltd.
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
index 0f1045c..db4cd46 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
@@ -16,92 +16,92 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
-
-import java.util.List;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
-import javax.jdo.listener.InstanceLifecycleEvent;
-import javax.jdo.metadata.TypeMetadata;
-import javax.jdo.spi.PersistenceCapable;
-
-import com.google.common.collect.Lists;
-
-import org.apache.isis.core.commons.ensure.Assert;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusObjectStore;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer.CalledFrom;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.IsisLifecycleListener;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManagerSpi;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceQuery;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.Persistor;
-
-public abstract class PersistenceQueryProcessorAbstract<T extends PersistenceQuery>
- implements PersistenceQueryProcessor<T> {
-
- private final PersistenceManager persistenceManager;
- private final FrameworkSynchronizer frameworkSynchronizer;
-
- protected PersistenceQueryProcessorAbstract(final PersistenceManager persistenceManager, final FrameworkSynchronizer frameworkSynchronizer) {
- this.persistenceManager = persistenceManager;
- this.frameworkSynchronizer = frameworkSynchronizer;
- }
-
- protected PersistenceManager getPersistenceManager() {
- return persistenceManager;
- }
-
-
- // /////////////////////////////////////////////////////////////
- // helpers for subclasses
- // /////////////////////////////////////////////////////////////
-
- protected PersistenceManagerFactory getPersistenceManagerFactory() {
- return getPersistenceManager().getPersistenceManagerFactory();
- }
-
- protected TypeMetadata getTypeMetadata(final String classFullName) {
- return getPersistenceManagerFactory().getMetadata(classFullName);
- }
-
- /**
- * Traversing the provided list causes (or should cause) the
- * {@link IsisLifecycleListener#postLoad(InstanceLifecycleEvent) {
- * to be called.
- */
- protected List<ObjectAdapter> loadAdapters(
- final ObjectSpecification specification, final List<?> pojos) {
- final List<ObjectAdapter> adapters = Lists.newArrayList();
- for (final Object pojo : pojos) {
- // ought not to be necessary, however for some queries it seems that the
- // lifecycle listener is not called
- frameworkSynchronizer.postLoadProcessingFor((PersistenceCapable) pojo, CalledFrom.OS_QUERY);
- ObjectAdapter adapter = getAdapterManager().getAdapterFor(pojo);
- Assert.assertNotNull(adapter);
- adapters.add(adapter);
- }
- return adapters;
- }
-
- // /////////////////////////////////////////////////////////////
- // Dependencies (from context)
- // /////////////////////////////////////////////////////////////
-
- protected Persistor getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- protected AdapterManager getAdapterManager() {
- return IsisContext.getPersistenceSession().getAdapterManager();
- }
-
- protected DataNucleusObjectStore getJdoObjectStore() {
- return (DataNucleusObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- }
-
-}
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
+
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.listener.InstanceLifecycleEvent;
+import javax.jdo.metadata.TypeMetadata;
+import javax.jdo.spi.PersistenceCapable;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.core.commons.ensure.Assert;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusObjectStore;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.FrameworkSynchronizer.CalledFrom;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.IsisLifecycleListener;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManagerSpi;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceQuery;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.Persistor;
+
+public abstract class PersistenceQueryProcessorAbstract<T extends PersistenceQuery>
+ implements PersistenceQueryProcessor<T> {
+
+ private final PersistenceManager persistenceManager;
+ private final FrameworkSynchronizer frameworkSynchronizer;
+
+ protected PersistenceQueryProcessorAbstract(final PersistenceManager persistenceManager, final FrameworkSynchronizer frameworkSynchronizer) {
+ this.persistenceManager = persistenceManager;
+ this.frameworkSynchronizer = frameworkSynchronizer;
+ }
+
+ protected PersistenceManager getPersistenceManager() {
+ return persistenceManager;
+ }
+
+
+ // /////////////////////////////////////////////////////////////
+ // helpers for subclasses
+ // /////////////////////////////////////////////////////////////
+
+ protected PersistenceManagerFactory getPersistenceManagerFactory() {
+ return getPersistenceManager().getPersistenceManagerFactory();
+ }
+
+ protected TypeMetadata getTypeMetadata(final String classFullName) {
+ return getPersistenceManagerFactory().getMetadata(classFullName);
+ }
+
+ /**
+ * Traversing the provided list causes (or should cause) the
+ * {@link IsisLifecycleListener#postLoad(InstanceLifecycleEvent) {
+ * to be called.
+ */
+ protected List<ObjectAdapter> loadAdapters(
+ final ObjectSpecification specification, final List<?> pojos) {
+ final List<ObjectAdapter> adapters = Lists.newArrayList();
+ for (final Object pojo : pojos) {
+ // ought not to be necessary, however for some queries it seems that the
+ // lifecycle listener is not called
+ frameworkSynchronizer.postLoadProcessingFor((PersistenceCapable) pojo, CalledFrom.OS_QUERY);
+ ObjectAdapter adapter = getAdapterManager().getAdapterFor(pojo);
+ Assert.assertNotNull(adapter);
+ adapters.add(adapter);
+ }
+ return adapters;
+ }
+
+ // /////////////////////////////////////////////////////////////
+ // Dependencies (from context)
+ // /////////////////////////////////////////////////////////////
+
+ protected Persistor getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
+ }
+
+ protected AdapterManager getAdapterManager() {
+ return IsisContext.getPersistenceSession().getAdapterManager();
+ }
+
+ protected DataNucleusObjectStore getJdoObjectStore() {
+ return (DataNucleusObjectStore) IsisContext.getPersistenceSession().getObjectStore();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/QueryUtil.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/QueryUtil.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/QueryUtil.java
index c3b0a32..e27f95a 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/QueryUtil.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/queries/QueryUtil.java
@@ -16,74 +16,74 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public final class QueryUtil {
-
- private static final Logger LOG = Logger.getLogger(QueryUtil.class);
-
- private QueryUtil() {}
-
- public static Query createQuery(
- final PersistenceManager persistenceManager,
- final String alias,
- final String select,
- final ObjectSpecification specification,
- final String whereClause) {
-
- final StringBuilder buf = new StringBuilder(128);
- appendSelect(buf, select, alias);
- appendFrom(buf, specification, alias);
- appendWhere(buf, whereClause);
-
- final String queryString = buf.toString();
- if (LOG.isDebugEnabled()) {
- LOG.debug("creating query: " + queryString);
- }
-
- return persistenceManager.newQuery(queryString);
- }
-
- private static StringBuilder appendSelect(
- final StringBuilder buf,
- final String select,
- String alias) {
- if (select != null) {
- buf.append(select);
- } else {
- buf.append("select ");
- // not required in JDOQL (cf JPA QL)
- // buf.append(alias);
- }
- buf.append(" ");
- return buf;
- }
-
- private static void appendWhere(StringBuilder buf, String whereClause) {
- if(whereClause == null) {
- return;
- }
- buf.append(" where ").append(whereClause);
- }
-
-
- private static StringBuilder appendFrom(
- final StringBuilder buf,
- final ObjectSpecification specification,
- final String alias) {
- return buf.append("from ")
- .append(specification.getFullIdentifier())
- .append(" as ")
- .append(alias);
- }
-}
-
-
-// Copyright (c) Naked Objects Group Ltd.
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.queries;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public final class QueryUtil {
+
+ private static final Logger LOG = Logger.getLogger(QueryUtil.class);
+
+ private QueryUtil() {}
+
+ public static Query createQuery(
+ final PersistenceManager persistenceManager,
+ final String alias,
+ final String select,
+ final ObjectSpecification specification,
+ final String whereClause) {
+
+ final StringBuilder buf = new StringBuilder(128);
+ appendSelect(buf, select, alias);
+ appendFrom(buf, specification, alias);
+ appendWhere(buf, whereClause);
+
+ final String queryString = buf.toString();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("creating query: " + queryString);
+ }
+
+ return persistenceManager.newQuery(queryString);
+ }
+
+ private static StringBuilder appendSelect(
+ final StringBuilder buf,
+ final String select,
+ String alias) {
+ if (select != null) {
+ buf.append(select);
+ } else {
+ buf.append("select ");
+ // not required in JDOQL (cf JPA QL)
+ // buf.append(alias);
+ }
+ buf.append(" ");
+ return buf;
+ }
+
+ private static void appendWhere(StringBuilder buf, String whereClause) {
+ if(whereClause == null) {
+ return;
+ }
+ buf.append(" where ").append(whereClause);
+ }
+
+
+ private static StringBuilder appendFrom(
+ final StringBuilder buf,
+ final ObjectSpecification specification,
+ final String alias) {
+ return buf.append("from ")
+ .append(specification.getFullIdentifier())
+ .append(" as ")
+ .append(alias);
+ }
+}
+
+
+// Copyright (c) Naked Objects Group Ltd.
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusIdentifierGenerator.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusIdentifierGenerator.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusIdentifierGenerator.java
index d0dabe3..eb2b4d5 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusIdentifierGenerator.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusIdentifierGenerator.java
@@ -16,91 +16,91 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi;
-
-import java.util.UUID;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.spi.PersistenceCapable;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusObjectStore;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
-
-public class DataNucleusIdentifierGenerator implements IdentifierGenerator {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = Logger.getLogger(DataNucleusIdentifierGenerator.class);
-
-
-
- // //////////////////////////////////////////////////////////////
- // main api
- // //////////////////////////////////////////////////////////////
-
- @Override
- public String createTransientIdentifierFor(ObjectSpecId objectSpecId, Object pojo) {
- return UUID.randomUUID().toString();
- }
-
-
- @Override
- public String createAggregateLocalId(ObjectSpecId objectSpecId, Object pojo, ObjectAdapter parentAdapter) {
- return UUID.randomUUID().toString();
- }
-
-
- @Override
- public String createPersistentIdentifierFor(ObjectSpecId objectSpecId, Object pojo, RootOid transientRootOid) {
-
- // hack to deal with services
- if(!(pojo instanceof PersistenceCapable)) {
- return "1";
- }
-
- final Object jdoOid = getJdoPersistenceManager().getObjectId(pojo);
-
- return JdoObjectIdSerializer.toOidIdentifier(jdoOid);
- }
-
-
-
- // //////////////////////////////////////////////////////////////
- // Debugging
- // //////////////////////////////////////////////////////////////
-
-
- public String debugTitle() {
- return "DataNucleus Identifier Generator";
- }
-
-
- @Override
- public void debugData(DebugBuilder debug) {
-
- }
-
-
- // //////////////////////////////////////////////////////////////
- // Dependencies (from context)
- // //////////////////////////////////////////////////////////////
-
-
- protected PersistenceManager getJdoPersistenceManager() {
- final DataNucleusObjectStore objectStore = getDataNucleusObjectStore();
- return objectStore.getPersistenceManager();
- }
-
-
- protected DataNucleusObjectStore getDataNucleusObjectStore() {
- return (DataNucleusObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- }
-
-}
-// Copyright (c) Naked Objects Group Ltd.
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi;
+
+import java.util.UUID;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.spi.PersistenceCapable;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusObjectStore;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
+
+public class DataNucleusIdentifierGenerator implements IdentifierGenerator {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = Logger.getLogger(DataNucleusIdentifierGenerator.class);
+
+
+
+ // //////////////////////////////////////////////////////////////
+ // main api
+ // //////////////////////////////////////////////////////////////
+
+ @Override
+ public String createTransientIdentifierFor(ObjectSpecId objectSpecId, Object pojo) {
+ return UUID.randomUUID().toString();
+ }
+
+
+ @Override
+ public String createAggregateLocalId(ObjectSpecId objectSpecId, Object pojo, ObjectAdapter parentAdapter) {
+ return UUID.randomUUID().toString();
+ }
+
+
+ @Override
+ public String createPersistentIdentifierFor(ObjectSpecId objectSpecId, Object pojo, RootOid transientRootOid) {
+
+ // hack to deal with services
+ if(!(pojo instanceof PersistenceCapable)) {
+ return "1";
+ }
+
+ final Object jdoOid = getJdoPersistenceManager().getObjectId(pojo);
+
+ return JdoObjectIdSerializer.toOidIdentifier(jdoOid);
+ }
+
+
+
+ // //////////////////////////////////////////////////////////////
+ // Debugging
+ // //////////////////////////////////////////////////////////////
+
+
+ public String debugTitle() {
+ return "DataNucleus Identifier Generator";
+ }
+
+
+ @Override
+ public void debugData(DebugBuilder debug) {
+
+ }
+
+
+ // //////////////////////////////////////////////////////////////
+ // Dependencies (from context)
+ // //////////////////////////////////////////////////////////////
+
+
+ protected PersistenceManager getJdoPersistenceManager() {
+ final DataNucleusObjectStore objectStore = getDataNucleusObjectStore();
+ return objectStore.getPersistenceManager();
+ }
+
+
+ protected DataNucleusObjectStore getDataNucleusObjectStore() {
+ return (DataNucleusObjectStore) IsisContext.getPersistenceSession().getObjectStore();
+ }
+
+}
+// Copyright (c) Naked Objects Group Ltd.
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java
index 2e90059..eb2fd53 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/DataNucleusSimplePersistAlgorithm.java
@@ -16,62 +16,62 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.core.commons.lang.ToString;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.callbacks.CallbackUtils;
-import org.apache.isis.core.metamodel.facets.object.callbacks.PersistingCallbackFacet;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithmAbstract;
-import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.ToPersistObjectSet;
-
-
-/**
- * A {@link PersistAlgorithm} which simply saves the object made persistent.
- */
-public class DataNucleusSimplePersistAlgorithm extends PersistAlgorithmAbstract {
-
- private static final Logger LOG = Logger
- .getLogger(DataNucleusSimplePersistAlgorithm.class);
-
-
- // ////////////////////////////////////////////////////////////////
- // name
- // ////////////////////////////////////////////////////////////////
-
- public String name() {
- return "SimplePersistAlgorithm";
- }
-
-
- // ////////////////////////////////////////////////////////////////
- // makePersistent
- // ////////////////////////////////////////////////////////////////
-
- public void makePersistent(final ObjectAdapter adapter,
- final ToPersistObjectSet toPersistObjectSet) {
- if (alreadyPersistedOrNotPersistable(adapter)) {
- return;
- }
- if (LOG.isInfoEnabled()) {
- LOG.info("persist " + adapter);
- }
- CallbackUtils.callCallback(adapter, PersistingCallbackFacet.class);
- toPersistObjectSet.addCreateObjectCommand(adapter);
- }
-
-
- // ////////////////////////////////////////////////////////////////
- // toString
- // ////////////////////////////////////////////////////////////////
-
- @Override
- public String toString() {
- final ToString toString = new ToString(this);
- return toString.toString();
- }
-}
-// Copyright (c) Naked Objects Group Ltd.
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.lang.ToString;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.callbacks.CallbackUtils;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistingCallbackFacet;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithmAbstract;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.ToPersistObjectSet;
+
+
+/**
+ * A {@link PersistAlgorithm} which simply saves the object made persistent.
+ */
+public class DataNucleusSimplePersistAlgorithm extends PersistAlgorithmAbstract {
+
+ private static final Logger LOG = Logger
+ .getLogger(DataNucleusSimplePersistAlgorithm.class);
+
+
+ // ////////////////////////////////////////////////////////////////
+ // name
+ // ////////////////////////////////////////////////////////////////
+
+ public String name() {
+ return "SimplePersistAlgorithm";
+ }
+
+
+ // ////////////////////////////////////////////////////////////////
+ // makePersistent
+ // ////////////////////////////////////////////////////////////////
+
+ public void makePersistent(final ObjectAdapter adapter,
+ final ToPersistObjectSet toPersistObjectSet) {
+ if (alreadyPersistedOrNotPersistable(adapter)) {
+ return;
+ }
+ if (LOG.isInfoEnabled()) {
+ LOG.info("persist " + adapter);
+ }
+ CallbackUtils.callCallback(adapter, PersistingCallbackFacet.class);
+ toPersistObjectSet.addCreateObjectCommand(adapter);
+ }
+
+
+ // ////////////////////////////////////////////////////////////////
+ // toString
+ // ////////////////////////////////////////////////////////////////
+
+ @Override
+ public String toString() {
+ final ToString toString = new ToString(this);
+ return toString.toString();
+ }
+}
+// Copyright (c) Naked Objects Group Ltd.
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/ResolveStateUtil.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/ResolveStateUtil.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/ResolveStateUtil.java
index 0f30346..47e0329 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/ResolveStateUtil.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/ResolveStateUtil.java
@@ -16,107 +16,107 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-
-public final class ResolveStateUtil {
-
- private ResolveStateUtil() {}
-
-
- public static void moveToResolving(final ObjectAdapter adapter) {
-
- moveUpToResolving(adapter);
- }
-
- public static void markAsResolved(final ObjectAdapter adapter) {
-
- moveUpToResolving(adapter);
-
- // move to ResolveState.RESOLVED;
-
- if (adapter.isResolving()) {
- adapter.changeState(ResolveState.RESOLVED);
-
- } else if (adapter.isResolved()) {
- // nothing to do.
-
-// } else if (adapter.getResolveState().isPartlyResolved()) {
-// adapter.changeState(ResolveState.RESOLVED);
-
- } else if (adapter.isUpdating()) {
- adapter.changeState(ResolveState.RESOLVED);
- }
- }
-
-
- private static void moveUpToResolving(final ObjectAdapter adapter) {
- // move these on so we can get to part_resolved or resolved.
- if (adapter.isTransient()) {
- adapter.changeState(ResolveState.RESOLVED);
- adapter.changeState(ResolveState.GHOST);
- adapter.changeState(ResolveState.RESOLVING);
-
- } else if (adapter.isNew()) {
- adapter.changeState(ResolveState.GHOST);
- adapter.changeState(ResolveState.RESOLVING);
-
- } else if (adapter.isGhost()) {
- adapter.changeState(ResolveState.RESOLVING);
- }
- }
-
- public static void markAsGhost(final ObjectAdapter adapter) {
-
- if (adapter.isValue()) {
- // TODO: what should we do here? throw exception?
- }
- if (adapter.isDestroyed()) {
- // TODO: what should we do here? throw exception?
- }
-
- if (adapter.isTransient()) {
- adapter.changeState(ResolveState.RESOLVED);
- adapter.changeState(ResolveState.GHOST);
-
- } else if (adapter.isNew()) {
- adapter.changeState(ResolveState.GHOST);
-
-// } else if (adapter.getResolveState().isPartlyResolved()) {
-// adapter.changeState(ResolveState.RESOLVING);
-// adapter.changeState(ResolveState.RESOLVED);
-// adapter.changeState(ResolveState.GHOST);
-
- } else if (adapter.isResolving()) {
- adapter.changeState(ResolveState.RESOLVED);
- adapter.changeState(ResolveState.GHOST);
-
- } else if (adapter.isUpdating()) {
- adapter.changeState(ResolveState.RESOLVED);
- adapter.changeState(ResolveState.GHOST);
-
- } else if (adapter.isResolved()) {
- adapter.changeState(ResolveState.GHOST);
-
- } else if (adapter.isGhost()) {
- // nothing to do.
- }
- }
-
-
- public static void markAsUpdating(final ObjectAdapter adapter) {
-
- if (adapter.isTransient()) {
- adapter.changeState(ResolveState.RESOLVED);
- }
- if (adapter.isResolved()) {
- adapter.changeState(ResolveState.UPDATING);
- }
- }
-
-}
-
-
-// Copyright (c) Naked Objects Group Ltd.
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.persistence.spi;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+
+public final class ResolveStateUtil {
+
+ private ResolveStateUtil() {}
+
+
+ public static void moveToResolving(final ObjectAdapter adapter) {
+
+ moveUpToResolving(adapter);
+ }
+
+ public static void markAsResolved(final ObjectAdapter adapter) {
+
+ moveUpToResolving(adapter);
+
+ // move to ResolveState.RESOLVED;
+
+ if (adapter.isResolving()) {
+ adapter.changeState(ResolveState.RESOLVED);
+
+ } else if (adapter.isResolved()) {
+ // nothing to do.
+
+// } else if (adapter.getResolveState().isPartlyResolved()) {
+// adapter.changeState(ResolveState.RESOLVED);
+
+ } else if (adapter.isUpdating()) {
+ adapter.changeState(ResolveState.RESOLVED);
+ }
+ }
+
+
+ private static void moveUpToResolving(final ObjectAdapter adapter) {
+ // move these on so we can get to part_resolved or resolved.
+ if (adapter.isTransient()) {
+ adapter.changeState(ResolveState.RESOLVED);
+ adapter.changeState(ResolveState.GHOST);
+ adapter.changeState(ResolveState.RESOLVING);
+
+ } else if (adapter.isNew()) {
+ adapter.changeState(ResolveState.GHOST);
+ adapter.changeState(ResolveState.RESOLVING);
+
+ } else if (adapter.isGhost()) {
+ adapter.changeState(ResolveState.RESOLVING);
+ }
+ }
+
+ public static void markAsGhost(final ObjectAdapter adapter) {
+
+ if (adapter.isValue()) {
+ // TODO: what should we do here? throw exception?
+ }
+ if (adapter.isDestroyed()) {
+ // TODO: what should we do here? throw exception?
+ }
+
+ if (adapter.isTransient()) {
+ adapter.changeState(ResolveState.RESOLVED);
+ adapter.changeState(ResolveState.GHOST);
+
+ } else if (adapter.isNew()) {
+ adapter.changeState(ResolveState.GHOST);
+
+// } else if (adapter.getResolveState().isPartlyResolved()) {
+// adapter.changeState(ResolveState.RESOLVING);
+// adapter.changeState(ResolveState.RESOLVED);
+// adapter.changeState(ResolveState.GHOST);
+
+ } else if (adapter.isResolving()) {
+ adapter.changeState(ResolveState.RESOLVED);
+ adapter.changeState(ResolveState.GHOST);
+
+ } else if (adapter.isUpdating()) {
+ adapter.changeState(ResolveState.RESOLVED);
+ adapter.changeState(ResolveState.GHOST);
+
+ } else if (adapter.isResolved()) {
+ adapter.changeState(ResolveState.GHOST);
+
+ } else if (adapter.isGhost()) {
+ // nothing to do.
+ }
+ }
+
+
+ public static void markAsUpdating(final ObjectAdapter adapter) {
+
+ if (adapter.isTransient()) {
+ adapter.changeState(ResolveState.RESOLVED);
+ }
+ if (adapter.isResolved()) {
+ adapter.changeState(ResolveState.UPDATING);
+ }
+ }
+
+}
+
+
+// Copyright (c) Naked Objects Group Ltd.
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
index db6d3b1..0276f64 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
@@ -1,48 +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.runtimes.dflt.objectstores.jdo.datanucleus;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
-
-public class DataNucleusPersistenceMechanismInstallerTest_getName {
-
- private DataNucleusPersistenceMechanismInstaller installer;
-
- @Before
- public void setUp() throws Exception {
- installer = new DataNucleusPersistenceMechanismInstaller();
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void isSet() {
- assertThat(installer.getName(), is("datanucleus"));
- }
-
-}
+/*
+ * 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.datanucleus;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
+
+public class DataNucleusPersistenceMechanismInstallerTest_getName {
+
+ private DataNucleusPersistenceMechanismInstaller installer;
+
+ @Before
+ public void setUp() throws Exception {
+ installer = new DataNucleusPersistenceMechanismInstaller();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ @Test
+ public void isSet() {
+ assertThat(installer.getName(), is("datanucleus"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
index 209ecfd..0474440 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
@@ -1,62 +1,62 @@
-/*
- * 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.datanucleus;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
-
-public class DataNucleusPersistenceMechanismInstallerTest_services {
-
- private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .withServices(repo)
- .build();
-
- @Test
- public void servicesBootstrapped() {
- final List<Object> services = IsisContext.getServices();
- assertThat(services.size(), is(1));
- assertThat(services.get(0), is((Object)repo));
-
- final ObjectAdapter serviceAdapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(repo);
- assertThat(serviceAdapter, is(not(nullValue())));
-
- assertThat(serviceAdapter.getOid(), is(equalTo((Oid)RootOidDefault.create(ObjectSpecId.of("PrimitiveValuedEntities"), "1"))));
- }
-
-
-}
+/*
+ * 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.datanucleus;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class DataNucleusPersistenceMechanismInstallerTest_services {
+
+ private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void servicesBootstrapped() {
+ final List<Object> services = IsisContext.getServices();
+ assertThat(services.size(), is(1));
+ assertThat(services.get(0), is((Object)repo));
+
+ final ObjectAdapter serviceAdapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(repo);
+ assertThat(serviceAdapter, is(not(nullValue())));
+
+ assertThat(serviceAdapter.getOid(), is(equalTo((Oid)RootOidDefault.create(ObjectSpecId.of("PrimitiveValuedEntities"), "1"))));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java
index 852d402..75d7b07 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java
@@ -1,124 +1,124 @@
-/*
- * 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.datanucleus;
-
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.Properties;
-
-import org.joda.time.LocalDate;
-import org.joda.time.LocalDateTime;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-
-public class Utils {
-
- private Utils(){}
-
- public static IsisSystemWithFixtures.Builder systemBuilder() {
- return IsisSystemWithFixtures.builder()
- .with(configurationForDataNucleusDb())
- .with(new DataNucleusPersistenceMechanismInstaller());
- }
-
- public static IsisSystemWithFixtures.Listener listenerToDeleteFrom(final String... tables) {
- return new IsisSystemWithFixtures.ListenerAdapter(){
-
- @Override
- public void postSetupSystem(boolean firstTime) throws Exception {
- Connection connection = getConnection();
- try {
- final Statement statement = connection.createStatement();
- for(String table: tables) {
- statement.executeUpdate("DELETE FROM " + table);
- }
- } catch(Exception ex) {
- connection.rollback();
- throw ex;
- } finally {
- connection.commit();
- }
- }
-
- private Connection getConnection() {
- final DataNucleusObjectStore objectStore = (DataNucleusObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- return objectStore.getJavaSqlConnection();
- }
- };
- }
-
- public static IsisConfiguration configurationForDataNucleusDb() {
- final IsisConfigurationDefault configuration = new IsisConfigurationDefault();
- Properties props = new Properties();
-
- props.put("isis.persistor.datanucleus.impl.javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
-
- // last one wins!
- configureHsqlDbFileBased(props);
- configureForMsSqlServer(props);
- configureHsqlDbInMemory(props);
-
- props.put("isis.persistor.datanucleus.impl.datanucleus.autoCreateSchema", "true");
- props.put("isis.persistor.datanucleus.impl.datanucleus.validateTables", "true");
- props.put("isis.persistor.datanucleus.impl.datanucleus.validateConstraints", "true");
-
- props.put("isis.persistor.datanucleus.impl.datanucleus.cache.level2.type", "none");
-
- configuration.add(props);
- return configuration;
- }
-
-
- private static void configureHsqlDbInMemory(Properties props) {
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:mem:test");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "sa");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "");
- }
-
- private static void configureHsqlDbFileBased(Properties props) {
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:file:hsql-db/test;hsqldb.write_delay=false;shutdown=true");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "sa");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "");
- }
-
- private static void configureForMsSqlServer(Properties props) {
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:sqlserver://127.0.0.1:1433;instance=SQLEXPRESS;databaseName=jdo;");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "jdo");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "jdopass");
- }
-
-
-
- public static long toMillis(int year, int monthOfYear, int dayOfMonth) {
- LocalDate d = new LocalDate(year, monthOfYear, dayOfMonth);
- return d.toDateMidnight().getMillis();
- }
-
- public static long toMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute) {
- LocalDateTime d = new LocalDateTime(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute);
- return d.toDateTime().getMillis();
- }
-
-}
+/*
+ * 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.datanucleus;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.Properties;
+
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+
+public class Utils {
+
+ private Utils(){}
+
+ public static IsisSystemWithFixtures.Builder systemBuilder() {
+ return IsisSystemWithFixtures.builder()
+ .with(configurationForDataNucleusDb())
+ .with(new DataNucleusPersistenceMechanismInstaller());
+ }
+
+ public static IsisSystemWithFixtures.Listener listenerToDeleteFrom(final String... tables) {
+ return new IsisSystemWithFixtures.ListenerAdapter(){
+
+ @Override
+ public void postSetupSystem(boolean firstTime) throws Exception {
+ Connection connection = getConnection();
+ try {
+ final Statement statement = connection.createStatement();
+ for(String table: tables) {
+ statement.executeUpdate("DELETE FROM " + table);
+ }
+ } catch(Exception ex) {
+ connection.rollback();
+ throw ex;
+ } finally {
+ connection.commit();
+ }
+ }
+
+ private Connection getConnection() {
+ final DataNucleusObjectStore objectStore = (DataNucleusObjectStore) IsisContext.getPersistenceSession().getObjectStore();
+ return objectStore.getJavaSqlConnection();
+ }
+ };
+ }
+
+ public static IsisConfiguration configurationForDataNucleusDb() {
+ final IsisConfigurationDefault configuration = new IsisConfigurationDefault();
+ Properties props = new Properties();
+
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
+
+ // last one wins!
+ configureHsqlDbFileBased(props);
+ configureForMsSqlServer(props);
+ configureHsqlDbInMemory(props);
+
+ props.put("isis.persistor.datanucleus.impl.datanucleus.autoCreateSchema", "true");
+ props.put("isis.persistor.datanucleus.impl.datanucleus.validateTables", "true");
+ props.put("isis.persistor.datanucleus.impl.datanucleus.validateConstraints", "true");
+
+ props.put("isis.persistor.datanucleus.impl.datanucleus.cache.level2.type", "none");
+
+ configuration.add(props);
+ return configuration;
+ }
+
+
+ private static void configureHsqlDbInMemory(Properties props) {
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:mem:test");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "sa");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "");
+ }
+
+ private static void configureHsqlDbFileBased(Properties props) {
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:file:hsql-db/test;hsqldb.write_delay=false;shutdown=true");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "sa");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "");
+ }
+
+ private static void configureForMsSqlServer(Properties props) {
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:sqlserver://127.0.0.1:1433;instance=SQLEXPRESS;databaseName=jdo;");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "jdo");
+ props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "jdopass");
+ }
+
+
+
+ public static long toMillis(int year, int monthOfYear, int dayOfMonth) {
+ LocalDate d = new LocalDate(year, monthOfYear, dayOfMonth);
+ return d.toDateMidnight().getMillis();
+ }
+
+ public static long toMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute) {
+ LocalDateTime d = new LocalDateTime(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute);
+ return d.toDateTime().getMillis();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityAnnotationFacetFactory.java b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityAnnotationFacetFactory.java
index 7556e06..335fee6 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityAnnotationFacetFactory.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityAnnotationFacetFactory.java
@@ -1,52 +1,52 @@
-/*
- * 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.datastoreidentity;
-
-
-import javax.jdo.annotations.DatastoreIdentity;
-import javax.jdo.annotations.IdGeneratorStrategy;
-
-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 JdoDatastoreIdentityAnnotationFacetFactory extends FacetFactoryAbstract {
-
- public JdoDatastoreIdentityAnnotationFacetFactory() {
- super(FeatureType.OBJECTS_ONLY);
- }
-
- @Override
- public void process(ProcessClassContext processClassContext) {
- final Class<?> cls = processClassContext.getCls();
- final DatastoreIdentity annotation = Annotations.getAnnotation(cls, DatastoreIdentity.class);
- if (annotation == null) {
- return;
- }
- IdGeneratorStrategy strategyAttribute = annotation.strategy();
-
- FacetUtil.addFacet(new JdoDatastoreIdentityFacetAnnotation(
- strategyAttribute, processClassContext.getFacetHolder()));
- return;
- }
-
-
-}
+/*
+ * 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.datastoreidentity;
+
+
+import javax.jdo.annotations.DatastoreIdentity;
+import javax.jdo.annotations.IdGeneratorStrategy;
+
+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 JdoDatastoreIdentityAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public JdoDatastoreIdentityAnnotationFacetFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(ProcessClassContext processClassContext) {
+ final Class<?> cls = processClassContext.getCls();
+ final DatastoreIdentity annotation = Annotations.getAnnotation(cls, DatastoreIdentity.class);
+ if (annotation == null) {
+ return;
+ }
+ IdGeneratorStrategy strategyAttribute = annotation.strategy();
+
+ FacetUtil.addFacet(new JdoDatastoreIdentityFacetAnnotation(
+ strategyAttribute, processClassContext.getFacetHolder()));
+ return;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacet.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacet.java b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacet.java
index 7c626a7..0fca9ed 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacet.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacet.java
@@ -1,34 +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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.datastoreidentity;
-
-
-import javax.jdo.annotations.DatastoreIdentity;
-import javax.jdo.annotations.IdGeneratorStrategy;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-
-
-/**
- * Corresponds to annotating the class with the {@link DatastoreIdentity} annotation.
- */
-public interface JdoDatastoreIdentityFacet extends Facet {
-
- IdGeneratorStrategy getStrategy();
-}
+/*
+ * 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.datastoreidentity;
+
+
+import javax.jdo.annotations.DatastoreIdentity;
+import javax.jdo.annotations.IdGeneratorStrategy;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+
+/**
+ * Corresponds to annotating the class with the {@link DatastoreIdentity} annotation.
+ */
+public interface JdoDatastoreIdentityFacet extends Facet {
+
+ IdGeneratorStrategy getStrategy();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAbstract.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAbstract.java b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAbstract.java
index 17e3c05..bee946d 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAbstract.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAbstract.java
@@ -1,46 +1,46 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.metamodel.facets.object.datastoreidentity;
-
-import javax.jdo.annotations.IdGeneratorStrategy;
-
-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 JdoDatastoreIdentityFacetAbstract extends FacetAbstract implements
- JdoDatastoreIdentityFacet {
-
-
- public static Class<? extends Facet> type() {
- return JdoDatastoreIdentityFacet.class;
- }
-
- private final IdGeneratorStrategy strategy;
-
- public JdoDatastoreIdentityFacetAbstract(IdGeneratorStrategy strategy, FacetHolder facetHolder) {
- super(JdoDatastoreIdentityFacetAbstract.type(), facetHolder, Derivation.NOT_DERIVED);
- this.strategy = strategy;
- }
-
- public IdGeneratorStrategy getStrategy() {
- return strategy;
- }
-}
+/*
+ * 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.datastoreidentity;
+
+import javax.jdo.annotations.IdGeneratorStrategy;
+
+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 JdoDatastoreIdentityFacetAbstract extends FacetAbstract implements
+ JdoDatastoreIdentityFacet {
+
+
+ public static Class<? extends Facet> type() {
+ return JdoDatastoreIdentityFacet.class;
+ }
+
+ private final IdGeneratorStrategy strategy;
+
+ public JdoDatastoreIdentityFacetAbstract(IdGeneratorStrategy strategy, FacetHolder facetHolder) {
+ super(JdoDatastoreIdentityFacetAbstract.type(), facetHolder, Derivation.NOT_DERIVED);
+ this.strategy = strategy;
+ }
+
+ public IdGeneratorStrategy getStrategy() {
+ return strategy;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAnnotation.java b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAnnotation.java
index a3b0016..7a03135 100644
--- a/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAnnotation.java
+++ b/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/object/datastoreidentity/JdoDatastoreIdentityFacetAnnotation.java
@@ -1,32 +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.runtimes.dflt.objectstores.jdo.metamodel.facets.object.datastoreidentity;
-
-import javax.jdo.annotations.IdGeneratorStrategy;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-
-public class JdoDatastoreIdentityFacetAnnotation extends JdoDatastoreIdentityFacetImpl {
-
- public JdoDatastoreIdentityFacetAnnotation(IdGeneratorStrategy strategy, FacetHolder facetHolder) {
- super(strategy, facetHolder);
- }
-
-}
+/*
+ * 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.datastoreidentity;
+
+import javax.jdo.annotations.IdGeneratorStrategy;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+
+
+public class JdoDatastoreIdentityFacetAnnotation extends JdoDatastoreIdentityFacetImpl {
+
+ public JdoDatastoreIdentityFacetAnnotation(IdGeneratorStrategy strategy, FacetHolder facetHolder) {
+ super(strategy, facetHolder);
+ }
+
+}