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

danhaywood pushed a commit to branch jpa-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/isis-app-simpleapp.git


The following commit(s) were added to refs/heads/jpa-SNAPSHOT by this push:
     new bddbed6  adds in fullcalendar
bddbed6 is described below

commit bddbed6f3d17e1faf9a1305e60afcbbedeb1b6e3
Author: Dan Haywood <d...@haywood-associates.co.uk>
AuthorDate: Tue Aug 30 20:05:52 2022 +0100

    adds in fullcalendar
---
 .run/SimpleApp.run.xml                             |  1 +
 module-simple/pom.xml                              | 10 ++++++
 .../domainapp/modules/simple/SimpleModule.java     |  6 +++-
 .../simple/dom/so/SimpleObject.columnOrder.txt     |  3 +-
 .../modules/simple/dom/so/SimpleObject.java        | 41 +++++++++++++++++++++-
 .../simple/fixture/SimpleObjectBuilder.java        | 14 +++++---
 .../simple/fixture/SimpleObject_persona.java       | 15 ++++++--
 webapp/pom.xml                                     | 11 ++++--
 .../main/java/domainapp/webapp/AppManifest.java    |  2 ++
 .../src/main/resources/static/css/application.css  |  5 +++
 webapp/src/main/resources/static/index.html        |  2 +-
 11 files changed, 97 insertions(+), 13 deletions(-)

diff --git a/.run/SimpleApp.run.xml b/.run/SimpleApp.run.xml
index bbb78c4..52eb874 100644
--- a/.run/SimpleApp.run.xml
+++ b/.run/SimpleApp.run.xml
@@ -2,6 +2,7 @@
   <configuration default="false" name="SimpleApp" 
type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
     <option name="ACTIVE_PROFILES" />
     <module name="simpleapp-jpa-webapp" />
+    <option name="SHORTEN_COMMAND_LINE" value="ARGS_FILE" />
     <option name="SPRING_BOOT_MAIN_CLASS" value="domainapp.webapp.SimpleApp" />
     <option name="VM_PARAMETERS" value="-javaagent:lib/spring-instrument.jar" 
/>
     <method v="2">
diff --git a/module-simple/pom.xml b/module-simple/pom.xml
index aeb7cb5..8160be8 100644
--- a/module-simple/pom.xml
+++ b/module-simple/pom.xml
@@ -40,6 +40,16 @@
             <artifactId>isis-applib</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.isis.testing</groupId>
+            <artifactId>isis-testing-fakedata-applib</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.extensions</groupId>
+            <artifactId>isis-extensions-fullcalendar-applib</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.apache.isis.extensions</groupId>
             <artifactId>isis-extensions-pdfjs-applib</artifactId>
diff --git 
a/module-simple/src/main/java/domainapp/modules/simple/SimpleModule.java 
b/module-simple/src/main/java/domainapp/modules/simple/SimpleModule.java
index 8379b42..56ece4b 100644
--- a/module-simple/src/main/java/domainapp/modules/simple/SimpleModule.java
+++ b/module-simple/src/main/java/domainapp/modules/simple/SimpleModule.java
@@ -6,8 +6,10 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
 
+import 
org.apache.isis.extensions.fullcalendar.applib.IsisModuleExtFullCalendarApplib;
 import org.apache.isis.extensions.pdfjs.applib.IsisModuleExtPdfjsApplibModel;
 import org.apache.isis.persistence.jpa.applib.IsisModulePersistenceJpaApplib;
+import org.apache.isis.testing.fakedata.applib.IsisModuleTestingFakeDataApplib;
 import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScript;
 import org.apache.isis.testing.fixtures.applib.modules.ModuleWithFixtures;
 import 
org.apache.isis.testing.fixtures.applib.teardown.jpa.TeardownFixtureJpaAbstract;
@@ -17,7 +19,9 @@ import domainapp.modules.simple.dom.so.SimpleObject;
 @Configuration
 @Import({
         IsisModuleExtPdfjsApplibModel.class,
-        IsisModulePersistenceJpaApplib.class
+        IsisModuleExtFullCalendarApplib.class,
+        IsisModuleTestingFakeDataApplib.class,
+        IsisModulePersistenceJpaApplib.class,
 })
 @ComponentScan
 @EnableJpaRepositories
