You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/04/27 20:31:39 UTC

[20/50] [abbrv] ISIS-233: more testing on actions

http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
index d561f67..6866dbc 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
@@ -28,6 +28,7 @@ import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
 
 /**
  * Responsible for managing the {@link ObjectAdapter adapter}s and {@link Oid
@@ -113,7 +114,9 @@ public interface AdapterManager extends Injectable {
      * The {@link ConcurrencyChecking} parameter determines whether concurrency checking is performed.
      * If it is requested, then a check is made to ensure that the {@link Oid#getVersion() version} 
      * of the {@link TypedOid oid} of the recreated adapter is the same as that of the provided {@link TypedOid oid}.
-     * If the version differs, then a {@link ConcurrencyException} is thrown. 
+     * If the version differs, then a {@link ConcurrencyException} is thrown.
+     * 
+     * @throws {@link ObjectNotFoundException} if the object does not exist.
      */
     ObjectAdapter adapterFor(TypedOid oid, ConcurrencyChecking concurrencyChecking);
 

http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
new file mode 100644
index 0000000..47cee58
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.persistence;
+
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+
+public class ObjectNotFoundException extends ObjectPersistenceException {
+    private static final long serialVersionUID = 1L;
+
+    public ObjectNotFoundException() {
+        super();
+    }
+
+    public ObjectNotFoundException(final Oid oid) {
+        super("Object not found in store with oid " + oid);
+    }
+
+    public ObjectNotFoundException(final Oid oid, final Throwable cause) {
+        super("Object not found in store with oid " + oid, cause);
+    }
+
+    public ObjectNotFoundException(final String s) {
+        super(s);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
new file mode 100644
index 0000000..99f0593
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.persistence;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+public class ObjectPersistenceException extends IsisException {
+    private static final long serialVersionUID = 1L;
+
+    public ObjectPersistenceException() {
+        super();
+    }
+
+    public ObjectPersistenceException(final String message) {
+        super(message);
+    }
+
+    public ObjectPersistenceException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public ObjectPersistenceException(final Throwable cause) {
+        super(cause);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
deleted file mode 100644
index 47cee58..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectNotFoundException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence;
-
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-
-public class ObjectNotFoundException extends ObjectPersistenceException {
-    private static final long serialVersionUID = 1L;
-
-    public ObjectNotFoundException() {
-        super();
-    }
-
-    public ObjectNotFoundException(final Oid oid) {
-        super("Object not found in store with oid " + oid);
-    }
-
-    public ObjectNotFoundException(final Oid oid, final Throwable cause) {
-        super("Object not found in store with oid " + oid, cause);
-    }
-
-    public ObjectNotFoundException(final String s) {
-        super(s);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
deleted file mode 100644
index 99f0593..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectPersistenceException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-public class ObjectPersistenceException extends IsisException {
-    private static final long serialVersionUID = 1L;
-
-    public ObjectPersistenceException() {
-        super();
-    }
-
-    public ObjectPersistenceException(final String message) {
-        super(message);
-    }
-
-    public ObjectPersistenceException(final String message, final Throwable cause) {
-        super(message, cause);
-    }
-
-    public ObjectPersistenceException(final Throwable cause) {
-        super(cause);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
index 9f1b083..a8be449 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
@@ -58,6 +58,7 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
 import org.apache.isis.core.runtime.system.persistence.OidGenerator;
@@ -296,8 +297,12 @@ public class AdapterManagerDefault implements AdapterManagerSpi {
         ObjectAdapter adapter = getAdapterFor(typedOid);
         if (adapter == null) {
             // else recreate
-            final Object pojo = pojoRecreator.recreatePojo(typedOid);
-            adapter = mapRecreatedPojo(typedOid, pojo);
+            try {
+                final Object pojo = pojoRecreator.recreatePojo(typedOid);
+                adapter = mapRecreatedPojo(typedOid, pojo);
+            } catch(RuntimeException ex) {
+                throw new ObjectNotFoundException(typedOid, ex);
+            }
         }
 
         // sync versions of original, with concurrency checking if required

http://git-wip-us.apache.org/repos/asf/isis/blob/646a07ce/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
----------------------------------------------------------------------
diff --git a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
index 88c2b9a..b14a73f 100644
--- a/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
+++ b/core/tck/tck-dom/src/main/java/org/apache/isis/core/tck/dom/actions/ActionsEntityRepository.java
@@ -46,7 +46,6 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
         return this.firstMatch(query);
     }
 
-
     @ActionSemantics(Of.SAFE)
     @MemberOrder(sequence = "1")
     public List<ActionsEntity> subList(@Named("from") int from, @Named("to") int to) {
@@ -56,7 +55,11 @@ public class ActionsEntityRepository extends AbstractEntityRepository<ActionsEnt
         return list.subList(fromChecked, toChecked);
     }
 
-
-    
+    @ActionSemantics(Of.SAFE)
+    @MemberOrder(sequence = "1")
+    public boolean contains(@Named("searchFor") ActionsEntity entity, @Named("from") int from, @Named("to") int to) {
+        List<ActionsEntity> list = subList(from, to);
+        return list.contains(entity);
+    }
     
 }