You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2019/01/30 22:21:50 UTC

[isis] branch 2033-IoC updated: ISIS-2033: simple-app: adds menu 'List All Customers'

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch 2033-IoC
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/2033-IoC by this push:
     new b3ab45f  ISIS-2033: simple-app: adds menu 'List All Customers'
b3ab45f is described below

commit b3ab45fcff442638d01eaa16b5d9847835efdb9f
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 30 23:21:43 2019 +0100

    ISIS-2033: simple-app: adds menu 'List All Customers'
    
    Task-Url: https://issues.apache.org/jira/browse/ISIS-2033
---
 .../application/manifest/menubars.layout.xml       | 282 ++++++++++++---------
 .../modules/spring/dom/customer/CustomerMenu.java  |   8 +
 2 files changed, 166 insertions(+), 124 deletions(-)

diff --git a/example/application/simpleapp/application/src/main/java/domainapp/application/manifest/menubars.layout.xml b/example/application/simpleapp/application/src/main/java/domainapp/application/manifest/menubars.layout.xml
index 9846d45..6d15a67 100644
--- a/example/application/simpleapp/application/src/main/java/domainapp/application/manifest/menubars.layout.xml
+++ b/example/application/simpleapp/application/src/main/java/domainapp/application/manifest/menubars.layout.xml
@@ -1,128 +1,162 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
-  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
+<!-- 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. -->
+<mb3:menuBars
+	xsi:schemaLocation="http://isis.apache.org/applib/layout/menubars/bootstrap3 http://isis.apache.org/applib/layout/menubars/bootstrap3/menubars.xsd http://isis.apache.org/applib/layout/component http://isis.apache.org/applib/layout/component/component.xsd http://isis.apache.org/applib/layout/links http://isis.apache.org/applib/layout/links/links.xsd"
+	xmlns:cpt="http://isis.apache.org/applib/layout/component"
+	xmlns:lnk="http://isis.apache.org/applib/layout/links"
+	xmlns:mb3="http://isis.apache.org/applib/layout/menubars/bootstrap3"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<mb3:primary>
+		<mb3:menu>
+			<mb3:named>Simple Objects</mb3:named>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="simple.SimpleObjects" id="create">
+					<cpt:named>Create</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="simple.SimpleObjects" id="findByName">
+					<cpt:named>Find By Name</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="simple.SimpleObjects" id="listAll">
+					<cpt:named>List All</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+		</mb3:menu>
 
-         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.
--->
-<mb3:menuBars xsi:schemaLocation="http://isis.apache.org/applib/layout/menubars/bootstrap3 http://isis.apache.org/applib/layout/menubars/bootstrap3/menubars.xsd http://isis.apache.org/applib/layout/component http://isis.apache.org/applib/layout/component/component.xsd http://isis.apache.org/applib/layout/links http://isis.apache.org/applib/layout/links/links.xsd" xmlns:cpt="http://isis.apache.org/applib/layout/component" xmlns:lnk="http://isis.apache.org/applib/layout/links" xmlns:mb3="h [...]
-    <mb3:primary>
-        <mb3:menu>
-            <mb3:named>Simple Objects</mb3:named>
-            <mb3:section>
-                <mb3:serviceAction objectType="simple.SimpleObjects" id="create">
-                    <cpt:named>Create</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="simple.SimpleObjects" id="findByName">
-                    <cpt:named>Find By Name</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="simple.SimpleObjects" id="listAll">
-                    <cpt:named>List All</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-        </mb3:menu>
-        
-        </mb3:menu>
+		<mb3:menu>
 			<mb3:named>Spring</mb3:named>