diff --git 
a/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.columnOrder.txt
 
b/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.columnOrder.txt
index dbf267a..5f3107a 100644
--- 
a/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.columnOrder.txt
+++ 
b/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.columnOrder.txt
@@ -1,2 +1,3 @@
 name
-#version
\ No newline at end of file
+lastCheckedIn
+#version
diff --git 
a/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java 
b/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java
index 2765da2..31d21b8 100644
--- 
a/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java
+++ 
b/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java
@@ -1,6 +1,11 @@
 package domainapp.modules.simple.dom.so;
 
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
 import java.util.Comparator;
+import java.util.Optional;
 
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -27,7 +32,9 @@ import org.apache.isis.applib.annotation.Action;
 import org.apache.isis.applib.annotation.ActionLayout;
 import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.applib.annotation.Editing;
 import org.apache.isis.applib.annotation.MemberSupport;
+import org.apache.isis.applib.annotation.Optionality;
 import org.apache.isis.applib.annotation.PromptStyle;
 import org.apache.isis.applib.annotation.Property;
 import org.apache.isis.applib.annotation.PropertyLayout;
@@ -35,10 +42,17 @@ import org.apache.isis.applib.annotation.Publishing;
 import org.apache.isis.applib.annotation.Title;
 import org.apache.isis.applib.jaxb.PersistentEntityAdapter;
 import org.apache.isis.applib.layout.LayoutConstants;
+import org.apache.isis.applib.services.clock.ClockService;
+import org.apache.isis.applib.services.iactnlayer.InteractionContext;
+import org.apache.isis.applib.services.iactnlayer.InteractionService;
 import org.apache.isis.applib.services.message.MessageService;
 import org.apache.isis.applib.services.repository.RepositoryService;
 import org.apache.isis.applib.services.title.TitleService;
+import org.apache.isis.applib.services.user.UserCurrentSessionTimeZoneHolder;
+import org.apache.isis.applib.services.user.UserService;
 import org.apache.isis.applib.value.Blob;
+import org.apache.isis.extensions.fullcalendar.applib.CalendarEventable;
+import org.apache.isis.extensions.fullcalendar.applib.value.CalendarEvent;
 import org.apache.isis.extensions.pdfjs.applib.annotations.PdfJsViewer;
 import org.apache.isis.persistence.jpa.applib.integration.IsisEntityListener;
 import org.apache.isis.persistence.jpa.applib.types.BlobJpaEmbeddable;
@@ -80,7 +94,7 @@ import domainapp.modules.simple.types.Notes;
 @NoArgsConstructor(access = AccessLevel.PUBLIC)
 @XmlJavaTypeAdapter(PersistentEntityAdapter.class)
 @ToString(onlyExplicitlyIncluded = true)
