cmailleux 2005/10/20 16:19:55 CEST
Modified files:
core/src/conf/java nstep-workflowResources.properties
nstep-workflowResources_fr.properties
core/src/java/org/jahia/services/acl
JahiaACLManagerService.java
core/src/java/org/jahia/services/importexport
ProductionJob.java
core/src/java/org/jahia/services/scheduler
SchedulerService.java
SchedulerServiceImpl.java
core/src/java/org/jahia/workflow/nstep/model Workflow.java
core/src/java/org/jahia/workflow/nstep NStepWorkflow.java
Added files:
core/src/conf/java nstep-workflowResources_en.properties
Log:
Correct flush of acl cache
Add option to export site after last step of an nstep workflow
Revision Changes Path
1.2 +8 -1
jahia/core/src/conf/java/nstep-workflowResources.properties
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/conf/java/nstep-workflowResources.properties.diff?r1=1.1&r2=1.2&f=h
1.1 +21 -0
jahia/core/src/conf/java/nstep-workflowResources_en.properties (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/conf/java/nstep-workflowResources_en.properties?rev=1.1&content-type=text/plain
1.2 +8 -1
jahia/core/src/conf/java/nstep-workflowResources_fr.properties
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/conf/java/nstep-workflowResources_fr.properties.diff?r1=1.1&r2=1.2&f=h
1.11 +1 -5
jahia/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java.diff?r1=1.10&r2=1.11&f=h
1.2 +2 -2
jahia/core/src/java/org/jahia/services/importexport/ProductionJob.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/importexport/ProductionJob.java.diff?r1=1.1&r2=1.2&f=h
1.4 +3 -0
jahia/core/src/java/org/jahia/services/scheduler/SchedulerService.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/scheduler/SchedulerService.java.diff?r1=1.3&r2=1.4&f=h
1.7 +18 -4
jahia/core/src/java/org/jahia/services/scheduler/SchedulerServiceImpl.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/scheduler/SchedulerServiceImpl.java.diff?r1=1.6&r2=1.7&f=h
1.8 +66 -7
jahia/core/src/java/org/jahia/workflow/nstep/NStepWorkflow.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/workflow/nstep/NStepWorkflow.java.diff?r1=1.7&r2=1.8&f=h
1.4 +5 -0
jahia/core/src/java/org/jahia/workflow/nstep/model/Workflow.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/workflow/nstep/model/Workflow.java.diff?r1=1.3&r2=1.4&f=h
Index: nstep-workflowResources_en.properties
====================================================================
worklow.name = N-Step Workflow
comment.form.label = comment
workflow.last.step.production.no = Do not put in production now (wait for the
standard schedule defined by the adminsitrator)
workflow.last.step.production.job = Start production job ${jobName}
process.three_validation_step_workflow.mail.subject = [JAHIA] Workflow
${processName} modification by user ${userName} on page(s) : ${pageTitle}
edited by ${authorName}
process.three_validation_step_workflow.mail.body.rollback.to.author = The
modification on page ${pageTitle} have been refused. \nComment :
${comment}\nLink to page : ${pageLink}
process.three_validation_step_workflow.mail.body.rollback = The modification
on page ${pageTitle} have been refused. Rollback to ${step}\nComment :
${comment}\nLink to page : ${pageLink}
process.three_validation_step_workflow.mail.body.finish.published = The page
${pageTitle} is now published. \nComment : ${comment}\nLink to page :
${pageLink}
process.three_validation_step_workflow.mail.body.finish.deleted = The page
${pageTitle} is now deleted. \nComment : ${comment}
process.three_validation_step_workflow.mail.body.step.advance = The page
${pageTitle} edited by ${authorName} waits your validation to go through step
${step} to ${nextStep}\nComment : ${comment}\nLink to page : ${pageLink}
process.three_validation_step_workflow.display.name = Three Validation Step
process.three_validation_step_workflow.step.first_step = Notify edition of
current page
process.three_validation_step_workflow.step.second_step = Validate edition of
current page
process.three_validation_step_workflow.step.third_step = Publish modification
on current page
process.three_validation_step_workflow.step.rollback_to_previous_step =
Rollback to previous step
process.three_validation_step_workflow.step.rollback_to_author = Rollback to
author
workflow.last.step.production.label=Choose the server(s) where you want
immediatly export the content you are now validating without waiting for the
standard schedule \n\
defined by the administrator.\n\
<b>Warning : the immediate export to a distant server implies the immediate
export of all the website validated content \n\
from the previous export in production.</b>
process.three_validation_step_workflow.last.step.production.present=true
Index: nstep-workflowResources.properties
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/conf/java/nstep-workflowResources.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- nstep-workflowResources.properties 16 Jun 2005 08:42:43 -0000
1.1
+++ nstep-workflowResources.properties 20 Oct 2005 14:19:54 -0000
1.2
@@ -1,5 +1,11 @@
worklow.name = N-Step Workflow
comment.form.label = comment
+workflow.last.step.production.no = Do not put in production now (wait for
the standard schedule defined by the adminsitrator)
+workflow.last.step.production.job = Start production job ${jobName}
+workflow.last.step.production.label = Choose the server(s) where you want to
export the content you are now validating without waiting for the standard
schedule \
+ defined by the administrator.\
+ <b>Warning : the immediate export to a distant server implies the immediate
export of all the website validated content \
+ from the previous export in production.</b>
process.three_validation_step_workflow.mail.subject = [JAHIA] Workflow
${processName} modification by user ${userName} on page(s) : ${pageTitle}
edited by ${authorName}
process.three_validation_step_workflow.mail.body.rollback.to.author = The
modification on page ${pageTitle} have been refused. \nComment :
${comment}\nLink to page : ${pageLink}
process.three_validation_step_workflow.mail.body.rollback = The modification
on page ${pageTitle} have been refused. Rollback to ${step}\nComment :
${comment}\nLink to page : ${pageLink}
@@ -11,4 +17,5 @@
process.three_validation_step_workflow.step.second_step = Validate edition
of current page
process.three_validation_step_workflow.step.third_step = Publish
modification on current page
process.three_validation_step_workflow.step.rollback_to_previous_step =
Rollback to previous step
-process.three_validation_step_workflow.step.rollback_to_author = Rollback to
author
\ No newline at end of file
+process.three_validation_step_workflow.step.rollback_to_author = Rollback to
author
+process.three_validation_step_workflow.last.step.production.present = true
\ No newline at end of file
Index: nstep-workflowResources_fr.properties
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/conf/java/nstep-workflowResources_fr.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- nstep-workflowResources_fr.properties 29 Sep 2005 15:01:52 -0000
1.1
+++ nstep-workflowResources_fr.properties 20 Oct 2005 14:19:54 -0000
1.2
@@ -11,4 +11,11 @@
process.three_validation_step_workflow.step.second_step = Valider
l'édition de la page courante
process.three_validation_step_workflow.step.third_step = Publier les
modifications de la page courante
process.three_validation_step_workflow.step.rollback_to_previous_step =
Rollback to previous step
-process.three_validation_step_workflow.step.rollback_to_author = Rollback to
author
\ No newline at end of file
+process.three_validation_step_workflow.step.rollback_to_author = Rollback to
author
+workflow.last.step.production.no=Ne pas mettre en production tout de suite
(le contenu sera mis en production selon le planning défini par
l'administrateur)
+workflow.last.step.production.job=Lancer la mise en production : ${jobName}
+workflow.last.step.production.label=Choisissez le(s) serveur(s) vers
le(s)quel(s) vous souhaitez exporter immédiatement le contenu que vous
êtes en train de valider \n\
+ sans attendre la mise en production périodique prévue par
l'administrateur.\n \
+ <b>Attention : la mise en production immédiate sur serveur distant
implique la mise en production immédiate de l'ensemble du site \n\
+ (incluant donc tous les contenus validés depuis la dernière mise en
production)</b>
+process.three_validation_step_workflow.last.step.production.present=true
\ No newline at end of file
Index: JahiaACLManagerService.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JahiaACLManagerService.java 19 Aug 2005 15:51:28 -0000 1.10
+++ JahiaACLManagerService.java 20 Oct 2005 14:19:54 -0000 1.11
@@ -47,16 +47,12 @@
import org.jahia.exceptions.JahiaInitializationException;
import org.jahia.exceptions.database.JahiaDatabaseException;
import org.jahia.hibernate.manager.JahiaAclManager;
-import org.jahia.hibernate.manager.SpringContextSingleton;
import org.jahia.hibernate.model.JahiaAcl;
-import org.jahia.registries.ServicesRegistry;
import org.jahia.services.JahiaService;
import org.jahia.services.cache.Cache;
-import org.jahia.services.cache.CacheFactory;
import org.jahia.services.cache.CacheService;
import org.jahia.services.usermanager.JahiaGroup;
import org.jahia.services.usermanager.JahiaUser;
-import org.jahia.settings.SettingsBean;
import org.springframework.orm.ObjectRetrievalFailureException;
import java.util.Vector;
@@ -362,7 +358,7 @@
public void updateCache(JahiaAcl jahiaACL) {
manager.update(jahiaACL);
- mACLCache.put(jahiaACL.getId(), jahiaACL);
+ mACLCache.flush();
}
}
Index: ProductionJob.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/importexport/ProductionJob.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProductionJob.java 2 Sep 2005 10:26:21 -0000 1.1
+++ ProductionJob.java 20 Oct 2005 14:19:54 -0000 1.2
@@ -22,8 +22,8 @@
* To change this template use File | Settings | File Templates.
*/
public class ProductionJob implements StatefulJob {
- static final String JOB_NAME_PREFIX = "ProductionJob_";
- static final String JOB_GROUP_NAME = "ProductionJob";
+ public static final String JOB_NAME_PREFIX = "ProductionJob_";
+ public static final String JOB_GROUP_NAME = "ProductionJob";
static final String TRIGGER_NAME_PREFIX = "ProductionJobTrigger_";
public static final String SITE_ID = "Site_Id";
public static final String TARGET_NAME = "Target_Name";
Index: SchedulerService.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/scheduler/SchedulerService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SchedulerService.java 23 Aug 2005 15:54:54 -0000 1.3
+++ SchedulerService.java 20 Oct 2005 14:19:54 -0000 1.4
@@ -22,4 +22,7 @@
public abstract JobDetail getJobDetail(String jobName, String groupName)
throws JahiaException;
+ public abstract String[] getJobNames(String jobGroupName) throws
JahiaException;
+
+ public abstract void triggerJobWithVolatileTrigger(String jobName,
String jobGroupName) throws JahiaException;
}
Index: SchedulerServiceImpl.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/scheduler/SchedulerServiceImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SchedulerServiceImpl.java 23 Aug 2005 15:54:54 -0000 1.6
+++ SchedulerServiceImpl.java 20 Oct 2005 14:19:54 -0000 1.7
@@ -1,13 +1,12 @@
package org.jahia.services.scheduler;
-import org.jahia.settings.SettingsBean;
+import org.jahia.exceptions.JahiaException;
import org.jahia.exceptions.JahiaInitializationException;
-import org.quartz.SchedulerFactory;
+import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
-import org.jahia.exceptions.JahiaException;
-import org.quartz.JobDetail;
import org.quartz.Trigger;
+
import java.io.File;
public class SchedulerServiceImpl extends SchedulerService {
@@ -142,4 +141,19 @@
}
}
+ public String[] getJobNames(String jobGroupName) throws JahiaException {
+ try {
+ return scheduler.getJobNames(jobGroupName);
+ } catch (SchedulerException e) {
+ throw getJahiaException(e);
+ }
+ }
+
+ public void triggerJobWithVolatileTrigger(String jobName, String
jobGroupName) throws JahiaException {
+ try {
+ scheduler.triggerJobWithVolatileTrigger(jobName, jobGroupName);
+ } catch (SchedulerException e) {
+ throw getJahiaException(e);
+ }
+ }
}
Index: Workflow.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/workflow/nstep/model/Workflow.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Workflow.java 30 Sep 2005 16:31:06 -0000 1.3
+++ Workflow.java 20 Oct 2005 14:19:55 -0000 1.4
@@ -64,5 +64,10 @@
public void setSteps(List steps) {
this.steps = steps;
}
+
+ public boolean isLastStep(String actionName) {
+ WorkflowStep lastStep = (WorkflowStep) steps.get(steps.size()-1);
+ return lastStep.getName().equals(actionName);
+ }
}
Index: NStepWorkflow.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/workflow/nstep/NStepWorkflow.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NStepWorkflow.java 30 Sep 2005 08:40:28 -0000 1.7
+++ NStepWorkflow.java 20 Oct 2005 14:19:55 -0000 1.8
@@ -9,7 +9,9 @@
import org.jahia.hibernate.manager.SpringContextSingleton;
import org.jahia.params.ProcessingContext;
import org.jahia.registries.ServicesRegistry;
+import org.jahia.services.importexport.ProductionJob;
import org.jahia.services.mail.MailService;
+import org.jahia.services.scheduler.SchedulerService;
import org.jahia.services.usermanager.JahiaGroup;
import org.jahia.services.usermanager.JahiaUser;
import org.jahia.services.version.ActivationTestResults;
@@ -18,6 +20,7 @@
import org.jahia.services.version.StateModificationContext;
import org.jahia.services.workflow.ExternalWorkflow;
import org.jahia.services.workflow.WorkflowService;
+import org.jahia.workflow.nstep.model.Workflow;
import org.jahia.workflow.nstep.model.WorkflowInstance;
import org.jahia.workflow.nstep.model.WorkflowStep;
import org.springframework.context.ApplicationContext;
@@ -34,13 +37,17 @@
* Date: 9 déc. 2004
* Time: 14:53:40
* @author [EMAIL PROTECTED]
- * @version $Id: NStepWorkflow.java,v 1.7 2005/09/30 08:40:28 cmailleux Exp $
+ * @version $Id: NStepWorkflow.java,v 1.8 2005/10/20 14:19:55 cmailleux Exp $
*
* Revision log :
* $Log: NStepWorkflow.java,v $
+ * Revision 1.8 2005/10/20 14:19:55 cmailleux
+ * Correct flush of acl cache
+ * Add option to export site after last step of an nstep workflow
+ *
* Revision 1.7 2005/09/30 08:40:28 cmailleux
- * Show only rollback to author after first step and show rollback one step
and rollback to author after that
- *
+ * Show only rollback to author after first step and show rollback one step
and rollback to author after that
+ *
* Add some javadoc
*
*/
@@ -303,10 +310,46 @@
if (comment == null) {
comment = "comment";
}
- return "<table border=\"0\"><tr><td valign=\"middle\">" + comment +
" :</td>" +
- "<td valign=\"top\">" +
- "<textarea class=\"input\" name=\"nstepcomment\" cols=\"40\"
rows=\"4\"></textarea>" +
- "</td></tr></table>";
+ StringBuffer s = new StringBuffer("<table border=\"0\"><tr><td
valign=\"middle\">" + comment + " :</td>" +
+ "<td valign=\"top\">" +
+ "<textarea class=\"input\"
name=\"nstepcomment\" cols=\"40\" rows=\"4\"></textarea>");
+ String productionPresence;
+ try {
+ productionPresence = resourceBundle.getString("process." +
trimActionName(processName).toLowerCase() + ".last.step.production.present");
+ } catch (MissingResourceException e) {
+ productionPresence = Boolean.FALSE.toString();
+ }
+ if (Boolean.valueOf(productionPresence).booleanValue()) {
+ Workflow workflowByName =
workflowManager.getWorkflowByName(processName);
+ if (workflowByName.isLastStep(untrimActionName(actionName))) {
+ SchedulerService schedulerServ =
ServicesRegistry.getInstance().getSchedulerService();
+ try {
+ String[] jobNames =
schedulerServ.getJobNames(ProductionJob.JOB_GROUP_NAME);
+ // ensure we only show the site job
+ String jobNamePrefix = ProductionJob.JOB_NAME_PREFIX +
jParams.getSiteID();
+ StringBuffer options = new StringBuffer();
+ options.append("<option value=\"none\"
selected>").append(resourceBundle.getString("workflow.last.step.production.no")).append("</option>");
+ int nbOptions = 0;
+ for (int i = 0; i < jobNames.length; i++) {
+ String jobName = jobNames[i];
+ if (jobName.startsWith(jobNamePrefix)) {
+ nbOptions++;
+ options.append("<option
value=\"").append(jobName).append("\">").append(resourceBundle.getString("workflow.last.step.production.job").replaceAll("\\$\\{jobName\\}",
jobName)).append("</option>");
+ }
+ }
+ if (nbOptions > 0) {
+
s.append("<p>").append(resourceBundle.getString("workflow.last.step.production.label")).append("</p>");
+ s.append("<select name=\"nstepJobNamesToActivate\"
multiple size=\"").append(nbOptions < 5 ? nbOptions + 1 : 6).append("\">");
+ s.append(options.toString());
+ s.append("</select>");
+ }
+ } catch (JahiaException e) {
+ e.printStackTrace(); //To change body of catch
statement use File | Settings | File Templates.
+ }
+ }
+ }
+ s.append("</td></tr></table>");
+ return s.toString();
}
/**
@@ -323,6 +366,7 @@
try {
String unTrimmedActionName = untrimActionName(actionName);
String comment = jParams.getParameter("nstepcomment");
+ String[] selectedJobNames =
jParams.getParameterValues("nstepJobNamesToActivate");
boolean isStartStep = false;
boolean isFinished = false;
WorkflowInstance instance;
@@ -358,7 +402,21 @@
languageCode);
if (isFinished) {
// Publish object
- finishProcess(languageCode, jParams, objectKey,
processName);
+ ActivationTestResults testResults =
finishProcess(languageCode, jParams, objectKey, processName);
+ if (testResults.getStatus() ==
ActivationTestResults.COMPLETED_OPERATION_STATUS &&
+ (selectedJobNames != null && selectedJobNames.length
> 0)) {
+ SchedulerService schedulerServ =
ServicesRegistry.getInstance().getSchedulerService();
+ for (int i = 0; i < selectedJobNames.length; i++) {
+ String selectedJobName = selectedJobNames[i];
+ if(!"none".equals(selectedJobName)) {
+ try {
+
schedulerServ.triggerJobWithVolatileTrigger(selectedJobName,
ProductionJob.JOB_GROUP_NAME);
+ } catch(JahiaException e) {
+ log.error("Error du ring exectuion of
job "+selectedJobName,e);
+ }
+ }
+ }
+ }
} else {
changeStatus(languageCode, jParams, objectKey,
processName,
EntryLoadRequest.WAITING_WORKFLOW_STATE);