incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1036148 - in /incubator/isis/trunk: alternatives/progmodel/groovy/ alternatives/progmodel/groovy/applib/ alternatives/progmodel/groovy/gapplib/ alternatives/progmodel/groovy/gmetamodel/ alternatives/progmodel/groovy/metamodel/ viewer/bdd/c...
Date Wed, 17 Nov 2010 18:02:18 GMT
Author: danhaywood
Date: Wed Nov 17 18:02:17 2010
New Revision: 1036148

URL: http://svn.apache.org/viewvc?rev=1036148&view=rev
Log:
renaming groovy submodule directories to be consistent with artifactIds

Added:
    incubator/isis/trunk/alternatives/progmodel/groovy/applib/
      - copied from r1035987, incubator/isis/trunk/alternatives/progmodel/groovy/gapplib/
    incubator/isis/trunk/alternatives/progmodel/groovy/metamodel/
      - copied from r1035987, incubator/isis/trunk/alternatives/progmodel/groovy/gmetamodel/
Removed:
    incubator/isis/trunk/alternatives/progmodel/groovy/gapplib/
    incubator/isis/trunk/alternatives/progmodel/groovy/gmetamodel/
Modified:
    incubator/isis/trunk/alternatives/progmodel/groovy/pom.xml
    incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/UsingIsisViewerPeer.java
    incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/SaveObject.java
    incubator/isis/trunk/viewer/bdd/concordion/src/main/java/org/apache/isis/viewer/bdd/concordion/internal/fixtures/UsingIsisViewerForConcordion.java
    incubator/isis/trunk/viewer/bdd/fitnesse/src/main/java/net/sf/isiscontrib/bdd/fitnesse/internal/fixtures/UsingIsisViewerForFitNesse.java
    incubator/isis/trunk/viewer/bdd/src/docbkx/guide/isis-bdd-viewer.xml

Modified: incubator/isis/trunk/alternatives/progmodel/groovy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/progmodel/groovy/pom.xml?rev=1036148&r1=1036147&r2=1036148&view=diff
==============================================================================
--- incubator/isis/trunk/alternatives/progmodel/groovy/pom.xml (original)
+++ incubator/isis/trunk/alternatives/progmodel/groovy/pom.xml Wed Nov 17 18:02:17 2010
@@ -31,8 +31,8 @@
 	<url>http://incubator.apache.org/isis/${relativeUrl}</url>
 
 	<modules>
-		<module>gapplib</module>
-		<module>gmetamodel</module>
+		<module>applib</module>
+		<module>metamodel</module>
 	</modules>
 
 	<build>

