You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/06/02 15:34:19 UTC
[22/27] git commit: ISIS-792: recreated quickstart archetype for 1.5.0
ISIS-792: recreated quickstart archetype for 1.5.0
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/88b8b8a9
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/88b8b8a9
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/88b8b8a9
Branch: refs/heads/prepare/isis-1.5.0-RC1
Commit: 88b8b8a90f198bbd6f33969967d36abd34a3411b
Parents: a5f2a24
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Jun 2 14:00:07 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Jun 2 14:00:07 2014 +0100
----------------------------------------------------------------------
.../quickstart_wicket_restful_jdo/pom.xml | 6 +-
.../resources/archetype-resources/dom/pom.xml | 11 -
.../dom/src/main/java/app/ToDoAppDashboard.java | 25 +-
.../main/java/app/ToDoAppDashboardService.java | 14 +-
.../dom/src/main/java/app/ToDoItemAnalysis.java | 42 +--
.../java/app/ToDoItemAnalysisContributions.java | 11 +-
.../java/app/ToDoItemsByCategoryViewModel.java | 64 ++--
.../java/app/ToDoItemsByDateRangeViewModel.java | 33 +-
.../dom/src/main/java/dom/todo/ToDoItem.java | 347 +++++++++++--------
.../src/main/java/dom/todo/ToDoItem.layout.json | 11 +-
.../java/dom/todo/ToDoItemContributions.java | 49 +--
.../java/dom/todo/ToDoItemSubscriptions.java | 184 ++++++++++
.../dom/src/main/java/dom/todo/ToDoItems.java | 69 ++--
.../test/java/dom/todo/ToDoTest_completed.java | 19 +-
.../java/dom/todo/ToDoTest_notYetCompleted.java | 23 +-
.../java/fixture/todo/ToDoItemsFixture.java | 105 ------
.../fixture/todo/ToDoItemsFixturesService.java | 59 ++++
.../integtests/ToDoItemsIntegTestFixture.java | 43 +++
.../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 ++
.../fixture/todo/simple/ToDoItemsDelete.java | 56 +++
.../fixture/todo/simple/ToDoItemsRecreate.java | 98 ++++++
.../ToDoItemsRecreateAndCompleteSeveral.java | 75 ++++
.../src/main/java/fixture/todo/simple/Util.java | 39 +++
.../java/integration/ToDoSystemInitializer.java | 37 +-
.../integration/glue/CatalogOfFixturesGlue.java | 5 +-
.../integration/glue/todoitem/ToDoItemGlue.java | 4 +
.../java/integration/tests/ToDoIntegTest.java | 4 +-
...oDoItemContributionsTest_updateCategory.java | 51 +--
.../tests/actions/ToDoItemTest_completed.java | 110 +++++-
.../tests/actions/ToDoItemTest_duplicate.java | 31 +-
.../actions/ToDoItemTest_notYetCompleted.java | 29 +-
.../ToDoItemContributionsTest_similarTo.java | 40 ++-
.../colls/ToDoItemTest_dependencies_add.java | 117 ++++++-
.../colls/ToDoItemTest_dependencies_remove.java | 114 +++++-
.../ToDoItemContributionsTest_priority.java | 28 +-
.../tests/props/ToDoItemTest_attachment.java | 29 +-
.../tests/props/ToDoItemTest_category.java | 26 +-
.../tests/props/ToDoItemTest_cost.java | 27 +-
.../tests/props/ToDoItemTest_description.java | 144 +++++++-
.../tests/props/ToDoItemTest_dueBy.java | 35 +-
.../tests/props/ToDoItemTest_notes.java | 37 +-
.../tests/props/ToDoItemTest_ownedBy.java | 24 +-
.../tests/props/ToDoItemTest_subcategory.java | 24 +-
.../tests/repo/ToDoItemsTest_finders.java | 28 +-
.../repo/ToDoItemsTest_newToDo_and_delete.java | 21 +-
.../tests/smoke/ToDoItemTest_title.java | 30 +-
.../main/resources/archetype-resources/pom.xml | 10 +-
.../launch/ToDoApp-PROTOTYPE-jrebel.launch | 2 +-
.../launch/ToDoApp-PROTOTYPE-no-fixtures.launch | 25 --
.../ide/eclipse/launch/ToDoApp-PROTOTYPE.launch | 25 ++
.../launch/ToDoApp-SERVER-no-fixtures.launch | 25 --
.../ide/eclipse/launch/ToDoApp-SERVER.launch | 25 ++
.../archetype-resources/webapp/pom.xml | 111 +++++-
.../src/main/java/webapp/admin/Admin.java | 11 +-
.../webapp/prototyping/DeveloperUtilities.java | 2 +
.../prototyping/ToDoItemsFixturesService.java | 87 -----
.../webapp/src/main/resources/webapp/realm1.ini | 2 +-
.../webapp/src/main/resources/webapp/realm2.ini | 2 +-
.../src/main/webapp/WEB-INF/isis.properties | 7 +-
.../src/main/webapp/WEB-INF/logging.properties | 5 +-
.../WEB-INF/persistor_datanucleus.properties | 10 +
.../webapp/src/main/webapp/WEB-INF/shiro.ini | 2 +-
.../webapp/src/main/webapp/WEB-INF/web.xml | 15 +
.../projects/basic/archetype.properties | 2 +-
70 files changed, 2093 insertions(+), 893 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/pom.xml b/example/archetype/quickstart_wicket_restful_jdo/pom.xml
index bea4892..ce85822 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/pom.xml
+++ b/example/archetype/quickstart_wicket_restful_jdo/pom.xml
@@ -17,11 +17,11 @@
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/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.isis.archetype</groupId>
<artifactId>quickstart_wicket_restful_jdo-archetype</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.4.2-SNAPSHOT</version>
<packaging>maven-archetype</packaging>
<name>quickstart_wicket_restful_jdo-archetype</name>
<build>
@@ -44,7 +44,7 @@
<parent>
<groupId>org.apache.isis.core</groupId>
<artifactId>isis</artifactId>
- <version>1.4.0</version>
+ <version>1.5.0</version>
<relativePath>../../../core/pom.xml</relativePath>
</parent>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
index 5e75287..d8ad66c 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
@@ -114,21 +114,10 @@
<!-- Bytecode libraries (for mocking) -->
<dependency>
- <groupId>asm</groupId>
- <artifactId>asm</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <scope>test</scope>
- </dependency>
-
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
index c73e6d6..bf007d5 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
@@ -31,6 +31,8 @@ import org.apache.isis.applib.annotation.Render.Type;
public class ToDoAppDashboard extends AbstractViewModel {
+ //region > identification in the UI
+ // //////////////////////////////////////
public String title() {
return "Dashboard";
}
@@ -38,9 +40,9 @@ public class ToDoAppDashboard extends AbstractViewModel {
public String iconName() {
return "Dashboard";
}
-
- // //////////////////////////////////////
- // ViewModel contract
+ //endregion
+
+ //region > ViewModel contract
// //////////////////////////////////////
private String memento;
@@ -55,9 +57,9 @@ public class ToDoAppDashboard extends AbstractViewModel {
this.memento = memento;
}
+ //endregion
- // //////////////////////////////////////
- // getAnalysisByCategory
+ //region > getAnalysisByCategory (collection)
// //////////////////////////////////////
@Named("By Category")
@@ -66,9 +68,9 @@ public class ToDoAppDashboard extends AbstractViewModel {
public List<ToDoItemsByCategoryViewModel> getAnalysisByCategory() {
return toDoItemAnalysis.toDoItemsByCategory();
}
-
- // //////////////////////////////////////
- // getAnalysisByDateRange
+ //endregion
+
+ //region > getAnalysisByDateRange (collection)
// //////////////////////////////////////
@Named("By Date Range")
@@ -77,13 +79,14 @@ public class ToDoAppDashboard extends AbstractViewModel {
public List<ToDoItemsByDateRangeViewModel> getAnalysisByDateRange() {
return toDoItemAnalysis.toDoItemsByDateRange();
}
-
+ //endregion
- // //////////////////////////////////////
- // injected services
+ //region > injected services
// //////////////////////////////////////
@javax.inject.Inject
private ToDoItemAnalysis toDoItemAnalysis;
+ //endregion
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboardService.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboardService.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboardService.java
index 600f458..abd6268 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboardService.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboardService.java
@@ -30,6 +30,9 @@ import org.apache.isis.applib.annotation.HomePage;
@Hidden
public class ToDoAppDashboardService {
+ //region > identification in the UI
+ // //////////////////////////////////////
+
private static final String ID = "dashboard";
public String getId() {
@@ -39,21 +42,24 @@ public class ToDoAppDashboardService {
public String iconName() {
return ID;
}
+ //endregion
+ //region > lookup (action)
// //////////////////////////////////////
-
@ActionSemantics(Of.SAFE)
@HomePage
public ToDoAppDashboard lookup() {
return container.newViewModelInstance(ToDoAppDashboard.class, ID);
}
-
- // //////////////////////////////////////
- // Injected services
+ //endregion
+
+ //region > injected services
// //////////////////////////////////////
@javax.inject.Inject
private DomainObjectContainer container;
+ //endregion
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
index 6863ab0..1d4c73b 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
@@ -21,28 +21,22 @@
*/
package app;
+import dom.todo.ToDoItem.Category;
+
import java.util.Arrays;
import java.util.List;
-
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-
-import dom.todo.ToDoItem.Category;
-
import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.Bookmarkable;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Programmatic;
@Named("Analysis")
public class ToDoItemAnalysis {
- // //////////////////////////////////////
- // Identification in the UI
+
+ //region > identification in the UI
// //////////////////////////////////////
public String getId() {
@@ -52,11 +46,11 @@ public class ToDoItemAnalysis {
public String iconName() {
return "ToDoItem";
}
+ //endregion
+ //region > byCategory (action)
// //////////////////////////////////////
- // ByCategory (action)
- // //////////////////////////////////////
-
+
@Named("By Category")
@Bookmarkable
@ActionSemantics(Of.SAFE)
@@ -78,8 +72,9 @@ public class ToDoItemAnalysis {
};
}
- // //////////////////////////////////////
- // ByDateRange (action)
+ //endregion
+
+ //region > byDateRange (action)
// //////////////////////////////////////
public enum DateRange {
@@ -111,23 +106,24 @@ public class ToDoItemAnalysis {
}
};
}
-
-
- // //////////////////////////////////////
- // ForCategory (programmatic)
+ //endregion
+
+ //region > forCategory (programmatic)
// //////////////////////////////////////
@Programmatic
public ToDoItemsByCategoryViewModel toDoItemsForCategory(Category category) {
return byCategory().apply(category);
}
-
- // //////////////////////////////////////
- // Injected services
+ //endregion
+
+ //region > injected services
// //////////////////////////////////////
@javax.inject.Inject
private DomainObjectContainer container;
+ //endregion
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysisContributions.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysisContributions.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysisContributions.java
index e033b97..ead5e79 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysisContributions.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysisContributions.java
@@ -34,8 +34,7 @@ import org.apache.isis.applib.annotation.NotInServiceMenu;
public class ToDoItemAnalysisContributions {
- // //////////////////////////////////////
- // AnalyseCategory
+ //region > analyseCategory (action)
// //////////////////////////////////////
@NotInServiceMenu
@@ -44,12 +43,14 @@ public class ToDoItemAnalysisContributions {
public ToDoItemsByCategoryViewModel analyseCategory(final ToDoItem item) {
return toDoAppAnalysis.toDoItemsForCategory(item.getCategory());
}
+ //endregion
-
- // //////////////////////////////////////
- // injected services
+ //region > injected services
// //////////////////////////////////////
@javax.inject.Inject
private ToDoItemAnalysis toDoAppAnalysis;
+
+ //endregion
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
index 4014ad9..68f23b0 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
@@ -21,26 +21,20 @@
*/
package app;
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItem.Category;
+import dom.todo.ToDoItem.Subcategory;
+import dom.todo.ToDoItems;
+
import java.util.Arrays;
import java.util.List;
-
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-
-import dom.todo.ToDoItem;
-import dom.todo.ToDoItem.Category;
-import dom.todo.ToDoItem.Subcategory;
-import dom.todo.ToDoItems;
-
import org.apache.isis.applib.AbstractViewModel;
-import org.apache.isis.applib.annotation.Bookmarkable;
-import org.apache.isis.applib.annotation.MultiLine;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.Render.Type;
-import org.apache.isis.applib.annotation.Title;
import org.apache.isis.applib.util.ObjectContracts;
@Named("By Category")
@@ -49,9 +43,7 @@ public class ToDoItemsByCategoryViewModel
extends AbstractViewModel
implements Comparable<ToDoItemsByCategoryViewModel> {
-
- // //////////////////////////////////////
- // ViewModel implementation
+ //region > viewModel implementation
// //////////////////////////////////////
@Override
@@ -64,8 +56,9 @@ public class ToDoItemsByCategoryViewModel
setCategory(Category.valueOf(memento));
}
- // //////////////////////////////////////
- // Category
+ //endregion
+
+ //region > category (property)
// //////////////////////////////////////
private Category category;
@@ -81,10 +74,9 @@ public class ToDoItemsByCategoryViewModel
public void setCategory(final Category category) {
this.category = category;
}
+ //endregion
-
- // //////////////////////////////////////
- // NotYetComplete, Complete
+ //region > notYetComplete (property), complete (property)
// //////////////////////////////////////
@MultiLine(numberOfLines=5)
@@ -94,8 +86,6 @@ public class ToDoItemsByCategoryViewModel
Iterables.transform(subcategories(), summarizeBySubcategory(notYetComplete)));
}
- // //////////////////////////////////////
-
@MultiLine(numberOfLines=5)
public String getComplete() {
final List<ToDoItem> completeInCategory = getItemsComplete();
@@ -119,13 +109,12 @@ public class ToDoItemsByCategoryViewModel
}
private static int countIn(final Iterable<ToDoItem> items, final Subcategory subcategory) {
- return Iterables.size(Iterables.filter(items,
+ return Iterables.size(Iterables.filter(items,
ToDoItem.Predicates.thoseSubcategorised(subcategory)));
}
+ //endregion
-
- // //////////////////////////////////////
- // getItemsNotYetComplete, getItemsComplete
+ //region > getItemsNotYetComplete (collection), getItemsComplete (collection)
// //////////////////////////////////////
/**
@@ -137,8 +126,6 @@ public class ToDoItemsByCategoryViewModel
return Lists.newArrayList(Iterables.filter(notYetComplete, ToDoItem.Predicates.thoseCategorised(getCategory())));
}
- // //////////////////////////////////////
-
/**
* All those items {@link ToDoItems${symbol_pound}complete() complete}, for this {@link ${symbol_pound}getCategory() category}.
*/
@@ -148,9 +135,9 @@ public class ToDoItemsByCategoryViewModel
return Lists.newArrayList(Iterables.filter(complete, ToDoItem.Predicates.thoseCategorised(getCategory())));
}
-
- // //////////////////////////////////////
- // DeleteCompleted (action)
+ //endregion
+
+ //region > deleteCompleted (action)
// //////////////////////////////////////
@Named("Delete")
@@ -161,24 +148,23 @@ public class ToDoItemsByCategoryViewModel
// force reload of page
return this;
}
-
-
- // //////////////////////////////////////
- // compareTo
+ //endregion
+
+ //region > compareTo
// //////////////////////////////////////
@Override
public int compareTo(ToDoItemsByCategoryViewModel other) {
return ObjectContracts.compare(this, other, "category");
}
+ //endregion
-
- // //////////////////////////////////////
- // injected services
+ //region > injected services
// //////////////////////////////////////
-
+
@javax.inject.Inject
private ToDoItems toDoItems;
+ //endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
index baf75e4..ecd2f45 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
@@ -50,9 +50,7 @@ public class ToDoItemsByDateRangeViewModel
extends AbstractViewModel
implements Comparable<ToDoItemsByDateRangeViewModel> {
-
- // //////////////////////////////////////
- // ViewModel implementation
+ //region > viewModel implementation
// //////////////////////////////////////
@Override
@@ -65,8 +63,11 @@ public class ToDoItemsByDateRangeViewModel
setDateRange(DateRange.valueOf(memento));
}
+ //endregion
+
+ //region > dateRange (property)
// //////////////////////////////////////
- // DateRange
+ //
// //////////////////////////////////////
private DateRange dateRange;
@@ -82,18 +83,18 @@ public class ToDoItemsByDateRangeViewModel
public void setDateRange(final DateRange dateRange) {
this.dateRange = dateRange;
}
+ //endregion
-
- // //////////////////////////////////////
- // Count
+ //region > count (derived property)
// //////////////////////////////////////
public int getCount() {
return getItemsNotYetComplete().size();
}
-
- // //////////////////////////////////////
- // getItemsNotYetComplete
+
+ //endregion
+
+ //region > getItemsNotYetComplete (collection)
// //////////////////////////////////////
/**
@@ -135,20 +136,18 @@ public class ToDoItemsByDateRangeViewModel
}
return DateRange.Later;
}
+ //endregion
-
- // //////////////////////////////////////
- // compareTo
+ //region > compareTo
// //////////////////////////////////////
@Override
public int compareTo(ToDoItemsByDateRangeViewModel other) {
return ObjectContracts.compare(this, other, "dateRange");
}
+ //endregion
-
- // //////////////////////////////////////
- // injected services
+ //region > injected services
// //////////////////////////////////////
@javax.inject.Inject
@@ -157,4 +156,6 @@ public class ToDoItemsByDateRangeViewModel
@javax.inject.Inject
private ClockService clockService;
+ //endregion
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
index 9f65bf5..9ae0a78 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
@@ -24,58 +24,35 @@ package dom.todo;
import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
+import java.util.*;
import javax.jdo.JDOHelper;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.VersionStrategy;
-
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
import com.google.common.collect.Ordering;
-
import org.joda.time.LocalDate;
-
import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.Identifier;
import org.apache.isis.applib.NonRecoverableException;
import org.apache.isis.applib.RecoverableException;
-import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.Audited;
-import org.apache.isis.applib.annotation.AutoComplete;
-import org.apache.isis.applib.annotation.Bookmarkable;
-import org.apache.isis.applib.annotation.Bulk;
import org.apache.isis.applib.annotation.Bulk.AppliesTo;
import org.apache.isis.applib.annotation.Bulk.InteractionContext.InvokedAs;
-import org.apache.isis.applib.annotation.Command;
import org.apache.isis.applib.annotation.Command.ExecuteIn;
-import org.apache.isis.applib.annotation.Disabled;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.MinLength;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.ObjectType;
-import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.Prototype;
-import org.apache.isis.applib.annotation.PublishedAction;
-import org.apache.isis.applib.annotation.PublishedObject;
-import org.apache.isis.applib.annotation.RegEx;
-import org.apache.isis.applib.annotation.SortedBy;
-import org.apache.isis.applib.annotation.TypicalLength;
import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.services.background.BackgroundService;
import org.apache.isis.applib.services.clock.ClockService;
import org.apache.isis.applib.services.command.CommandContext;
+import org.apache.isis.applib.services.eventbus.ActionInvokedEvent;
+import org.apache.isis.applib.services.eventbus.EventBusService;
import org.apache.isis.applib.services.scratchpad.Scratchpad;
+import org.apache.isis.applib.services.wrapper.WrapperFactory;
import org.apache.isis.applib.util.ObjectContracts;
import org.apache.isis.applib.util.TitleBuffer;
import org.apache.isis.applib.value.Blob;
+import org.apache.isis.applib.value.Clob;
@javax.jdo.annotations.PersistenceCapable(identityType=IdentityType.DATASTORE)
@javax.jdo.annotations.DatastoreIdentity(
@@ -128,16 +105,16 @@ import org.apache.isis.applib.value.Blob;
@Bookmarkable
public class ToDoItem implements Comparable<ToDoItem> {
+ //region > LOG
/**
* It isn't common for entities to log, but they can if required.
* Isis uses slf4j API internally (with log4j as implementation), and is the recommended API to use.
*/
private final static org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(ToDoItem.class);
-
- // //////////////////////////////////////
- // Identification in the UI
- // //////////////////////////////////////
+ //endregion
+ // region > title, icon
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public String title() {
final TitleBuffer buf = new TitleBuffer();
buf.append(getDescription());
@@ -154,14 +131,14 @@ public class ToDoItem implements Comparable<ToDoItem> {
public String iconName() {
return "ToDoItem-" + (!isComplete() ? "todo" : "done");
}
+ //endregion
- // //////////////////////////////////////
- // Description (property)
- // //////////////////////////////////////
-
+ //region > description (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private String description;
@javax.jdo.annotations.Column(allowsNull="false", length=100)
+ @PostsPropertyChangedEvent()
@RegEx(validation = "${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]*")
@TypicalLength(50)
public String getDescription() {
@@ -171,13 +148,16 @@ public class ToDoItem implements Comparable<ToDoItem> {
public void setDescription(final String description) {
this.description = description;
}
+ public void modifyDescription(final String description) {
+ setDescription(description);
+ }
+ public void clearDescription() {
+ setDescription(null);
+ }
+ //endregion
-
-
- // //////////////////////////////////////
- // DueBy (property)
- // //////////////////////////////////////
-
+ //region > dueBy (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@javax.jdo.annotations.Persistent(defaultFetchGroup="true")
private LocalDate dueBy;
@@ -199,11 +179,11 @@ public class ToDoItem implements Comparable<ToDoItem> {
}
return isMoreThanOneWeekInPast(dueBy) ? "Due by date cannot be more than one week old" : null;
}
+ //endregion
- // //////////////////////////////////////
- // Category and Subcategory (property)
- // //////////////////////////////////////
+ //region > category and subcategory (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static enum Category {
Professional {
@Override
@@ -259,7 +239,6 @@ public class ToDoItem implements Comparable<ToDoItem> {
// //////////////////////////////////////
-
private Category category;
@javax.jdo.annotations.Column(allowsNull="false")
@@ -282,12 +261,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
public void setSubcategory(final Subcategory subcategory) {
this.subcategory = subcategory;
}
+ //endregion
-
- // //////////////////////////////////////
- // OwnedBy (property)
- // //////////////////////////////////////
-
+ //region > ownedBy (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private String ownedBy;
@javax.jdo.annotations.Column(allowsNull="false")
@@ -298,13 +275,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
public void setOwnedBy(final String ownedBy) {
this.ownedBy = ownedBy;
}
+ //endregion
-
- // //////////////////////////////////////
- // Complete (property),
- // Done (action), Undo (action)
- // //////////////////////////////////////
-
+ //region > complete (property), completed (action), notYetCompleted (action)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private boolean complete;
@Disabled
@@ -316,6 +290,7 @@ public class ToDoItem implements Comparable<ToDoItem> {
this.complete = complete;
}
+ @PostsActionInvokedEvent(CompletedEvent.class)
@Command
@PublishedAction
@Bulk
@@ -343,6 +318,7 @@ public class ToDoItem implements Comparable<ToDoItem> {
return isComplete() ? "Already completed" : null;
}
+ @PostsActionInvokedEvent(NoLongerCompletedEvent.class)
@Command
@PublishedAction
@Bulk
@@ -357,11 +333,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
public String disableNotYetCompleted() {
return !complete ? "Not yet completed" : null;
}
+ //endregion
- // //////////////////////////////////////
- // completeSlowly
- // //////////////////////////////////////
-
+ //region > completeSlowly (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Hidden
public void completeSlowly(int millis) {
try {
@@ -370,12 +345,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
}
setComplete(true);
}
+ //endregion
-
- // //////////////////////////////////////
- // Cost (property), UpdateCost (action)
- // //////////////////////////////////////
-
+ //region > cost (property), updateCost (action)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private BigDecimal cost;
@javax.jdo.annotations.Column(allowsNull="true", scale=2)
@@ -416,11 +389,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
if(proposedCost == null) { return null; }
return proposedCost.compareTo(BigDecimal.ZERO) < 0? "Cost must be positive": null;
}
+ //endregion
- // //////////////////////////////////////
- // Notes (property)
- // //////////////////////////////////////
-
+ //region > notes (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private String notes;
@javax.jdo.annotations.Column(allowsNull="true", length=400)
@@ -431,15 +403,17 @@ public class ToDoItem implements Comparable<ToDoItem> {
public void setNotes(final String notes) {
this.notes = notes;
}
+ //endregion
- // //////////////////////////////////////
- // Attachment (property)
- // //////////////////////////////////////
-
+ //region > attachment (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private Blob attachment;
-
- @javax.jdo.annotations.Persistent(defaultFetchGroup="false")
- @javax.jdo.annotations.Column(allowsNull="true")
+ @javax.jdo.annotations.Persistent(defaultFetchGroup="false", columns = {
+ @javax.jdo.annotations.Column(name = "attachment_name"),
+ @javax.jdo.annotations.Column(name = "attachment_mimetype"),
+ @javax.jdo.annotations.Column(name = "attachment_bytes", jdbcType = "BLOB", sqlType = "BLOB")
+ })
+ @Optional
public Blob getAttachment() {
return attachment;
}
@@ -447,11 +421,28 @@ public class ToDoItem implements Comparable<ToDoItem> {
public void setAttachment(final Blob attachment) {
this.attachment = attachment;
}
+ //endregion
- // //////////////////////////////////////
- // Version (derived property)
- // //////////////////////////////////////
+ //region > doc (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ private Clob doc;
+ @javax.jdo.annotations.Persistent(defaultFetchGroup="false", columns = {
+ @javax.jdo.annotations.Column(name = "doc_name"),
+ @javax.jdo.annotations.Column(name = "doc_mimetype"),
+ @javax.jdo.annotations.Column(name = "doc_chars", jdbcType = "CLOB", sqlType = "CLOB")
+ })
+ @Optional
+ public Clob getDoc() {
+ return doc;
+ }
+
+ public void setDoc(final Clob doc) {
+ this.doc = doc;
+ }
+ //endregion
+ //region > version (derived property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public Long getVersionSequence() {
if(!(this instanceof javax.jdo.spi.PersistenceCapable)) {
return null;
@@ -464,11 +455,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
public boolean hideVersionSequence() {
return !(this instanceof javax.jdo.spi.PersistenceCapable);
}
+ //endregion
- // //////////////////////////////////////
- // Dependencies (collection),
- // Add (action), Remove (action)
- // //////////////////////////////////////
+ //region > dependencies (property), add (action), remove (action)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// overrides the natural ordering
public static class DependenciesComparator implements Comparator<ToDoItem> {
@@ -485,13 +475,13 @@ public class ToDoItem implements Comparable<ToDoItem> {
}
}
-
-
@javax.jdo.annotations.Persistent(table="ToDoItemDependencies")
@javax.jdo.annotations.Join(column="dependingId")
@javax.jdo.annotations.Element(column="dependentId")
private SortedSet<ToDoItem> dependencies = new TreeSet<ToDoItem>();
+ @PostsCollectionAddedToEvent
+ @PostsCollectionRemovedFromEvent
@SortedBy(DependenciesComparator.class)
public SortedSet<ToDoItem> getDependencies() {
return dependencies;
@@ -500,13 +490,22 @@ public class ToDoItem implements Comparable<ToDoItem> {
public void setDependencies(final SortedSet<ToDoItem> dependencies) {
this.dependencies = dependencies;
}
-
+ public void addToDependencies(final ToDoItem toDoItem) {
+ getDependencies().add(toDoItem);
+ }
+ public void removeFromDependencies(final ToDoItem toDoItem) {
+ getDependencies().remove(toDoItem);
+ }
+
@PublishedAction
public ToDoItem add(
@TypicalLength(20)
final ToDoItem toDoItem) {
- getDependencies().add(toDoItem);
+ // By wrapping the call, Isis will detect that the collection is modified
+ // and it will automatically send a CollectionAddedToEvent to the Event Bus.
+ // ToDoItemSubscriptions is a demo subscriber to this event
+ wrapperFactory.wrapSkipRules(this).addToDependencies(toDoItem);
return this;
}
public List<ToDoItem> autoComplete0Add(final @MinLength(2) String search) {
@@ -536,7 +535,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
public ToDoItem remove(
@TypicalLength(20)
final ToDoItem toDoItem) {
- getDependencies().remove(toDoItem);
+ // By wrapping the call, Isis will detect that the collection is modified
+ // and it will automatically send a CollectionRemovedFromEvent to the Event Bus.
+ // ToDoItemSubscriptions is a demo subscriber to this event
+ wrapperFactory.wrapSkipRules(this).removeFromDependencies(toDoItem);
return this;
}
// disable action dependent on state of object
@@ -557,11 +559,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
public Collection<ToDoItem> choices0Remove() {
return getDependencies();
}
-
+ //endregion
- // //////////////////////////////////////
- // Clone (action)
- // //////////////////////////////////////
+ //region > clone (action)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// the name of the action in the UI
// nb: method is not called "clone()" is inherited by java.lang.Object and
@@ -597,24 +598,25 @@ public class ToDoItem implements Comparable<ToDoItem> {
final LocalDate dueBy, final BigDecimal cost) {
return toDoItems.validateNewToDo(description, category, subcategory, dueBy, cost);
}
+ //endregion
- // //////////////////////////////////////
- // Delete (action)
- // //////////////////////////////////////
-
+ //region > delete (action)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ @PostsActionInvokedEvent(DeletedEvent.class)
@Bulk
public List<ToDoItem> delete() {
+
container.removeIfNotAlready(this);
+
container.informUser("Deleted " + container.titleOf(this));
+
// invalid to return 'this' (cannot render a deleted object)
return toDoItems.notYetComplete();
}
+ //endregion
-
- // //////////////////////////////////////
- // totalCost
- // //////////////////////////////////////
-
+ //region > totalCost (property)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ActionSemantics(Of.SAFE)
@Bulk(AppliesTo.BULK_ONLY)
public BigDecimal totalCost() {
@@ -625,14 +627,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
}
return total.setScale(2);
}
+ //endregion
-
-
- // //////////////////////////////////////
- // scheduleExplicitly
- // scheduleImplicitly
- // //////////////////////////////////////
-
+ //region > scheduleExplicitly (action), scheduleImplicitly (background action)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ActionSemantics(Of.IDEMPOTENT)
@Prototype
public ToDoItem scheduleExplicitly() {
@@ -650,24 +648,20 @@ public class ToDoItem implements Comparable<ToDoItem> {
completeSlowly(3000);
return this;
}
-
-
-
- // //////////////////////////////////////
- // OpenSourceCodeOnGithub (action)
- // //////////////////////////////////////
-
+ //endregion
+
+ //region > openSourceCodeOnGithub (action)
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Prototype
@ActionSemantics(Of.SAFE)
public URL openSourceCodeOnGithub() throws MalformedURLException {
return new URL("https://github.com/apache/isis/tree/master/example/application/${parentArtifactId}/dom/src/main/java/dom/todo/ToDoItem.java");
}
+ //endregion
+ //region > demoException (action)
- // //////////////////////////////////////
- // Throw exception
- // //////////////////////////////////////
-
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static enum DemoExceptionType {
RecoverableException,
RecoverableExceptionAutoEscalated,
@@ -684,8 +678,8 @@ public class ToDoItem implements Comparable<ToDoItem> {
throw new RecoverableException("Demo throwing " + type.name());
case RecoverableExceptionAutoEscalated:
try {
- // this will trigger an exception (because subcategory cannot be null), causing the xactn to be aborted
- setSubcategory(null);
+ // this will trigger an exception (because category cannot be null), causing the xactn to be aborted
+ setCategory(null);
container.flush();
} catch(Exception e) {
// it's a programming mistake to throw only a recoverable exception here, because of the xactn's state.
@@ -694,11 +688,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
}
}
}
+ //endregion
-
- // //////////////////////////////////////
- // Object-level validation
- // //////////////////////////////////////
+ //region > object-level validation
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* In a real app, if this were actually a rule, then we'd expect that
@@ -711,11 +704,11 @@ public class ToDoItem implements Comparable<ToDoItem> {
}
return null;
}
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //endregion
- // //////////////////////////////////////
- // Programmatic Helpers
- // //////////////////////////////////////
-
+ //region > programmatic helpers
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private static final long ONE_WEEK_IN_MILLIS = 7 * 24 * 60 * 60 * 1000L;
@Programmatic // excluded from the framework's metamodel
@@ -729,11 +722,62 @@ public class ToDoItem implements Comparable<ToDoItem> {
private static boolean isMoreThanOneWeekInPast(final LocalDate dueBy) {
return dueBy.toDateTimeAtStartOfDay().getMillis() < Clock.getTime() - ONE_WEEK_IN_MILLIS;
}
+ //endregion
+
+ //region > events
+
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ public static abstract class AbstractActionInvokedEvent extends ActionInvokedEvent<ToDoItem> {
+ private static final long serialVersionUID = 1L;
+ private final String description;
+ public AbstractActionInvokedEvent(
+ final String description,
+ final ToDoItem source,
+ final Identifier identifier,
+ final Object... arguments) {
+ super(source, identifier, arguments);
+ this.description = description;
+ }
+ public String getEventDescription() {
+ return description;
+ }
+ }
- // //////////////////////////////////////
- // Predicates
- // //////////////////////////////////////
+ public static class CompletedEvent extends AbstractActionInvokedEvent {
+ private static final long serialVersionUID = 1L;
+ public CompletedEvent(
+ final ToDoItem source,
+ final Identifier identifier,
+ final Object... arguments) {
+ super("completed", source, identifier, arguments);
+ }
+ }
+
+ public static class NoLongerCompletedEvent extends AbstractActionInvokedEvent {
+ private static final long serialVersionUID = 1L;
+ public NoLongerCompletedEvent(
+ final ToDoItem source,
+ final Identifier identifier,
+ final Object... arguments) {
+ super("no longer completed", source, identifier, arguments);
+ }
+ }
+
+ public static class DeletedEvent extends AbstractActionInvokedEvent {
+ private static final long serialVersionUID = 1L;
+ public DeletedEvent(
+ final ToDoItem source,
+ final Identifier identifier,
+ final Object... arguments) {
+ super("deleted", source, identifier, arguments);
+ }
+ }
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //endregion
+ //region > predicates
+
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public static class Predicates {
public static Predicate<ToDoItem> thoseOwnedBy(final String currentUser) {
@@ -808,19 +852,15 @@ public class ToDoItem implements Comparable<ToDoItem> {
}
}
-
- // //////////////////////////////////////
- // toString
- // //////////////////////////////////////
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //endregion
+ //region > toString, compareTo
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public String toString() {
return ObjectContracts.toString(this, "description,complete,dueBy,ownedBy");
}
-
- // //////////////////////////////////////
- // compareTo
- // //////////////////////////////////////
/**
* Required so can store in {@link SortedSet sorted set}s (eg {@link ${symbol_pound}getDependencies()}).
@@ -829,11 +869,11 @@ public class ToDoItem implements Comparable<ToDoItem> {
public int compareTo(final ToDoItem other) {
return ObjectContracts.compare(this, other, "complete,dueBy,description");
}
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //endregion
- // //////////////////////////////////////
- // Injected Services
- // //////////////////////////////////////
-
+ //region > injected services
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@javax.inject.Inject
private DomainObjectContainer container;
@@ -844,7 +884,7 @@ public class ToDoItem implements Comparable<ToDoItem> {
@SuppressWarnings("unused")
private ClockService clockService;
- private Bulk.InteractionContext bulkInteractionContext;
+ Bulk.InteractionContext bulkInteractionContext;
public void injectBulkInteractionContext(Bulk.InteractionContext bulkInteractionContext) {
this.bulkInteractionContext = bulkInteractionContext;
}
@@ -856,10 +896,17 @@ public class ToDoItem implements Comparable<ToDoItem> {
@javax.inject.Inject
private BackgroundService backgroundService;
+ @javax.inject.Inject
private Scratchpad scratchpad;
- public void injectScratchpad(Scratchpad scratchpad) {
- this.scratchpad = scratchpad;
+
+ EventBusService eventBusService;
+ public void injectEventBusService(EventBusService eventBusService) {
+ this.eventBusService = eventBusService;
}
+ @javax.inject.Inject
+ private WrapperFactory wrapperFactory;
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.layout.json
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.layout.json b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.layout.json
index 81cdea3..db9e7d2 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.layout.json
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.layout.json
@@ -54,12 +54,12 @@
},
cssClass: { value: "x-highlight" }
},
+ notYetCompleted: {
+ named: { value: "Not done" }
+ },
scheduleExplicitly: {
},
scheduleImplicitly: {
- },
- notYetCompleted: {
- named: { value: "Not done" }
}
},
describedAs: {
@@ -122,6 +122,11 @@
hidden: {
where: STANDALONE_TABLES
}
+ },
+ doc: {
+ hidden: {
+ where: STANDALONE_TABLES
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemContributions.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemContributions.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemContributions.java
index 816b9d8..eb7c606 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemContributions.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemContributions.java
@@ -21,40 +21,27 @@
*/
package dom.todo;
+import dom.todo.ToDoItem.Category;
+import dom.todo.ToDoItem.Subcategory;
+
import java.util.List;
import java.util.concurrent.Callable;
-
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
-
-import dom.todo.ToDoItem.Category;
-import dom.todo.ToDoItem.Subcategory;
-
import org.joda.time.LocalDate;
-
import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.DescribedAs;
-import org.apache.isis.applib.annotation.Disabled;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.NotContributed;
import org.apache.isis.applib.annotation.NotContributed.As;
-import org.apache.isis.applib.annotation.NotInServiceMenu;
-import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.query.QueryDefault;
import org.apache.isis.applib.services.queryresultscache.QueryResultsCache;
public class ToDoItemContributions extends AbstractFactoryAndRepository {
-
- // //////////////////////////////////////
- // priority (contributed property)
+ //region > priority (contributed property)
// //////////////////////////////////////
@DescribedAs("The relative priority of this item compared to others not yet complete (using 'due by' date)")
@@ -107,8 +94,9 @@ public class ToDoItemContributions extends AbstractFactoryAndRepository {
});
- // //////////////////////////////////////
- // Next, Previous (contributed actions)
+ //endregion
+
+ //region > next, previous (contributed actions)
// //////////////////////////////////////
@DescribedAs("The next item not yet completed")
@@ -172,9 +160,9 @@ public class ToDoItemContributions extends AbstractFactoryAndRepository {
}
return priority>=0 && items.size()>=priority? items.get(priority-1): itemElse;
}
+ //endregion
- // //////////////////////////////////////
- // SimilarTo (contributed collection)
+ //region > similarTo (contributed collection)
// //////////////////////////////////////
@NotInServiceMenu
@@ -198,10 +186,9 @@ public class ToDoItemContributions extends AbstractFactoryAndRepository {
}
};
}
+ //endregion
-
- // //////////////////////////////////////
- // UpdateCategory (contributed action)
+ //region > updateCategory (contributed action)
// //////////////////////////////////////
@DescribedAs("Update category and subcategory")
@@ -234,25 +221,25 @@ public class ToDoItemContributions extends AbstractFactoryAndRepository {
final ToDoItem item, final Category category, final Subcategory subcategory) {
return Subcategory.validate(category, subcategory);
}
+ //endregion
-
- // //////////////////////////////////////
- // helpers
+ //region > helpers
// //////////////////////////////////////
protected String currentUserName() {
return getContainer().getUser().getName();
}
+ //endregion
- // //////////////////////////////////////
- // Injected services
+ //region > injected services
// //////////////////////////////////////
@javax.inject.Inject
private ToDoItems toDoItems;
-
+
@javax.inject.Inject
private QueryResultsCache queryResultsCache;
+ //endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
new file mode 100644
index 0000000..1ee6d98
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
@@ -0,0 +1,184 @@
+#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 java.util.EventObject;
+import java.util.List;
+import com.google.common.collect.Lists;
+import com.google.common.eventbus.Subscribe;
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.NonRecoverableException;
+import org.apache.isis.applib.RecoverableException;
+import org.apache.isis.applib.annotation.*;
+import org.apache.isis.applib.services.eventbus.CollectionAddedToEvent;
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
+import org.apache.isis.applib.services.eventbus.EventBusService;
+import org.apache.isis.applib.services.eventbus.PropertyChangedEvent;
+
+public class ToDoItemSubscriptions {
+
+ //region > LOG
+ private final static org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger(ToDoItemSubscriptions.class);
+ //endregion
+
+
+ //region > on(Event)...
+ // //////////////////////////////////////
+ public static enum Behaviour {
+ AcceptEvents,
+ RejectEventsWithRecoverableException,
+ RejectEventsWithNonRecoverableException,
+ ThrowOtherException
+ }
+ private Behaviour behaviour = Behaviour.AcceptEvents;
+
+ /**
+ * To demo/test what occurs if a subscriber that might veto an event.
+ */
+ @Prototype
+ @MemberOrder(name = "Prototyping", sequence = "80")
+ @Named("Set subscriber behaviour")
+ @ActionSemantics(ActionSemantics.Of.IDEMPOTENT)
+ public String subscriberBehaviour(@Named("Behaviour") Behaviour behaviour) {
+ this.behaviour = behaviour;
+ return "Subscriber behaviour set to: " + behaviour;
+ }
+ public Behaviour default0SubscriberBehaviour() {
+ return this.behaviour;
+ }
+ @Programmatic
+ public Behaviour getSubscriberBehaviour() {
+ return behaviour;
+ }
+ private void rejectIfRequired() {
+ if(behaviour == Behaviour.RejectEventsWithRecoverableException) {
+ throw new RecoverableException("Rejecting event (recoverable exception thrown)");
+ }
+ if(behaviour == Behaviour.RejectEventsWithNonRecoverableException) {
+ throw new NonRecoverableException("Rejecting event (recoverable exception thrown)");
+ }
+ if(behaviour == Behaviour.ThrowOtherException) {
+ throw new RuntimeException("Throwing some other exception");
+ }
+ }
+ //endregion
+
+ //region > on(Event)...
+ // //////////////////////////////////////
+
+ @Programmatic
+ @Subscribe
+ public void on(ToDoItem.AbstractActionInvokedEvent ev) {
+ rejectIfRequired();
+ recordEvent(ev);
+ LOG.info(ev.getEventDescription() + ": " + container.titleOf(ev.getSource()));
+ }
+
+
+ @Programmatic
+ @Subscribe
+ public void on(PropertyChangedEvent<?,?> ev) {
+ rejectIfRequired();
+ recordEvent(ev);
+ if(ev.getIdentifier().getMemberName().contains("description")) {
+ String newValue = (String) ev.getNewValue();
+ if(newValue.matches(".*demo veto.*")) {
+ throw new RecoverableException("oh no you don't! " + ev.getNewValue());
+ }
+ }
+ LOG.info(container.titleOf(ev.getSource()) + ", changed " + ev.getIdentifier().getMemberName() + " : " + ev.getOldValue() + " -> " + ev.getNewValue());
+ }
+
+ @Programmatic
+ @Subscribe
+ public void on(CollectionAddedToEvent<?,?> ev) {
+ rejectIfRequired();
+ recordEvent(ev);
+ LOG.info(container.titleOf(ev.getSource()) + ", added to " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
+ }
+
+ @Programmatic
+ @Subscribe
+ public void on(CollectionRemovedFromEvent<?,?> ev) {
+ rejectIfRequired();
+ recordEvent(ev);
+ LOG.info(container.titleOf(ev.getSource()) + ", removed from " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
+ }
+
+ //endregion
+
+ //region > receivedEvents
+ // //////////////////////////////////////
+
+ private final List<java.util.EventObject> receivedEvents = Lists.newLinkedList();
+
+ /**
+ * Used in integration tests.
+ */
+ @Programmatic
+ public List<java.util.EventObject> receivedEvents() {
+ return receivedEvents;
+ }
+ /**
+ * Used in integration tests.
+ */
+ @Programmatic
+ public <T extends java.util.EventObject> T mostRecentlyReceivedEvent(Class<T> expectedType) {
+ if (receivedEvents.isEmpty()) {
+ return null;
+ }
+ final EventObject ev = receivedEvents.get(0);
+ if(!expectedType.isAssignableFrom(ev.getClass())) {
+ return null;
+ }
+ return expectedType.cast(ev);
+ }
+ private void recordEvent(final java.util.EventObject ev) {
+ receivedEvents.add(0, ev);
+ }
+ /**
+ * Used in integration tests.
+ */
+ @Programmatic
+ public void reset() {
+ receivedEvents.clear();
+ subscriberBehaviour(ToDoItemSubscriptions.Behaviour.AcceptEvents);
+ }
+
+ //endregion
+
+
+ //region > injected services
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private DomainObjectContainer container;
+
+ @SuppressWarnings("unused")
+ private EventBusService eventBusService;
+ public final void injectEventBusService(EventBusService eventBusService) {
+ eventBusService.register(this);
+ }
+ //endregion
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
index fdc9ade..aa2adc1 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
@@ -21,36 +21,23 @@
*/
package dom.todo;
-import java.math.BigDecimal;
-import java.util.List;
-
-import com.google.common.base.Predicates;
-
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.ActionSemantics;
+import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.annotation.Bookmarkable;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Optional;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.RegEx;
import org.apache.isis.applib.query.QueryDefault;
import org.apache.isis.applib.services.clock.ClockService;
@Named("ToDos")
public class ToDoItems {
- public ToDoItems() {
- }
-
- // //////////////////////////////////////
- // Identification in the UI
+ //region > identification in the UI
// //////////////////////////////////////
public String getId() {
@@ -60,9 +47,9 @@ public class ToDoItems {
public String iconName() {
return "ToDoItem";
}
+ //endregion
- // //////////////////////////////////////
- // NotYetComplete (action)
+ //region > notYetComplete (action)
// //////////////////////////////////////
@Bookmarkable
@@ -83,10 +70,9 @@ public class ToDoItems {
"findByOwnedByAndCompleteIsFalse",
"ownedBy", currentUserName()));
}
+ //endregion
-
- // //////////////////////////////////////
- // Complete (action)
+ //region > complete (action)
// //////////////////////////////////////
@ActionSemantics(Of.SAFE)
@@ -106,10 +92,9 @@ public class ToDoItems {
"findByOwnedByAndCompleteIsTrue",
"ownedBy", currentUserName()));
}
+ //endregion
-
- // //////////////////////////////////////
- // categorized (action)
+ //region > categorized (action)
// //////////////////////////////////////
@SuppressWarnings("unchecked")
@@ -146,10 +131,9 @@ public class ToDoItems {
final boolean completed) {
return Subcategory.validate(category, subcategory);
}
+ //endregion
-
- // //////////////////////////////////////
- // NewToDo (action)
+ //region > newToDo (action)
// //////////////////////////////////////
@MemberOrder(sequence = "40")
@@ -180,13 +164,11 @@ public class ToDoItems {
final LocalDate dueBy, final BigDecimal cost) {
return Subcategory.validate(category, subcategory);
}
+ //endregion
- // //////////////////////////////////////
- // AllToDos (action)
+ //region > allToDos (action)
// //////////////////////////////////////
- // findByOwnedBy
-
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "50")
public List<ToDoItem> allToDos() {
@@ -199,10 +181,9 @@ public class ToDoItems {
}
return items;
}
+ //endregion
-
- // //////////////////////////////////////
- // AutoComplete
+ //region > autoComplete (programmatic)
// //////////////////////////////////////
@Programmatic // not part of metamodel
@@ -213,9 +194,9 @@ public class ToDoItems {
"ownedBy", currentUserName(),
"description", description));
}
+ //endregion
- // //////////////////////////////////////
- // Programmatic Helpers
+ //region > helpers
// //////////////////////////////////////
@Programmatic // for use by fixtures
@@ -243,18 +224,16 @@ public class ToDoItems {
return container.getUser().getName();
}
-
- // //////////////////////////////////////
- // Injected Services
- // //////////////////////////////////////
+ //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/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_completed.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_completed.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_completed.java
index 235c164..718460f 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_completed.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_completed.java
@@ -24,22 +24,35 @@ import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
+import org.jmock.auto.Mock;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.apache.isis.applib.annotation.Bulk;
+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;
public class ToDoTest_completed {
+ @Rule
+ public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+ @Mock
+ private EventBusService eventBusService;
+
private ToDoItem toDoItem;
@Before
public void setUp() throws Exception {
toDoItem = new ToDoItem();
+ toDoItem.bulkInteractionContext = Bulk.InteractionContext.regularAction(toDoItem);
+ toDoItem.eventBusService = eventBusService;
+
+ context.ignoring(eventBusService);
+
toDoItem.setComplete(false);
-
- Bulk.InteractionContext interactionContext = Bulk.InteractionContext.regularAction(toDoItem);
- toDoItem.injectBulkInteractionContext(interactionContext);
}
@Test
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_notYetCompleted.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_notYetCompleted.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_notYetCompleted.java
index 3a75b3b..bc02446 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_notYetCompleted.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/test/java/dom/todo/ToDoTest_notYetCompleted.java
@@ -19,25 +19,40 @@
*/
package dom.todo;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
+import org.jmock.auto.Mock;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.apache.isis.applib.annotation.Bulk;
+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;
public class ToDoTest_notYetCompleted {
+ @Rule
+ public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+ @Mock
+ private EventBusService eventBusService;
+
private ToDoItem toDoItem;
@Before
public void setUp() throws Exception {
toDoItem = new ToDoItem();
- toDoItem.setComplete(true);
- Bulk.InteractionContext interactionContext = Bulk.InteractionContext.regularAction(toDoItem);
- toDoItem.injectBulkInteractionContext(interactionContext);
+ toDoItem.bulkInteractionContext = Bulk.InteractionContext.regularAction(toDoItem);
+ toDoItem.eventBusService = eventBusService;
+
+ context.ignoring(eventBusService);
+ toDoItem.setComplete(true);
}
@Test
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
deleted file mode 100644
index 818bfab..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
+++ /dev/null
@@ -1,105 +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;
-
-import java.math.BigDecimal;
-
-import dom.todo.ToDoItem;
-import dom.todo.ToDoItem.Category;
-import dom.todo.ToDoItem.Subcategory;
-import dom.todo.ToDoItems;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.clock.Clock;
-import org.apache.isis.applib.fixtures.AbstractFixture;
-import org.apache.isis.objectstore.jdo.applib.service.support.IsisJdoSupport;
-
-public class ToDoItemsFixture extends AbstractFixture {
-
- private final String user;
-
- public ToDoItemsFixture() {
- this(null);
- }
-
- public ToDoItemsFixture(String ownedBy) {
- this.user = ownedBy;
- }
-
- @Override
- public void install() {
-
- final String ownedBy = this.user != null? this.user : getContainer().getUser().getName();
-
- isisJdoSupport.executeUpdate("delete from ${symbol_escape}"ToDoItem${symbol_escape}" where ${symbol_escape}"ownedBy${symbol_escape}" = '" + ownedBy + "'");
-
- installFor(ownedBy);
-
- getContainer().flush();
- }
-
- private void installFor(String user) {
-
- createToDoItemForUser("Buy milk", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("0.75"));
- createToDoItemForUser("Buy bread", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("1.75"));
- createToDoItemForUser("Buy stamps", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("10.00")).setComplete(true);
- createToDoItemForUser("Pick up laundry", Category.Domestic, Subcategory.Chores, user, daysFromToday(6), new BigDecimal("7.50"));
- createToDoItemForUser("Mow lawn", Category.Domestic, Subcategory.Garden, user, daysFromToday(6), null);
- createToDoItemForUser("Vacuum house", Category.Domestic, Subcategory.Housework, user, daysFromToday(3), null);
- createToDoItemForUser("Sharpen knives", Category.Domestic, Subcategory.Chores, user, daysFromToday(14), null);
-
- createToDoItemForUser("Write to penpal", Category.Other, Subcategory.Other, user, null, null);
-
- createToDoItemForUser("Write blog post", Category.Professional, Subcategory.Marketing, user, daysFromToday(7), null).setComplete(true);
- createToDoItemForUser("Organize brown bag", Category.Professional, Subcategory.Consulting, user, daysFromToday(14), null);
- createToDoItemForUser("Submit conference session", Category.Professional, Subcategory.Education, user, daysFromToday(21), null);
- createToDoItemForUser("Stage Isis release", Category.Professional, Subcategory.OpenSource, user, null, null);
-
- getContainer().flush();
- }
-
-
- // //////////////////////////////////////
-
- private ToDoItem createToDoItemForUser(final String description, final Category category, Subcategory subcategory, String user, final LocalDate dueBy, final BigDecimal cost) {
- return toDoItems.newToDo(description, category, subcategory, user, dueBy, cost);
- }
-
- private static LocalDate daysFromToday(final int i) {
- final LocalDate date = new LocalDate(Clock.getTimeAsDateTime());
- return date.plusDays(i);
- }
-
-
- // //////////////////////////////////////
- // Injected services
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private ToDoItems toDoItems;
-
- @javax.inject.Inject
- private IsisJdoSupport isisJdoSupport;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
new file mode 100644
index 0000000..38676d4
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
@@ -0,0 +1,59 @@
+#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.RecreateToDoItemsAndCompleteSeveralForCurrent;
+
+import java.util.List;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Prototype;
+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.
+ */
+@Named("Prototyping") // has the effect of defining a "Prototyping" menu item
+public class ToDoItemsFixturesService extends FixtureScripts {
+
+ public ToDoItemsFixturesService() {
+ super("fixture.todo");
+ }
+
+ /**
+ * 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();
+ }
+
+ @Prototype
+ @MemberOrder(sequence="20")
+ public Object recreateToDoItemsForCurrentAndReturnFirst() {
+ final List<FixtureResult> run = findFixtureScriptFor(RecreateToDoItemsAndCompleteSeveralForCurrent.class).run(null);
+ return run.get(0).getObject();
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java
new file mode 100644
index 0000000..d844083
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/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.simple.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) {
+ execute(new ToDoItemsRecreateAndCompleteSeveral(null), executionContext);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/88b8b8a9/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.java
new file mode 100644
index 0000000..6d627a5
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/scenarios/DeleteToDoItemsFor.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.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