ISIS-928: recreating todoapp archetype
Project: http://git-wip-us.apache.org/repos/asf/isis/repo Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/60c5e045 Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/60c5e045 Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/60c5e045 Branch: refs/heads/master Commit: 60c5e0453e28624b50f5776651142257b406689b Parents: 1be9851 Author: Dan Haywood <[email protected]> Authored: Tue Nov 18 11:41:31 2014 +0100 Committer: Dan Haywood <[email protected]> Committed: Tue Nov 18 12:17:02 2014 +0100 ---------------------------------------------------------------------- .../fixture/todo/ToDoItemsFixturesService.java | 15 ++- .../integtests/ToDoItemsIntegTestFixture.java | 4 +- .../complete/ToDoItemCompleteAbstract.java | 73 +++++++++++++++ .../complete/ToDoItemCompleteForBuyStamps.java | 38 ++++++++ .../ToDoItemCompleteForWriteBlogPost.java | 39 ++++++++ .../todo/items/create/ToDoItemAbstract.java | 72 ++++++++++++++ .../todo/items/create/ToDoItemForBuyBread.java | 40 ++++++++ .../todo/items/create/ToDoItemForBuyMilk.java | 40 ++++++++ .../todo/items/create/ToDoItemForBuyStamps.java | 42 +++++++++ .../todo/items/create/ToDoItemForMowLawn.java | 40 ++++++++ .../create/ToDoItemForOrganizeBrownBag.java | 40 ++++++++ .../items/create/ToDoItemForPickUpLaundry.java | 40 ++++++++ .../items/create/ToDoItemForSharpenKnives.java | 40 ++++++++ .../create/ToDoItemForStageIsisRelease.java | 40 ++++++++ .../ToDoItemForSubmitConferenceSession.java | 40 ++++++++ .../items/create/ToDoItemForVacuumHouse.java | 40 ++++++++ .../items/create/ToDoItemForWriteBlogPost.java | 42 +++++++++ .../items/create/ToDoItemForWriteToPenPal.java | 40 ++++++++ .../todo/items/delete/ToDoItemsDelete.java | 56 +++++++++++ .../todo/scenarios/DeleteToDoItemsFor.java | 39 -------- .../todo/scenarios/DeleteToDoItemsForSven.java | 33 ------- ...teToDoItemsAndCompleteSeveralForCurrent.java | 33 ------- .../todo/scenarios/RecreateToDoItemsFor.java | 39 -------- .../scenarios/RecreateToDoItemsForDick.java | 32 ------- .../todo/scenarios/RecreateToDoItemsForJoe.java | 32 ------- .../scenarios/RecreateToDoItemsForSven.java | 32 ------- .../todo/scenarios/ToDoItemsRecreate.java | 84 +++++++++++++++++ .../ToDoItemsRecreateAndCompleteSeveral.java | 63 +++++++++++++ ...oItemsRecreateAndCompleteSeveralForDick.java | 31 +++++++ ...DoItemsRecreateAndCompleteSeveralForJoe.java | 31 +++++++ .../scenarios/ToDoItemsRecreateForSven.java | 32 +++++++ .../fixture/todo/simple/ToDoItemsDelete.java | 56 ----------- .../fixture/todo/simple/ToDoItemsRecreate.java | 98 -------------------- .../ToDoItemsRecreateAndCompleteSeveral.java | 75 --------------- .../src/main/java/fixture/todo/simple/Util.java | 39 -------- .../src/main/java/fixture/todo/util/Util.java | 35 +++++++ .../tests/ToDoItemContributionsIntegTest.java | 5 +- .../integration/tests/ToDoItemIntegTest.java | 3 +- .../src/main/webapp/WEB-INF/isis.properties | 2 +- .../projects/basic/archetype.properties | 2 +- 40 files changed, 1058 insertions(+), 519 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java index f85d122..06b31f9 100644 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java @@ -21,7 +21,7 @@ */ package fixture.todo; -import fixture.todo.scenarios.RecreateToDoItemsAndCompleteSeveralForCurrent; +import fixture.todo.scenarios.ToDoItemsRecreateAndCompleteSeveral; import java.util.List; import org.apache.isis.applib.annotation.CssClassFa; @@ -39,7 +39,7 @@ import org.apache.isis.applib.fixturescripts.FixtureScripts; /** * Enables fixtures to be installed from the application. */ -@Named("Prototyping") // has the effect of defining a "Prototyping" menu item +@Named("Prototyping") @DomainService(menuOrder = "40.1") public class ToDoItemsFixturesService extends FixtureScripts { @@ -49,13 +49,18 @@ public class ToDoItemsFixturesService extends FixtureScripts { @CssClassFa("fa fa-bolt") @Override - public List<FixtureResult> runFixtureScript(FixtureScript fixtureScript, @Named("Parameters") @DescribedAs("Script-specific parameters (if any). The format depends on the script implementation (eg key=value, CSV, JSON, XML etc)") @MultiLine(numberOfLines = 10) @Optional String parameters) { + public List<FixtureResult> runFixtureScript( + final FixtureScript fixtureScript, + final @Named("Parameters") @DescribedAs("Script-specific parameters (key=value) ") + @MultiLine(numberOfLines = 10) + @Optional + String parameters) { return super.runFixtureScript(fixtureScript, parameters); } @Override public FixtureScript default0RunFixtureScript() { - return findFixtureScriptFor(RecreateToDoItemsAndCompleteSeveralForCurrent.class); + return findFixtureScriptFor(ToDoItemsRecreateAndCompleteSeveral.class); } /** @@ -74,7 +79,7 @@ public class ToDoItemsFixturesService extends FixtureScripts { @CssClassFa("fa fa-list") @MemberOrder(sequence="20") public Object recreateToDoItemsReturnFirst() { - final List<FixtureResult> run = findFixtureScriptFor(RecreateToDoItemsAndCompleteSeveralForCurrent.class).run(null); + final List<FixtureResult> run = findFixtureScriptFor(ToDoItemsRecreateAndCompleteSeveral.class).run(null); return run.get(0).getObject(); } } http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java index 3795f85..d8743b5 100644 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java @@ -22,7 +22,7 @@ package fixture.todo.integtests; -import fixture.todo.simple.ToDoItemsRecreateAndCompleteSeveral; +import fixture.todo.scenarios.ToDoItemsRecreateAndCompleteSeveral; import org.apache.isis.applib.fixturescripts.FixtureScript; @@ -37,7 +37,7 @@ public class ToDoItemsIntegTestFixture extends FixtureScript { @Override protected void execute(ExecutionContext executionContext) { - executeChild(new ToDoItemsRecreateAndCompleteSeveral(null), executionContext); + executeChild(new ToDoItemsRecreateAndCompleteSeveral(), executionContext); } } http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java new file mode 100644 index 0000000..383dee9 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java @@ -0,0 +1,73 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.actions.complete; + +import dom.todo.ToDoItem; + +import java.util.Collection; +import com.google.common.base.Objects; +import com.google.common.base.Predicate; +import com.google.common.collect.Collections2; +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public abstract class ToDoItemCompleteAbstract extends FixtureScript { + + @Override + protected void execute(ExecutionContext executionContext) { + validateParameters(executionContext); + + + } + + /** + * Subclasses should call from within {@link ${symbol_pound}execute(org.apache.isis.applib.fixturescripts.FixtureScript.ExecutionContext)}. + */ + protected void validateParameters(ExecutionContext executionContext) { + final String ownedBy = executionContext.getParameter("ownedBy"); + if(ownedBy == null) { + throw new IllegalArgumentException("'ownedBy' must be specified"); + } + } + + /** + * Looks up item from repository, and completes. + */ + protected void complete(final String description, final ExecutionContext executionContext) { + String ownedBy = executionContext.getParameter("ownedBy"); + final ToDoItem toDoItem = findToDoItem(description, ownedBy); + toDoItem.setComplete(true); + executionContext.add(this, toDoItem); + } + + + private ToDoItem findToDoItem(final String description, final String ownedBy) { + final Collection<ToDoItem> filtered = Collections2.filter(getContainer().allInstances(ToDoItem.class), new Predicate<ToDoItem>() { + @Override + public boolean apply(ToDoItem input) { + return Objects.equal(description, input.getDescription()) && + Objects.equal(ownedBy, input.getOwnedBy()); + } + }); + return filtered.isEmpty()? null: filtered.iterator().next(); + } + //endregion +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java new file mode 100644 index 0000000..7f2bb5b --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java @@ -0,0 +1,38 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.actions.complete; + +import fixture.todo.items.create.ToDoItemForBuyStamps; + +public class ToDoItemCompleteForBuyStamps extends ToDoItemCompleteAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + // prereqs + executeChild(new ToDoItemForBuyStamps(), executionContext); + + // this fixture + complete(ToDoItemForBuyStamps.DESCRIPTION, executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java new file mode 100644 index 0000000..1288528 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java @@ -0,0 +1,39 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.actions.complete; + +import fixture.todo.items.create.ToDoItemForWriteBlogPost; + +public class ToDoItemCompleteForWriteBlogPost extends ToDoItemCompleteAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + // prereqs + executeChild(new ToDoItemForWriteBlogPost(), executionContext); + + // this fixture + complete(ToDoItemForWriteBlogPost.DESCRIPTION, executionContext); + } + + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java new file mode 100644 index 0000000..b9ce83a --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java @@ -0,0 +1,72 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem; +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; +import dom.todo.ToDoItems; + +import java.math.BigDecimal; +import org.joda.time.LocalDate; +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.services.clock.ClockService; + +public abstract class ToDoItemAbstract extends FixtureScript { + + protected ToDoItem createToDoItem( + final String description, + final Category category, final Subcategory subcategory, + final LocalDate dueBy, + final BigDecimal cost, + final ExecutionContext executionContext) { + + // validate parameters + final String ownedBy = executionContext.getParameter("ownedBy"); + if(ownedBy == null) { + throw new IllegalArgumentException("'ownedBy' must be specified"); + } + + // execute + ToDoItem newToDo = toDoItems.newToDo( + description, category, subcategory, ownedBy, dueBy, cost); + return executionContext.add(this, newToDo); + } + + protected LocalDate nowPlusDays(int days) { + return clockService.now().plusDays(days); + } + + protected BigDecimal BD(String str) { + return new BigDecimal(str); + } + + //region > injected services + @javax.inject.Inject + private ToDoItems toDoItems; + + @javax.inject.Inject + protected ClockService clockService; + //endregion + + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java new file mode 100644 index 0000000..f13fe6f --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForBuyBread extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Buy bread", + Category.Domestic, Subcategory.Shopping, + nowPlusDays(0), + BD("1.75"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java new file mode 100644 index 0000000..d7140fb --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForBuyMilk extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Buy milk", + Category.Domestic, Subcategory.Shopping, + nowPlusDays(0), + BD("0.75"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java new file mode 100644 index 0000000..a5f760b --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java @@ -0,0 +1,42 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForBuyStamps extends ToDoItemAbstract { + + public static final String DESCRIPTION = "Buy stamps"; + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + DESCRIPTION, + Category.Domestic, Subcategory.Shopping, + nowPlusDays(0), + BD("10.00"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java new file mode 100644 index 0000000..c13606b --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForMowLawn extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Mow lawn", + Category.Domestic, Subcategory.Garden, + nowPlusDays(6), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java new file mode 100644 index 0000000..0df57a4 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForOrganizeBrownBag extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Organize brown bag", + Category.Professional, Subcategory.Consulting, + nowPlusDays(14), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java new file mode 100644 index 0000000..74ba550 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForPickUpLaundry extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Pick up laundry", + Category.Domestic, Subcategory.Chores, + nowPlusDays(6), + BD("7.50"), + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java new file mode 100644 index 0000000..191d941 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForSharpenKnives extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Sharpen knives", + Category.Domestic, Subcategory.Chores, + nowPlusDays(14), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java new file mode 100644 index 0000000..c3a1633 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForStageIsisRelease extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Stage Isis release", + Category.Professional, Subcategory.OpenSource, + null, + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java new file mode 100644 index 0000000..5c84305 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForSubmitConferenceSession extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Submit conference session", + Category.Professional, Subcategory.Education, + nowPlusDays(21), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java new file mode 100644 index 0000000..87efcc0 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForVacuumHouse extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Vacuum house", + Category.Domestic, Subcategory.Housework, + nowPlusDays(3), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java new file mode 100644 index 0000000..48154e0 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java @@ -0,0 +1,42 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForWriteBlogPost extends ToDoItemAbstract { + + public static final String DESCRIPTION = "Write blog post"; + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + DESCRIPTION, + Category.Professional, Subcategory.Marketing, + nowPlusDays(7), + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java new file mode 100644 index 0000000..96c5b53 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java @@ -0,0 +1,40 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.create; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +public class ToDoItemForWriteToPenPal extends ToDoItemAbstract { + + @Override + protected void execute(ExecutionContext executionContext) { + + createToDoItem( + "Write to penpal", + Category.Other, Subcategory.Other, + null, + null, + executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java new file mode 100644 index 0000000..656d625 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java @@ -0,0 +1,56 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.items.delete; + +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.services.jdosupport.IsisJdoSupport; + +public class ToDoItemsDelete extends FixtureScript { + + //region > ownedBy (optional) + private String ownedBy; + + public String getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(String ownedBy) { + this.ownedBy = ownedBy; + } + //endregion + + //region > execute + protected void execute(ExecutionContext executionContext) { + + final String ownedBy = executionContext.getParameter("ownedBy"); + + isisJdoSupport.executeUpdate("delete from ${symbol_escape}"ToDoItem${symbol_escape}" where ${symbol_escape}"ownedBy${symbol_escape}" = '" + ownedBy + "'"); + } + + //endregion + + //region > injected services + @javax.inject.Inject + private IsisJdoSupport isisJdoSupport; + //endregion + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.java deleted file mode 100644 index 6d627a5..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.java +++ /dev/null @@ -1,39 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.scenarios; - -import fixture.todo.simple.ToDoItemsDelete; - -import com.google.common.base.Strings; - -public class DeleteToDoItemsFor extends ToDoItemsDelete { - - public DeleteToDoItemsFor() { - super(null); - withDiscoverability(Discoverability.DISCOVERABLE); - } - - @Override - public String validateRun(final String parameters) { - return Strings.isNullOrEmpty(parameters) ? "Specify the owner of the ToDoItems to be deleted" : null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsForSven.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsForSven.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsForSven.java deleted file mode 100644 index 9bf14e4..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsForSven.java +++ /dev/null @@ -1,33 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.scenarios; - -import fixture.todo.simple.ToDoItemsDelete; - -public final class DeleteToDoItemsForSven extends ToDoItemsDelete { - - public DeleteToDoItemsForSven() { - super("sven"); - withDiscoverability(Discoverability.DISCOVERABLE); - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsAndCompleteSeveralForCurrent.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsAndCompleteSeveralForCurrent.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsAndCompleteSeveralForCurrent.java deleted file mode 100644 index f6c1b22..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsAndCompleteSeveralForCurrent.java +++ /dev/null @@ -1,33 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.scenarios; - -import fixture.todo.simple.ToDoItemsRecreateAndCompleteSeveral; - -public class RecreateToDoItemsAndCompleteSeveralForCurrent extends ToDoItemsRecreateAndCompleteSeveral { - - public RecreateToDoItemsAndCompleteSeveralForCurrent() { - super(null); - withDiscoverability(Discoverability.DISCOVERABLE); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsFor.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsFor.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsFor.java deleted file mode 100644 index bc0d0ca..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsFor.java +++ /dev/null @@ -1,39 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.scenarios; - -import fixture.todo.simple.ToDoItemsRecreate; - -import com.google.common.base.Strings; - -public final class RecreateToDoItemsFor extends ToDoItemsRecreate { - - public RecreateToDoItemsFor() { - super(null); - withDiscoverability(Discoverability.DISCOVERABLE); - } - - @Override - public String validateRun(String parameters) { - return Strings.isNullOrEmpty(parameters) ? "Specify the owner of the ToDoItems to be recreated" : null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForDick.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForDick.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForDick.java deleted file mode 100644 index f95e100..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForDick.java +++ /dev/null @@ -1,32 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.scenarios; - -import fixture.todo.simple.ToDoItemsRecreate; - -public final class RecreateToDoItemsForDick extends ToDoItemsRecreate { - - public RecreateToDoItemsForDick() { - super("dick"); - withDiscoverability(Discoverability.DISCOVERABLE); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForJoe.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForJoe.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForJoe.java deleted file mode 100644 index b6b5a28..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForJoe.java +++ /dev/null @@ -1,32 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.scenarios; - -import fixture.todo.simple.ToDoItemsRecreate; - -public final class RecreateToDoItemsForJoe extends ToDoItemsRecreate { - - public RecreateToDoItemsForJoe() { - super("joe"); - withDiscoverability(Discoverability.DISCOVERABLE); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForSven.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForSven.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForSven.java deleted file mode 100644 index ec57d94..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/RecreateToDoItemsForSven.java +++ /dev/null @@ -1,32 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.scenarios; - -import fixture.todo.simple.ToDoItemsRecreate; - -public final class RecreateToDoItemsForSven extends ToDoItemsRecreate { - - public RecreateToDoItemsForSven() { - super("sven"); - withDiscoverability(Discoverability.DISCOVERABLE); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java new file mode 100644 index 0000000..d7b758d --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java @@ -0,0 +1,84 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.scenarios; + +import fixture.todo.items.delete.ToDoItemsDelete; +import fixture.todo.items.create.ToDoItemForBuyBread; +import fixture.todo.items.create.ToDoItemForBuyMilk; +import fixture.todo.items.create.ToDoItemForBuyStamps; +import fixture.todo.items.create.ToDoItemForMowLawn; +import fixture.todo.items.create.ToDoItemForOrganizeBrownBag; +import fixture.todo.items.create.ToDoItemForPickUpLaundry; +import fixture.todo.items.create.ToDoItemForSharpenKnives; +import fixture.todo.items.create.ToDoItemForStageIsisRelease; +import fixture.todo.items.create.ToDoItemForSubmitConferenceSession; +import fixture.todo.items.create.ToDoItemForVacuumHouse; +import fixture.todo.items.create.ToDoItemForWriteBlogPost; +import fixture.todo.items.create.ToDoItemForWriteToPenPal; +import fixture.todo.util.Util; + +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public class ToDoItemsRecreate extends FixtureScript { + + public ToDoItemsRecreate() { + withDiscoverability(Discoverability.DISCOVERABLE); + } + + //region > ownedBy (optional) + private String ownedBy; + + public String getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(String ownedBy) { + this.ownedBy = ownedBy; + } + //endregion + + @Override + protected void execute(ExecutionContext executionContext) { + + // defaults + executionContext.setParameterIfNotPresent( + "ownedBy", + Util.coalesce(getOwnedBy(), getContainer().getUser().getName())); + + // prereqs + executeChild(new ToDoItemsDelete(), executionContext); + + // create items + executeChild(new ToDoItemForBuyMilk(), executionContext); + executeChild(new ToDoItemForBuyBread(), executionContext); + executeChild(new ToDoItemForBuyStamps(), executionContext); + executeChild(new ToDoItemForPickUpLaundry(), executionContext); + executeChild(new ToDoItemForMowLawn(), executionContext); + executeChild(new ToDoItemForVacuumHouse(), executionContext); + executeChild(new ToDoItemForSharpenKnives(), executionContext); + executeChild(new ToDoItemForWriteToPenPal(), executionContext); + executeChild(new ToDoItemForWriteBlogPost(), executionContext); + executeChild(new ToDoItemForOrganizeBrownBag(), executionContext); + executeChild(new ToDoItemForSubmitConferenceSession(), executionContext); + executeChild(new ToDoItemForStageIsisRelease(), executionContext); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java new file mode 100644 index 0000000..7ae2d7f --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java @@ -0,0 +1,63 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.scenarios; + +import fixture.todo.items.actions.complete.ToDoItemCompleteForBuyStamps; +import fixture.todo.items.actions.complete.ToDoItemCompleteForWriteBlogPost; +import fixture.todo.util.Util; + +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public class ToDoItemsRecreateAndCompleteSeveral extends FixtureScript { + + public ToDoItemsRecreateAndCompleteSeveral() { + withDiscoverability(Discoverability.DISCOVERABLE); + } + + //region > ownedBy (optional) + private String ownedBy; + + public String getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(String ownedBy) { + this.ownedBy = ownedBy; + } + //endregion + + @Override + protected void execute(ExecutionContext executionContext) { + + // defaults + executionContext.setParameterIfNotPresent( + "ownedBy", + Util.coalesce(getOwnedBy(), getContainer().getUser().getName())); + + // prereqs + executeChild(new ToDoItemsRecreate(), executionContext); + + // this fixture + executeChild(new ToDoItemCompleteForBuyStamps(), executionContext); + executeChild(new ToDoItemCompleteForWriteBlogPost(), executionContext); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java new file mode 100644 index 0000000..82d1a4e --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java @@ -0,0 +1,31 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.scenarios; + +public final class ToDoItemsRecreateAndCompleteSeveralForDick extends ToDoItemsRecreateAndCompleteSeveral { + + public ToDoItemsRecreateAndCompleteSeveralForDick() { + withDiscoverability(Discoverability.DISCOVERABLE); + + setOwnedBy("dick"); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java new file mode 100644 index 0000000..e2cfc0e --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java @@ -0,0 +1,31 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.scenarios; + +public final class ToDoItemsRecreateAndCompleteSeveralForJoe extends ToDoItemsRecreateAndCompleteSeveral { + + public ToDoItemsRecreateAndCompleteSeveralForJoe() { + withDiscoverability(Discoverability.DISCOVERABLE); + + setOwnedBy("joe"); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java new file mode 100644 index 0000000..bf58168 --- /dev/null +++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java @@ -0,0 +1,32 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +/* + * 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 fixture.todo.scenarios; + +public final class ToDoItemsRecreateForSven extends ToDoItemsRecreate { + + public ToDoItemsRecreateForSven() { + withDiscoverability(Discoverability.DISCOVERABLE); + + setOwnedBy("sven"); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsDelete.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsDelete.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsDelete.java deleted file mode 100644 index f9c81d0..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsDelete.java +++ /dev/null @@ -1,56 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.simple; - -import org.apache.isis.applib.fixturescripts.FixtureScript; -import org.apache.isis.objectstore.jdo.applib.service.support.IsisJdoSupport; - -public class ToDoItemsDelete extends FixtureScript { - - //region > constructor - private final String user; - - /** - * @param user - if null then executes for the current user or will use any {@link ${symbol_pound}run(String) parameters} provided when run. - */ - public ToDoItemsDelete(final String user) { - super(null, Util.localNameFor("delete", user)); - this.user = user; - } - //endregion - - //region > execute - @Override - protected void execute(ExecutionContext executionContext) { - final String ownedBy = Util.coalesce(user, executionContext.getParameters(), getContainer().getUser().getName()); - - isisJdoSupport.executeUpdate("delete from ${symbol_escape}"ToDoItem${symbol_escape}" where ${symbol_escape}"ownedBy${symbol_escape}" = '" + ownedBy + "'"); - } - - //endregion - - //region > injected services - @javax.inject.Inject - private IsisJdoSupport isisJdoSupport; - //endregion - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java deleted file mode 100644 index d6e1158..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java +++ /dev/null @@ -1,98 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.simple; - -import dom.todo.ToDoItem; -import dom.todo.ToDoItem.Category; -import dom.todo.ToDoItem.Subcategory; -import dom.todo.ToDoItems; - -import java.math.BigDecimal; -import org.joda.time.LocalDate; -import org.apache.isis.applib.fixturescripts.FixtureScript; -import org.apache.isis.applib.services.clock.ClockService; - -public class ToDoItemsRecreate extends FixtureScript { - - //region > constructor - private final String user; - - /** - * @param user - if null then executes for the current user or will use any {@link ${symbol_pound}run(String) parameters} provided when run. - */ - public ToDoItemsRecreate(final String user) { - super(null, Util.localNameFor("create", user)); - this.user = user; - } - //endregion - - //region > execute - @Override - protected void execute(ExecutionContext executionContext) { - final String ownedBy = Util.coalesce(user, executionContext.getParameters(), getContainer().getUser().getName()); - - // prereqs - executeChild(new ToDoItemsDelete(null), executionContext); - - // this fixture - createToDoItem("Buy milk", Category.Domestic, Subcategory.Shopping, ownedBy, nowPlusDays(0), new BigDecimal("0.75"), executionContext); - createToDoItem("Buy bread", Category.Domestic, Subcategory.Shopping, ownedBy, nowPlusDays(0), new BigDecimal("1.75"), executionContext); - createToDoItem("Buy stamps", Category.Domestic, Subcategory.Shopping, ownedBy, nowPlusDays(0), new BigDecimal("10.00"), executionContext); - createToDoItem("Pick up laundry", Category.Domestic, Subcategory.Chores, ownedBy, nowPlusDays(6), new BigDecimal("7.50"), executionContext); - createToDoItem("Mow lawn", Category.Domestic, Subcategory.Garden, ownedBy, nowPlusDays(6), null, executionContext); - createToDoItem("Vacuum house", Category.Domestic, Subcategory.Housework, ownedBy, nowPlusDays(3), null, executionContext); - createToDoItem("Sharpen knives", Category.Domestic, Subcategory.Chores, ownedBy, nowPlusDays(14), null, executionContext); - - createToDoItem("Write to penpal", Category.Other, Subcategory.Other, ownedBy, null, null, executionContext); - - createToDoItem("Write blog post", Category.Professional, Subcategory.Marketing, ownedBy, nowPlusDays(7), null, executionContext); - createToDoItem("Organize brown bag", Category.Professional, Subcategory.Consulting, ownedBy, nowPlusDays(14), null, executionContext); - createToDoItem("Submit conference session", Category.Professional, Subcategory.Education, ownedBy, nowPlusDays(21), null, executionContext); - createToDoItem("Stage Isis release", Category.Professional, Subcategory.OpenSource, ownedBy, null, null, executionContext); - } - - private ToDoItem createToDoItem( - final String description, - final Category category, Subcategory subcategory, - final String user, - final LocalDate dueBy, - final BigDecimal cost, - final ExecutionContext executionContext) { - ToDoItem newToDo = toDoItems.newToDo(description, category, subcategory, user, dueBy, cost); - return executionContext.add(this, newToDo); - } - - private LocalDate nowPlusDays(int days) { - return clockService.now().plusDays(days); - } - //endregion - - //region > injected services - @javax.inject.Inject - private ToDoItems toDoItems; - - @javax.inject.Inject - private ClockService clockService; - //endregion - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/60c5e045/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java deleted file mode 100644 index c7397bb..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java +++ /dev/null @@ -1,75 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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 fixture.todo.simple; - -import dom.todo.ToDoItem; - -import java.util.Collection; -import com.google.common.base.Objects; -import com.google.common.base.Predicate; -import com.google.common.collect.Collections2; -import org.apache.isis.applib.fixturescripts.FixtureScript; - -public class ToDoItemsRecreateAndCompleteSeveral extends FixtureScript { - - //region > constructor - private final String user; - /** - * @param user - if null then executes for the current user or will use any {@link ${symbol_pound}run(String) parameters} provided when run. - */ - public ToDoItemsRecreateAndCompleteSeveral(final String user) { - super(null, Util.localNameFor("complete", user)); - this.user = user; - } - //endregion - - //region > doRun - @Override - protected void execute(ExecutionContext executionContext) { - final String ownedBy = Util.coalesce(user, executionContext.getParameters(), getContainer().getUser().getName()); - - // prereqs - executeChild(new ToDoItemsRecreate(null), executionContext); - - // this fixture - complete(ownedBy, "Buy stamps", executionContext); - complete(ownedBy, "Write blog post", executionContext); - } - - private void complete(final String user, final String description, final ExecutionContext executionContext) { - final ToDoItem toDoItem = findToDoItem(description, user); - toDoItem.setComplete(true); - executionContext.add(this, toDoItem); - } - - private ToDoItem findToDoItem(final String description, final String user) { - final Collection<ToDoItem> filtered = Collections2.filter(getContainer().allInstances(ToDoItem.class), new Predicate<ToDoItem>() { - @Override - public boolean apply(ToDoItem input) { - return Objects.equal(description, input.getDescription()) && - Objects.equal(user, input.getOwnedBy()); - } - }); - return filtered.isEmpty()? null: filtered.iterator().next(); - } - //endregion -} \ No newline at end of file