-            <mb3:section>
-                <mb3:serviceAction objectType="simple.CustomerMenu" id="createCustomer">
-                    <cpt:named>Create Customer</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="simple.CustomerMenu" id="findByLastName">
-                    <cpt:named>Find By Last Name</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-        </mb3:menu>
-        
-        <mb3:menu unreferencedActions="true">
-            <mb3:named>Other</mb3:named>
-        </mb3:menu>
-    </mb3:primary>
-    <mb3:secondary>
-        <mb3:menu>
-            <mb3:named>Prototyping</mb3:named>
-            <mb3:section>
-                <mb3:serviceAction objectType="isisApplib.FixtureScriptsDefault" id="runFixtureScript">
-                    <cpt:named>Run Fixture Script</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.FixtureScriptsDefault" id="runFixtureScriptWithAutoComplete">
-                    <cpt:named>Run Fixture Script</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.FixtureScriptsDefault" id="recreateObjectsAndReturnFirst">
-                    <cpt:named>Recreate Objects And Return First</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-            <mb3:section>
-                <mb3:serviceAction objectType="isisApplib.LayoutServiceMenu" id="downloadLayouts">
-                    <cpt:named>Download Object Layouts (ZIP)</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.LayoutServiceMenu" id="downloadMenuBarsLayout">
-                    <cpt:named>Download Menu Bars Layout (XML)</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-            <mb3:section>
-				<mb3:serviceAction objectType="isisApplib.MetaModelServicesMenu" id="downloadMetaModelXml">
-                    <cpt:named>Download Meta Model (XML)</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.MetaModelServicesMenu" id="downloadMetaModelCsv">
-                    <cpt:named>Download Meta Model (CSV)</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-            <mb3:section>
-                <mb3:serviceAction objectType="isisApplib.SwaggerServiceMenu" id="openSwaggerUi">
-                    <cpt:named>Open Swagger Ui</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.SwaggerServiceMenu" id="openRestApi">
-                    <cpt:named>Open Rest Api</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.SwaggerServiceMenu" id="downloadSwaggerSchemaDefinition">
-                    <cpt:named>Download Swagger Schema Definition</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-            <mb3:section>
-                <mb3:serviceAction objectType="isisApplib.TranslationServicePoMenu" id="downloadTranslations">
-                    <cpt:named>Download Translations</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.TranslationServicePoMenu" id="resetTranslationCache">
-                    <cpt:named>Clear translation cache</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.TranslationServicePoMenu" id="switchToReadingTranslations">
-                    <cpt:named>Switch To Reading Translations</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.TranslationServicePoMenu" id="switchToWritingTranslations">
-                    <cpt:named>Switch To Writing Translations</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-            <mb3:section>
-                <mb3:serviceAction objectType="isisApplib.HsqlDbManagerMenu" id="hsqlDbManager">
-                    <cpt:named>HSQL DB Manager</cpt:named>
-                </mb3:serviceAction>
-                <mb3:serviceAction objectType="isisApplib.H2ManagerMenu" id="openH2Console">
-                    <cpt:named>H2 Console</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-        </mb3:menu>
-    </mb3:secondary>
-    <mb3:tertiary>
-        <mb3:menu>
-            <mb3:named>Configuration Service Menu</mb3:named>
-            <mb3:section>
-                <mb3:serviceAction objectType="isisApplib.ConfigurationMenu" id="configuration">
-                    <cpt:named>Configuration</cpt:named>
-                </mb3:serviceAction>
-            </mb3:section>
-        </mb3:menu>
-    </mb3:tertiary>
+			<mb3:section>
+				<mb3:serviceAction objectType="simple.CustomerMenu"
+					id="createCustomer">
+					<cpt:named>Create Customer</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction objectType="simple.CustomerMenu"
+					id="findByLastName">
+					<cpt:named>Find By Last Name</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction objectType="simple.CustomerMenu"
+					id="listAll">
+					<cpt:named>List All</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+		</mb3:menu>
+
+		<mb3:menu unreferencedActions="true">
+			<mb3:named>Other</mb3:named>
+		</mb3:menu>
+		
+	</mb3:primary>
+	<mb3:secondary>
+		<mb3:menu>
+			<mb3:named>Prototyping</mb3:named>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="isisApplib.FixtureScriptsDefault" id="runFixtureScript">
+					<cpt:named>Run Fixture Script</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.FixtureScriptsDefault"
+					id="runFixtureScriptWithAutoComplete">
+					<cpt:named>Run Fixture Script</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.FixtureScriptsDefault"
+					id="recreateObjectsAndReturnFirst">
+					<cpt:named>Recreate Objects And Return First</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="isisApplib.LayoutServiceMenu" id="downloadLayouts">
+					<cpt:named>Download Object Layouts (ZIP)</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.LayoutServiceMenu"
+					id="downloadMenuBarsLayout">
+					<cpt:named>Download Menu Bars Layout (XML)</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="isisApplib.MetaModelServicesMenu"
+					id="downloadMetaModelXml">
+					<cpt:named>Download Meta Model (XML)</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.MetaModelServicesMenu"
+					id="downloadMetaModelCsv">
+					<cpt:named>Download Meta Model (CSV)</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="isisApplib.SwaggerServiceMenu" id="openSwaggerUi">
+					<cpt:named>Open Swagger Ui</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.SwaggerServiceMenu" id="openRestApi">
+					<cpt:named>Open Rest Api</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.SwaggerServiceMenu"
+					id="downloadSwaggerSchemaDefinition">
+					<cpt:named>Download Swagger Schema Definition</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="isisApplib.TranslationServicePoMenu"
+					id="downloadTranslations">
+					<cpt:named>Download Translations</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.TranslationServicePoMenu"
+					id="resetTranslationCache">
+					<cpt:named>Clear translation cache</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.TranslationServicePoMenu"
+					id="switchToReadingTranslations">
+					<cpt:named>Switch To Reading Translations</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.TranslationServicePoMenu"
+					id="switchToWritingTranslations">
+					<cpt:named>Switch To Writing Translations</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="isisApplib.HsqlDbManagerMenu" id="hsqlDbManager">
+					<cpt:named>HSQL DB Manager</cpt:named>
+				</mb3:serviceAction>
+				<mb3:serviceAction
+					objectType="isisApplib.H2ManagerMenu" id="openH2Console">
+					<cpt:named>H2 Console</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+		</mb3:menu>
+	</mb3:secondary>
+	<mb3:tertiary>
+		<mb3:menu>
+			<mb3:named>Configuration Service Menu</mb3:named>
+			<mb3:section>
+				<mb3:serviceAction
+					objectType="isisApplib.ConfigurationMenu" id="configuration">
+					<cpt:named>Configuration</cpt:named>
+				</mb3:serviceAction>
+			</mb3:section>
+		</mb3:menu>
+	</mb3:tertiary>
 </mb3:menuBars>
diff --git a/example/application/simpleapp/module-spring/src/main/java/domainapp/modules/spring/dom/customer/CustomerMenu.java b/example/application/simpleapp/module-spring/src/main/java/domainapp/modules/spring/dom/customer/CustomerMenu.java
index 0dbaa79..4cfe083 100644
--- a/example/application/simpleapp/module-spring/src/main/java/domainapp/modules/spring/dom/customer/CustomerMenu.java
+++ b/example/application/simpleapp/module-spring/src/main/java/domainapp/modules/spring/dom/customer/CustomerMenu.java
@@ -1,5 +1,7 @@
 package domainapp.modules.spring.dom.customer;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import javax.inject.Inject;
@@ -31,6 +33,12 @@ public class CustomerMenu {
 	
 	@Action
 	@ActionLayout(cssClassFa="fa-leaf")
+	public List<Customer> listAll() {
+		return new ArrayList<Customer>((Collection<? extends Customer>) customerRepository.findAll());
+	}
+	
+	@Action
+	@ActionLayout(cssClassFa="fa-leaf")
 	public Customer createCustomer ( 
 			
 			@ParameterLayout(named="First Name")