Modified: incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/UsingIsisViewerPeer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/UsingIsisViewerPeer.java?rev=1036148&r1=1036147&r2=1036148&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/UsingIsisViewerPeer.java
(original)
+++ incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/UsingIsisViewerPeer.java
Wed Nov 17 18:02:17 2010
@@ -44,318 +44,308 @@ import org.apache.isis.viewer.bdd.common
 
 public class UsingIsisViewerPeer extends AbstractFixturePeer {
 
-	private static List<Perform> performCommands(final Perform.Mode mode) {
-		ArrayList<Perform> commands = new ArrayList<Perform>();
+    private static List<Perform> performCommands(final Perform.Mode mode) {
+        ArrayList<Perform> commands = new ArrayList<Perform>();
 
-		commands.add(new CheckProperty(mode));
-		commands.add(new CheckSetProperty(mode));
-		commands.add(new CheckClearProperty(mode));
-		commands.add(new GetProperty(mode));
-		commands.add(new SetProperty(mode));
-		commands.add(new ClearProperty(mode));
-		commands.add(new GetPropertyDefault(mode));
-		commands.add(new GetPropertyChoices(mode));
-
-		commands.add(new CheckCollection(mode));
-		commands.add(new CheckAddToCollection(mode));
-		commands.add(new CheckRemoveFromCollection(mode));
-		commands.add(new AddToCollection(mode));
-		commands.add(new RemoveFromCollection(mode));
-		commands.add(new GetCollection(mode));
-
-		commands.add(new CheckAction(mode));
-		commands.add(new InvokeAction(mode));
-		commands.add(new GetActionParameterDefault(mode));
-		commands.add(new GetActionParameterChoices(mode));
-
-		commands.add(new CheckObject(mode));
-		commands.add(new SaveObject(mode));
-
-		return commands;
-	}
-
-	private final CellBinding onObjectBinding;
-	private final CellBinding aliasResultAsBinding;
-	private final CellBinding performBinding;
-	private final CellBinding onMemberBinding;
-	private final CellBinding thatItBinding;
-	private final CellBinding arg0Binding;
-
-	private final Map<String, Perform> commandByKey = new HashMap<String, Perform>();
-
-	public UsingIsisViewerPeer(final AliasRegistry aliasesRegistry,
-			final Perform.Mode mode, final CellBinding onObjectBinding,
-			final CellBinding aliasResultAsBinding,
-			final CellBinding performBinding,
-			final CellBinding onMemberBinding, final CellBinding thatItBinding,
-			final CellBinding arg0Binding) {
-		super(aliasesRegistry, onObjectBinding, aliasResultAsBinding,
-				performBinding, onMemberBinding, thatItBinding, arg0Binding);
-
-		this.onObjectBinding = onObjectBinding;
-		this.aliasResultAsBinding = aliasResultAsBinding;
-		this.performBinding = performBinding;
-		this.onMemberBinding = onMemberBinding;
-		this.thatItBinding = thatItBinding;
-		this.arg0Binding = arg0Binding;
-
-		final List<Perform> performCommands = performCommands(mode);
-		for (final Perform command : performCommands) {
-			commandByKey.put(command.getKey(), command);
-		}
-	}
-
-	public CellBinding getOnObjectBinding() {
-		return onObjectBinding;
-	}
-
-	public CellBinding getAliasResultAsBinding() {
-		return aliasResultAsBinding;
-	}
-
-	public CellBinding getOnMemberBinding() {
-		return onMemberBinding;
-	}
-
-	public CellBinding getPerformBinding() {
-		return performBinding;
-	}
-
-	public CellBinding getThatItBinding() {
-		return thatItBinding;
-	}
-
-	public CellBinding getArg0Binding() {
-		return arg0Binding;
-	}
-
-	public boolean isArg0BindingLast() {
-		return !bindingAfterArg0();
-
-	}
-
-	private boolean bindingAfterArg0() {
-		if (!getArg0Binding().isFound()) {
-			return false;
-		}
-		for (final CellBinding binding : getCellBindings()) {
-			if (binding.getColumn() > getArg0Binding().getColumn()) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	// //////////////////////////////////////////////////////////////////
-	// 
-	// //////////////////////////////////////////////////////////////////
-
-	public void makePersistent(ObjectAdapter adapter) {
-		getPersistenceSession().makePersistent(adapter);
-	}
-
-	public void provideDefault(StoryCell storySource, String resultStr) {
-		// TODO Auto-generated method stub
-		throw new NotYetImplementedException();
-	}
-
-	private String previousOnObject = null;
-
-	public ObjectAdapter validateOnObject() throws StoryBoundValueException {
-
-		StoryCell onObjectCell = onObjectBinding.getCurrentCell();
-		String onObject = onObjectCell.getText();
-		if (onObject == null) {
-			if (previousOnObject == null) {
-				throw StoryBoundValueException.current(onObjectBinding, "(required)");
-			}
-			onObject = previousOnObject;
-		} else {
-			previousOnObject = onObject;
-		}
-		final ObjectAdapter onAdapter = getAliasRegistry().getAliased(onObject);
-		if (onAdapter == null) {
-			throw StoryBoundValueException.current(onMemberBinding, "(unknown object)");
-		}
-		return onAdapter;
-	}
-
-	public String validateAliasAs() throws StoryBoundValueException {
-		if (getAliasResultAsBinding() == null) {
-			return null;
-		}
-		final StoryCell aliasCell = aliasResultAsBinding
-				.getCurrentCell();
-		if (aliasCell == null) {
-			return null;
-		}
-
-		String aliasAs = aliasCell.getText();
-		if (getAliasRegistry().getAliased(aliasAs) != null) {
-			throw StoryBoundValueException.current(aliasResultAsBinding, "(already used)");
-		}
-		return aliasAs;
-	}
-
-	public ObjectMember validateOnMember(ObjectAdapter onAdapter)
-			throws StoryBoundValueException {
-
-		final StoryCell onMemberCell = onMemberBinding.getCurrentCell();
-		final String onMember = onMemberCell.getText();
-
-		if (Strings.emptyString(onMember)) {
-			throw StoryBoundValueException.current(onMemberBinding, "(required)");
-		}
-
-		if (onAdapter == null) {
-			return null;
-		}
-
-		// see if property, collection or action.
-		final String memberId = Strings.memberIdFor(onMember);
-		final ObjectSpecification spec = onAdapter.getSpecification();
-		final List<ObjectMember> objectMembers = new ArrayList<ObjectMember>();
-
-		objectMembers.addAll(spec.getAssociationList());
-
-		// see if action (of any type)
-		objectMembers.addAll(spec
-				.getObjectActionList(ObjectActionType.USER));
-		objectMembers.addAll(spec
-				.getObjectActionList(ObjectActionType.EXPLORATION));
-		objectMembers.addAll(spec
-				.getObjectActionList(ObjectActionType.DEBUG));
-		for (final ObjectMember member : objectMembers) {
-			if (matchesId(member, memberId)) {
-				return member;
-			}
-			// special handling for contributed actions.
-			if (member instanceof ObjectActionSet) {
-				final ObjectActionSet actionSet = (ObjectActionSet) member;
-				for (final ObjectAction contributedAction : actionSet
-						.getActions()) {
-					if (contributedAction.getId().equals(memberId)) {
-						return contributedAction;
-					}
-				}
-			}
-		}
-		throw StoryBoundValueException.current(onMemberBinding, "(unknown member)");
-	}
-
-	private boolean matchesId(final ObjectMember member,
-			final String memberId) {
-		return member.getId().equals(memberId);
-	}
-
-	public Perform validatePerform() throws StoryBoundValueException {
-		final String perform = performBinding.getCurrentCell()
-				.getText();
-		if (perform == null) {
-			throw StoryBoundValueException.current(performBinding, "(required)");
-		}
-		final Perform performCommand = commandByKey.get(perform);
-		if (performCommand == null) {
-			throw StoryBoundValueException.current(performBinding, "(unknown interaction)");
-		}
-		return performCommand;
-	}
-
-	private void aliasResultFromPerformCommand(Perform performCommand,
-			String aliasAs) throws StoryBoundValueException {
-		if (Strings.emptyString(aliasAs)) {
-			return;
-		}
-		final ObjectAdapter resultAdapter = performCommand.getResult();
-		if (resultAdapter == null) {
-			throw StoryBoundValueException.current(onMemberBinding, "(no result)");
-		}
-		getAliasRegistry().aliasAs(aliasAs, resultAdapter);
-	}
-
-	public StoryCell getMemberElseOnObjectCell() {
-		StoryCell storyCell = getOnMemberBinding().getCurrentCell();
-		if (storyCell == null) {
-			storyCell = getOnObjectBinding().getCurrentCell();
-		}
-		return storyCell;
-	}
-
-	public void performCommand(Perform performCommand, ObjectAdapter onAdapter,
-			ObjectMember nakedObjectMember,
-			List<StoryCell> argumentStoryCells, 
-			String aliasAs)
-			throws StoryBoundValueException {
-		PerformContext performContext = new PerformContext(this, onAdapter,
-				nakedObjectMember, argumentStoryCells);
-		try {
-			performCommand.perform(performContext);
-		} catch (final RuntimeException ex) {
-			// handler should have colored in invalid cells.
-		}
-		aliasResultFromPerformCommand(performCommand, aliasAs);
-	}
-
-	public ObjectAdapter getAdapter(final ObjectAdapter contextAdapter,
-			final ObjectSpecification noSpec, final CellBinding contextBinding, final StoryCell paramCell)
-			throws StoryBoundValueException {
-
-		final String cellText = paramCell.getText();
-
-		// see if can handle as parseable value
-		final ParseableFacet parseableFacet = noSpec
-				.getFacet(ParseableFacet.class);
-		if (parseableFacet != null) {
-			try {
-				return parseableFacet.parseTextEntry(contextAdapter, cellText);
-			} catch (final IllegalArgumentException ex) {
-				throw StoryBoundValueException.arg(contextBinding, paramCell, "(cannot parse)");
-			}
-		}
-
-		// otherwise, handle as reference to known object
-		final ObjectAdapter adapter = getAliasRegistry().getAliased(cellText);
-		if (adapter == null) {
-			throw StoryBoundValueException.arg(contextBinding, paramCell, "(unknown reference)");
-		}
-
-		return adapter;
-	}
-
-	/**
-	 * Ensures that there are at least enough arguments for the number of parameters required.
-	 */
-	public ObjectAdapter[] getAdapters(final ObjectAdapter onAdapter,
-			final ObjectAction nakedObjectAction,
-			CellBinding onMemberBinding, final List<StoryCell> argumentCells) throws StoryBoundValueException
{
-		final ObjectActionParameter[] parameters = nakedObjectAction
-				.getParameters();
-		
-		int parameterCount = parameters.length;
-		if (argumentCells.size() < parameterCount) {
-			throw StoryBoundValueException.current(onMemberBinding, 
-					"(action requires " + parameterCount + " arguments)");
-		}
-		final ObjectAdapter[] adapters = new ObjectAdapter[parameterCount];
-
-
-		for (int i = 0; i < parameterCount; i++) {
-			final StoryCell paramCell = argumentCells.get(i);
-			final ObjectActionParameter parameter = parameters[i];
-			adapters[i] = getAdapter(null, parameter.getSpecification(),
-					onMemberBinding, paramCell);
-		}
-		return adapters;
-	}
-
-	public ObjectAdapter toAdaptedListOfPojos(final ObjectAdapter[] choiceAdapters) {
-		final List<Object> choiceList = new ArrayList<Object>();
-		if (choiceAdapters != null) {
-			for (final ObjectAdapter adapter : choiceAdapters) {
-				choiceList.add(adapter.getObject());
-			}
-		}
-		return getAdapterManager().adapterFor(choiceList);
-	}
+        commands.add(new CheckProperty(mode));
+        commands.add(new CheckSetProperty(mode));
+        commands.add(new CheckClearProperty(mode));
+        commands.add(new GetProperty(mode));
+        commands.add(new SetProperty(mode));
+        commands.add(new ClearProperty(mode));
+        commands.add(new GetPropertyDefault(mode));
+        commands.add(new GetPropertyChoices(mode));
+
+        commands.add(new CheckCollection(mode));
+        commands.add(new CheckAddToCollection(mode));
+        commands.add(new CheckRemoveFromCollection(mode));
+        commands.add(new AddToCollection(mode));
+        commands.add(new RemoveFromCollection(mode));
+        commands.add(new GetCollection(mode));
+
+        commands.add(new CheckAction(mode));
+        commands.add(new InvokeAction(mode));
+        commands.add(new GetActionParameterDefault(mode));
+        commands.add(new GetActionParameterChoices(mode));
+
+        commands.add(new CheckObject(mode));
+        commands.add(new SaveObject(mode));
+
+        return commands;
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // constructor
+    // //////////////////////////////////////////////////////////////////
+
+    private final CellBinding onObjectBinding;
+    private final CellBinding aliasResultAsBinding;
+    private final CellBinding performBinding;
+    private final CellBinding onMemberBinding;
+    private final CellBinding thatItBinding;
+    private final CellBinding arg0Binding;
+
+    private final Map<String, Perform> commandByKey = new HashMap<String, Perform>();
+
+    public UsingIsisViewerPeer(final AliasRegistry aliasesRegistry, final Perform.Mode mode,
+        final CellBinding onObjectBinding, final CellBinding aliasResultAsBinding, final
CellBinding performBinding,
+        final CellBinding onMemberBinding, final CellBinding thatItBinding, final CellBinding
arg0Binding) {
+        super(aliasesRegistry, onObjectBinding, aliasResultAsBinding, performBinding, onMemberBinding,
thatItBinding,
+            arg0Binding);
+
+        this.onObjectBinding = onObjectBinding;
+        this.aliasResultAsBinding = aliasResultAsBinding;
+        this.performBinding = performBinding;
+        this.onMemberBinding = onMemberBinding;
+        this.thatItBinding = thatItBinding;
+        this.arg0Binding = arg0Binding;
+
+        final List<Perform> performCommands = performCommands(mode);
+        for (final Perform command : performCommands) {
+            commandByKey.put(command.getKey(), command);
+        }
+    }
+
+    public CellBinding getOnObjectBinding() {
+        return onObjectBinding;
+    }
+
+    public CellBinding getAliasResultAsBinding() {
+        return aliasResultAsBinding;
+    }
+
+    public CellBinding getOnMemberBinding() {
+        return onMemberBinding;
+    }
+
+    public CellBinding getPerformBinding() {
+        return performBinding;
+    }
+
+    public CellBinding getThatItBinding() {
+        return thatItBinding;
+    }
+
+    public CellBinding getArg0Binding() {
+        return arg0Binding;
+    }
+
+    public boolean isArg0BindingLast() {
+        return !bindingAfterArg0();
+
+    }
+
+    private boolean bindingAfterArg0() {
+        if (!getArg0Binding().isFound()) {
+            return false;
+        }
+        for (final CellBinding binding : getCellBindings()) {
+            if (binding.getColumn() > getArg0Binding().getColumn()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // validate API
+    // //////////////////////////////////////////////////////////////////
+
+    public ObjectAdapter validateOnObject() throws StoryBoundValueException {
+
+        StoryCell onObjectCell = onObjectBinding.getCurrentCell();
+        String onObject = onObjectCell.getText();
+        if (onObject == null) {
+            if (previousOnObject == null) {
+                throw StoryBoundValueException.current(onObjectBinding, "(required)");
+            }
+            onObject = previousOnObject;
+        } else {
+            previousOnObject = onObject;
+        }
+        final ObjectAdapter onAdapter = getAliasRegistry().getAliased(onObject);
+        if (onAdapter == null) {
+            throw StoryBoundValueException.current(onMemberBinding, "(unknown object)");
+        }
+        return onAdapter;
+    }
+
+    public String validateAliasAs() throws StoryBoundValueException {
+        if (getAliasResultAsBinding() == null) {
+            return null;
+        }
+        final StoryCell aliasCell = aliasResultAsBinding.getCurrentCell();
+        if (aliasCell == null) {
+            return null;
+        }
+
+        String aliasAs = aliasCell.getText();
+        if (getAliasRegistry().getAliased(aliasAs) != null) {
+            throw StoryBoundValueException.current(aliasResultAsBinding, "(already used)");
+        }
+        return aliasAs;
+    }
+
+    public ObjectMember validateOnMember(ObjectAdapter onAdapter) throws StoryBoundValueException
{
+
+        final StoryCell onMemberCell = onMemberBinding.getCurrentCell();
+        final String onMember = onMemberCell.getText();
+
+        if (Strings.emptyString(onMember)) {
+            throw StoryBoundValueException.current(onMemberBinding, "(required)");
+        }
+
+        if (onAdapter == null) {
+            return null;
+        }
+
+        // see if property, collection or action.
+        final String memberId = Strings.memberIdFor(onMember);
+        final ObjectSpecification spec = onAdapter.getSpecification();
+        final List<ObjectMember> objectMembers = new ArrayList<ObjectMember>();
+
+        objectMembers.addAll(spec.getAssociationList());
+
+        // see if action (of any type)
+        objectMembers.addAll(spec.getObjectActionList(ObjectActionType.USER));
+        objectMembers.addAll(spec.getObjectActionList(ObjectActionType.EXPLORATION));
+        objectMembers.addAll(spec.getObjectActionList(ObjectActionType.DEBUG));
+        for (final ObjectMember member : objectMembers) {
+            if (matchesId(member, memberId)) {
+                return member;
+            }
+            // special handling for contributed actions.
+            if (member instanceof ObjectActionSet) {
+                final ObjectActionSet actionSet = (ObjectActionSet) member;
+                for (final ObjectAction contributedAction : actionSet.getActions()) {
+                    if (contributedAction.getId().equals(memberId)) {
+                        return contributedAction;
+                    }
+                }
+            }
+        }
+        throw StoryBoundValueException.current(onMemberBinding, "(unknown member)");
+    }
+
+    public Perform validatePerform() throws StoryBoundValueException {
+        final String perform = performBinding.getCurrentCell().getText();
+        if (perform == null) {
+            throw StoryBoundValueException.current(performBinding, "(required)");
+        }
+        final Perform performCommand = commandByKey.get(perform);
+        if (performCommand == null) {
+            throw StoryBoundValueException.current(performBinding, "(unknown interaction)");
+        }
+        return performCommand;
+    }
+
+    private boolean matchesId(final ObjectMember member, final String memberId) {
+        return member.getId().equals(memberId);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    // "perform" API
+    // //////////////////////////////////////////////////////////////////
+
+    public void performCommand(ObjectAdapter onAdapter, String aliasAs, ObjectMember objectMember,
+        Perform performCommand, List<StoryCell> argumentStoryCells) throws StoryBoundValueException
{
+        PerformContext performContext = new PerformContext(this, onAdapter, objectMember,
argumentStoryCells);
+        try {
+            performCommand.perform(performContext);
+        } catch (final RuntimeException ex) {
+            // handler should have colored in invalid cells.
+        }
+        aliasResultFromPerformCommand(performCommand, aliasAs);
+    }
+
+    private void aliasResultFromPerformCommand(Perform performCommand, String aliasAs) throws
StoryBoundValueException {
+        if (Strings.emptyString(aliasAs)) {
+            return;
+        }
+        final ObjectAdapter resultAdapter = performCommand.getResult();
+        if (resultAdapter == null) {
+            throw StoryBoundValueException.current(onMemberBinding, "(no result)");
+        }
+        getAliasRegistry().aliasAs(aliasAs, resultAdapter);
+    }
+
+    // //////////////////////////////////////////////////////////////////
+    //
+    // //////////////////////////////////////////////////////////////////
+
+    private String previousOnObject = null;
+
+    /**
+     * Not public API
+     */
+    public void provideDefault(StoryCell storySource, String resultStr) {
+        // TODO Auto-generated method stub
+        throw new NotYetImplementedException();
+    }
+
+    /**
+     * Not public API
+     */
+    public ObjectAdapter getAdapter(final ObjectAdapter contextAdapter, final ObjectSpecification
noSpec,
+        final CellBinding contextBinding, final StoryCell paramCell) throws StoryBoundValueException
{
+
+        final String cellText = paramCell.getText();
+
+        // see if can handle as parseable value
+        final ParseableFacet parseableFacet = noSpec.getFacet(ParseableFacet.class);
+        if (parseableFacet != null) {
+            try {
+                return parseableFacet.parseTextEntry(contextAdapter, cellText);
+            } catch (final IllegalArgumentException ex) {
+                throw StoryBoundValueException.arg(contextBinding, paramCell, "(cannot parse)");
+            }
+        }
+
+        // otherwise, handle as reference to known object
+        final ObjectAdapter adapter = getAliasRegistry().getAliased(cellText);
+        if (adapter == null) {
+            throw StoryBoundValueException.arg(contextBinding, paramCell, "(unknown reference)");
+        }
+
+        return adapter;
+    }
+
+    /**
+     * Not public API
+     * 
+     * <p>
+     * Ensures that there are at least enough arguments for the number of parameters required.
+     */
+    public ObjectAdapter[] getAdapters(final ObjectAdapter onAdapter, final ObjectAction
nakedObjectAction,
+        CellBinding onMemberBinding, final List<StoryCell> argumentCells) throws StoryBoundValueException
{
+        final ObjectActionParameter[] parameters = nakedObjectAction.getParameters();
+
+        int parameterCount = parameters.length;
+        if (argumentCells.size() < parameterCount) {
+            throw StoryBoundValueException.current(onMemberBinding, "(action requires " +
parameterCount
+                + " arguments)");
+        }
+        final ObjectAdapter[] adapters = new ObjectAdapter[parameterCount];
+
+        for (int i = 0; i < parameterCount; i++) {
+            final StoryCell paramCell = argumentCells.get(i);
+            final ObjectActionParameter parameter = parameters[i];
+            adapters[i] = getAdapter(null, parameter.getSpecification(), onMemberBinding,
paramCell);
+        }
+        return adapters;
+    }
+
+    /**
+     * Not public API
+     */
+    public ObjectAdapter toAdaptedListOfPojos(final ObjectAdapter[] choiceAdapters) {
+        final List<Object> choiceList = new ArrayList<Object>();
+        if (choiceAdapters != null) {
+            for (final ObjectAdapter adapter : choiceAdapters) {
+                choiceList.add(adapter.getObject());
+            }
+        }
+        return getAdapterManager().adapterFor(choiceList);
+    }
 
 }

Modified: incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/SaveObject.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/SaveObject.java?rev=1036148&r1=1036147&r2=1036148&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/SaveObject.java
(original)
+++ incubator/isis/trunk/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/SaveObject.java
Wed Nov 17 18:02:17 2010
@@ -2,49 +2,52 @@ package org.apache.isis.viewer.bdd.commo
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.runtime.context.IsisContext;
+import org.apache.isis.core.runtime.persistence.PersistenceSession;
 import org.apache.isis.viewer.bdd.common.CellBinding;
 import org.apache.isis.viewer.bdd.common.StoryBoundValueException;
 
 public class SaveObject extends PerformAbstractTypeParams {
 
-	private ObjectAdapter result;
+    private ObjectAdapter result;
 
-	public SaveObject(final Perform.Mode mode) {
-		super("save", Type.OBJECT, NumParameters.ZERO, mode);
-	}
+    public SaveObject(final Perform.Mode mode) {
+        super("save", Type.OBJECT, NumParameters.ZERO, mode);
+    }
 
-	@Override
-	public void doHandle(final PerformContext performContext)
-			throws StoryBoundValueException {
+    @Override
+    public void doHandle(final PerformContext performContext) throws StoryBoundValueException
{
 
-		final ObjectAdapter onAdapter = performContext.getOnAdapter();
+        final ObjectAdapter onAdapter = performContext.getOnAdapter();
 
-		final Consent valid = onAdapter.getSpecification().isValid(onAdapter);
+        final Consent valid = onAdapter.getSpecification().isValid(onAdapter);
 
-		CellBinding performBinding = performContext.getPeer()
-				.getPerformBinding();
-		if (valid.isVetoed()) {
-			throw StoryBoundValueException.current(performBinding,
-					valid.getReason());
-		}
+        CellBinding performBinding = performContext.getPeer().getPerformBinding();
+        if (valid.isVetoed()) {
+            throw StoryBoundValueException.current(performBinding, valid.getReason());
+        }
 
-		if (onAdapter.isPersistent()) {
-			throw StoryBoundValueException.current(performBinding, 
-					"(already persistent)");
-		}
+        if (onAdapter.isPersistent()) {
+            throw StoryBoundValueException.current(performBinding, "(already persistent)");
+        }
 
-		// persist
+        // persist
 
-		// xactn mgmt now performed by PersistenceSession#makePersistent
-		// getOwner().getTransactionManager().startTransaction();
-		performContext.getPeer().makePersistent(onAdapter);
-		// getOwner().getTransactionManager().endTransaction();
+        // xactn mgmt now performed by PersistenceSession#makePersistent
+        // getOwner().getTransactionManager().startTransaction();
+        getPersistenceSession().makePersistent(onAdapter);
+        // getOwner().getTransactionManager().endTransaction();
 
-		// all OK.
-	}
+        // all OK.
+    }
 
-	public ObjectAdapter getResult() {
-		return result;
-	}
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    @Override
+    public ObjectAdapter getResult() {
+        return result;
+    }
 
 }

Modified: incubator/isis/trunk/viewer/bdd/concordion/src/main/java/org/apache/isis/viewer/bdd/concordion/internal/fixtures/UsingIsisViewerForConcordion.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/bdd/concordion/src/main/java/org/apache/isis/viewer/bdd/concordion/internal/fixtures/UsingIsisViewerForConcordion.java?rev=1036148&r1=1036147&r2=1036148&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/bdd/concordion/src/main/java/org/apache/isis/viewer/bdd/concordion/internal/fixtures/UsingIsisViewerForConcordion.java
(original)
+++ incubator/isis/trunk/viewer/bdd/concordion/src/main/java/org/apache/isis/viewer/bdd/concordion/internal/fixtures/UsingIsisViewerForConcordion.java
Wed Nov 17 18:02:17 2010
@@ -121,12 +121,12 @@ public class UsingIsisViewerForConcordio
 		String aliasAs = getPeer().validateAliasAs();
 		Perform performCommand = getPeer().validatePerform();
 		
-		ObjectMember nakedObjectMember = null;
+		ObjectMember objectMember = null;
 		if (performCommand.requiresMember()) {
-			nakedObjectMember = getPeer().validateOnMember(onAdapter);
+			objectMember = getPeer().validateOnMember(onAdapter);
 		}
 
-		getPeer().performCommand(performCommand, onAdapter, nakedObjectMember, asValues(argumentCells),
aliasAs);
+		getPeer().performCommand(onAdapter, aliasAs, objectMember, performCommand, asValues(argumentCells));
 	}
 
 	private static List<StoryCell> asValues(List<String> argumentCells) {

Modified: incubator/isis/trunk/viewer/bdd/fitnesse/src/main/java/net/sf/isiscontrib/bdd/fitnesse/internal/fixtures/UsingIsisViewerForFitNesse.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/bdd/fitnesse/src/main/java/net/sf/isiscontrib/bdd/fitnesse/internal/fixtures/UsingIsisViewerForFitNesse.java?rev=1036148&r1=1036147&r2=1036148&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/bdd/fitnesse/src/main/java/net/sf/isiscontrib/bdd/fitnesse/internal/fixtures/UsingIsisViewerForFitNesse.java
(original)
+++ incubator/isis/trunk/viewer/bdd/fitnesse/src/main/java/net/sf/isiscontrib/bdd/fitnesse/internal/fixtures/UsingIsisViewerForFitNesse.java
Wed Nov 17 18:02:17 2010
@@ -109,10 +109,10 @@ public class UsingIsisViewerForFitNesse 
             return;
         }
 
-        ObjectMember nakedObjectMember = null;
+        ObjectMember objectMember = null;
         if (performCommand.requiresMember()) {
             try {
-                nakedObjectMember = getPeer().validateOnMember(onAdapter);
+                objectMember = getPeer().validateOnMember(onAdapter);
             } catch (StoryBoundValueException ex) {
                 FitnesseUtil.exception(this, ex);
                 return;
@@ -121,7 +121,7 @@ public class UsingIsisViewerForFitNesse 
 
         try {
             List<StoryCell> argumentStoryCells = asValues(argumentCells);
-            getPeer().performCommand(performCommand, onAdapter, nakedObjectMember, argumentStoryCells,
aliasAs);
+            getPeer().performCommand(onAdapter, aliasAs, objectMember, performCommand, argumentStoryCells);
         } catch (StoryBoundValueException ex) {
             FitnesseUtil.exception(this, ex);
             return;
@@ -139,7 +139,19 @@ public class UsingIsisViewerForFitNesse 
     }
 
     private void rightMemberElseOnObjectCell() {
-        right(getPeer().getMemberElseOnObjectCell());
+        UsingIsisViewerPeer peer = getPeer();
+        StoryCell storyCell =
+            coalesce(peer.getOnMemberBinding().getCurrentCell(), peer.getOnObjectBinding().getCurrentCell());
+        right(storyCell);
+    }
+
+    private static <T> T coalesce(T... objects) {
+        for (T object : objects) {
+            if (object != null) {
+                return object;
+            }
+        }
+        return null;
     }
 
 }

Modified: incubator/isis/trunk/viewer/bdd/src/docbkx/guide/isis-bdd-viewer.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/bdd/src/docbkx/guide/isis-bdd-viewer.xml?rev=1036148&r1=1036147&r2=1036148&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/bdd/src/docbkx/guide/isis-bdd-viewer.xml (original)
+++ incubator/isis/trunk/viewer/bdd/src/docbkx/guide/isis-bdd-viewer.xml Wed Nov 17 18:02:17
2010
@@ -154,8 +154,17 @@
           methods so the matching is done simply by parameter position to
           these method).</para>
 
-          <para>The library provides a default implementation, though
-          subclasses can override if required.</para>
+          <para>***</para>
+
+          <para></para>
+
+          <para></para>
+
+          <para></para>
+
+          <para>The library provides a default implementation of
+          <classname>CellBinding</classname>, though subclasses can override
+          if required.</para>
         </listitem>
       </itemizedlist>
 
@@ -1575,7 +1584,7 @@ and running in &lt;span concordion:set="
                 </row>
 
                 <row>
-                  <entry><emphasis>sobject alias</emphasis></entry>
+                  <entry><emphasis>object alias</emphasis></entry>
 
                   <entry><emphasis>alias for list of
                   choices</emphasis></entry>
@@ -2001,11 +2010,61 @@ and running in &lt;span concordion:set="
               here. While it is tempting to refactor the common library to use
               type safe enums, this would move the need to translate story
               text into each and every <acronym>BDD</acronym> framework
-              integration. The API is probably correct as it is, even though
-              it is reliant on the exact string phrases that appear in the
-              tables above.</para>
+              integration. The <acronym>API</acronym> is probably correct as
+              it is, even though it is reliant on the exact string phrases
+              that appear in the tables above.</para>
+            </listitem>
+          </itemizedlist>
+
+          <para>To actually perform, these interaction, the set</para>
+
+          <para></para>
+
+          <para>*** discuss captureCurrent()</para>
+
+          <para></para>
+
+          <para>the <classname>UsingIsisViewerPeer</classname> provides
the
+          following methods:</para>
+
+          <itemizedlist>
+            <listitem>
+              <para><methodname>#validateOnObject():
+              ObjectAdapter</methodname></para>
+
+              <para></para>
+            </listitem>
+
+            <listitem>
+              <para><methodname>#validateAliasAs(): String</methodname></para>
+
+              <para></para>
+            </listitem>
+
+            <listitem>
+              <para><methodname>#validateOnMember():
+              ObjectMember</methodname></para>
+
+              <para></para>
+            </listitem>
+
+            <listitem>
+              <para><methodname>#validatePerform():
+              Perform</methodname></para>
+
+              <para></para>
+            </listitem>
+
+            <listitem>
+              <para><methodname>#performCommand(ObjectAdapter onObject, String
+              aliasAs, ObjectMember onMember, Perform perform,
+              List&lt;StoryCell&gt; args)</methodname></para>
+
+              <para></para>
             </listitem>
           </itemizedlist>
+
+          <para></para>
         </sect3>
 
         <sect3>
@@ -2049,7 +2108,7 @@ and running in &lt;span concordion:set="
             </listitem>
 
             <listitem>
-              <para><methodname>usingIsisViewerThatArgs(String onObject,
+              <para><methodname>#usingIsisViewerThatArgs(String onObject,
               String aliasResultAs, String perform, String usingMember, String
               arg0, String arg1, ...)</methodname></para>
 
@@ -2060,13 +2119,16 @@ and running in &lt;span concordion:set="
               <para>There are multiple overloaded versions of this method
               taking from 1 to 5 arguments.</para>
             </listitem>
-
-            <listitem>
-              <para></para>
-            </listitem>
           </itemizedlist>
 
-          <para></para>
+          <para>If there is a requirement for more than 5 arguments, then you
+          can write your own method and delegate to the (protected visibility)
+          <methodname>#usingIsisViewerThatArgsVarargs(...)</methodname>
+          method.</para>
+
+          <para>In all cases these methods return the string "ok", or return
+          the text of an exception otherwise. This makes them easy to
+          embed</para>
 
           <para>Returns ok</para>
 
@@ -2210,10 +2272,20 @@ and running in &lt;span concordion:set="
         </sect3>
       </sect2>
 
-      <sect2>
+      <sect2 id="sec.CheckList">
         <title>Check List</title>
 
-        <para></para>
+        <para>Check items in list, either precisely or just for presence,
+        using their title. Lists are either aliased results of actions, or
+        aliased collections within objects.</para>
+
+        <para>Typically used in the "Then", though can be helpful as a way of
+        confirming/documenting a "Given".</para>
+
+        <para>See also AliasItemsInList (<xref
+        linkend="sec.AliasItemsInList" />), which also performs an implicit
+        check (will fail if the objects are not in the list) and aliases them
+        for further use.</para>
 
         <para></para>
 
@@ -2242,9 +2314,18 @@ and running in &lt;span concordion:set="
         </sect3>
       </sect2>
 
-      <sect2>
+      <sect2 id="sec.AliasItemsInList">
         <title>Alias Items In List</title>
 
+        <para>Allows an alias to be associated with items in a list. The list
+        items are located by their title, and are presumed to exist. This
+        fixture can therefore also be used as a way of checking for presence
+        of items in a list (similar to CheckList, <xref
+        linkend="sec.CheckList" />).</para>
+
+        <para>Typically used both in the "Given" (to simplify writing the rest
+        of a test).</para>
+
         <para></para>
 
         <para></para>
@@ -2273,145 +2354,6 @@ and running in &lt;span concordion:set="
           <para></para>
         </sect3>
       </sect2>
-
-      <sect2 id="sec.UsingIsisViewer">
-        <title>Using Isis Viewer / Using Isis Viewer For Setup</title>
-
-        <para>Simulates interacting with domain objects as if through a
-        viewer. Interact with objects, check their state, alias referenced or
-        returned objects.</para>
-
-        <para>The "ForSetup" version disables checks for visibility and
-        usability, making it easier to reuse functionality for setting up
-        objects prior to a test scenario (the "given"). The DebugObjectStore
-        fixture (<xref linkend="sec.DebugObjectStore" />) can be used to check
-        the state of objects created.</para>
-
-        <screenshot>
-          <screeninfo>UsingNakedObjectsViewer</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/UsingNakedObjectsViewer.png"
-                         scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-
-        <para>Example usage:</para>
-
-        <screenshot>
-          <screeninfo>ExampleUsage</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/UsingNakedObjectsViewer.ExampleUsage.png"
-                         scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-
-        <para>On properties:</para>
-
-        <screenshot>
-          <screeninfo>On Properties</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/UsingNakedObjectsViewer.PerformOnProperties.png"
-                         scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-
-        <para>On collections:</para>
-
-        <screenshot>
-          <screeninfo>On Collections</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/UsingNakedObjectsViewer.PerformOnCollections.png"
-                         scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-
-        <para>On actions:</para>
-
-        <screenshot>
-          <screeninfo>On Actions</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/UsingNakedObjectsViewer.PerformOnActions.png"
-                         scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-
-        <para>On objects:</para>
-
-        <screenshot>
-          <screeninfo>On Objects</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/UsingNakedObjectsViewer.PerformOnObjects.png"
-                         scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-      </sect2>
-
-      <sect2 id="sec.CheckList">
-        <title>CheckList</title>
-
-        <para>Check items in list, either precisely or just for presence,
-        using their title. Lists are either aliased results of actions, or
-        aliased collections within objects.</para>
-
-        <para>Typically used in the "Then", though can be helpful as a way of
-        confirming/documenting a "Given".</para>
-
-        <para>See also AliasItemsInList (<xref
-        linkend="sec.AliasItemsInList" />), which also performs an implicit
-        check (will fail if the objects are not in the list) and aliases them
-        for further use.</para>
-
-        <screenshot>
-          <screeninfo>CheckList</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/CheckList.png" scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-      </sect2>
-
-      <sect2 id="sec.AliasItemsInList">
-        <title>AliasItemsInList</title>
-
-        <para>Allows an alias to be associated with items in a list. The list
-        items are located by their title, and are presumed to exist. This
-        fixture can therefore also be used as a way of checking for presence
-        of items in a list (similar to CheckList, <xref
-        linkend="sec.CheckList" />).</para>
-
-        <para>Typically used both in the "Given" (to simplify writing the rest
-        of a test).</para>
-
-        <screenshot>
-          <screeninfo>AliasItemsInList</screeninfo>
-
-          <mediaobject>
-            <imageobject>
-              <imagedata fileref="images/AliasItemsInList.png" scale="40" />
-            </imageobject>
-          </mediaobject>
-        </screenshot>
-      </sect2>
     </sect1>
 
     <sect1 id="sec.Debugging">



Mime
View raw message