http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/about/index.html ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/about/index.html b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/about/index.html deleted file mode 100644 index 2a425e5..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/about/index.html +++ /dev/null @@ -1,178 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<!-- - 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. ---> -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> - <title>Apache Isis™ TodoApp</title> - - <style type="text/css"> -body { - background-color: ${symbol_pound}1A467B; - font-family: Verdana, Helvetica, Arial; - font-size: 90%; -} - -li { - margin-top: 6px; - margin-bottom: 6px; -} -table { - border-collapse: collapse; -} -table, th, td { - border: 1px; - border-style: solid; - border-color: lightgray; -} -th, td { - padding: 10px; -} -${symbol_pound}wrapper { - background-color: ${symbol_pound}ffffff; - width: 900px; - margin: 8px auto; - padding: 12px; -} - </style> - </head> - <body> - <div id="wrapper"> - <img alt="Isis Logo" src="about/images/isis-logo.png" /> - - <p> - <a href="http://isis.apache.org" target="_blank">Apache Isis</a>™ is a framework to let you rapidly develop - domain-driven apps in Java. This app has been generated using Isis' - <a href="http://isis.apache.org/intro/getting-started/todo%61pp-archetype.html" target="_blank">TodoApp</a> archetype, - which configures Isis to run a (quite feature rich) "todo" app. - - <p> - The app itself consists of a single domain class, <tt>ToDoItem</tt>, along with a number of supporting - services. - </p> - - <p>To access the app:</p> - <ul> - <li> - <p> - <b><a href="wicket/">wicket/</a></b> - </p> - <p> - provides accesses to a generic UI for end-users, - Isis' <a href="http://isis.apache.org/components/viewers/wicket/about.html" target="_blank">Wicket Viewer</a>. - As its name suggests, this viewer is built on top of <a href="http://wicket.apache.org" target="_blank">Apache Wicket</a>™. - </p> - </li> - <li> - <p> - <b> - <a href="restful/">restful/</a> - </b> - </p> - <p> - provides access to a RESTful API conformant with the - <a href="http://restfulobjects.org">Restful Objects</a> spec</td>. This is part of Isis Core. The - implementation technology is JBoss RestEasy. - </p> - </li> - </ul> - - <p> - The default user/password is <b><i>sven/pass</i></b> (as configured in the - <a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/shiro.ini" target="_blank">shiro.ini</a> file). - </p> - - <p> - To build your own app, while you could start with this todo app and remove/rename as required, you are - probably better off using the extremely minimal - <a href="http://isis.apache.org/intro/getting-started/simpleapp-archetype.html" target="_blank">SimpleApp</a> archetype. - </p> - - <h2>App contents</h2> - <p>The key files in this "todo" app are:</p> - <!-- the hrefs below are partially URL encoded to prevent them from being modified when the archetype is created --> - <ul> - <li>Domain classes (todo functionality) (in <tt>dom</tt> module) - <ul> - <li><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/dom/src/main/java/dom/todo/ToDoItem.java" target="_blank"><tt>ToDoItem</tt></a> domain entity - </li> - <li><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/dom/src/main/java/dom/todo/ToDoItems.java" target="_blank"><tt>ToDoItems</tt></a> domain service (repository/factory) - </li> - <li><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/dom/src/main/java/app/ToDoItemAnalysis.java" target="_blank"><tt>ToDoItemAnalysis</tt></a> application service analysing todo items - </li> - <li><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/dom/src/main/java/app/ToDoAppDashboard.java" target="_blank"><tt>ToDoAppDashboard</tt></a> dashboard application service - </li> - </ul> - </li> - <li>Fixture scripts (in <tt>fixture</tt> module) - <ul> - <li><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java" target="_blank"><tt>ToDoItemsFixtureService</tt></a> domain service to install fixtures at run-time - </li> - </ul> - </li> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml" target="_blank">WEB-INF/web.xml</a></tt> (in <tt>webapp</tt> module) - <ul> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml${symbol_pound}L98" target="_blank">ResourceCachingFilter</a></tt> and <tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml${symbol_pound}L134" target="_blank">ResourceServlet</a></tt> - filter and servlet for serving up static resources. - </li> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml${symbol_pound}L174" target="_blank">WicketFilter</a></tt> - filter for the wicket application, mapped to <tt>/wicket/*</tt> - </li> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml${symbol_pound}L223" target="_blank">ResteasyBootstrap</a></tt>, - <tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml${symbol_pound}L240" target="_blank">IsisSessionFilterForRestfulObjects</a></tt>, - <tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml${symbol_pound}L271" target="_blank">RestfulObjectsRestEasyDispatcher</a></tt> - listeners, filters and servlets to bootstrap and map restful objects viewer to <tt>/restful/*</tt>. - </li> - <li>commented out <tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/web.xml${symbol_pound}L208" target="_blank">IsisWebAppBootstrapper</a></tt> listener; this is NOT required unless wicket viewer config is removed - </li> - </ul> - </li> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/isis.properties" target="_blank">WEB-INF/isis.properties</a></tt> (in <tt>webapp</tt> module) - <ul> - <li><tt>isis.services</tt> - explicitly loaded framework-provide domain services. Other services (including <tt>ToDoItems</tt> and <tt>ToDoItemsFixtureService</tt> described above), - are loaded automatically from the classpath. - </li> - <li><tt>isis.persistor</tt> - specifies to use Isis' integration with <a href="http://datanucleus.org">DataNucleus</a> for (JDO-based) persistence. - </li> - <li><tt>isis.authentication</tt> and <tt>isis.authorization</tt> - specifies to use Isis' integration with <a href="http://shiro.apache.org">Apache Shiro</a> for security. - </li> - </ul> - </li> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties" target="_blank">WEB-INF/persistor_datanucleus.properties</a></tt> (in <tt>webapp</tt> module) - <ul> - <li>configuration for the DataNucleus (JDO) object store - </li> - </ul> - </li> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/persistor.properties" target="_blank">WEB-INF/persistor.properties</a></tt> (in <tt>webapp</tt> module) - <ul> - <li>JDBC URL for DataNucleus (JDO) object store - </li> - </ul> - </li> - <li><tt><a href="https://github.com/apache/isis/blob/master/example/application/todo%61pp/webapp/src/main/webapp/WEB-INF/shiro.ini" target="_blank">WEB-INF/shiro.ini</a></tt> (in <tt>webapp</tt> module) - <ul> - <li>configuration for Shiro security - </li> - </ul> - </li> - </ul> - </div> - </body> -</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/css/application.css ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/css/application.css b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/css/application.css deleted file mode 100644 index e4aed6e..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/css/application.css +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - -.navbar-brand img { - margin-top: -5px; - margin-left: 5px; -} - -.x-key label.scalarName { - color: red; -} - -tr.todo { -} - -tr.done { - text-decoration: line-through; - color: #d3d3d3; -} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.pdn ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.pdn b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.pdn deleted file mode 100644 index 016c9b8..0000000 Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.pdn and /dev/null differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.png ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.png b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.png deleted file mode 100644 index 2c417fb..0000000 Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-header.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.pdn ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.pdn b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.pdn deleted file mode 100644 index 7a164e1..0000000 Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.pdn and /dev/null differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.png ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.png b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.png deleted file mode 100644 index ee2feb4..0000000 Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo-signin.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo.pdn ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo.pdn b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo.pdn deleted file mode 100644 index 4983ca9..0000000 Binary files a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/images/todoapp-logo.pdn and /dev/null differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/scripts/application.js ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/scripts/application.js b/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/scripts/application.js deleted file mode 100644 index d8cf6fe..0000000 --- a/example/archetype/todoapp/src/main/resources/archetype-resources/webapp/src/main/webapp/scripts/application.js +++ /dev/null @@ -1,3 +0,0 @@ -$(document).ready(function() { - /// here... -}); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/test/resources/projects/basic/archetype.properties ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/test/resources/projects/basic/archetype.properties b/example/archetype/todoapp/src/test/resources/projects/basic/archetype.properties deleted file mode 100644 index 465d32c..0000000 --- a/example/archetype/todoapp/src/test/resources/projects/basic/archetype.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Tue Feb 03 23:39:52 GMT 2015 -package=it.pkg -version=0.1-SNAPSHOT -groupId=archetype.it -artifactId=basic http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/example/archetype/todoapp/src/test/resources/projects/basic/goal.txt ---------------------------------------------------------------------- diff --git a/example/archetype/todoapp/src/test/resources/projects/basic/goal.txt b/example/archetype/todoapp/src/test/resources/projects/basic/goal.txt deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/.gitattributes ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/.gitattributes b/mothballed/example/application/todoapp/.gitattributes new file mode 100644 index 0000000..b1eafb6 --- /dev/null +++ b/mothballed/example/application/todoapp/.gitattributes @@ -0,0 +1,51 @@ +# +# +# text files are normalized (convert crlf => lf) +# binary files are not normalized (binary is a macro for -text -diff) +# +# + + +# Unless otherwise stated, assume text + +* text=auto + + +*.java text diff=java +*.html text diff=html +*.xhtml text diff=html +*.xml text +*.txt text + + +*.jar binary +*.so binary +*.dll binary + +# images +*.jpg binary +*.jpeg binary +*.png binary +*.pdn binary +*.pdn binary + + +*.cs text diff=csharp + +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/.gitignore ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/.gitignore b/mothballed/example/application/todoapp/.gitignore new file mode 100644 index 0000000..ad3f5e2 --- /dev/null +++ b/mothballed/example/application/todoapp/.gitignore @@ -0,0 +1,40 @@ +*~ +*.swp +*.class +bin/ +target/ +target-ide/ +logs/ +.settings/ +.project +.classpath +.idea +*.iml + +JArchitectOut/ +*.jdproj + +neo4j_DB/ + +# log files +datanucleus.log +isis.log +hs_err_pid*.log + +# Package Files # +*.jar +*.war +*.ear + +dependency-reduced-pom.xml +pom.xml.tag +pom.xml.next +pom.xml.releaseBackup +pom.xml.versionsBackup + +.clover/ +*.jdproj +JArchitectOut/ + + +rebel.xml http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/log4j.properties ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/log4j.properties b/mothballed/example/application/todoapp/dom/log4j.properties new file mode 100644 index 0000000..ca165ac --- /dev/null +++ b/mothballed/example/application/todoapp/dom/log4j.properties @@ -0,0 +1,41 @@ +# 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. + +# LOG4J Configuration +# =================== + +# Basic logging goes to "datanucleus.log" +log4j.appender.A1=org.apache.log4j.FileAppender +log4j.appender.A1.File=datanucleus.log +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} (%t) %-5p [%c] - %m%n +#log4j.appender.A1.Threshold=INFO + +# Categories +# Each category can be set to a "level", and to direct to an appender + +# Default to DEBUG level for all DataNucleus categories +log4j.logger.DataNucleus = DEBUG, A1 + +log4j.category.com.mchange.v2.c3p0=INFO, A1 +log4j.category.com.mchange.v2.resourcepool=INFO, A1 +log4j.category.org.logicalcobwebs.proxool=INFO,A1 + + +# Hbase libs logging +log4j.category.org.apache.hadoop=INFO,A1 +log4j.category.org.apache.zookeeper=INFO,A1 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/pom.xml ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/pom.xml b/mothballed/example/application/todoapp/dom/pom.xml new file mode 100644 index 0000000..09f46d9 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/pom.xml @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.isis.example.application</groupId> + <artifactId>todoapp</artifactId> + <version>1.8.0-SNAPSHOT</version> + </parent> + + <artifactId>todoapp-dom</artifactId> + <name>ToDo App DOM</name> + + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + </resource> + <resource> + <filtering>false</filtering> + <directory>src/main/java</directory> + <includes> + <include>**</include> + </includes> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.datanucleus</groupId> + <artifactId>datanucleus-maven-plugin</artifactId> + <version>${datanucleus-maven-plugin.version}</version> + <configuration> + <fork>false</fork> + <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration> + <verbose>true</verbose> + <props>${basedir}/datanucleus.properties</props> + </configuration> + <executions> + <execution> + <phase>compile</phase> + <goals> + <goal>enhance</goal> + </goals> + </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> + + <dependencies> + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-applib</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.isis.core</groupId> + <artifactId>isis-core-unittestsupport</artifactId> + <scope>test</scope> + </dependency> + + <!-- Bytecode libraries (for mocking) --> + <dependency> + <groupId>org.objenesis</groupId> + <artifactId>objenesis</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>isis-validate</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.isis.tool</groupId> + <artifactId>isis-maven-plugin</artifactId> + <version>1.8.0-SNAPSHOT</version> + <configuration> + <isisConfigDir>../webapp/src/main/webapp/WEB-INF</isisConfigDir> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.isis.example.application</groupId> + <artifactId>todoapp-dom</artifactId> + <version>1.8.0-SNAPSHOT</version> + </dependency> + <!-- + ... workaround to avoid conflict with plexus-default + (not sure why exclusions in the isis-maven-plugin aren't sufficient, though ... + --> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>16.0.1</version> + </dependency> + </dependencies> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>validate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/META-INF/persistence.xml b/mothballed/example/application/todoapp/dom/src/main/java/META-INF/persistence.xml new file mode 100644 index 0000000..9b38012 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/META-INF/persistence.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<persistence xmlns="http://java.sun.com/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> + + <persistence-unit name="quickstart"> + </persistence-unit> +</persistence> http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.java b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.java new file mode 100644 index 0000000..e3a3723 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.java @@ -0,0 +1,69 @@ +/* + * 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 app; + +import java.util.List; +import org.apache.isis.applib.annotation.Collection; +import org.apache.isis.applib.annotation.CollectionLayout; +import org.apache.isis.applib.annotation.DomainObject; +import org.apache.isis.applib.annotation.Editing; +import org.apache.isis.applib.annotation.Nature; +import org.apache.isis.applib.annotation.RenderType; + +@DomainObject(nature = Nature.VIEW_MODEL) +public class ToDoAppDashboard { + + //region > identification in the UI + public String title() { + return "Dashboard"; + } + //endregion + + //region > getAnalysisByCategory (collection) + @CollectionLayout( + named="By Category", + render = RenderType.EAGERLY + ) + @Collection( + editing = Editing.DISABLED + ) + public List<ToDoItemsByCategoryViewModel> getAnalysisByCategory() { + return toDoItemAnalysis.toDoItemsByCategory(); + } + //endregion + + //region > getAnalysisByDateRange (collection) + @CollectionLayout( + named="By Date Range", + render = RenderType.EAGERLY + ) + @Collection( + editing = Editing.DISABLED + ) + public List<ToDoItemsByDateRangeViewModel> getAnalysisByDateRange() { + return toDoItemAnalysis.toDoItemsByDateRange(); + } + //endregion + + //region > injected services + @javax.inject.Inject + private ToDoItemAnalysis toDoItemAnalysis; + //endregion + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.layout.json ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.layout.json b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.layout.json new file mode 100644 index 0000000..3421543 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.layout.json @@ -0,0 +1,26 @@ +{ + "columns": [ + { + "span": 0, + "memberGroups": {} + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 12, + "collections": { + "analysisByCategory": {} + } + } + ], + "actions": { + "downloadLayout": {}, + "refreshLayout": {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.png ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.png b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.png new file mode 100644 index 0000000..fe6e6a1 Binary files /dev/null and b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboard.png differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboardService.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboardService.java b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboardService.java new file mode 100644 index 0000000..3bc371c --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoAppDashboardService.java @@ -0,0 +1,44 @@ +/* + * 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 app; + +import javax.inject.Inject; +import org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.applib.annotation.Action; +import org.apache.isis.applib.annotation.DomainService; +import org.apache.isis.applib.annotation.HomePage; +import org.apache.isis.applib.annotation.NatureOfService; +import org.apache.isis.applib.annotation.SemanticsOf; + +@DomainService(nature = NatureOfService.DOMAIN) +public class ToDoAppDashboardService { + + @Action( + semantics = SemanticsOf.SAFE + //hidden = Where.EVERYWHERE + ) + @HomePage + public ToDoAppDashboard lookup() { + return container.injectServicesInto(new ToDoAppDashboard()); + } + + @Inject + private DomainObjectContainer container; + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysis.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysis.java b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysis.java new file mode 100644 index 0000000..4c7d157 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysis.java @@ -0,0 +1,126 @@ +/* + * 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 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 org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.applib.annotation.Action; +import org.apache.isis.applib.annotation.ActionLayout; +import org.apache.isis.applib.annotation.BookmarkPolicy; +import org.apache.isis.applib.annotation.DomainService; +import org.apache.isis.applib.annotation.DomainServiceLayout; +import org.apache.isis.applib.annotation.MemberOrder; +import org.apache.isis.applib.annotation.Programmatic; +import org.apache.isis.applib.annotation.SemanticsOf; + +@DomainServiceLayout( + named="Analysis", + menuOrder = "20") +@DomainService +public class ToDoItemAnalysis { + + + //region > identification in the UI + public String getId() { + return "analysis"; + } + + public String iconName() { + return "ToDoItem"; + } + //endregion + + + //region > byCategory (action) + @ActionLayout( + cssClassFa="fa fa-pie-chart", + named="By Category", + bookmarking = BookmarkPolicy.AS_ROOT + ) + @Action(semantics = SemanticsOf.SAFE) + @MemberOrder(sequence = "1") + public List<ToDoItemsByCategoryViewModel> toDoItemsByCategory() { + final List<Category> categories = Arrays.asList(Category.values()); + return Lists.newArrayList(Iterables.transform(categories, byCategory())); + } + + private Function<Category, ToDoItemsByCategoryViewModel> byCategory() { + return new Function<Category, ToDoItemsByCategoryViewModel>(){ + @Override + public ToDoItemsByCategoryViewModel apply(final Category category) { + return new ToDoItemsByCategoryViewModel(category); + } + }; + } + //endregion + + //region > byDateRange (action) + + public enum DateRange { + OverDue, + Today, + Tomorrow, + ThisWeek, + Later, + Unknown, + } + + @ActionLayout( + cssClassFa="fa fa-calendar", + named="By Date Range", + bookmarking = BookmarkPolicy.AS_ROOT + ) + @Action(semantics = SemanticsOf.SAFE) + @MemberOrder(sequence = "1") + public List<ToDoItemsByDateRangeViewModel> toDoItemsByDateRange() { + final List<DateRange> dateRanges = Arrays.asList(DateRange.values()); + return Lists.newArrayList(Iterables.transform(dateRanges, byDateRange())); + } + + private static Function<DateRange, ToDoItemsByDateRangeViewModel> byDateRange() { + return new Function<DateRange, ToDoItemsByDateRangeViewModel>(){ + @Override + public ToDoItemsByDateRangeViewModel apply(final DateRange dateRange) { + return new ToDoItemsByDateRangeViewModel(dateRange); + } + }; + } + //endregion + + //region > forCategory (programmatic) + @Programmatic + public ToDoItemsByCategoryViewModel toDoItemsForCategory(final Category category) { + return byCategory().apply(category); + } + + //endregion + + //region > injected services + @javax.inject.Inject + private DomainObjectContainer container; + + //endregion + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysisContributions.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysisContributions.java b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysisContributions.java new file mode 100644 index 0000000..baf4b00 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemAnalysisContributions.java @@ -0,0 +1,50 @@ +/* + * 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 app; + +import dom.todo.ToDoItem; + +import org.apache.isis.applib.annotation.Action; +import org.apache.isis.applib.annotation.ActionLayout; +import org.apache.isis.applib.annotation.Contributed; +import org.apache.isis.applib.annotation.DomainService; +import org.apache.isis.applib.annotation.NatureOfService; +import org.apache.isis.applib.annotation.SemanticsOf; + +@DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY) +public class ToDoItemAnalysisContributions { + + + //region > analyseCategory (action) + @ActionLayout(contributed = Contributed.AS_ACTION) + @Action( + semantics = SemanticsOf.SAFE + ) + public ToDoItemsByCategoryViewModel analyseCategory(final ToDoItem item) { + return toDoAppAnalysis.toDoItemsForCategory(item.getCategory()); + } + //endregion + + //region > injected services + @javax.inject.Inject + private ToDoItemAnalysis toDoAppAnalysis; + + //endregion + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java new file mode 100644 index 0000000..8ebae61 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.java @@ -0,0 +1,168 @@ +/* + * 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 app; + +import dom.todo.ToDoItem; +import dom.todo.ToDoItem.Category; +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 org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.applib.annotation.ActionLayout; +import org.apache.isis.applib.annotation.BookmarkPolicy; +import org.apache.isis.applib.annotation.CollectionLayout; +import org.apache.isis.applib.annotation.DomainObject; +import org.apache.isis.applib.annotation.DomainObjectLayout; +import org.apache.isis.applib.annotation.Nature; +import org.apache.isis.applib.annotation.PropertyLayout; +import org.apache.isis.applib.annotation.RenderType; +import org.apache.isis.applib.annotation.Title; +import org.apache.isis.applib.util.ObjectContracts; + +@DomainObjectLayout( + named="By Category", + bookmarking = BookmarkPolicy.AS_ROOT +) +@DomainObject( + nature = Nature.VIEW_MODEL +) +public class ToDoItemsByCategoryViewModel + implements Comparable<ToDoItemsByCategoryViewModel> { + + //region > constructors + public ToDoItemsByCategoryViewModel() { + } + public ToDoItemsByCategoryViewModel(final Category category) { + setCategory(category); + } + //endregion + + + //region > category (property) + private Category category; + + @Title + public Category getCategory() { + return category; + } + + public void setCategory(final Category category) { + this.category = category; + } + //endregion + + //region > notYetComplete (property), complete (property) + @PropertyLayout( + multiLine=5 + ) + public String getNotYetComplete() { + final List<ToDoItem> notYetComplete = getItemsNotYetComplete(); + return Joiner.on(", ").join( + Iterables.transform(subcategories(), summarizeBySubcategory(notYetComplete))); + } + + @PropertyLayout( + multiLine=5 + ) + public String getComplete() { + final List<ToDoItem> completeInCategory = getItemsComplete(); + return Joiner.on(", ").join( + Iterables.transform(subcategories(), summarizeBySubcategory(completeInCategory))); + } + + // ////////////////////////////////////// + + private Iterable<ToDoItem.Subcategory> subcategories() { + return Iterables.filter(Arrays.asList(ToDoItem.Subcategory.values()), ToDoItem.Subcategory.thoseFor(getCategory())); + } + + private Function<ToDoItem.Subcategory, String> summarizeBySubcategory(final Iterable<ToDoItem> itemsInCategory) { + return new Function<ToDoItem.Subcategory, String>() { + @Override + public String apply(final ToDoItem.Subcategory subcategory) { + return subcategory + ": " + countIn(itemsInCategory, subcategory); + } + }; + } + + private static int countIn(final Iterable<ToDoItem> items, final ToDoItem.Subcategory subcategory) { + return Iterables.size(Iterables.filter(items, + ToDoItem.Predicates.thoseSubcategorised(subcategory))); + } + //endregion + + //region > getItemsNotYetComplete (collection), getItemsComplete (collection) + /** + * All those items {@link ToDoItems#notYetComplete() not yet complete}, for this {@link #getCategory() category}. + */ + @CollectionLayout( + render = RenderType.EAGERLY + ) + public List<ToDoItem> getItemsNotYetComplete() { + final List<ToDoItem> notYetComplete = toDoItems.notYetCompleteNoUi(); + return Lists.newArrayList(Iterables.filter(notYetComplete, ToDoItem.Predicates.thoseCategorised(getCategory()))); + } + + /** + * All those items {@link ToDoItems#complete() complete}, for this {@link #getCategory() category}. + */ + @CollectionLayout( + render = RenderType.EAGERLY + ) + public List<ToDoItem> getItemsComplete() { + final List<ToDoItem> complete = toDoItems.completeNoUi(); + return Lists.newArrayList(Iterables.filter(complete, ToDoItem.Predicates.thoseCategorised(getCategory()))); + } + + //endregion + + //region > deleteCompleted (action) + @ActionLayout( + named="Delete" + ) + public ToDoItemsByCategoryViewModel deleteCompleted() { + for (final ToDoItem item : getItemsComplete()) { + container.removeIfNotAlready(item); + } + // force reload of page + return this; + } + + //endregion + + //region > compareTo + @Override + public int compareTo(final ToDoItemsByCategoryViewModel other) { + return ObjectContracts.compare(this, other, "category"); + } + //endregion + + //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/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.layout.json ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.layout.json b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.layout.json new file mode 100644 index 0000000..c87b554 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.layout.json @@ -0,0 +1,43 @@ +{ + "columns": [ + { + "span": 4, + "memberGroups": { + "General": { + "members": { + "category": {} + } + }, + "Analysis": { + "members": { + "notYetComplete": {}, + "complete": {} + } + } + } + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 8, + "collections": { + "itemsNotYetComplete": {}, + "itemsComplete": { + "actions": { + "deleteCompleted": {} + } + } + } + } + ], + "actions": { + "downloadLayout": {}, + "refreshLayout": {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.png ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.png b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.png new file mode 100644 index 0000000..c22ab2b Binary files /dev/null and b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByCategoryViewModel.png differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java new file mode 100644 index 0000000..baf5bac --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.java @@ -0,0 +1,137 @@ +/* + * 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 app; + +import app.ToDoItemAnalysis.DateRange; +import dom.todo.ToDoItem; +import dom.todo.ToDoItems; + +import java.util.List; +import com.google.common.base.Objects; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import org.joda.time.DateTime; +import org.apache.isis.applib.annotation.BookmarkPolicy; +import org.apache.isis.applib.annotation.CollectionLayout; +import org.apache.isis.applib.annotation.DomainObject; +import org.apache.isis.applib.annotation.DomainObjectLayout; +import org.apache.isis.applib.annotation.Nature; +import org.apache.isis.applib.annotation.RenderType; +import org.apache.isis.applib.annotation.Title; +import org.apache.isis.applib.services.clock.ClockService; +import org.apache.isis.applib.util.ObjectContracts; + +@DomainObjectLayout( + named="By Date Range", + bookmarking = BookmarkPolicy.AS_ROOT +) +@DomainObject( + nature = Nature.VIEW_MODEL +) +public class ToDoItemsByDateRangeViewModel + implements Comparable<ToDoItemsByDateRangeViewModel> { + + //region > constructors + public ToDoItemsByDateRangeViewModel() { + } + public ToDoItemsByDateRangeViewModel(final DateRange dateRange) { + setDateRange(dateRange); + } + //endregion + + //region > dateRange (property) + private DateRange dateRange; + + @Title + public DateRange getDateRange() { + return dateRange; + } + + public void setDateRange(final DateRange dateRange) { + this.dateRange = dateRange; + } + //endregion + + //region > count (derived property) + public int getCount() { + return getItemsNotYetComplete().size(); + } + //endregion + + //region > getItemsNotYetComplete (collection) + /** + * All those items {@link ToDoItems#notYetComplete() not yet complete}, for this {@link #getDateRange() date range}. + */ + @CollectionLayout( + render = RenderType.EAGERLY + ) + public List<ToDoItem> getItemsNotYetComplete() { + final List<ToDoItem> notYetComplete = toDoItems.notYetCompleteNoUi(); + return Lists.newArrayList(Iterables.filter(notYetComplete, thoseInDateRange())); + } + + private Predicate<ToDoItem> thoseInDateRange() { + return new Predicate<ToDoItem>() { + @Override + public boolean apply(final ToDoItem t) { + return Objects.equal(dateRangeFor(t), getDateRange()); + } + }; + } + + private DateRange dateRangeFor(final ToDoItem t) { + if(t.getDueBy() == null) { + return DateRange.Unknown; + } + final DateTime dueBy = t.getDueBy().toDateTimeAtStartOfDay(); + final DateTime today = clockService.now().toDateTimeAtStartOfDay(); + + if(dueBy.isBefore(today)) { + return DateRange.OverDue; + } + if(dueBy.isBefore(today.plusDays(1))) { + return DateRange.Today; + } + if(dueBy.isBefore(today.plusDays(2))) { + return DateRange.Tomorrow; + } + if(dueBy.isBefore(today.plusDays(7))) { + return DateRange.ThisWeek; + } + return DateRange.Later; + } + //endregion + + //region > compareTo + @Override + public int compareTo(final ToDoItemsByDateRangeViewModel other) { + return ObjectContracts.compare(this, other, "dateRange"); + } + //endregion + + //region > injected services + @javax.inject.Inject + private ToDoItems toDoItems; + + @javax.inject.Inject + private ClockService clockService; + //endregion + +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.layout.json ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.layout.json b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.layout.json new file mode 100644 index 0000000..648e146 --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.layout.json @@ -0,0 +1,33 @@ +{ + "columns": [ + { + "span": 4, + "memberGroups": { + "General": { + "members": { + "dateRange": {}, + "count": {} + } + } + } + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 8, + "collections": { + "itemsNotYetComplete": {} + } + } + ], + "actions": { + "downloadLayout": {}, + "refreshLayout": {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.png ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.png b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.png new file mode 100644 index 0000000..034a1f9 Binary files /dev/null and b/mothballed/example/application/todoapp/dom/src/main/java/app/ToDoItemsByDateRangeViewModel.png differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/Categorized.java ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/Categorized.java b/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/Categorized.java new file mode 100644 index 0000000..fabbc9b --- /dev/null +++ b/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/Categorized.java @@ -0,0 +1,32 @@ +/* + * 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; + +/** + * Enables {@link dom.todo.ToDoItemContributions#updateCategory(dom.todo.Categorized, dom.todo.ToDoItem.Category, dom.todo.ToDoItem.Subcategory)} to be contributed to + * both the {@link dom.todo.ToDoItem} (entity) and also the {@link app.ToDoItemWizard} (wizard). + */ +public interface Categorized { + + ToDoItem.Category getCategory(); + void setCategory(ToDoItem.Category category); + + ToDoItem.Subcategory getSubcategory(); + void setSubcategory(ToDoItem.Subcategory subcategory); +} http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-done.png ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-done.png b/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-done.png new file mode 100644 index 0000000..b0fc6e8 Binary files /dev/null and b/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-done.png differ http://git-wip-us.apache.org/repos/asf/isis/blob/a4ec0b72/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-todo.png ---------------------------------------------------------------------- diff --git a/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-todo.png b/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-todo.png new file mode 100644 index 0000000..99a9fed Binary files /dev/null and b/mothballed/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem-todo.png differ
