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 2015/09/08 08:51:13 UTC
[02/12] isis git commit: ISIS-1194: removing ResolveState,
derived persistence state from underlying pojo.
ISIS-1194: removing ResolveState, derived persistence state from underlying pojo.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/a91eef53
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/a91eef53
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/a91eef53
Branch: refs/heads/master
Commit: a91eef53a53fb7381d7f10c476e42e4922210cc8
Parents: b4a08de
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Sep 7 09:38:46 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Sep 7 09:38:46 2015 +0100
----------------------------------------------------------------------
.../core/metamodel/adapter/ObjectAdapter.java | 63 +----
.../metamodel/adapter/ResolveException.java | 47 ----
.../core/metamodel/adapter/ResolveState.java | 239 ----------------
.../metamodel/adapter/mgr/AdapterManager.java | 1 -
.../apache/isis/core/metamodel/util/Dump.java | 1 -
.../adapter/ResolveState_GetEndStateTest.java | 76 -----
.../adapter/ResolveState_IsDestroyedTest.java | 77 ------
.../adapter/ResolveState_IsGhostTest.java | 77 ------
.../adapter/ResolveState_IsNewTest.java | 76 -----
.../adapter/ResolveState_IsPersistentTest.java | 76 -----
.../adapter/ResolveState_IsResolvedTest.java | 76 -----
.../adapter/ResolveState_IsResolvingTest.java | 76 -----
.../adapter/ResolveState_IsTransientTest.java | 76 -----
.../ResolveState_IsValidToChangeToTest.java | 275 -------------------
...RespondToChangesInPersistentObjectsTest.java | 76 -----
.../apache/isis/core/runtime/memento/Data.java | 4 +-
.../isis/core/runtime/memento/Memento.java | 10 +-
.../core/runtime/persistence/PersistorUtil.java | 76 -----
.../persistence/adapter/PojoAdapter.java | 240 +++++++---------
.../adaptermanager/AdapterManagerDefault.java | 37 +--
.../adaptermanager/PojoAdapterHashMap.java | 10 -
.../container/DomainObjectContainerResolve.java | 19 +-
.../algorithm/PersistAlgorithmAbstract.java | 4 +-
.../algorithm/PersistAlgorithmDefault.java | 14 -
.../system/persistence/PersistenceSession.java | 33 +--
.../system/transaction/IsisTransaction.java | 4 -
.../jdo/datanucleus/DataNucleusObjectStore.java | 6 -
.../persistence/FrameworkSynchronizer.java | 50 ----
.../persistence/spi/ResolveStateUtil.java | 122 --------
.../adapterfactory/pojo/PojoAdapterTest.java | 12 -
...AdapterManagerDefault_aggregateAdapters.java | 3 -
.../transaction/PojoAdapterBuilder.java | 22 +-
...WrapperFactoryDefaultTest_wrappedObject.java | 3 +-
33 files changed, 123 insertions(+), 1858 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
index a194b06..8433fd9 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
@@ -148,13 +148,6 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
String getIconName();
/**
- * Changes the 'lazy loaded' state of the domain object.
- *
- * @see ResolveState
- */
- void changeState(ResolveState newState);
-
- /**
* Checks the version of this adapter to make sure that it does not differ
* from the specified version.
*
@@ -184,44 +177,12 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
*/
void replaceOid(Oid persistedOid);
- /**
- * Determines what 'lazy loaded' state the domain object is in.
- *
- * @see ResolveState
- */
- ResolveState getResolveState();
-
-
- /**
- * Whether the object is persisted.
- *
- * <p>
- * Note: not necessarily the reciprocal of {@link #isTransient()};
- * standalone adapters (with {@link ResolveState#VALUE}) report as neither
- * persistent or transient.
- */
- boolean representsPersistent();
-
- boolean isNew();
- boolean isTransient();
-
- boolean isGhost();
- boolean isResolved();
-
- boolean isResolving();
- boolean isUpdating();
-
- boolean isDestroyed();
-
-
- boolean canTransitionToResolving();
- void markAsResolvedIfPossible();
+ ObjectAdapter getAggregateRoot();
-
Version getVersion();
-
void setVersion(Version version);
+
/**
* Whether this instance belongs to another object (meaning its
* {@link #getOid()} will be <tt>ParentedOid</tt>, either an
@@ -240,18 +201,6 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
boolean isValue();
- /**
- * Either the aggregate root (either itself or, if parented, then its parent adapter).
- *
- * TODO: should this be recursive, to support root->aggregate->aggregate etc.
- */
- ObjectAdapter getAggregateRoot();
-
- boolean respondToChangesInPersistentObjects();
-
-
-
-
public final class Util {
private Util() {
@@ -343,8 +292,6 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
* {@link ObjectAdapter}s of those that are visible (as per any facet(s) installed on the element class
* of the collection).
* @param collectionAdapter - an adapter around a collection (as returned by a getter of a collection, or of an autoCompleteNXxx() or choicesNXxx() method, etc
- * @param authenticationSession - the user requesting the collection; if null then no filtering will be performed
- * @param deploymentCategory - whether prototyping etc
* @param interactionInitiatedBy
*/
public static List<ObjectAdapter> visibleAdapters(
@@ -360,8 +307,6 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
/**
* as per {@link #visibleAdapters(ObjectAdapter, InteractionInitiatedBy)}.
* @param objectAdapters - iterable over the respective adapters of a collection (as returned by a getter of a collection, or of an autoCompleteNXxx() or choicesNXxx() method, etc
- * @param authenticationSession - the user requesting the collection; if null then no visibility checking will be performed
- * @param deploymentCategory - whether prototyping etc; may influence visibility
* @param interactionInitiatedBy
*/
public static List<ObjectAdapter> visibleAdapters(
@@ -405,6 +350,10 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
}
}
+ boolean representsPersistent();
+ boolean isDestroyed();
+
+
public final class InvokeUtils {
private InvokeUtils() {
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveException.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveException.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveException.java
deleted file mode 100644
index b11d8f5..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-/**
- * Indicates that a request to resolve an object has failed. Unresolved objects
- * should never be used as they will cause further errors.
- */
-public class ResolveException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public ResolveException() {
- super();
- }
-
- public ResolveException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-
- public ResolveException(final String msg) {
- super(msg);
- }
-
- public ResolveException(final Throwable cause) {
- super(cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
deleted file mode 100644
index fbf1fe6..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import java.util.*;
-import com.google.common.collect.Maps;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RepresentsPersistent.DOES_NOT_REPRESENT_PERSISTENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RepresentsPersistent.REPRESENTS_PERSISTENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RespondsToChanges.DOES_NOT_RESPOND_TO_CHANGES;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RespondsToChanges.RESPONDS_TO_CHANGES;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TransitionFrom.CANNOT_TRANSITION_FROM;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TransitionFrom.CAN_TRANSITION_FROM;
-
-public final class ResolveState {
- private static final Map<String, ResolveState> statesByName = Maps.newHashMap();
-
- static enum TransitionFrom {
- CAN_TRANSITION_FROM, CANNOT_TRANSITION_FROM
- }
-
- static enum RespondsToChanges {
- RESPONDS_TO_CHANGES, DOES_NOT_RESPOND_TO_CHANGES
- }
-
- static enum RepresentsPersistent {
- REPRESENTS_PERSISTENT, DOES_NOT_REPRESENT_PERSISTENT
- }
-
- /**
- * When first instantiated by <tt>PojoAdapterFactory</tt>.
- */
- public static final ResolveState NEW = new ResolveState("New", "N~~", null, CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, DOES_NOT_REPRESENT_PERSISTENT);
- public static final ResolveState TRANSIENT = new ResolveState("Transient", "T~~", null, CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, DOES_NOT_REPRESENT_PERSISTENT);
- public static final ResolveState GHOST = new ResolveState("Ghost", "PG~", null, CAN_TRANSITION_FROM, RESPONDS_TO_CHANGES, REPRESENTS_PERSISTENT);
- public static final ResolveState RESOLVED = new ResolveState("Resolved", "PR~", null, CAN_TRANSITION_FROM, RESPONDS_TO_CHANGES, REPRESENTS_PERSISTENT);
- public static final ResolveState RESOLVING = new ResolveState("Resolving", "Pr~", RESOLVED, CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, REPRESENTS_PERSISTENT);
- public static final ResolveState UPDATING = new ResolveState("Updating", "PU~", RESOLVED, CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, REPRESENTS_PERSISTENT);
- public static final ResolveState DESTROYED = new ResolveState("Destroyed", "D~~", null, CANNOT_TRANSITION_FROM, RESPONDS_TO_CHANGES, DOES_NOT_REPRESENT_PERSISTENT);
- public static final ResolveState VALUE = new ResolveState("Value", "V~~", null, CANNOT_TRANSITION_FROM, RESPONDS_TO_CHANGES, DOES_NOT_REPRESENT_PERSISTENT);
-
-
-
- /**
- * These cannot be passed into the constructor because cannot reference an
- * instance until it has been declared.
- */
- public static Map<ResolveState, ResolveState[]> changeToStatesByState = new HashMap<ResolveState, ResolveState[]>() {
- private static final long serialVersionUID = 1L;
- {
- put(GHOST, new ResolveState[] { DESTROYED, RESOLVING, UPDATING });
- put(NEW, new ResolveState[] { TRANSIENT, GHOST, VALUE });
- put(TRANSIENT, new ResolveState[] { RESOLVED });
- put(RESOLVING, new ResolveState[] { RESOLVED });
- put(RESOLVED, new ResolveState[] { GHOST, UPDATING, DESTROYED });
- put(UPDATING, new ResolveState[] { RESOLVED });
- put(DESTROYED, new ResolveState[] {});
- put(VALUE, new ResolveState[] {});
- }
- };
-
- private final String code;
- private final ResolveState endState;
- private final String name;
- private final TransitionFrom transitionFrom;
- private final RespondsToChanges respondsToChanges;
- private final RepresentsPersistent representsPersistent;
- private HashSet<ResolveState> changeToStates;
-
- private ResolveState(final String name, final String code, final ResolveState endState, final TransitionFrom transitionFrom, final RespondsToChanges respondsToChanges, final RepresentsPersistent representsPersistent) {
- this.name = name;
- this.code = code;
- this.endState = endState;
- this.transitionFrom = transitionFrom;
- this.respondsToChanges = respondsToChanges;
- this.representsPersistent = representsPersistent;
- statesByName.put(name, this);
- }
-
- /**
- * Four character representation of the state.
- *
- * <p>
- * The format is <tt>XYZ</tt> where:
- * <ul>
- * <li><tt>X</tt> is transient state:
- * <ul>
- * <li>N</li> for <b>N</b>ew
- * <li>T</li> for <b>T</b>ransient
- * <li>P</li> for <b>P</b>ersistent
- * <li>D</li> for <b>D</b>estroyed
- * <li>V</li> for <b>V</b>alue
- * </ul>
- * </li>
- * <li><tt>Y</tt> (for persistent only) is the resolve state:
- * <ul>
- * <li>G</li> for <b>G</b>host
- * <li>R</li> for <b>R</b>esolved
- * <li>r</li> for <b>r</b>esolving
- * <li>~</li> if not persistent
- * </ul>
- * </li>
- * <li><tt>Z</tt> (for non-standalone, not resolving, not updating, not
- * destroyed) is the serialization state:
- * <ul>
- * <li>~</li> not serializing
- * <li>S</li> is serializing
- * </ul>
- * </li>
- * </ul>
- */
- public String code() {
- return code;
- }
-
- public ResolveState getEndState() {
- return endState;
- }
-
- /**
- * Returns <tt>true</tt> when an object is persistent (except for
- * {@link #VALUE} adapters).
- *
- * <p>
- * Always returns <tt>false</tt> for {@link #VALUE}.
- */
- public boolean representsPersistent() {
- return this.representsPersistent == RepresentsPersistent.REPRESENTS_PERSISTENT;
- }
-
- /**
- * As per {@link #isValidToChangeTo(ResolveState)}, but will additionally
- * return <tt>false</tt> if the current state can never be transitioned from.
- */
- public boolean canTransitionToResolving() {
- if (this.transitionFrom != CAN_TRANSITION_FROM) {
- return false;
- }
- return isValidToChangeTo(ResolveState.RESOLVING);
- }
-
- /**
- * Returns false while object is having its field set up.
- */
- public boolean respondToChangesInPersistentObjects() {
- return respondsToChanges == RESPONDS_TO_CHANGES;
- }
-
- public boolean isNew() {
- return this == NEW;
- }
-
- public boolean isValue() {
- return this == VALUE;
- }
-
- public boolean isTransient() {
- return this == TRANSIENT;
- }
-
- public boolean isGhost() {
- return this == GHOST;
- }
-
- public boolean isUpdating() {
- return this == UPDATING;
- }
-
- public boolean isResolved() {
- return this == RESOLVED;
- }
-
- public boolean isResolving() {
- return this == RESOLVING;
- }
-
- public boolean isDestroyed() {
- return this == DESTROYED;
- }
-
-
- /**
- * Determines if the resolved state can be changed from this state to the
- * specified state. Returns true if the change is valid.
- */
- public boolean isValidToChangeTo(final ResolveState nextState) {
- cacheChangeToStatesIfNecessary();
- return this.changeToStates.contains(nextState);
- }
-
- private void cacheChangeToStatesIfNecessary() {
- if (this.changeToStates == null) {
- final List<ResolveState> nextStates = Arrays.asList(changeToStatesByState.get(this));
- changeToStates = new HashSet<ResolveState>(nextStates);
- }
- }
-
- public String name() {
- return name;
- }
-
- private transient String cachedToString;
-
- @Override
- public String toString() {
- if (cachedToString == null) {
- final StringBuffer str = new StringBuffer();
- str.append("ResolveState [name=");
- str.append(name);
- str.append(",code=");
- str.append(code);
- if (endState != null) {
- str.append(",endstate=");
- str.append(endState.name());
- }
- str.append("]");
- cachedToString = str.toString();
- }
- return cachedToString;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/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 49821cd..b6c1402 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
@@ -24,7 +24,6 @@ import java.util.concurrent.Callable;
import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.core.commons.components.Injectable;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/main/java/org/apache/isis/core/metamodel/util/Dump.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/util/Dump.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/util/Dump.java
index 65235c3..3187baf 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/util/Dump.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/util/Dump.java
@@ -367,7 +367,6 @@ public final class Dump {
builder.appendln("Icon", adapter.getIconName());
builder.appendln("OID", adapter.getOid());
- builder.appendln("State", adapter.getResolveState());
builder.appendln("Version", adapter.getVersion());
} catch (final RuntimeException e) {
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java
deleted file mode 100644
index 28bfb11..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_GetEndStateTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { NEW, null }, //
- { GHOST, null }, //
- { TRANSIENT, null }, //
- // { RESOLVING_PART, PART_RESOLVED },
- // { PART_RESOLVED, null },
- { RESOLVING, RESOLVED }, //
- { RESOLVED, null }, //
- { UPDATING, RESOLVED }, //
- // { SERIALIZING_TRANSIENT, TRANSIENT },
- // { SERIALIZING_PART_RESOLVED, PART_RESOLVED },
- // { SERIALIZING_GHOST, GHOST },
- // { SERIALIZING_RESOLVED, RESOLVED },
- { VALUE, null }, //
- { DESTROYED, null }, //
- });
- }
-
- private final ResolveState from;
- private final ResolveState to;
-
- public ResolveState_GetEndStateTest(final ResolveState from, final ResolveState to) {
- this.from = from;
- this.to = to;
- }
-
- @Test
- public void testGetEndState() {
- assertThat(from.getEndState(), is(to));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java
deleted file mode 100644
index 85479b4..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsDestroyedTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] {
- { false, GHOST }, //
- { false, NEW },//
- // { false, PART_RESOLVED },
- { false, RESOLVED }, //
- { false, RESOLVING }, //
- // { false, RESOLVING_PART },
- { false, TRANSIENT }, //
- { true, DESTROYED }, //
- { false, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT },
- // { false, SERIALIZING_GHOST },
- // { false, SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_RESOLVED },
- { false, VALUE },//
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_IsDestroyedTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testIsDestroyed() {
- assertThat(state.isDestroyed(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java
deleted file mode 100644
index e59b0af..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsGhostTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] {
- { true, GHOST }, //
- { false, NEW }, //
- // { false, PART_RESOLVED },
- { false, RESOLVED }, //
- { false, RESOLVING }, //
- // { false, RESOLVING_PART },
- { false, TRANSIENT }, //
- { false, DESTROYED }, //
- { false, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT }, //
- // { false, SERIALIZING_GHOST },
- // { false, SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_RESOLVED },
- { false, VALUE },//
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_IsGhostTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testIsGhost() {
- assertThat(state.isGhost(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java
deleted file mode 100644
index 9aeb543..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsNewTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { false, GHOST }, //
- { true, NEW }, //
- // { false, PART_RESOLVED },
- { false, RESOLVED }, //
- { false, RESOLVING }, //
- // { false, RESOLVING_PART },
- { false, TRANSIENT }, //
- { false, DESTROYED }, //
- { false, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT }, //
- // { false, SERIALIZING_GHOST },
- // { false, SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_RESOLVED },
- { false, VALUE }, //
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_IsNewTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testIsNew() {
- assertThat(state.isNew(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java
deleted file mode 100644
index e13dfee..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsPersistentTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { true, GHOST }, //
- { false, NEW }, //
- // { true, PART_RESOLVED },
- { true, RESOLVED }, //
- { true, RESOLVING }, //
- // { true, RESOLVING_PART },
- { false, TRANSIENT }, //
- { false, DESTROYED }, //
- { true, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT }, //
- // { true, SERIALIZING_GHOST },
- // { true, SERIALIZING_PART_RESOLVED },
- // { true, SERIALIZING_RESOLVED },
- { false, VALUE }, //
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_IsPersistentTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testIsPersistent() {
- assertThat(state.representsPersistent(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java
deleted file mode 100644
index 6b4ef7b..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsResolvedTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { false, GHOST }, //
- { false, NEW }, //
- // { false, PART_RESOLVED },
- { true, RESOLVED }, //
- { false, RESOLVING }, //
- // { false, RESOLVING_PART },
- { false, TRANSIENT }, //
- { false, DESTROYED }, //
- { false, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT }, //
- // { false, SERIALIZING_GHOST },
- // { false, SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_RESOLVED },
- { false, VALUE }, //
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_IsResolvedTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testIsResolved() {
- assertThat(state.isResolved(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java
deleted file mode 100644
index d5c366b..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsResolvingTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { false, GHOST }, //
- { false, NEW }, //
- // { false, PART_RESOLVED },
- { false, RESOLVED }, //
- { true, RESOLVING }, //
- // { true, RESOLVING_PART },
- { false, TRANSIENT }, //
- { false, DESTROYED }, //
- { false, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT },
- // { false, SERIALIZING_GHOST },
- // { false, SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_RESOLVED },
- { false, VALUE }, //
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_IsResolvingTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testIsResolving() {
- assertThat(state.isResolving(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java
deleted file mode 100644
index 2a2394e..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsTransientTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { false, GHOST }, //
- { false, NEW }, //
- // { false, PART_RESOLVED },
- { false, RESOLVED }, //
- { false, RESOLVING }, //
- // { false, RESOLVING_PART },
- { true, TRANSIENT }, //
- { false, DESTROYED }, //
- { false, UPDATING }, //
- // { true, SERIALIZING_TRANSIENT },
- // { false, SERIALIZING_GHOST },
- // { false, SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_RESOLVED },
- { false, VALUE }, //
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_IsTransientTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testIsTransient() {
- assertThat(state.isTransient(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java
deleted file mode 100644
index 7f7604e..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_IsValidToChangeToTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { true, NEW, GHOST },//
- { false, NEW, NEW },//
- // { false, NEW, PART_RESOLVED },
- { false, NEW, RESOLVED },//
- { false, NEW, RESOLVING },//
- // { false, NEW, RESOLVING_PART },//
- { true, NEW, TRANSIENT },//
- { false, NEW, DESTROYED },//
- { false, NEW, UPDATING },//
- // { false, NEW, SERIALIZING_TRANSIENT },
- // { false, NEW, SERIALIZING_GHOST },
- // { false, NEW, SERIALIZING_PART_RESOLVED },
- // { false, NEW, SERIALIZING_RESOLVED },//
- { true, NEW, VALUE },//
-
- { false, GHOST, GHOST },//
- { false, GHOST, NEW },//
- // { false, GHOST, PART_RESOLVED },
- { false, GHOST, RESOLVED },//
- { true, GHOST, RESOLVING },//
- // { true, GHOST, RESOLVING_PART },//
- { false, GHOST, TRANSIENT },//
- { true, GHOST, DESTROYED },//
- { true, GHOST, UPDATING },//
- // { false, GHOST, SERIALIZING_TRANSIENT },
- // { true, GHOST, SERIALIZING_GHOST },
- // { false, GHOST, SERIALIZING_PART_RESOLVED },
- // { false, GHOST, SERIALIZING_RESOLVED }, //
- { false, GHOST, VALUE },//
-
- { false, TRANSIENT, GHOST },//
- { false, TRANSIENT, NEW },//
- // { false, TRANSIENT, PART_RESOLVED },
- { true, TRANSIENT, RESOLVED },//
- { false, TRANSIENT, RESOLVING },//
- // { false, TRANSIENT, RESOLVING_PART },
- { false, TRANSIENT, TRANSIENT },//
- { false, TRANSIENT, DESTROYED },//
- { false, TRANSIENT, UPDATING },//
- // { true, TRANSIENT, SERIALIZING_TRANSIENT },
- // { false, TRANSIENT, SERIALIZING_GHOST },
- // { false, TRANSIENT, SERIALIZING_PART_RESOLVED },
- // { false, TRANSIENT, SERIALIZING_RESOLVED },//
- { false, TRANSIENT, VALUE },//
-
- // { false, RESOLVING_PART, GHOST }, //
- // { false, RESOLVING_PART, NEW },//
- // { true, RESOLVING_PART, PART_RESOLVED },//
- // { true, RESOLVING_PART, RESOLVED },//
- // { false, RESOLVING_PART, RESOLVING },//
- // { false, RESOLVING_PART, RESOLVING_PART },
- // { false, RESOLVING_PART, TRANSIENT },//
- // { false, RESOLVING_PART, DESTROYED },//
- // { false, RESOLVING_PART, UPDATING },//
- // { false, RESOLVING_PART, SERIALIZING_TRANSIENT },//
- // { false, RESOLVING_PART, SERIALIZING_GHOST },
- // { false, RESOLVING_PART, SERIALIZING_PART_RESOLVED },
- // { false, RESOLVING_PART, SERIALIZING_RESOLVED }, //
- // { false, RESOLVING_PART, VALUE },//
-
- // { false, PART_RESOLVED, GHOST }, //
- // { false, PART_RESOLVED, NEW }, //
- // { false, PART_RESOLVED, PART_RESOLVED }, //
- // { false, PART_RESOLVED, RESOLVED },//
- // { true, PART_RESOLVED, RESOLVING },//
- // // { true, PART_RESOLVED, RESOLVING_PART },//
- // { false, PART_RESOLVED, TRANSIENT },//
- // { true, PART_RESOLVED, DESTROYED },//
- // { true, PART_RESOLVED, UPDATING },//
- // { false, PART_RESOLVED, SERIALIZING_TRANSIENT },//
- // // { false, PART_RESOLVED, SERIALIZING_GHOST },
- // // { true, PART_RESOLVED, SERIALIZING_PART_RESOLVED },
- // { false, PART_RESOLVED, SERIALIZING_RESOLVED }, //
- // { false, PART_RESOLVED, VALUE },//
-
- { false, RESOLVING, GHOST }, //
- { false, RESOLVING, NEW }, //
- // { false, RESOLVING, PART_RESOLVED }, //
- { true, RESOLVING, RESOLVED },//
- { false, RESOLVING, RESOLVING },//
- // { false, RESOLVING, RESOLVING_PART },//
- { false, RESOLVING, TRANSIENT },//
- { false, RESOLVING, DESTROYED },//
- { false, RESOLVING, UPDATING },//
- // { false, RESOLVING, SERIALIZING_TRANSIENT },
- // { false, RESOLVING, SERIALIZING_GHOST },
- // { false, RESOLVING, SERIALIZING_PART_RESOLVED },
- // { false, RESOLVING, SERIALIZING_RESOLVED },//
- { false, RESOLVING, VALUE },//
-
- { true, RESOLVED, GHOST }, //
- { false, RESOLVED, NEW }, //
- // { false, RESOLVED, PART_RESOLVED }, //
- { false, RESOLVED, RESOLVED }, //
- { false, RESOLVED, RESOLVING }, //
- // { false, RESOLVED, RESOLVING_PART }, //
- { false, RESOLVED, TRANSIENT },//
- { true, RESOLVED, DESTROYED },//
- { true, RESOLVED, UPDATING },//
- // { false, RESOLVED, SERIALIZING_TRANSIENT },
- // { false, RESOLVED, SERIALIZING_GHOST },
- // { false, RESOLVED, SERIALIZING_PART_RESOLVED },
- // { true, RESOLVED, SERIALIZING_RESOLVED }, //
- { false, RESOLVED, VALUE },
-
- { false, UPDATING, GHOST }, //
- { false, UPDATING, NEW }, //
- // { false, UPDATING, PART_RESOLVED }, //
- { true, UPDATING, RESOLVED }, //
- { false, UPDATING, RESOLVING }, //
- // { false, UPDATING, RESOLVING_PART }, //
- { false, UPDATING, TRANSIENT },//
- { false, UPDATING, DESTROYED },//
- { false, UPDATING, UPDATING },//
- // { false, UPDATING, SERIALIZING_TRANSIENT },
- // { false, UPDATING, SERIALIZING_GHOST },
- // { false, UPDATING, SERIALIZING_PART_RESOLVED },
- // { false, UPDATING, SERIALIZING_RESOLVED }, //
- { false, UPDATING, VALUE },//
-
- // { false, SERIALIZING_TRANSIENT, GHOST },//
- // { false, SERIALIZING_TRANSIENT, NEW }, //
- // // { false, SERIALIZING_TRANSIENT, PART_RESOLVED }, //
- // { false, SERIALIZING_TRANSIENT, RESOLVED }, //
- // { false, SERIALIZING_TRANSIENT, RESOLVING }, //
- // // { false, SERIALIZING_TRANSIENT, RESOLVING_PART },
- // { true, SERIALIZING_TRANSIENT, TRANSIENT }, //
- // { false, SERIALIZING_TRANSIENT, DESTROYED }, //
- // { false, SERIALIZING_TRANSIENT, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT, SERIALIZING_TRANSIENT },//
- // // { false, SERIALIZING_TRANSIENT, SERIALIZING_GHOST },
- // // { false, SERIALIZING_TRANSIENT, SERIALIZING_PART_RESOLVED
- // },
- // // { false, SERIALIZING_TRANSIENT, SERIALIZING_RESOLVED }, //
- // { false, SERIALIZING_TRANSIENT, VALUE },//
-
- // { false, SERIALIZING_PART_RESOLVED, GHOST }, { false,
- // SERIALIZING_PART_RESOLVED, NEW }, { true,
- // SERIALIZING_PART_RESOLVED, PART_RESOLVED }, { false,
- // SERIALIZING_PART_RESOLVED, RESOLVED }, { false,
- // SERIALIZING_PART_RESOLVED, RESOLVING },
- // { false, SERIALIZING_PART_RESOLVED, RESOLVING_PART }, {
- // false, SERIALIZING_PART_RESOLVED, TRANSIENT }, { false,
- // SERIALIZING_PART_RESOLVED, DESTROYED }, { false,
- // SERIALIZING_PART_RESOLVED, UPDATING }, { false,
- // SERIALIZING_PART_RESOLVED, SERIALIZING_TRANSIENT },
- // { false, SERIALIZING_PART_RESOLVED, SERIALIZING_GHOST }, {
- // false, SERIALIZING_PART_RESOLVED, SERIALIZING_PART_RESOLVED
- // }, { false, SERIALIZING_PART_RESOLVED, SERIALIZING_RESOLVED
- // }, { false, SERIALIZING_PART_RESOLVED, VALUE },
-
- // { false, SERIALIZING_RESOLVED, GHOST }, //
- // { false, SERIALIZING_RESOLVED, NEW }, //
- // // { false, SERIALIZING_RESOLVED, PART_RESOLVED }, //
- // { true, SERIALIZING_RESOLVED, RESOLVED }, //
- // { false, SERIALIZING_RESOLVED, RESOLVING }, //
- // // { false, SERIALIZING_RESOLVED, RESOLVING_PART }, //
- // { false, SERIALIZING_RESOLVED, TRANSIENT }, //
- // { false, SERIALIZING_RESOLVED, DESTROYED }, //
- // { false, SERIALIZING_RESOLVED, UPDATING }, //
- // { false, SERIALIZING_RESOLVED, SERIALIZING_TRANSIENT },
- // // { false, SERIALIZING_RESOLVED, SERIALIZING_GHOST },
- // // { false, SERIALIZING_RESOLVED, SERIALIZING_PART_RESOLVED
- // },
- // { false, SERIALIZING_RESOLVED, SERIALIZING_RESOLVED }, //
- // { false, SERIALIZING_RESOLVED, VALUE },
-
- // { true, SERIALIZING_GHOST, GHOST }, { false,
- // SERIALIZING_GHOST, NEW }, { false, SERIALIZING_GHOST,
- // PART_RESOLVED }, { false, SERIALIZING_GHOST, RESOLVED }, {
- // false, SERIALIZING_GHOST, RESOLVING }, { false,
- // SERIALIZING_GHOST, RESOLVING_PART }, { false,
- // SERIALIZING_GHOST, TRANSIENT },
- // { false, SERIALIZING_GHOST, DESTROYED }, { false,
- // SERIALIZING_GHOST, UPDATING }, { false, SERIALIZING_GHOST,
- // SERIALIZING_TRANSIENT }, { false, SERIALIZING_GHOST,
- // SERIALIZING_GHOST }, { false, SERIALIZING_GHOST,
- // SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_GHOST, SERIALIZING_RESOLVED }, { false,
- // SERIALIZING_GHOST, VALUE },
-
- { false, VALUE, GHOST }, //
- { false, VALUE, NEW }, //
- // { false, VALUE, PART_RESOLVED }, //
- { false, VALUE, RESOLVED }, //
- { false, VALUE, RESOLVING }, //
- // { false, VALUE, RESOLVING_PART }, //
- { false, VALUE, TRANSIENT }, //
- { false, VALUE, DESTROYED }, //
- { false, VALUE, UPDATING }, //
- // { false, VALUE, SERIALIZING_TRANSIENT },
- // { false, VALUE, SERIALIZING_GHOST },
- // { false, VALUE, SERIALIZING_PART_RESOLVED },
- // { false, VALUE, SERIALIZING_RESOLVED }, //
- { false, VALUE, VALUE },
-
- { false, DESTROYED, GHOST }, //
- { false, DESTROYED, NEW }, //
- // { false, DESTROYED, PART_RESOLVED }, //
- { false, DESTROYED, RESOLVED }, //
- { false, DESTROYED, RESOLVING }, //
- // { false, DESTROYED, RESOLVING_PART }, //
- { false, DESTROYED, TRANSIENT }, //
- { false, DESTROYED, DESTROYED }, //
- { false, DESTROYED, UPDATING }, //
- // { false, DESTROYED, SERIALIZING_TRANSIENT },
- // { false, DESTROYED, SERIALIZING_GHOST },
- // { false, DESTROYED, SERIALIZING_PART_RESOLVED },
- // { false, DESTROYED, SERIALIZING_RESOLVED }, //
- { false, DESTROYED, VALUE },
-
- });
- }
-
- private final boolean whetherValidToChangeTo;
- private final ResolveState from;
- private final ResolveState to;
-
- public ResolveState_IsValidToChangeToTest(final boolean whetherValidToChangeTo, final ResolveState from, final ResolveState to) {
- this.whetherValidToChangeTo = whetherValidToChangeTo;
- this.from = from;
- this.to = to;
- }
-
- @Test
- public void testIsValidToChange() {
- assertThat(from.isValidToChangeTo(to), is(whetherValidToChangeTo));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java
deleted file mode 100644
index 767d884..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.adapter;
-
-import static org.apache.isis.core.metamodel.adapter.ResolveState.DESTROYED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.GHOST;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class ResolveState_RespondToChangesInPersistentObjectsTest {
-
- @Parameters
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][] { { true, GHOST }, //
- { false, NEW }, //
- // { true, PART_RESOLVED },
- { true, RESOLVED }, //
- { false, RESOLVING }, //
- // { false, RESOLVING_PART },
- { false, TRANSIENT }, //
- { true, DESTROYED }, //
- { false, UPDATING }, //
- // { false, SERIALIZING_TRANSIENT },
- // { false, SERIALIZING_GHOST },
- // { false, SERIALIZING_PART_RESOLVED },
- // { false, SERIALIZING_RESOLVED },
- { true, VALUE }, //
- });
- }
-
- private final boolean whetherIs;
- private final ResolveState state;
-
- public ResolveState_RespondToChangesInPersistentObjectsTest(final boolean whetherIs, final ResolveState state) {
- this.whetherIs = whetherIs;
- this.state = state;
- }
-
- @Test
- public void testRespondToChangesInPersistentObjects() {
- assertThat(state.respondToChangesInPersistentObjects(), is(whetherIs));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Data.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Data.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Data.java
index 85d8251..d696860 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Data.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Data.java
@@ -26,7 +26,6 @@ import org.apache.isis.core.commons.debug.DebugBuilder;
import org.apache.isis.core.commons.encoding.DataInputExtended;
import org.apache.isis.core.commons.encoding.DataOutputExtended;
import org.apache.isis.core.commons.encoding.Encodable;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
@@ -64,8 +63,7 @@ public class Data implements Encodable, Serializable {
// ///////////////////////////////////////////////////////
/**
- * Note: could be <tt>null</tt> if represents a
- * {@link ResolveState#isValue() standalone} adapter.
+ * Note: could be <tt>null</tt> if represents a value (standalone adapter).
*/
public Oid getOid() {
return oid;
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
index e30c3b0..8daff63 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
@@ -49,7 +49,6 @@ import org.apache.isis.core.metamodel.spec.feature.Contributed;
import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.runtime.persistence.PersistorUtil;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
@@ -310,13 +309,8 @@ public class Memento implements Serializable {
boolean dataIsTransient = data.getOid().isTransient();
if (!dataIsTransient) {
- try {
- PersistorUtil.startResolvingOrUpdating(objectAdapter);
- updateFields(objectAdapter, data);
- objectAdapter.getOid().setVersion(data.getOid().getVersion());
- } finally {
- PersistorUtil.toEndState(objectAdapter);
- }
+ updateFields(objectAdapter, data);
+ objectAdapter.getOid().setVersion(data.getOid().getVersion());
} else if (objectAdapter.isTransient() && dataIsTransient) {
updateFields(objectAdapter, data);
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistorUtil.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistorUtil.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistorUtil.java
deleted file mode 100644
index 6718ca0..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistorUtil.java
+++ /dev/null
@@ -1,76 +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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-
-public class PersistorUtil {
-
- private static final Logger LOG = LoggerFactory.getLogger(PersistorUtil.class);
-
- private PersistorUtil() {
- }
-
- // //////////////////////////////////////////////////////////////////
- // update resolve state
- // //////////////////////////////////////////////////////////////////
-
- public static void startResolvingOrUpdating(ObjectAdapter objectAdapter) {
- if(objectAdapter.canTransitionToResolving()) {
- startResolving(objectAdapter);
- } else {
- startUpdating(objectAdapter);
- }
- }
-
- public static void startResolving(final ObjectAdapter adapter) {
- changeTo(adapter, ResolveState.RESOLVING);
- }
-
- public static void startUpdating(final ObjectAdapter adapter) {
- changeTo(adapter, ResolveState.UPDATING);
- }
-
- private static void changeTo(final ObjectAdapter adapter, final ResolveState state) {
- changeTo("start ", adapter, state);
- }
-
- /**
- * Marks the specified object as loaded: resolved, partly resolve or updated
- * as specified by the second parameter. Attempting to specify any other
- * state throws a run time exception.
- */
- public static void toEndState(final ObjectAdapter adapter) {
- changeTo("end ", adapter, adapter.getResolveState().getEndState());
- }
-
- private static void changeTo(final String direction, final ObjectAdapter adapter, final ResolveState state) {
- if (LOG.isTraceEnabled()) {
- LOG.trace(direction + adapter + " as " + state.name());
- }
- adapter.changeState(state);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/a91eef53/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
index 98c4cc5..c13e70a 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
@@ -19,16 +19,16 @@
package org.apache.isis.core.runtime.persistence.adapter;
+import org.datanucleus.enhancement.Persistable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.isis.applib.profiles.Localization;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.ensure.Assert;
import org.apache.isis.core.commons.ensure.Ensure;
import org.apache.isis.core.commons.exceptions.IsisException;
import org.apache.isis.core.commons.util.ToString;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
@@ -38,7 +38,12 @@ import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
import org.apache.isis.core.metamodel.adapter.version.Version;
import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.spec.*;
+import org.apache.isis.core.metamodel.spec.ElementSpecificationProvider;
+import org.apache.isis.core.metamodel.spec.Instance;
+import org.apache.isis.core.metamodel.spec.InstanceAbstract;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.Specification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
@@ -57,7 +62,6 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
private Object pojo;
private Oid oid;
- private ResolveState resolveState;
private ElementSpecificationProvider elementSpecificationProvider;
@@ -79,7 +83,6 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
}
this.pojo = pojo;
this.oid = oid;
- resolveState = ResolveState.NEW;
}
@@ -122,127 +125,8 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
}
- // ///////////////////////////////////////////////////////////////////
- // ResolveState, changeState
- // ///////////////////////////////////////////////////////////////////
-
- @Override
- public ResolveState getResolveState() {
- return aggregateResolveState();
- }
-
-
- private ResolveState aggregateResolveState() {
- return isAggregated() ?
- ((PojoAdapter)getAggregateRoot()).aggregateResolveState() :
- resolveState;
- }
-
-
-
- @Override
- public void changeState(final ResolveState newState) {
- if(isAggregated()) {
- return; // no-op for aggregated objects.
- }
-
- final boolean validToChangeTo = resolveState.isValidToChangeTo(newState);
- // don't call toString() since that could hit titleString() and we might
- // be in the process of transitioning to ghost
- Assert.assertTrue("oid= " + this.getOid() + "; can't change from " + resolveState.name() + " to " + newState.name(), validToChangeTo);
-
- if (LOG.isTraceEnabled()) {
- String oidString;
- if (oid == null) {
- oidString = "";
- } else {
- // don't call toString() in case in process of transitioning to
- // ghost
- oidString = "for " + this.getOid() + " ";
- }
- LOG.trace(oidString + "changing resolved state to " + newState.name());
- }
- resolveState = newState;
- }
-
- private boolean elementsLoaded() {
- return isTransient() || this.isResolved();
- }
-
- // ///////////////////////////////////////////////////////////////////
- // ResolveState
- // ///////////////////////////////////////////////////////////////////
-
- /**
- * Just delegates to {@link #aggregateResolveState() resolve state}.
- *
- * @see ResolveState#representsPersistent()
- * @see #isTransient()
- */
- @Override
- public boolean representsPersistent() {
- return aggregateResolveState().representsPersistent();
- }
-
-
- /**
- * Just delegates to {@link #aggregateResolveState() resolve state}.
- *
- * @see ResolveState#isTransient()
- * @see #representsPersistent()
- */
- @Override
- public boolean isTransient() {
- return aggregateResolveState().isTransient();
- }
-
- @Override
- public boolean isNew() {
- return aggregateResolveState().isNew();
- }
-
- @Override
- public boolean isResolving() {
- return aggregateResolveState().isResolving();
- }
-
- @Override
- public boolean isResolved() {
- return aggregateResolveState().isResolved();
- }
-
- @Override
- public boolean isGhost() {
- return aggregateResolveState().isGhost();
- }
-
- @Override
- public boolean isUpdating() {
- return aggregateResolveState().isUpdating();
- }
-
- @Override
- public boolean isDestroyed() {
- return aggregateResolveState().isDestroyed();
- }
-
- @Override
- public boolean canTransitionToResolving() {
- return aggregateResolveState().canTransitionToResolving();
- }
- /**
- * If {@link #isGhost()}, then will become resolved.
- */
- @Override
- public void markAsResolvedIfPossible() {
- if (!canTransitionToResolving()) {
- return;
- }
- changeState(ResolveState.RESOLVING);
- changeState(ResolveState.RESOLVED);
- }
@@ -273,11 +157,85 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
@Override
public boolean isValue() {
- // equivalently: aggregateResolveState().isValue();
return oid == null;
}
@Override
+ public boolean isTransient() {
+ if(getSpecification().isService()) {
+ // view models are treated as persistent objects
+ return false;
+ }
+ if(getSpecification().isViewModel()) {
+ // view models are treated as persistent objects
+ return false;
+ }
+ if (pojo instanceof Persistable) {
+ final Persistable pojo = (Persistable) this.pojo;
+ final boolean isNew = pojo.dnIsNew();
+ final boolean isPersistent = pojo.dnIsPersistent();
+ final boolean isDirty = pojo.dnIsDirty();
+ final boolean isDeleted = pojo.dnIsDeleted();
+ final boolean isDetached = pojo.dnIsDetached();
+ final boolean isTransactional = pojo.dnIsTransactional();
+ if (!isPersistent && !isDeleted) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean representsPersistent() {
+ if(getSpecification().isService()) {
+ // view models are treated as persistent objects
+ return true;
+ }
+ if(getSpecification().isViewModel()) {
+ // view models are treated as persistent objects
+ return true;
+ }
+ if (pojo instanceof Persistable) {
+ final Persistable pojo = (Persistable) this.pojo;
+ final boolean isNew = pojo.dnIsNew();
+ final boolean isPersistent = pojo.dnIsPersistent();
+ final boolean isDirty = pojo.dnIsDirty();
+ final boolean isDeleted = pojo.dnIsDeleted();
+ final boolean isDetached = pojo.dnIsDetached();
+ final boolean isTransactional = pojo.dnIsTransactional();
+ if (isPersistent) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isDestroyed() {
+ if(getSpecification().isService()) {
+ // view models are treated as persistent objects
+ return false;
+ }
+ if(getSpecification().isViewModel()) {
+ // view models are treated as persistent objects
+ return false;
+ }
+ if (pojo instanceof Persistable) {
+ final Persistable pojo = (Persistable) this.pojo;
+ final boolean isNew = pojo.dnIsNew();
+ final boolean isPersistent = pojo.dnIsPersistent();
+ final boolean isDirty = pojo.dnIsDirty();
+ final boolean isDeleted = pojo.dnIsDeleted();
+ final boolean isDetached = pojo.dnIsDetached();
+ final boolean isTransactional = pojo.dnIsTransactional();
+ if (isDeleted) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
public ObjectAdapter getAggregateRoot() {
if(!isParented()) {
return this;
@@ -383,9 +341,6 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
}
private String objectTitleString(ObjectAdapter contextAdapterIfAny) {
- if (isNew()) {
- return "";
- }
if (getObject() instanceof String) {
return (String) getObject();
}
@@ -399,7 +354,7 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
}
private String collectionTitleString(final CollectionFacet facet) {
- final int size = elementsLoaded() ? facet.size(this) : INCOMPLETE_COLLECTION;
+ final int size = facet.size(this);
final ObjectSpecification elementSpecification = getElementSpecification();
if (elementSpecification == null || elementSpecification.getFullIdentifier().equals(Object.class.getName())) {
switch (size) {
@@ -445,7 +400,7 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
}
protected void toString(final ToString str) {
- str.append(aggregateResolveState().code());
+ str.append(aggregateResolveStateCode());
final Oid oid = getOid();
if (oid != null) {
str.append(":");
@@ -465,6 +420,18 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
}
}
+ private String aggregateResolveStateCode() {
+
+ // this is an approximate re-implementation...
+ final Oid oid = getOid();
+ if(oid != null) {
+ if(oid.isPersistent()) return "P";
+ if(oid.isTransient()) return "T";
+ if(oid.isViewModel()) return "V";
+ }
+ return "S"; // standalone adapter (value)
+ }
+
// ///////////////////////////////////////////////////////////////////
// IconName
// ///////////////////////////////////////////////////////////////////
@@ -506,17 +473,6 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
throw new UnsupportedOperationException();
}
- // ///////////////////////////////////////////////////////////////////
- // Fire Changes
- // ///////////////////////////////////////////////////////////////////
-
-
- @Override
- public boolean respondToChangesInPersistentObjects() {
- return aggregateResolveState().respondToChangesInPersistentObjects();
- }
-
-
////////////////////////////////////////////////////////////////////
@@ -531,6 +487,4 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
return authenticationSession;
}
-
-
}