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/10/14 00:50:53 UTC
[3/7] git commit: ISIS-872: recreating todoapp archetype
ISIS-872: recreating todoapp archetype
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/ec94051e
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/ec94051e
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/ec94051e
Branch: refs/heads/prepare/isis-1.7.0
Commit: ec94051e39afdabd2a9e7ea4c2a1cb5b7f5c446d
Parents: 66e02d8
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Oct 13 23:45:32 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Oct 13 23:45:32 2014 +0100
----------------------------------------------------------------------
example/archetype/todoapp/pom.xml | 4 +-
.../META-INF/maven/archetype-metadata.xml | 10 +-
.../resources/archetype-resources/dom/pom.xml | 107 ++++++-----
.../dom/src/main/java/app/ToDoAppDashboard.java | 4 -
.../dom/src/main/java/app/ToDoAppDashboard.png | Bin 0 -> 684 bytes
.../dom/src/main/java/app/ToDoItemAnalysis.java | 10 +-
.../java/app/ToDoItemsByCategoryViewModel.java | 24 ++-
.../java/app/ToDoItemsByDateRangeViewModel.java | 25 +--
.../src/main/java/dom/todo/ToDoItem-done.png | Bin 0 -> 1363 bytes
.../src/main/java/dom/todo/ToDoItem-todo.png | Bin 0 -> 971 bytes
.../dom/src/main/java/dom/todo/ToDoItem.java | 87 +++------
.../dom/src/main/java/dom/todo/ToDoItem.png | Bin 0 -> 971 bytes
.../java/dom/todo/ToDoItemSubscriptions.java | 10 +-
.../dom/src/main/java/dom/todo/ToDoItems.java | 10 --
.../dom/src/main/resources/images/Dashboard.png | Bin 684 -> 0 bytes
.../src/main/resources/images/ToDoItem-done.png | Bin 1363 -> 0 bytes
.../src/main/resources/images/ToDoItem-todo.png | Bin 971 -> 0 bytes
.../dom/src/main/resources/images/ToDoItem.png | Bin 971 -> 0 bytes
.../archetype-resources/fixture/pom.xml | 20 +--
.../fixture/todo/ToDoItemsFixturesService.java | 2 +-
.../integtests/ToDoItemsIntegTestFixture.java | 2 +-
.../fixture/todo/simple/ToDoItemsRecreate.java | 2 +-
.../ToDoItemsRecreateAndCompleteSeveral.java | 2 +-
.../archetype-resources/integtests/pom.xml | 30 ++--
.../java/integration/ToDoSystemInitializer.java | 8 +
.../tests/ToDoItemContributionsIntegTest.java | 12 +-
.../integration/tests/ToDoItemIntegTest.java | 13 +-
.../integration/tests/ToDoItemsIntegTest.java | 36 +++-
.../main/resources/archetype-resources/pom.xml | 32 ++--
.../archetype-resources/webapp/pom.xml | 46 -----
.../ComponentFactoryRegistrarForToDoApp.java | 36 ----
.../main/java/webapp/CustomMementoService.java | 64 +++++++
.../webapp/CustomRepresentationService.java | 35 ++++
.../java/webapp/PageClassListForToDoApp.java | 64 -------
.../src/main/java/webapp/ToDoApplication.java | 22 +--
.../src/main/java/webapp/admin/Admin.java | 176 -------------------
.../java/webapp/admin/AdminContributions.java | 110 ------------
.../webapp/prototyping/DeveloperUtilities.java | 53 ------
.../prototyping/ExternalLinksService.java | 2 +-
.../webapp/scheduler/AbstractIsisQuartzJob.java | 96 ----------
.../BackgroundCommandExecutionQuartzJob.java | 31 ----
.../webapp/scheduler/SchedulerConstants.java | 30 ----
.../webapp/src/main/resources/webapp/realm1.ini | 29 ++-
.../webapp/src/main/resources/webapp/realm2.ini | 66 -------
.../webapp/scheduler/quartz-config.xml | 65 -------
.../webapp/scheduler/quartz.properties | 28 ---
.../WEB-INF/authentication_file.passwords | 28 ---
.../WEB-INF/authentication_file.properties | 28 ---
.../webapp/WEB-INF/authorization_file.allow | 28 ---
.../WEB-INF/authorization_file.properties | 50 ------
.../src/main/webapp/WEB-INF/isis.properties | 49 +-----
.../main/webapp/WEB-INF/persistor.properties | 20 ++-
.../WEB-INF/persistor_datanucleus.properties | 9 +-
.../webapp/src/main/webapp/WEB-INF/shiro.ini | 6 +-
.../webapp/WEB-INF/viewer_wicket.properties | 8 +
.../webapp/src/main/webapp/WEB-INF/web.xml | 21 +--
.../webapp/src/main/webapp/about/index.html | 14 +-
.../projects/basic/archetype.properties | 2 +-
58 files changed, 378 insertions(+), 1288 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/pom.xml b/example/archetype/todoapp/pom.xml
index dd73d4a..cddfb32 100644
--- a/example/archetype/todoapp/pom.xml
+++ b/example/archetype/todoapp/pom.xml
@@ -17,7 +17,7 @@
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>todoapp-archetype</artifactId>
@@ -44,7 +44,7 @@
<parent>
<groupId>org.apache.isis.core</groupId>
<artifactId>isis</artifactId>
- <version>1.6.0</version>
+ <version>1.7.0</version>
<relativePath>../../../core/pom.xml</relativePath>
</parent>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/META-INF/maven/archetype-metadata.xml b/example/archetype/todoapp/src/main/resources/META-INF/maven/archetype-metadata.xml
index a87e7ef..2698586 100644
--- a/example/archetype/todoapp/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/example/archetype/todoapp/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -31,6 +31,7 @@
<fileSet encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
+ <include>**/*.png</include>
<include>**/*.json</include>
</includes>
</fileSet>
@@ -40,12 +41,6 @@
<include>**/*.xml</include>
</includes>
</fileSet>
- <fileSet encoding="UTF-8">
- <directory>src/main/resources</directory>
- <includes>
- <include>**/*.png</include>
- </includes>
- </fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
@@ -118,7 +113,6 @@
<directory>src/main/resources</directory>
<includes>
<include>**/*.html</include>
- <include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</fileSet>
@@ -132,8 +126,6 @@
<fileSet encoding="UTF-8">
<directory>src/main/webapp</directory>
<includes>
- <include>**/*.passwords</include>
- <include>**/*.allow</include>
<include>**/*.png</include>
<include>**/*.js</include>
<include>**/*.ini</include>
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/pom.xml b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/pom.xml
index 4b60832..271e198 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/pom.xml
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/pom.xml
@@ -17,18 +17,18 @@
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>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>${groupId}</groupId>
- <artifactId>${rootArtifactId}</artifactId>
+ <parent>
+ <groupId>${groupId}</groupId>
+ <artifactId>${rootArtifactId}</artifactId>
<version>${version}</version>
- </parent>
+ </parent>
- <artifactId>${artifactId}</artifactId>
- <name>ToDo App DOM</name>
+ <artifactId>${artifactId}</artifactId>
+ <name>ToDo App DOM</name>
- <build>
+ <build>
<resources>
<resource>
<directory>src/main/resources</directory>
@@ -43,13 +43,13 @@
</excludes>
</resource>
</resources>
- <plugins>
+ <plugins>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>${datanucleus-maven-plugin.version}</version>
<configuration>
- <fork>false</fork>
+ <fork>false</fork>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
<props>${basedir}/datanucleus.properties</props>
@@ -63,58 +63,49 @@
</execution>
</executions>
</plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-maven-plugin</artifactId>
- <versionRange>[3.2.0-release,)</versionRange>
- <goals>
- <goal>enhance</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.datanucleus</groupId>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <versionRange>[3.2.0-release,)</versionRange>
+ <goals>
+ <goal>enhance</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings-applib</artifactId>
- </dependency>
+ <dependencies>
<dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils-applib</artifactId>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-applib</artifactId>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
+ <artifactId>isis-core-unittestsupport</artifactId>
<scope>test</scope>
- </dependency>
+ </dependency>
<!-- Bytecode libraries (for mocking) -->
<dependency>
@@ -122,6 +113,6 @@
<artifactId>objenesis</artifactId>
<scope>test</scope>
</dependency>
- </dependencies>
-
+ </dependencies>
+
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
index c63b566..641c06d 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.java
@@ -35,10 +35,6 @@ public class ToDoAppDashboard extends AbstractViewModel {
public String title() {
return "Dashboard";
}
-
- public String iconName() {
- return "Dashboard";
- }
//endregion
//region > ViewModel contract
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.png
new file mode 100644
index 0000000..c22ab2b
Binary files /dev/null and b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoAppDashboard.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
index 9609164..5f7eeef 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemAnalysis.java
@@ -61,10 +61,7 @@ public class ToDoItemAnalysis {
return new Function<Category, ToDoItemsByCategoryViewModel>(){
@Override
public ToDoItemsByCategoryViewModel apply(final Category category) {
- final ToDoItemsByCategoryViewModel byCategory =
- container.newViewModelInstance(ToDoItemsByCategoryViewModel.class, category.name());
- byCategory.setCategory(category);
- return byCategory;
+ return new ToDoItemsByCategoryViewModel(category);
}
};
}
@@ -94,10 +91,7 @@ public class ToDoItemAnalysis {
return new Function<DateRange, ToDoItemsByDateRangeViewModel>(){
@Override
public ToDoItemsByDateRangeViewModel apply(final DateRange dateRange) {
- final ToDoItemsByDateRangeViewModel byDateRange =
- container.newViewModelInstance(ToDoItemsByDateRangeViewModel.class, dateRange.name());
- byDateRange.setDateRange(dateRange);
- return byDateRange;
+ return new ToDoItemsByDateRangeViewModel(dateRange);
}
};
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
index f92cbac..6eddbc8 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java
@@ -32,35 +32,29 @@ 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 org.apache.isis.applib.AbstractViewModel;
+import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.Render.Type;
import org.apache.isis.applib.util.ObjectContracts;
@Named("By Category")
@Bookmarkable
+@ViewModel
public class ToDoItemsByCategoryViewModel
- extends AbstractViewModel
implements Comparable<ToDoItemsByCategoryViewModel> {
- //region > viewModel implementation
- @Override
- public String viewModelMemento() {
- return getCategory().name();
+ //region > constructors
+ public ToDoItemsByCategoryViewModel() {
}
-
- @Override
- public void viewModelInit(String memento) {
- setCategory(Category.valueOf(memento));
+ public ToDoItemsByCategoryViewModel(Category category) {
+ setCategory(category);
}
//endregion
+
//region > category (property)
private Category category;
- /**
- * Used as {@link ${symbol_pound}viewModelMemento() memento}
- */
@Title
public Category getCategory() {
return category;
@@ -132,7 +126,7 @@ public class ToDoItemsByCategoryViewModel
@Named("Delete")
public ToDoItemsByCategoryViewModel deleteCompleted() {
for (ToDoItem item : getItemsComplete()) {
- removeIfNotAlready(item);
+ container.removeIfNotAlready(item);
}
// force reload of page
return this;
@@ -149,6 +143,8 @@ public class ToDoItemsByCategoryViewModel
//region > injected services
@javax.inject.Inject
+ private DomainObjectContainer container;
+ @javax.inject.Inject
private ToDoItems toDoItems;
//endregion
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
index 5d2b118..3523f8a 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java
@@ -36,39 +36,28 @@ import dom.todo.ToDoItems;
import org.joda.time.DateTime;
import org.apache.isis.applib.AbstractViewModel;
-import org.apache.isis.applib.annotation.Bookmarkable;
-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.services.clock.ClockService;
import org.apache.isis.applib.util.ObjectContracts;
@Named("By Date Range")
@Bookmarkable
-public class ToDoItemsByDateRangeViewModel
- extends AbstractViewModel
+@ViewModel
+public class ToDoItemsByDateRangeViewModel
implements Comparable<ToDoItemsByDateRangeViewModel> {
- //region > viewModel implementation
- @Override
- public String viewModelMemento() {
- return getDateRange().name();
+ //region > constructors
+ public ToDoItemsByDateRangeViewModel() {
}
-
- @Override
- public void viewModelInit(String memento) {
- setDateRange(DateRange.valueOf(memento));
+ public ToDoItemsByDateRangeViewModel(DateRange dateRange) {
+ setDateRange(dateRange);
}
-
//endregion
//region > dateRange (property)
private DateRange dateRange;
- /**
- * Used as {@link ${symbol_pound}viewModelMemento() memento}
- */
@Title
public DateRange getDateRange() {
return dateRange;
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-done.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-done.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-done.png
new file mode 100644
index 0000000..b0fc6e8
Binary files /dev/null and b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-done.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-todo.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-todo.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-todo.png
new file mode 100644
index 0000000..99a9fed
Binary files /dev/null and b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem-todo.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
index 4ddc10d..c32b3a8 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
@@ -40,14 +40,11 @@ import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
import org.apache.isis.applib.annotation.Bulk.AppliesTo;
import org.apache.isis.applib.annotation.Bulk.InteractionContext.InvokedAs;
-import org.apache.isis.applib.annotation.Command.ExecuteIn;
-import org.apache.isis.applib.annotation.Optional;
-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.security.UserMemento;
import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
import org.apache.isis.applib.services.eventbus.EventBusService;
import org.apache.isis.applib.services.scratchpad.Scratchpad;
+import org.apache.isis.applib.services.wrapper.HiddenException;
import org.apache.isis.applib.services.wrapper.WrapperFactory;
import org.apache.isis.applib.util.ObjectContracts;
import org.apache.isis.applib.util.TitleBuffer;
@@ -98,8 +95,6 @@ import org.apache.isis.applib.value.Clob;
+ "description.indexOf(:description) >= 0")
})
@ObjectType("TODO")
-@Audited
-@PublishedObject(ToDoItemChangedPayloadFactory.class)
@AutoComplete(repository=ToDoItems.class, action="autoComplete") // default unless overridden by autoCompleteNXxx() method
//@Bounded - if there were a small number of instances only (overrides autoComplete functionality)
@Bookmarkable
@@ -120,15 +115,20 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
if (isComplete()) {
buf.append("- Completed!");
} else {
- if (getDueBy() != null) {
- buf.append(" due by", getDueBy());
+ try {
+ final LocalDate dueBy = wrapperFactory.wrap(this).getDueBy();
+ if (dueBy != null) {
+ buf.append(" due by", dueBy);
+ }
+ } catch(HiddenException ex) {
+ // ignore
}
}
return buf.toString();
}
public String iconName() {
- return "ToDoItem-" + (!isComplete() ? "todo" : "done");
+ return !isComplete() ? "todo" : "done";
}
//endregion
@@ -162,6 +162,11 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
return dueBy;
}
+ public boolean hideDueBy() {
+ final UserMemento user = container.getUser();
+ return user.hasRole("realm1:noDueBy_role");
+ }
+
public void setDueBy(final LocalDate dueBy) {
this.dueBy = dueBy;
}
@@ -288,8 +293,6 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
}
@ActionInteraction(CompletedEvent.class)
- @Command
- @PublishedAction
@Bulk
public ToDoItem completed() {
setComplete(true);
@@ -316,8 +319,6 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
}
@ActionInteraction(NoLongerCompletedEvent.class)
- @Command
- @PublishedAction
@Bulk
public ToDoItem notYetCompleted() {
setComplete(false);
@@ -489,7 +490,6 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
getDependencies().remove(toDoItem);
}
- @PublishedAction
public ToDoItem add(
@TypicalLength(20)
final ToDoItem toDoItem) {
@@ -617,29 +617,11 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
}
//endregion
- //region > scheduleExplicitly (action), scheduleImplicitly (background action)
- @ActionSemantics(Of.IDEMPOTENT)
- @Prototype
- public ToDoItem scheduleExplicitly() {
- backgroundService.execute(this).completeSlowly(2000);
- container.informUser("Task '" + getDescription() + "' scheduled for completion");
- return this;
- }
-
- @ActionSemantics(Of.IDEMPOTENT)
- @Command(executeIn=ExecuteIn.BACKGROUND)
- @Prototype
- public ToDoItem scheduleImplicitly() {
- completeSlowly(3000);
- return this;
- }
- //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/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java");
+ return new URL("https://github.com/apache/isis/tree/master/example/application/${parentArtifactId}/dom/src/main/java/dom/todo/ToDoItem.java");
}
//endregion
@@ -676,34 +658,34 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
//region > lifecycle callbacks
public void created() {
- LOG.debug("lifecycle callback: created: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: created: " + this.toString());
}
public void loaded() {
- LOG.debug("lifecycle callback: loaded: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: loaded: " + this.toString());
}
public void persisting() {
- LOG.debug("lifecycle callback: persisting: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: persisting: " + this.toString());
}
public void persisted() {
- LOG.debug("lifecycle callback: persisted: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: persisted: " + this.toString());
}
public void updating() {
- LOG.debug("lifecycle callback: updating: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: updating: " + this.toString());
}
public void updated() {
- LOG.debug("lifecycle callback: updated: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: updated: " + this.toString());
}
public void removing() {
- LOG.debug("lifecycle callback: removing: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: removing: " + this.toString());
}
public void removed() {
- LOG.debug("lifecycle callback: removed: " + container.titleOf(this));
+ LOG.debug("lifecycle callback: removed: " + this.toString());
}
//endregion
@@ -795,15 +777,15 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
};
}
- public static Predicate<ToDoItem> thoseCompleted(
- final boolean completed) {
+ public static Predicate<ToDoItem> thoseCompleted(
+ final boolean completed) {
return new Predicate<ToDoItem>() {
@Override
public boolean apply(final ToDoItem t) {
return Objects.equal(t.isComplete(), completed);
}
};
- }
+ }
public static Predicate<ToDoItem> thoseWithSimilarDescription(final String description) {
return new Predicate<ToDoItem>() {
@@ -862,7 +844,6 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
//endregion
//region > toString, compareTo
- // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public String toString() {
return ObjectContracts.toString(this, "description,complete,dueBy,ownedBy");
@@ -875,33 +856,20 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
public int compareTo(final ToDoItem other) {
return ObjectContracts.compare(this, other, "complete,dueBy,description");
}
- // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//endregion
//region > injected services
- // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@javax.inject.Inject
private DomainObjectContainer container;
@javax.inject.Inject
private ToDoItems toDoItems;
- @javax.inject.Inject
- @SuppressWarnings("unused")
- private ClockService clockService;
-
Bulk.InteractionContext bulkInteractionContext;
public void injectBulkInteractionContext(Bulk.InteractionContext bulkInteractionContext) {
this.bulkInteractionContext = bulkInteractionContext;
}
- @SuppressWarnings("unused")
- @javax.inject.Inject
- private CommandContext commandContext;
-
- @javax.inject.Inject
- private BackgroundService backgroundService;
-
@javax.inject.Inject
private Scratchpad scratchpad;
@@ -913,7 +881,6 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
@javax.inject.Inject
private WrapperFactory wrapperFactory;
- // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.png
new file mode 100644
index 0000000..99a9fed
Binary files /dev/null and b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.png differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
index dab085e..1230090 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
@@ -118,7 +118,7 @@ public class ToDoItemSubscriptions {
case EXECUTING:
break;
case EXECUTED:
- LOG.info("Received ToDoItem.CompletedEvent for : " + container.titleOf(ev.getSource()));
+ LOG.info("Received ToDoItem.CompletedEvent for : " + ev.getSource().toString());
break;
}
}
@@ -154,7 +154,7 @@ public class ToDoItemSubscriptions {
case EXECUTING:
break;
case EXECUTED:
- LOG.info("Received ActionInteractionEvent, " + container.titleOf(ev.getSource()) + ", invoked " + ev.getIdentifier().getMemberName());
+ LOG.info("Received ActionInteractionEvent, " + ev.getSource().toString() + ", invoked " + ev.getIdentifier().getMemberName());
onExecutedVetoIfRequired();
break;
}
@@ -186,7 +186,7 @@ public class ToDoItemSubscriptions {
case EXECUTING:
break;
case EXECUTED:
- LOG.info("Received PropertyInteractionEvent, " + container.titleOf(ev.getSource()) + ", changed " + ev.getIdentifier().getMemberName() + " : " + ev.getOldValue() + " -> " + ev.getNewValue());
+ LOG.info("Received PropertyInteractionEvent, " + ev.getSource().toString() + ", changed " + ev.getIdentifier().getMemberName() + " : " + ev.getOldValue() + " -> " + ev.getNewValue());
onExecutedVetoIfRequired();
if(ev.getIdentifier().getMemberName().contains("description")) {
@@ -236,9 +236,9 @@ public class ToDoItemSubscriptions {
break;
case EXECUTED:
if(ev.getOf() == CollectionInteractionEvent.Of.ADD_TO) {
- LOG.info("Received CollectionInteractionEvent, " + container.titleOf(ev.getSource()) + ", added to " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
+ LOG.info("Received CollectionInteractionEvent, " + ev.getSource().toString() + ", added to " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
} else {
- LOG.info("Received CollectionInteractionEvent, " + container.titleOf(ev.getSource()) + ", removed from " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
+ LOG.info("Received CollectionInteractionEvent, " + ev.getSource().toString() + ", removed from " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
}
onExecutedVetoIfRequired();
break;
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
index bee7631..07d3c66 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
@@ -38,16 +38,6 @@ import org.apache.isis.applib.services.clock.ClockService;
@DomainService(menuOrder = "10", repositoryFor = ToDoItem.class)
public class ToDoItems {
- //region > identification in the UI
- public String getId() {
- return "toDoItems";
- }
-
- public String iconName() {
- return "ToDoItem";
- }
- //endregion
-
//region > notYetComplete (action)
@Bookmarkable
@ActionSemantics(Of.SAFE)
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/Dashboard.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/Dashboard.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/Dashboard.png
deleted file mode 100644
index c22ab2b..0000000
Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/Dashboard.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-done.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-done.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-done.png
deleted file mode 100644
index b0fc6e8..0000000
Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-done.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-todo.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-todo.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-todo.png
deleted file mode 100644
index 99a9fed..0000000
Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem-todo.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem.png
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem.png b/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem.png
deleted file mode 100644
index 99a9fed..0000000
Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/dom/src/main/resources/images/ToDoItem.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml
index d75a856..478ac42 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/pom.xml
@@ -17,22 +17,22 @@
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>
+ <modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>${groupId}</groupId>
+ <groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}</artifactId>
<version>${version}</version>
</parent>
- <artifactId>${artifactId}</artifactId>
- <name>ToDo App Fixtures</name>
+ <artifactId>${artifactId}</artifactId>
+ <name>ToDo App Fixtures</name>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>${rootArtifactId}-dom</artifactId>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${rootArtifactId}-dom</artifactId>
+ </dependency>
+ </dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
index da1c7c3..dcaa956 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
@@ -43,7 +43,7 @@ public class ToDoItemsFixturesService extends FixtureScripts {
super("fixture.todo");
}
- //@Override // compatibility with core 1.5.0
+ @Override
public FixtureScript default0RunFixtureScript() {
return findFixtureScriptFor(RecreateToDoItemsAndCompleteSeveralForCurrent.class);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java
index d844083..3795f85 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/integtests/ToDoItemsIntegTestFixture.java
@@ -37,7 +37,7 @@ public class ToDoItemsIntegTestFixture extends FixtureScript {
@Override
protected void execute(ExecutionContext executionContext) {
- execute(new ToDoItemsRecreateAndCompleteSeveral(null), executionContext);
+ executeChild(new ToDoItemsRecreateAndCompleteSeveral(null), executionContext);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java
index 8f8077e..d6e1158 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreate.java
@@ -51,7 +51,7 @@ public class ToDoItemsRecreate extends FixtureScript {
final String ownedBy = Util.coalesce(user, executionContext.getParameters(), getContainer().getUser().getName());
// prereqs
- execute(new ToDoItemsDelete(null), executionContext);
+ executeChild(new ToDoItemsDelete(null), executionContext);
// this fixture
createToDoItem("Buy milk", Category.Domestic, Subcategory.Shopping, ownedBy, nowPlusDays(0), new BigDecimal("0.75"), executionContext);
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java
index b04bfd5..c7397bb 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/simple/ToDoItemsRecreateAndCompleteSeveral.java
@@ -48,7 +48,7 @@ public class ToDoItemsRecreateAndCompleteSeveral extends FixtureScript {
final String ownedBy = Util.coalesce(user, executionContext.getParameters(), getContainer().getUser().getName());
// prereqs
- execute(new ToDoItemsRecreate(null), executionContext);
+ executeChild(new ToDoItemsRecreate(null), executionContext);
// this fixture
complete(ownedBy, "Buy stamps", executionContext);
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/pom.xml b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/pom.xml
index ba865c1..1396994 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/pom.xml
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/pom.xml
@@ -17,16 +17,16 @@
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>
+ <modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>${groupId}</groupId>
+ <groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}</artifactId>
<version>${version}</version>
</parent>
- <artifactId>${artifactId}</artifactId>
- <name>ToDo App Integration Tests</name>
+ <artifactId>${artifactId}</artifactId>
+ <name>ToDo App Integration Tests</name>
<build>
<testResources>
@@ -42,15 +42,15 @@
<exclude>**/*.java</exclude>
</excludes>
</testResource>
- </testResources>
+ </testResources>
</build>
- <dependencies>
-
- <!-- other modules in this project -->
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>${rootArtifactId}-fixture</artifactId>
- </dependency>
+ <dependencies>
+
+ <!-- other modules in this project -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${rootArtifactId}-fixture</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.isis.core</groupId>
@@ -65,7 +65,7 @@
<groupId>org.apache.isis.core</groupId>
<artifactId>isis-core-specsupport</artifactId>
</dependency>
-
+
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
@@ -105,7 +105,7 @@
<version>0.0.4</version>
</dependency>
-->
- </dependencies>
+ </dependencies>
<!--
uncomment for enhanced cucumber-jvm reporting
@@ -117,6 +117,6 @@
</repository>
</repositories>
-->
-
+
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java
index 70adfb8..000b712 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java
@@ -21,6 +21,7 @@ package integration;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.integtestsupport.IsisSystemForTest;
+import org.apache.isis.core.runtime.persistence.PersistenceConstants;
import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
@@ -66,6 +67,13 @@ public class ToDoSystemInitializer {
private static IsisConfiguration testConfiguration() {
final IsisConfigurationForJdoIntegTests testConfiguration = new IsisConfigurationForJdoIntegTests();
testConfiguration.addRegisterEntitiesPackagePrefix("dom");
+
+ // enable stricter checking
+ //
+ // the consequence of this is having to call 'nextTransaction()' between most of the given/when/then's
+ // because the command2 only ever refers to the event of the originating action.
+ testConfiguration.put(PersistenceConstants.ENFORCE_SAFE_SEMANTICS, "true");
+
return testConfiguration;
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemContributionsIntegTest.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemContributionsIntegTest.java b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemContributionsIntegTest.java
index c1b59ed..3500adb 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemContributionsIntegTest.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemContributionsIntegTest.java
@@ -30,6 +30,7 @@ import java.util.List;
import javax.inject.Inject;
import org.junit.Before;
import org.junit.Test;
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
@@ -37,12 +38,17 @@ import static org.junit.Assert.assertThat;
public abstract class ToDoItemContributionsIntegTest extends AbstractToDoIntegTest {
+ ToDoItemsIntegTestFixture fixture;
+
@Before
public void setUpData() throws Exception {
- scenarioExecution().install(new ToDoItemsIntegTestFixture().withTracing());
+ // executing the fixtures directly allows us to look up the results later.
+ fixtureScripts.runFixtureScript(fixture = new ToDoItemsIntegTestFixture(), null);
}
@Inject
+ FixtureScripts fixtureScripts;
+ @Inject
ToDoItems toDoItems;
@Inject
ToDoItemContributions toDoItemContributions;
@@ -52,8 +58,8 @@ public abstract class ToDoItemContributionsIntegTest extends AbstractToDoIntegTe
@Before
public void setUp() throws Exception {
- final List<ToDoItem> all = toDoItems.notYetComplete();
- toDoItem = wrap(all.get(0));
+
+ toDoItem = wrap(fixture.lookup("integ-test/complete-current/create-current/item-2", ToDoItem.class));
toDoItemContributionsWrapped = wrap(toDoItemContributions);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
index 447070e..ccfd19c 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
@@ -45,6 +45,7 @@ import org.junit.Test;
import org.apache.isis.applib.NonRecoverableException;
import org.apache.isis.applib.RecoverableException;
import org.apache.isis.applib.clock.Clock;
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
import org.apache.isis.applib.services.clock.ClockService;
import org.apache.isis.applib.services.eventbus.*;
import org.apache.isis.applib.value.Blob;
@@ -55,12 +56,17 @@ import static org.junit.Assert.assertTrue;
public class ToDoItemIntegTest extends AbstractToDoIntegTest {
+ ToDoItemsIntegTestFixture fixture;
+
@Before
public void setUpData() throws Exception {
- scenarioExecution().install(new ToDoItemsIntegTestFixture());
+ // executing the fixtures directly allows us to look up the results later.
+ fixtureScripts.runFixtureScript(fixture = new ToDoItemsIntegTestFixture(), null);
}
@Inject
+ FixtureScripts fixtureScripts;
+ @Inject
ToDoItems toDoItems;
@Inject
ToDoItemSubscriptions toDoItemSubscriptions;
@@ -85,9 +91,14 @@ public class ToDoItemIntegTest extends AbstractToDoIntegTest {
@Before
public void setUp() throws Exception {
+ super.setUp();
final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
toDoItem = wrap(all.get(0));
+ toDoItem = wrap(fixture.lookup("integ-test/complete-current/create-current/item-2", ToDoItem.class));
+
+ nextTransaction();
+
dueBy = toDoItem.getDueBy();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemsIntegTest.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemsIntegTest.java b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemsIntegTest.java
index c95e9c0..7f8d2a6 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemsIntegTest.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoItemsIntegTest.java
@@ -31,19 +31,26 @@ import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
+
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class ToDoItemsIntegTest extends AbstractToDoIntegTest {
@Inject
+ FixtureScripts fixtureScripts;
+ @Inject
ToDoItems toDoItems;
public static class Finders extends ToDoItemsIntegTest {
+ ToDoItemsIntegTestFixture fixture;
+
@Before
public void setUpData() throws Exception {
- scenarioExecution().install(new ToDoItemsIntegTestFixture());
+ // executing the fixtures directly allows us to look up the results later.
+ fixtureScripts.runFixtureScript(fixture = new ToDoItemsIntegTestFixture(), null);
}
private int notYetCompletedSize;
@@ -51,6 +58,8 @@ public class ToDoItemsIntegTest extends AbstractToDoIntegTest {
@Before
public void setUp() throws Exception {
+
+ // could use fixture${symbol_pound}lookup(...), but can also just search directly.
final List<ToDoItem> notYetCompleteItems = wrap(toDoItems).notYetComplete();
final List<ToDoItem> completedItems = wrap(toDoItems).complete();
@@ -64,22 +73,26 @@ public class ToDoItemsIntegTest extends AbstractToDoIntegTest {
public void complete_and_notYetComplete() throws Exception {
// given
- List<ToDoItem> notYetCompleteItems = wrap(service(ToDoItems.class)).notYetComplete();
+ List<ToDoItem> notYetCompleteItems = wrap(toDoItems).notYetComplete();
final ToDoItem toDoItem = wrap(notYetCompleteItems.get(0));
+ nextTransaction();
// when
toDoItem.completed();
+ nextTransaction();
// then
- assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(notYetCompletedSize-1));
- assertThat(wrap(service(ToDoItems.class)).complete().size(), is(completedSize+1));
+ assertThat(wrap(toDoItems).notYetComplete().size(), is(notYetCompletedSize-1));
+ assertThat(wrap(toDoItems).complete().size(), is(completedSize+1));
+ nextTransaction();
// and when
toDoItem.notYetCompleted();
+ nextTransaction();
// then
- assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(notYetCompletedSize));
- assertThat(wrap(service(ToDoItems.class)).complete().size(), is(completedSize));
+ assertThat(wrap(toDoItems).notYetComplete().size(), is(notYetCompletedSize));
+ assertThat(wrap(toDoItems).complete().size(), is(completedSize));
}
}
@@ -95,20 +108,27 @@ public class ToDoItemsIntegTest extends AbstractToDoIntegTest {
// given
int size = wrap(toDoItems).notYetComplete().size();
+ nextTransaction();
// when
final ToDoItem newToDo = toDoItems.newToDo("new todo", ToDoItem.Category.Professional, ToDoItem.Subcategory.OpenSource, null, null);
+ nextTransaction();
// then
assertThat(newToDo.getDescription(), is("new todo"));
assertThat(newToDo.getCategory(), is(ToDoItem.Category.Professional));
- assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(size+1));
+ assertThat(wrap(toDoItems).notYetComplete().size(), is(size+1));
+ assertThat(container().isPersistent(newToDo), is(true));
+ assertThat(container().isPersistent(wrap(newToDo)), is(true));
+
+ nextTransaction();
// when
newToDo.delete();
+ nextTransaction();
// then
- assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(size));
+ assertThat(wrap(toDoItems).notYetComplete().size(), is(size));
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/pom.xml b/example/archetype/todoapp/src/main/resources/archetype-resources/pom.xml
index 8b6ee60..d15570e 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/pom.xml
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/pom.xml
@@ -32,15 +32,13 @@
</prerequisites>
<properties>
- <isis.version>1.6.0</isis.version>
- <isis-viewer-wicket.version>1.6.0</isis-viewer-wicket.version>
+ <isis.version>1.7.0</isis.version>
+ <isis-viewer-wicket.version>1.7.0</isis-viewer-wicket.version>
<!-- must be consistent with the versions defined by the JDO Objectstore -->
<datanucleus-accessplatform-jdo-rdbms.version>3.3.6</datanucleus-accessplatform-jdo-rdbms.version>
<datanucleus-maven-plugin.version>3.3.2</datanucleus-maven-plugin.version>
-
- <quartz-scheduler.version>2.2.1</quartz-scheduler.version>
-
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
@@ -87,9 +85,14 @@
<version>2.16</version>
<configuration>
<includes>
- <include>**/*.java</include>
+ <include>**/*Test.java</include>
+ <include>**/*Test$*.java</include>
+ <include>**/*Test_*.java</include>
+ <include>**/*Spec*.java</include>
</includes>
<excludes>
+ <exclude>**/Test*.java</exclude>
+ <exclude>**/*ForTesting.java</exclude>
<exclude>**/*Abstract*.java</exclude>
</excludes>
<useFile>true</useFile>
@@ -105,6 +108,7 @@
<configuration>
<includes>
<include>**/*Test.java</include>
+ <include>**/*Test$*.java</include>
<include>**/*Test_*.java</include>
<include>**/*Spec*.java</include>
</includes>
@@ -198,7 +202,8 @@
<exclude>**/*.project</exclude>
<exclude>**/.classpath</exclude>
<exclude>**/.settings/**</exclude>
- <exclude>**/*.launch</exclude>
+ <exclude>**/ide/eclipse/launch/**</exclude>
+ <exclude>**/ide/intellij/launch/**</exclude>
<exclude>src/site/resources/ide/eclipse/**</exclude>
<exclude>**/rebel.xml</exclude>
@@ -329,19 +334,6 @@
</dependency>
- <!-- quartz scheduler integration -->
-
- <dependency>
- <groupId>org.quartz-scheduler</groupId>
- <artifactId>quartz</artifactId>
- <version>${quartz-scheduler.version}</version>
- </dependency>
- <dependency>
- <groupId>org.quartz-scheduler</groupId>
- <artifactId>quartz-jobs</artifactId>
- <version>${quartz-scheduler.version}</version>
- </dependency>
-
</dependencies>
</dependencyManagement>
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/pom.xml b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/pom.xml
index 9fafe06..c4bdfc4 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/pom.xml
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/pom.xml
@@ -184,45 +184,10 @@
</dependency>
<dependency>
<groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-profilestore</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
<artifactId>isis-core-security</artifactId>
</dependency>
- <!-- isis modules -->
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-background</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-devutils-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-audit-jdo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-command-jdo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-publishing-jdo</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-publishingeventserializer-ro</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.module</groupId>
- <artifactId>isis-module-settings-impl-jdo</artifactId>
- </dependency>
-
-
<!-- to run using WebServer (optional) -->
<dependency>
<groupId>org.apache.isis.core</groupId>
@@ -285,17 +250,6 @@
</exclusions>
</dependency>
-
- <!-- quartz scheduler integration -->
- <dependency>
- <groupId>org.quartz-scheduler</groupId>
- <artifactId>quartz</artifactId>
- </dependency>
- <dependency>
- <groupId>org.quartz-scheduler</groupId>
- <artifactId>quartz-jobs</artifactId>
- </dependency>
-
</dependencies>
<profiles>
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ComponentFactoryRegistrarForToDoApp.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ComponentFactoryRegistrarForToDoApp.java b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ComponentFactoryRegistrarForToDoApp.java
deleted file mode 100644
index 7f7f0cf..0000000
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ComponentFactoryRegistrarForToDoApp.java
+++ /dev/null
@@ -1,36 +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 webapp;
-
-import com.google.inject.Singleton;
-
-import org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistrarDefault;
-
-@Singleton
-public class ComponentFactoryRegistrarForToDoApp extends ComponentFactoryRegistrarDefault {
-
- @Override
- public void addComponentFactories(ComponentFactoryList componentFactories) {
- super.addComponentFactories(componentFactories);
- // currently no replacements
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomMementoService.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomMementoService.java b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomMementoService.java
new file mode 100644
index 0000000..51f3db9
--- /dev/null
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomMementoService.java
@@ -0,0 +1,64 @@
+#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 webapp;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.core.runtime.services.memento.MementoServiceDefault;
+
+
+/**
+ * Demonstrates how to register a replacement for one of the default framework-provided services.
+ *
+ * <p>
+ * In <code>isis.properties</code>, is registered using:
+ * </p>
+ *
+ * <pre>
+ * isis.services = ${symbol_escape}
+ * ...,
+ * 1:webapp.MyMementoService,
+ * ...,
+ * </pre>
+ * <p>
+ * that is, with a menuOrder of 1.
+ * </p>
+ */
+public class CustomMementoService extends MementoServiceDefault {
+
+ @Programmatic
+ @Override
+ public Memento create() {
+ return super.create();
+ }
+
+ @Programmatic
+ @Override
+ public Memento parse(String str) {
+ return super.parse(str);
+ }
+
+ @Programmatic
+ @Override
+ public boolean canSet(Object input) {
+ return super.canSet(input);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomRepresentationService.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomRepresentationService.java b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomRepresentationService.java
new file mode 100644
index 0000000..08c2339
--- /dev/null
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/CustomRepresentationService.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 webapp;
+
+import javax.ws.rs.core.Response;
+import org.apache.isis.viewer.restfulobjects.rendering.service.RepresentationServiceForRestfulObjects;
+
+public class CustomRepresentationService extends RepresentationServiceForRestfulObjects {
+
+ @Override
+ protected Response buildResponse(Response.ResponseBuilder responseBuilder) {
+ responseBuilder.header("X-ResponseGeneratedBy", getClass().getCanonicalName());
+ return super.buildResponse(responseBuilder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/PageClassListForToDoApp.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/PageClassListForToDoApp.java b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/PageClassListForToDoApp.java
deleted file mode 100644
index 442f055..0000000
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/PageClassListForToDoApp.java
+++ /dev/null
@@ -1,64 +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 webapp;
-
-import org.apache.wicket.Page;
-
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassListDefault;
-
-public class PageClassListForToDoApp extends PageClassListDefault {
-
- @Override
- protected Class<? extends Page> getSignInPageClass() {
- // no override
- return super.getSignInPageClass();
- }
-
- @Override
- protected Class<? extends Page> getHomePageClass() {
- // no override
- return super.getHomePageClass();
- }
-
- @Override
- protected Class<? extends Page> getAboutPageClass() {
- // no override
- return super.getAboutPageClass();
- }
-
- /**
- * More typically, override using custom {@link ComponentFactory}s.
- */
- @Override
- protected Class<? extends Page> getEntityPageClass() {
- // no override
- return super.getEntityPageClass();
- }
-
- /**
- * More typically, override using custom {@link ComponentFactory}s.
- */
- @Override
- protected Class<? extends Page> getActionPromptPageClass() {
- // no override
- return super.getActionPromptPageClass();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ToDoApplication.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ToDoApplication.java b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ToDoApplication.java
index 8b22730..459970c 100644
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ToDoApplication.java
+++ b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/ToDoApplication.java
@@ -25,9 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.List;
-
import javax.servlet.http.HttpServletRequest;
-
import com.google.common.base.Joiner;
import com.google.common.io.Resources;
import com.google.inject.AbstractModule;
@@ -35,14 +33,10 @@ import com.google.inject.Module;
import com.google.inject.name.Names;
import com.google.inject.util.Modules;
import com.google.inject.util.Providers;
-
import org.apache.wicket.Session;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;
import org.apache.wicket.request.http.WebRequest;
-
-import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistrar;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassList;
import org.apache.isis.viewer.wicket.viewer.IsisWicketApplication;
import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
@@ -114,31 +108,29 @@ public class ToDoApplication extends IsisWicketApplication {
protected Module newIsisWicketModule() {
final Module isisDefaults = super.newIsisWicketModule();
- final Module quickstartOverrides = new AbstractModule() {
+ final Module overrides = new AbstractModule() {
@Override
protected void configure() {
- bind(ComponentFactoryRegistrar.class).to(ComponentFactoryRegistrarForToDoApp.class);
- bind(PageClassList.class).to(PageClassListForToDoApp.class);
-
+
bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("ToDo App");
bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
- bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines("welcome.html"));
+ bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("ToDo App");
bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
}
};
- return Modules.override(isisDefaults).with(quickstartOverrides);
+ return Modules.override(isisDefaults).with(overrides);
}
- private static String readLines(final String resourceName) {
+ private static String readLines(final Class<?> contextClass, final String resourceName) {
try {
- List<String> readLines = Resources.readLines(Resources.getResource(ToDoApplication.class, resourceName), Charset.defaultCharset());
+ List<String> readLines = Resources.readLines(Resources.getResource(contextClass, resourceName), Charset.defaultCharset());
final String aboutText = Joiner.on("${symbol_escape}n").join(readLines);
return aboutText;
} catch (IOException e) {
- return "This is Quick Start";
+ return "This is a Todo app";
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/ec94051e/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/admin/Admin.java
----------------------------------------------------------------------
diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/admin/Admin.java b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/admin/Admin.java
deleted file mode 100644
index 9130c31..0000000
--- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/java/webapp/admin/Admin.java
+++ /dev/null
@@ -1,176 +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 webapp.admin;
-
-import java.util.List;
-import java.util.UUID;
-import org.joda.time.LocalDate;
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.*;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.applib.services.clock.ClockService;
-import org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo;
-import org.apache.isis.objectstore.jdo.applib.service.audit.AuditingServiceJdoRepository;
-import org.apache.isis.objectstore.jdo.applib.service.command.CommandJdo;
-import org.apache.isis.objectstore.jdo.applib.service.command.CommandServiceJdoRepository;
-import org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo;
-import org.apache.isis.objectstore.jdo.applib.service.publish.PublishingServiceJdoRepository;
-
-@DomainService(menuOrder = "35")
-public class Admin extends AbstractService {
-
-
- @ActionSemantics(Of.SAFE)
- @Bookmarkable
- @MemberOrder(sequence="10.1")
- public List<CommandJdo> commandsCurrentlyRunning() {
- return commandServiceRepository.findCurrent();
- }
- public boolean hideCommandsCurrentlyRunning() {
- return commandServiceRepository == null;
- }
-
- // //////////////////////////////////////
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="10.2")
- public List<CommandJdo> commandsPreviouslyRan() {
- return commandServiceRepository.findCompleted();
- }
- public boolean hideCommandsPreviouslyRan() {
- return commandServiceRepository == null;
- }
-
- // //////////////////////////////////////
-
- @MemberOrder(sequence="10.3")
- @ActionSemantics(Of.SAFE)
- public CommandJdo lookupCommand(
- final @Named("Transaction Id") UUID transactionId) {
- return commandServiceRepository.findByTransactionId(transactionId);
- }
- public boolean hideLookupCommand() {
- return commandServiceRepository == null;
- }
-
- // //////////////////////////////////////
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="10.4")
- public List<CommandJdo> findCommands(
- final @Optional @Named("From") LocalDate from,
- final @Optional @Named("To") LocalDate to) {
- return commandServiceRepository.findByFromAndTo(from, to);
- }
- public boolean hideFindCommands() {
- return commandServiceRepository == null;
- }
- public LocalDate default0FindCommands() {
- return clockService.now().minusDays(7);
- }
- public LocalDate default1FindCommands() {
- return clockService.now();
- }
-
-
- // //////////////////////////////////////
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="20.1")
- public List<AuditEntryJdo> findAuditEntries(
- final @Optional @Named("From") LocalDate from,
- final @Optional @Named("To") LocalDate to) {
- return auditingServiceRepository.findByFromAndTo(from, to);
- }
- public boolean hideFindAuditEntries() {
- return auditingServiceRepository == null;
- }
- public LocalDate default0FindAuditEntries() {
- return clockService.now().minusDays(7);
- }
- public LocalDate default1FindAuditEntries() {
- return clockService.now();
- }
-
- // //////////////////////////////////////
-
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="30.1")
- public List<PublishedEventJdo> allQueuedEvents() {
- return publishingServiceRepository.findQueued();
- }
- public boolean hideAllQueuedEvents() {
- return publishingServiceRepository == null;
- }
-
- @ActionSemantics(Of.SAFE)
- @Prototype
- @MemberOrder(sequence="30.2")
- public List<PublishedEventJdo> allProcessedEvents() {
- return publishingServiceRepository.findProcessed();
- }
- public boolean hideAllProcessedEvents() {
- return publishingServiceRepository == null;
- }
-
- @ActionSemantics(Of.IDEMPOTENT)
- @MemberOrder(sequence="30.3")
- public void purgeProcessedEvents() {
- publishingServiceRepository.purgeProcessed();
- }
- public boolean hidePurgeProcessedEvents() {
- return publishingServiceRepository == null;
- }
-
- @ActionSemantics(Of.SAFE)
- @MemberOrder(sequence="30.4")
- public List<PublishedEventJdo> findPublishedEvents(
- final @Optional @Named("From") LocalDate from,
- final @Optional @Named("To") LocalDate to) {
- return publishingServiceRepository.findByFromAndTo(from, to);
- }
- public boolean hideFindPublishedEvents() {
- return publishingServiceRepository == null;
- }
- public LocalDate default0FindPublishedEvents() {
- return clockService.now().minusDays(7);
- }
- public LocalDate default1FindPublishedEvents() {
- return clockService.now();
- }
-
-
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private CommandServiceJdoRepository commandServiceRepository;
-
- @javax.inject.Inject
- private AuditingServiceJdoRepository auditingServiceRepository;
-
- @javax.inject.Inject
- private PublishingServiceJdoRepository publishingServiceRepository;
-
- @javax.inject.Inject
- private ClockService clockService;
-
-}
-