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 2020/12/05 10:16:07 UTC

[isis] branch master updated: ISIS-2464: updates DemoJob (quartz docs)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9b8bd67  ISIS-2464: updates DemoJob (quartz docs)
9b8bd67 is described below

commit 9b8bd6735d85734a46cc4955d8572eaef14d14c1
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sat Dec 5 11:15:54 2020 +0100

    ISIS-2464: updates DemoJob (quartz docs)
---
 .../core/quartz/adoc/modules/quartz/examples/DemoJob.java   | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/extensions/core/quartz/adoc/modules/quartz/examples/DemoJob.java b/extensions/core/quartz/adoc/modules/quartz/examples/DemoJob.java
index d82d9ca..ecb6346 100644
--- a/extensions/core/quartz/adoc/modules/quartz/examples/DemoJob.java
+++ b/extensions/core/quartz/adoc/modules/quartz/examples/DemoJob.java
@@ -26,28 +26,31 @@ import javax.inject.Inject;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 
+import org.apache.isis.applib.services.user.UserMemento;
 import org.apache.isis.applib.services.user.UserService;
 import org.apache.isis.core.config.IsisConfiguration;
 import org.apache.isis.core.runtime.iactn.template.AbstractIsisInteractionTemplate;
 import org.apache.isis.core.security.authentication.Authentication;
 import org.apache.isis.core.security.authentication.standard.SimpleAuthentication;
 
+import lombok.val;
 import lombok.extern.log4j.Log4j2;
 
 //tag::class[]
-//TODO example is not up to date
 @Log4j2
 public class DemoJob implements Job {
 
     public void execute(final JobExecutionContext context) {
 
-        final Authentication auth = newAuthSession(context);
-        new DemoIsisInteractionTemplate().execute(authSession, null);
+        final Authentication authentication = newAuthentication(context);
+        new DemoIsisInteractionTemplate().execute(authentication, null);
 
     }
 
-    protected Authentication newAuthSession(JobExecutionContext context) {
-        return new SimpleAuthentication("isisModuleExtQuartzDemoUser", Arrays.asList("isisModuleExtQuartzDemoRole"));
+    protected Authentication newAuthentication(JobExecutionContext context) {
+        
+        val user = UserMemento.ofNameAndRoleNames("isisModuleExtQuartzDemoUser", Arrays.asList("isisModuleExtQuartzDemoRole")); 
+        return SimpleAuthentication.ofValid(user);
     }
 
     @Inject IsisConfiguration isisConfiguration;