-public class SimpleObject implements Comparable<SimpleObject> {
+public class SimpleObject implements Comparable<SimpleObject>, 
CalendarEventable {
 
     static final String NAMED_QUERY__FIND_BY_NAME_LIKE = 
"SimpleObject.findByNameLike";
 
@@ -139,6 +153,31 @@ public class SimpleObject implements 
Comparable<SimpleObject> {
         this.attachment = BlobJpaEmbeddable.fromBlob(attachment);
     }
 
+
+
+    @Property(optionality = Optionality.OPTIONAL, editing = Editing.ENABLED)
+    @PropertyLayout(fieldSetId = LayoutConstants.FieldSetId.DETAILS, sequence 
= "3")
+    @Column(nullable = true)
+    @Getter @Setter
+    private java.time.LocalDate lastCheckedIn;
+
+
+    @Override
+    public String getCalendarName() {
+        return "Last checked-in";
+    }
+
+    @Override
+    public CalendarEvent toCalendarEvent() {
+        if (getLastCheckedIn() != null) {
+            long epochMillis = 
getLastCheckedIn().toEpochSecond(LocalTime.MIDNIGHT, 
ZoneOffset.systemDefault().getRules().getOffset(getLastCheckedIn().atStartOfDay()))
 * 1000L;
+            return new CalendarEvent(epochMillis, getCalendarName(), 
titleService.titleOf(this), getNotes());
+        } else {
+            return null;
+        }
+    }
+
+
     @Action(semantics = IDEMPOTENT, commandPublishing = Publishing.ENABLED, 
executionPublishing = Publishing.ENABLED)
     @ActionLayout(
             associateWith = "name", promptStyle = PromptStyle.INLINE,
diff --git 
a/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObjectBuilder.java
 
b/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObjectBuilder.java
index b54ea84..ac9ad03 100644
--- 
a/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObjectBuilder.java
+++ 
b/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObjectBuilder.java
@@ -7,7 +7,9 @@ import javax.inject.Inject;
 
 import org.springframework.core.io.ClassPathResource;
 
+import org.apache.isis.applib.services.clock.ClockService;
 import org.apache.isis.applib.value.Blob;
+import org.apache.isis.testing.fakedata.applib.services.FakeDataService;
 import 
org.apache.isis.testing.fixtures.applib.personas.BuilderScriptWithResult;
 
 import domainapp.modules.simple.dom.so.SimpleObject;
@@ -21,10 +23,8 @@ import lombok.experimental.Accessors;
 @Accessors(chain = true)
 public class SimpleObjectBuilder extends BuilderScriptWithResult<SimpleObject> 
{
 
-    @Getter @Setter
-    private String name;
-    @Getter @Setter
-    private String contentFileName;
+    @Getter @Setter private String name;
+    @Getter @Setter private String contentFileName;
 
     @Override
     protected SimpleObject buildResult(final ExecutionContext ec) {
@@ -38,6 +38,9 @@ public class SimpleObjectBuilder extends 
BuilderScriptWithResult<SimpleObject> {
             val attachment = new Blob(contentFileName, "application/pdf", 
bytes);
             simpleObject.updateAttachment(attachment);
         }
+
+        
simpleObject.setLastCheckedIn(clockService.getClock().nowAsLocalDate().plusDays(fakeDataService.ints().between(-10,
 +10)));
+
         return simpleObject;
     }
 
@@ -59,5 +62,8 @@ public class SimpleObjectBuilder extends 
BuilderScriptWithResult<SimpleObject> {
     // -- DEPENDENCIES
 
     @Inject SimpleObjects simpleObjects;
+    @Inject ClockService clockService;
+    @Inject FakeDataService fakeDataService;
+
 
 }
diff --git 
a/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObject_persona.java
 
b/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObject_persona.java
index 525206d..8fc5df2 100644
--- 
a/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObject_persona.java
+++ 
b/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleObject_persona.java
@@ -1,15 +1,23 @@
 package domainapp.modules.simple.fixture;
 
+import java.time.LocalDate;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.services.clock.ClockService;
 import org.apache.isis.applib.services.registry.ServiceRegistry;
+import org.apache.isis.testing.fakedata.applib.services.FakeDataService;
 import org.apache.isis.testing.fixtures.applib.personas.Persona;
 import org.apache.isis.testing.fixtures.applib.setup.PersonaEnumPersistAll;
 
 import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
 
 import domainapp.modules.simple.dom.so.SimpleObject;
 import domainapp.modules.simple.dom.so.SimpleObjects;
 
-@AllArgsConstructor
+@RequiredArgsConstructor
 public enum SimpleObject_persona
 implements Persona<SimpleObject, SimpleObjectBuilder> {
 
@@ -29,7 +37,9 @@ implements Persona<SimpleObject, SimpleObjectBuilder> {
 
     @Override
     public SimpleObjectBuilder builder() {
-        return new 
SimpleObjectBuilder().setName(name).setContentFileName(contentFileName);
+                return new SimpleObjectBuilder()
+                    .setName(name)
+                    .setContentFileName(contentFileName);
     }
 
     @Override
@@ -45,4 +55,5 @@ implements Persona<SimpleObject, SimpleObjectBuilder> {
             super(SimpleObject_persona.class);
         }
     }
+
 }
diff --git a/webapp/pom.xml b/webapp/pom.xml
index b8d6923..0845607 100644
--- a/webapp/pom.xml
+++ b/webapp/pom.xml
@@ -102,17 +102,22 @@
 
         <dependency>
             <groupId>org.apache.isis.extensions</groupId>
-            <artifactId>isis-extensions-exceldownload-wicket-ui</artifactId> 
<!--.-->
+            <artifactId>isis-extensions-exceldownload-wicket-ui</artifactId>
         </dependency>
 
         <dependency>
             <groupId>org.apache.isis.extensions</groupId>
-            <artifactId>isis-extensions-pdfjs-wicket-ui</artifactId> <!--.-->
+            <artifactId>isis-extensions-fullcalendar-wicket-ui</artifactId>
         </dependency>
 
         <dependency>
             <groupId>org.apache.isis.extensions</groupId>
-            <artifactId>isis-extensions-secman-encryption-jbcrypt</artifactId> 
<!--.-->
+            <artifactId>isis-extensions-pdfjs-wicket-ui</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.extensions</groupId>
+            <artifactId>isis-extensions-secman-encryption-jbcrypt</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.isis.extensions</groupId>
diff --git a/webapp/src/main/java/domainapp/webapp/AppManifest.java 
b/webapp/src/main/java/domainapp/webapp/AppManifest.java
index f5892e4..4329382 100644
--- a/webapp/src/main/java/domainapp/webapp/AppManifest.java
+++ b/webapp/src/main/java/domainapp/webapp/AppManifest.java
@@ -14,6 +14,7 @@ import 
org.apache.isis.extensions.commandlog.jpa.IsisModuleExtCommandLogPersiste
 import 
org.apache.isis.extensions.executionlog.jpa.IsisModuleExtExecutionLogPersistenceJpa;
 import 
org.apache.isis.extensions.executionoutbox.jpa.IsisModuleExtExecutionOutboxPersistenceJpa;
 import org.apache.isis.extensions.flyway.impl.IsisModuleExtFlywayImpl;
+import 
org.apache.isis.extensions.fullcalendar.wkt.viewer.IsisModuleExtFullCalendarWicketUi;
 import org.apache.isis.extensions.pdfjs.wkt.ui.IsisModuleExtPdfjsWicketUi;
 import 
org.apache.isis.extensions.secman.encryption.jbcrypt.IsisModuleExtSecmanEncryptionJbcrypt;
 import org.apache.isis.extensions.secman.jpa.IsisModuleExtSecmanPersistenceJpa;
@@ -58,6 +59,7 @@ import domainapp.webapp.quartz.QuartzModule;
         IsisModuleExtExecutionOutboxPersistenceJpa.class,
 
         IsisModuleExtExcelDownloadWicketUi.class,
+        IsisModuleExtFullCalendarWicketUi.class,
         IsisModuleExtPdfjsWicketUi.class,
 
         IsisModuleValAsciidocMetaModel.class, // for pretty rendering of DTO 
objects such as CommandDto, InteractionDto
diff --git a/webapp/src/main/resources/static/css/application.css 
b/webapp/src/main/resources/static/css/application.css
index 888fac0..f47df5f 100644
--- a/webapp/src/main/resources/static/css/application.css
+++ b/webapp/src/main/resources/static/css/application.css
@@ -1,3 +1,8 @@
 body > nav > div > a > img {
     height: 32px;
 }
+
+
+td.fc-day a.fc-daygrid-event {
+    cursor: pointer;
+}
diff --git a/webapp/src/main/resources/static/index.html 
b/webapp/src/main/resources/static/index.html
index 5e8c12d..a7f42f3 100644
--- a/webapp/src/main/resources/static/index.html
+++ b/webapp/src/main/resources/static/index.html
@@ -46,7 +46,7 @@
             </ul>
 
             <p>
-            The default user/password is <b><i>sven/pass</i></b>.
+            The default admin/password is <b><i>secman-admin/pass</i></b>, the 
default regular user/password is <b><i>sven/pass</i></b>.
             </p>
 
         </div>

Reply via email to