http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java new file mode 100644 index 0000000..0c2b1c8 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java @@ -0,0 +1,260 @@ +#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 dom.todo; + +import dom.todo.ToDoItem.Category; +import dom.todo.ToDoItem.Subcategory; + +import java.math.BigDecimal; +import java.util.List; +import com.google.common.base.Predicates; +import org.joda.time.LocalDate; +import org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.applib.annotation.Action; +import org.apache.isis.applib.annotation.ActionLayout; +import org.apache.isis.applib.annotation.BookmarkPolicy; +import org.apache.isis.applib.annotation.DomainService; +import org.apache.isis.applib.annotation.DomainServiceLayout; +import org.apache.isis.applib.annotation.RestrictTo; +import org.apache.isis.applib.annotation.MemberOrder; +import org.apache.isis.applib.annotation.Optionality; +import org.apache.isis.applib.annotation.Parameter; +import org.apache.isis.applib.annotation.ParameterLayout; +import org.apache.isis.applib.annotation.Programmatic; +import org.apache.isis.applib.annotation.SemanticsOf; +import org.apache.isis.applib.query.QueryDefault; +import org.apache.isis.applib.services.clock.ClockService; + +@DomainServiceLayout(named="ToDos", menuOrder = "10") +@DomainService(repositoryFor = ToDoItem.class) +public class ToDoItems { + + //region > notYetComplete (action) + @Action(semantics = SemanticsOf.SAFE) + @ActionLayout( + cssClassFa = "fa fa-thumbs-down", + bookmarking = BookmarkPolicy.AS_ROOT + ) + @MemberOrder(sequence = "10") + public List<ToDoItem> notYetComplete() { + final List<ToDoItem> items = notYetCompleteNoUi(); + if(items.isEmpty()) { + container.informUser("All to-do items have been completed :-)"); + } + return items; + } + + @Programmatic + public List<ToDoItem> notYetCompleteNoUi() { + return container.allMatches( + new QueryDefault<>(ToDoItem.class, + "findByOwnedByAndCompleteIsFalse", + "ownedBy", currentUserName())); + } + //endregion + + //region > complete (action) + @ActionLayout( + cssClassFa = "fa fa-thumbs-up" + ) + @Action(semantics = SemanticsOf.SAFE) + @MemberOrder(sequence = "20") + public List<ToDoItem> complete() { + final List<ToDoItem> items = completeNoUi(); + if(items.isEmpty()) { + container.informUser("No to-do items have yet been completed :-("); + } + return items; + } + + @Programmatic + public List<ToDoItem> completeNoUi() { + return container.allMatches( + new QueryDefault<>(ToDoItem.class, + "findByOwnedByAndCompleteIsTrue", + "ownedBy", currentUserName())); + } + //endregion + + //region > categorized (action) + @SuppressWarnings("unchecked") + @Action(semantics = SemanticsOf.SAFE) + @ActionLayout( + cssClassFa = "fa fa-question", + bookmarking = BookmarkPolicy.AS_ROOT + ) + @MemberOrder(sequence = "40") + public List<ToDoItem> categorized( + @ParameterLayout(named="Category") final Category category, + @ParameterLayout(named="Subcategory") final Subcategory subcategory, + @ParameterLayout(named="Completed?") final boolean completed) { + // an example "naive" implementation (filtered in Java code, not DBMS) + return container.allMatches(ToDoItem.class, + Predicates.and( + ToDoItem.Predicates.thoseOwnedBy(currentUserName()), + ToDoItem.Predicates.thoseCompleted(completed), + ToDoItem.Predicates.thoseCategorised(category, subcategory))); + } + public Category default0Categorized() { + return Category.Professional; + } + public Subcategory default1Categorized() { + return default0Categorized().subcategories().get(0); + } + public boolean default2Categorized() { + return false; + } + public List<Subcategory> choices1Categorized( + final Category category) { + return Subcategory.listFor(category); + } + public String validateCategorized( + final Category category, + final Subcategory subcategory, + final boolean completed) { + return Subcategory.validate(category, subcategory); + } + //endregion + + //region > newToDo (action) + @ActionLayout(cssClassFa = "fa fa-plus") + @MemberOrder(sequence = "5") + public ToDoItem newToDo( + @Parameter(regexPattern = "${symbol_escape}${symbol_escape}w[@&:${symbol_escape}${symbol_escape}-${symbol_escape}${symbol_escape},${symbol_escape}${symbol_escape}.${symbol_escape}${symbol_escape}+ ${symbol_escape}${symbol_escape}w]*") + @ParameterLayout(named="Description") + final String description, + @ParameterLayout(named="Category") + final Category category, + @Parameter(optional = Optionality.TRUE) + @ParameterLayout(named="Subcategory") + final Subcategory subcategory, + @Parameter(optional = Optionality.TRUE) + @ParameterLayout(named="Due by") + final LocalDate dueBy, + @Parameter(optional = Optionality.TRUE) + @ParameterLayout(named="Cost") + final BigDecimal cost) { + return newToDo(description, category, subcategory, currentUserName(), dueBy, cost); + } + public Category default1NewToDo() { + return Category.Professional; + } + public Subcategory default2NewToDo() { + return Category.Professional.subcategories().get(0); + } + public LocalDate default3NewToDo() { + return clockService.now().plusDays(14); + } + public List<Subcategory> choices2NewToDo( + final String description, final Category category) { + return Subcategory.listFor(category); + } + public String validateNewToDo( + final String description, + final Category category, final Subcategory subcategory, + final LocalDate dueBy, final BigDecimal cost) { + return Subcategory.validate(category, subcategory); + } + //endregion + + //region > allToDos (action) + @ActionLayout( + cssClassFa = "fa fa-globe" + ) + @Action( + semantics = SemanticsOf.SAFE, + restrictTo = RestrictTo.PROTOTYPING + ) + @MemberOrder(sequence = "50") + public List<ToDoItem> allToDos() { + final List<ToDoItem> items = container.allMatches( + new QueryDefault<>(ToDoItem.class, + "findByOwnedBy", + "ownedBy", currentUserName())); + if(items.isEmpty()) { + container.warnUser("No to-do items found."); + } + return items; + } + //endregion + + //region > autoComplete (programmatic) + @Programmatic // not part of metamodel + public List<ToDoItem> autoComplete(final String description) { + return container.allMatches( + new QueryDefault<>(ToDoItem.class, + "findByOwnedByAndDescriptionContains", + "ownedBy", currentUserName(), + "description", description)); + } + //endregion + + //region > helpers + @Programmatic // for use by fixtures + public ToDoItem newToDo( + final String description, + final Category category, + final Subcategory subcategory, + final String userName, + final LocalDate dueBy, final BigDecimal cost) { + final ToDoItem toDoItem = container.newTransientInstance(ToDoItem.class); + toDoItem.setDescription(description); + toDoItem.setCategory(category); + toDoItem.setSubcategory(subcategory); + toDoItem.setOwnedBy(userName); + toDoItem.setDueBy(dueBy); + toDoItem.setCost(cost); + + container.persist(toDoItem); + container.flush(); + + return toDoItem; + } + + private String currentUserName() { + return container.getUser().getName(); + } + + //endregion + + //region > common validation + private static final long ONE_WEEK_IN_MILLIS = 7 * 24 * 60 * 60 * 1000L; + + @Programmatic + public String validateDueBy(final LocalDate dueBy) { + return isMoreThanOneWeekInPast(dueBy) ? "Due by date cannot be more than one week old" : null; + } + @Programmatic + boolean isMoreThanOneWeekInPast(final LocalDate dueBy) { + return dueBy.toDateTimeAtStartOfDay().getMillis() < clockService.nowAsMillis() - ONE_WEEK_IN_MILLIS; + } + //endregion + + //region > injected services + @javax.inject.Inject + private DomainObjectContainer container; + + @javax.inject.Inject + private ClockService clockService; + //endregion + +}
http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoItemTest.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoItemTest.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoItemTest.java new file mode 100644 index 0000000..cd23b44 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoItemTest.java @@ -0,0 +1,136 @@ +#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 dom.todo; + +import org.jmock.Expectations; +import org.jmock.auto.Mock; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.applib.services.actinvoc.ActionInvocationContext; +import org.apache.isis.applib.security.RoleMemento; +import org.apache.isis.applib.security.UserMemento; +import org.apache.isis.applib.services.eventbus.EventBusService; +import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2; +import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertThat; + +public abstract class ToDoItemTest { + + @Rule + public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); + + @Mock + EventBusService eventBusService; + + ToDoItem toDoItem; + + @Before + public void setUp() throws Exception { + toDoItem = new ToDoItem(); + + toDoItem.actionInvocationContext = ActionInvocationContext.onObject(toDoItem); + toDoItem.eventBusService = eventBusService; + + context.ignoring(eventBusService); + } + + public static class Properties extends ToDoItemTest { + + @Mock + DomainObjectContainer mockContainer; + + public static class DueBy extends Properties { + + @Test + public void hiddenForNoDueByRole() { + final UserMemento userWithRole = new UserMemento("user", new RoleMemento("realm1:noDueBy_role")); + context.checking(new Expectations() {{ + allowing(mockContainer).getUser(); + will(returnValue(userWithRole)); + }}); + + toDoItem.container = mockContainer; + + assertThat(toDoItem.hideDueBy(), is(true)); + } + + @Test + public void notHiddenWithoutRole() { + final UserMemento userWithRole = new UserMemento("user", new RoleMemento("realm1:someOtherRole")); + context.checking(new Expectations() {{ + allowing(mockContainer).getUser(); + will(returnValue(userWithRole)); + }}); + + toDoItem.container = mockContainer; + + assertThat(toDoItem.hideDueBy(), is(false)); + } + } + + } + + public static class Actions extends ToDoItemTest { + + public static class Completed extends Actions { + + @Test + public void happyCase() throws Exception { + + // given + toDoItem.setComplete(false); + assertThat(toDoItem.disableCompleted(), is(nullValue())); + + // when + toDoItem.completed(); + + // then + assertThat(toDoItem.isComplete(), is(true)); + assertThat(toDoItem.disableCompleted(), is(not(nullValue()))); + } + } + + public static class NotYetCompleted extends Actions { + + @Test + public void happyCase() throws Exception { + + // given + toDoItem.setComplete(true); + assertThat(toDoItem.disableNotYetCompleted(), is(nullValue())); + + // when + toDoItem.notYetCompleted(); + + // then + assertThat(toDoItem.isComplete(), is(false)); + assertThat(toDoItem.disableNotYetCompleted(), is(not(nullValue()))); + } + } + } + + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml new file mode 100644 index 0000000..478ac42 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>${groupId}</groupId> + <artifactId>${rootArtifactId}</artifactId> + <version>${version}</version> + </parent> + + <artifactId>${artifactId}</artifactId> + <name>ToDo App Fixtures</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>${rootArtifactId}-dom</artifactId> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java new file mode 100644 index 0000000..d56a515 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java @@ -0,0 +1,100 @@ +#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; + +import fixture.todo.scenarios.ToDoItemsRecreateAndCompleteSeveral; + +import java.util.List; +import org.apache.isis.applib.annotation.Action; +import org.apache.isis.applib.annotation.ActionLayout; +import org.apache.isis.applib.annotation.DomainService; +import org.apache.isis.applib.annotation.DomainServiceLayout; +import org.apache.isis.applib.annotation.RestrictTo; +import org.apache.isis.applib.annotation.MemberOrder; +import org.apache.isis.applib.annotation.Optionality; +import org.apache.isis.applib.annotation.Parameter; +import org.apache.isis.applib.annotation.ParameterLayout; +import org.apache.isis.applib.fixturescripts.FixtureResult; +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.fixturescripts.FixtureScripts; + +/** + * Enables fixtures to be installed from the application. + */ +@DomainService +@DomainServiceLayout( + named = "Prototyping", + menuBar = DomainServiceLayout.MenuBar.SECONDARY, + menuOrder = "10") +public class ToDoItemsFixturesService extends FixtureScripts { + + public ToDoItemsFixturesService() { + super("fixture.todo"); + } + + @ActionLayout( + cssClassFa="fa fa-bolt" + ) + @Action( + restrictTo = RestrictTo.PROTOTYPING + ) + @Override + public List<FixtureResult> runFixtureScript( + final FixtureScript fixtureScript, + @ParameterLayout( + named="Parameters", + describedAs = "Script-specific parameters (key=value) ", + multiLine = 10) + @Parameter(optional = Optionality.TRUE) + final String parameters) { + return super.runFixtureScript(fixtureScript, parameters); + } + + @Override + public FixtureScript default0RunFixtureScript() { + return findFixtureScriptFor(ToDoItemsRecreateAndCompleteSeveral.class); + } + + /** + * Raising visibility to <tt>public</tt> so that choices are available for first param + * of {@link ${symbol_pound}runFixtureScript(FixtureScript, String)}. + */ + @Override + public List<FixtureScript> choices0RunFixtureScript() { + return super.choices0RunFixtureScript(); + } + + // ////////////////////////////////////// + + + @ActionLayout( + cssClassFa="fa fa-list" + ) + @Action( + restrictTo = RestrictTo.PROTOTYPING + ) + @MemberOrder(sequence="20") + public Object recreateToDoItemsReturnFirst() { + final List<FixtureResult> run = findFixtureScriptFor(ToDoItemsRecreateAndCompleteSeveral.class).run(null); + return run.get(0).getObject(); + } +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java new file mode 100644 index 0000000..eb2c28f --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java @@ -0,0 +1,43 @@ +#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.integtests; + +import fixture.todo.scenarios.ToDoItemsRecreateAndCompleteSeveral; + +import org.apache.isis.applib.fixturescripts.FixtureScript; + +/** + * Refactored to reuse the newer {@link FixtureScript} API. + */ +public class ToDoItemsIntegTestFixture extends FixtureScript { + + public ToDoItemsIntegTestFixture() { + super(null, "integ-test"); + } + + @Override + protected void execute(ExecutionContext executionContext) { + executionContext.executeChild(this, new ToDoItemsRecreateAndCompleteSeveral()); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java b/mothballed/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..b1ffcd1 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteAbstract.java @@ -0,0 +1,55 @@ +#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 { + + /** + * 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.addResult(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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java b/mothballed/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..3a5d149 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForBuyStamps.java @@ -0,0 +1,33 @@ +#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) { + complete(ToDoItemForBuyStamps.DESCRIPTION, executionContext); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java b/mothballed/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..14e417f --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/actions/complete/ToDoItemCompleteForWriteBlogPost.java @@ -0,0 +1,34 @@ +#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) { + complete(ToDoItemForWriteBlogPost.DESCRIPTION, executionContext); + } + + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemAbstract.java new file mode 100644 index 0000000..305cef7 --- /dev/null +++ b/mothballed/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.addResult(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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyBread.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyMilk.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForBuyStamps.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForMowLawn.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForOrganizeBrownBag.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForPickUpLaundry.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSharpenKnives.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForStageIsisRelease.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForSubmitConferenceSession.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForVacuumHouse.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteBlogPost.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/create/ToDoItemForWriteToPenPal.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java new file mode 100644 index 0000000..429d596 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/items/delete/ToDoItemsDelete.java @@ -0,0 +1,41 @@ +#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 > 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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreate.java new file mode 100644 index 0000000..a1bb33f --- /dev/null +++ b/mothballed/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 + executionContext.executeChild(this, new ToDoItemsDelete()); + + // create items + executionContext.executeChild(this, new ToDoItemForBuyMilk()); + executionContext.executeChild(this, new ToDoItemForBuyBread()); + executionContext.executeChild(this, new ToDoItemForBuyStamps()); + executionContext.executeChild(this, new ToDoItemForPickUpLaundry()); + executionContext.executeChild(this, new ToDoItemForMowLawn()); + executionContext.executeChild(this, new ToDoItemForVacuumHouse()); + executionContext.executeChild(this, new ToDoItemForSharpenKnives()); + executionContext.executeChild(this, new ToDoItemForWriteToPenPal()); + executionContext.executeChild(this, new ToDoItemForWriteBlogPost()); + executionContext.executeChild(this, new ToDoItemForOrganizeBrownBag()); + executionContext.executeChild(this, new ToDoItemForSubmitConferenceSession()); + executionContext.executeChild(this, new ToDoItemForStageIsisRelease()); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java new file mode 100644 index 0000000..3d790b7 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveral.java @@ -0,0 +1,89 @@ +#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.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.items.delete.ToDoItemsDelete; +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())); + + executionContext.executeChild(this, new ToDoItemsDelete()); + + // create items + executionContext.executeChild(this, new ToDoItemForBuyMilk()); + executionContext.executeChild(this, new ToDoItemForBuyBread()); + executionContext.executeChild(this, new ToDoItemForBuyStamps()); + executionContext.executeChild(this, new ToDoItemForPickUpLaundry()); + executionContext.executeChild(this, new ToDoItemForMowLawn()); + executionContext.executeChild(this, new ToDoItemForVacuumHouse()); + executionContext.executeChild(this, new ToDoItemForSharpenKnives()); + executionContext.executeChild(this, new ToDoItemForWriteToPenPal()); + executionContext.executeChild(this, new ToDoItemForWriteBlogPost()); + executionContext.executeChild(this, new ToDoItemForOrganizeBrownBag()); + executionContext.executeChild(this, new ToDoItemForSubmitConferenceSession()); + executionContext.executeChild(this, new ToDoItemForStageIsisRelease()); + + // this fixture + executionContext.executeChild(this, new ToDoItemCompleteForBuyStamps()); + executionContext.executeChild(this, new ToDoItemCompleteForWriteBlogPost()); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForDick.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateAndCompleteSeveralForJoe.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/ToDoItemsRecreateForSven.java b/mothballed/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/mothballed/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/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/util/Util.java ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/util/Util.java b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/util/Util.java new file mode 100644 index 0000000..7a0ae71 --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/util/Util.java @@ -0,0 +1,35 @@ +#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.util; + +public final class Util { + + private Util(){} + + public static String coalesce(final String... strings) { + for (String str : strings) { + if(str != null) { return str; } + } + return null; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/logging.properties ---------------------------------------------------------------------- diff --git a/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/logging.properties b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/logging.properties new file mode 100644 index 0000000..f49afbf --- /dev/null +++ b/mothballed/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/logging.properties @@ -0,0 +1,104 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +${symbol_pound} Licensed to the Apache Software Foundation (ASF) under one +${symbol_pound} or more contributor license agreements. See the NOTICE file +${symbol_pound} distributed with this work for additional information +${symbol_pound} regarding copyright ownership. The ASF licenses this file +${symbol_pound} to you under the Apache License, Version 2.0 (the +${symbol_pound} "License"); you may not use this file except in compliance +${symbol_pound} with the License. You may obtain a copy of the License at +${symbol_pound} +${symbol_pound} http://www.apache.org/licenses/LICENSE-2.0 +${symbol_pound} +${symbol_pound} Unless required by applicable law or agreed to in writing, +${symbol_pound} software distributed under the License is distributed on an +${symbol_pound} "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +${symbol_pound} KIND, either express or implied. See the License for the +${symbol_pound} specific language governing permissions and limitations +${symbol_pound} under the License. + + +${symbol_pound} +${symbol_pound} Isis uses log4j is used to provide system logging +${symbol_pound} +log4j.rootCategory=INFO, Console + +${symbol_pound} The console appender +log4j.appender.Console=org.apache.log4j.ConsoleAppender +log4j.appender.Console.target=System.out +log4j.appender.Console.layout=org.apache.log4j.PatternLayout +log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} [%-20c{1} %-10t %-5p] %m%n + +log4j.appender.File=org.apache.log4j.RollingFileAppender +log4j.appender.File.file=isis.log +log4j.appender.File.append=false +log4j.appender.File.layout=org.apache.log4j.PatternLayout +log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p] %m%n + +! turn on the internal log4j debugging flag so we can see what it is doing +${symbol_pound}log4j.debug=true + +${symbol_pound} DataNucleus +${symbol_pound} the first two log the DML and DDL (if set to DEBUG) +log4j.logger.DataNucleus.Datastore.Native=WARN, Console +log4j.logger.DataNucleus.Datastore.Schema=DEBUG, Console +${symbol_pound} the remainder can probably be left to WARN +log4j.logger.DataNucleus.Persistence=WARN, Console +log4j.logger.DataNucleus.Transaction=WARN, Console +log4j.logger.DataNucleus.Connection=WARN, Console +log4j.logger.DataNucleus.Query=WARN, Console +log4j.logger.DataNucleus.Cache=WARN, Console +log4j.logger.DataNucleus.MetaData=WARN, Console +log4j.logger.DataNucleus.Datastore=WARN, Console +log4j.logger.DataNucleus.Datastore.Persist=WARN, Console +log4j.logger.DataNucleus.Datastore.Retrieve=WARN, Console +log4j.logger.DataNucleus.General=WARN, Console +log4j.logger.DataNucleus.Lifecycle=WARN, Console +log4j.logger.DataNucleus.ValueGeneration=WARN, Console +log4j.logger.DataNucleus.Enhancer=WARN, Console +log4j.logger.DataNucleus.SchemaTool=ERROR, Console +log4j.logger.DataNucleus.JDO=WARN, Console +log4j.logger.DataNucleus.JPA=ERROR, Console +log4j.logger.DataNucleus.JCA=WARN, Console +log4j.logger.DataNucleus.IDE=ERROR, Console + +log4j.additivity.DataNucleus.Datastore.Native=false +log4j.additivity.DataNucleus.Datastore.Schema=false +log4j.additivity.DataNucleus.Datastore.Persistence=false +log4j.additivity.DataNucleus.Datastore.Transaction=false +log4j.additivity.DataNucleus.Datastore.Connection=false +log4j.additivity.DataNucleus.Datastore.Query=false +log4j.additivity.DataNucleus.Datastore.Cache=false +log4j.additivity.DataNucleus.Datastore.MetaData=false +log4j.additivity.DataNucleus.Datastore.Datastore=false +log4j.additivity.DataNucleus.Datastore.Datastore.Persist=false +log4j.additivity.DataNucleus.Datastore.Datastore.Retrieve=false +log4j.additivity.DataNucleus.Datastore.General=false +log4j.additivity.DataNucleus.Datastore.Lifecycle=false +log4j.additivity.DataNucleus.Datastore.ValueGeneration=false +log4j.additivity.DataNucleus.Datastore.Enhancer=false +log4j.additivity.DataNucleus.Datastore.SchemaTool=false +log4j.additivity.DataNucleus.Datastore.JDO=false +log4j.additivity.DataNucleus.Datastore.JPA=false +log4j.additivity.DataNucleus.Datastore.JCA=false +log4j.additivity.DataNucleus.Datastore.IDE=false + + + + +${symbol_pound} if using log4jdbc-remix as JDBC driver +${symbol_pound}log4j.logger.jdbc.sqlonly=DEBUG, sql, Console +${symbol_pound}log4j.additivity.jdbc.sqlonly=false +${symbol_pound}log4j.logger.jdbc.resultsettable=DEBUG, jdbc, Console +${symbol_pound}log4j.additivity.jdbc.resultsettable=false + +${symbol_pound}log4j.logger.jdbc.audit=WARN,jdbc, Console +${symbol_pound}log4j.additivity.jdbc.audit=false +${symbol_pound}log4j.logger.jdbc.resultset=WARN,jdbc +${symbol_pound}log4j.additivity.jdbc.resultset=false +${symbol_pound}log4j.logger.jdbc.sqltiming=WARN,sqltiming +${symbol_pound}log4j.additivity.jdbc.sqltiming=false +${symbol_pound}log4j.logger.jdbc.connection=FATAL,connection +${symbol_pound}log4j.additivity.jdbc.connection=false +
