cmailleux 2005/08/22 15:34:52 CEST
Modified files:
core/src/java/org/jahia/hibernate/model JahiaSitesUserPK.java
core/src/java/org/jahia/workflow/nstep/model
WorkflowInstance.java
core/src/java/org/jahia/workflow/nstep/service/impl
WorkflowInstanceManagerImpl.java
core/src/java/org/jahia/workflow/nstep NStepWorkflow.java
Log:
Correct bug in sending mail in NStepWorkflow
Add a field timestamp in workflow instance to know when we started this step
of worflow.
Revision Changes Path
1.6 +2 -2
jahia/core/src/java/org/jahia/hibernate/model/JahiaSitesUserPK.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/hibernate/model/JahiaSitesUserPK.java.diff?r1=1.5&r2=1.6&f=h
1.5 +10 -9
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.4&r2=1.5&f=h
1.4 +17 -2
jahia/core/src/java/org/jahia/workflow/nstep/model/WorkflowInstance.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/workflow/nstep/model/WorkflowInstance.java.diff?r1=1.3&r2=1.4&f=h
1.3 +4 -0
jahia/core/src/java/org/jahia/workflow/nstep/service/impl/WorkflowInstanceManagerImpl.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/workflow/nstep/service/impl/WorkflowInstanceManagerImpl.java.diff?r1=1.2&r2=1.3&f=h
Index: JahiaSitesUserPK.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/hibernate/model/JahiaSitesUserPK.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JahiaSitesUserPK.java 21 Jul 2005 14:18:03 -0000 1.5
+++ JahiaSitesUserPK.java 22 Aug 2005 13:34:51 -0000 1.6
@@ -49,8 +49,8 @@
}
/**
- * @hibernate.many-to-one update="false"
- * insert="false" cascade="none" column="siteid_sites_users"
+ * @hibernate.many-to-one update="true"
+ * insert="true" cascade="all" column="siteid_sites_users"
*/
public JahiaSite getSite() {
return this.site;
Index: WorkflowInstance.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/workflow/nstep/model/WorkflowInstance.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WorkflowInstance.java 4 Aug 2005 08:52:36 -0000 1.3
+++ WorkflowInstance.java 22 Aug 2005 13:34:52 -0000 1.4
@@ -1,5 +1,6 @@
package org.jahia.workflow.nstep.model;
+import java.util.Date;
/*
@@ -21,7 +22,7 @@
private User user;
private Workflow workflow;
private WorkflowStep step;
-
+ private Date startDate;
// --------------------- GETTER / SETTER METHODS ---------------------
/**
@@ -103,7 +104,7 @@
}
/**
- * @return Returns the workflwo associated.
+ * @return Returns the workflow associated.
*
* @hibernate.many-to-one class="org.jahia.workflow.nstep.model.Workflow"
*/
@@ -114,5 +115,19 @@
public void setWorkflow(Workflow workflow) {
this.workflow = workflow;
}
+
+ /**
+ *
+ * @return The date of instanciation of this workflowstep
+ *
+ * @hibernate.property type="timestamp"
+ */
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(Date startDate) {
+ this.startDate = startDate;
+ }
}
Index: WorkflowInstanceManagerImpl.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/workflow/nstep/service/impl/WorkflowInstanceManagerImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WorkflowInstanceManagerImpl.java 22 Jun 2005 12:43:18 -0000 1.2
+++ WorkflowInstanceManagerImpl.java 22 Aug 2005 13:34:52 -0000 1.3
@@ -9,6 +9,7 @@
import org.springframework.orm.ObjectRetrievalFailureException;
import java.util.List;
+import java.util.Calendar;
/*
* Copyright (c) 2004 CODEVA. All Rights Reserved.
@@ -81,6 +82,7 @@
instance.setUser(user);
instance.setWorkflow(workflow);
instance.setStep((org.jahia.workflow.nstep.model.WorkflowStep)
workflow.getSteps().get(0));
+ instance.setStartDate(Calendar.getInstance().getTime());
instanceDAO.saveWorkflowInstance(instance);
}
@@ -95,6 +97,7 @@
}
instance.setStep((org.jahia.workflow.nstep.model.WorkflowStep)
steps.get(index));
instance.setUser(getUser(login));
+ instance.setStartDate(Calendar.getInstance().getTime());
instanceDAO.saveWorkflowInstance(instance);
return index == 0;
}
@@ -115,6 +118,7 @@
int indexCurrentStep = steps.indexOf(instance.getStep());
instance.setStep((org.jahia.workflow.nstep.model.WorkflowStep)
steps.get(indexCurrentStep + 1));
instance.setUser(getUser(login));
+ instance.setStartDate(Calendar.getInstance().getTime());
instanceDAO.saveWorkflowInstance(instance);
return (indexCurrentStep + 1) == (steps.size() - 1);
}
Index: NStepWorkflow.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/workflow/nstep/NStepWorkflow.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NStepWorkflow.java 5 Jul 2005 15:46:43 -0000 1.4
+++ NStepWorkflow.java 22 Aug 2005 13:34:52 -0000 1.5
@@ -6,6 +6,7 @@
import org.jahia.content.ContentObject;
import org.jahia.content.ObjectKey;
import org.jahia.exceptions.JahiaException;
+import org.jahia.hibernate.manager.SpringContextSingleton;
import org.jahia.params.ProcessingContext;
import org.jahia.registries.ServicesRegistry;
import org.jahia.services.mail.MailService;
@@ -19,9 +20,7 @@
import org.jahia.services.workflow.WorkflowService;
import org.jahia.workflow.nstep.model.WorkflowInstance;
import org.jahia.workflow.nstep.model.WorkflowStep;
-import org.jahia.hibernate.manager.SpringContextSingleton;
import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.orm.ObjectRetrievalFailureException;
import java.io.FileInputStream;
@@ -467,11 +466,11 @@
string = string.replaceAll("\\$\\{step\\}",stepLabel);
}
if (nextStep != null) {
- String stepLabel = curStep.getName();
+ String stepLabel = nextStep.getName();
try {
stepLabel = resourceBundle.getString("process." +
trimActionName(processName.toLowerCase()) +
".step." +
-
trimActionName(curStep.getName().toLowerCase()));
+
trimActionName(nextStep.getName().toLowerCase()));
} catch(Exception e) {
log.error("Resource bundle not found",e);
}
@@ -579,14 +578,16 @@
// Send an email to the author that is modification have been
refused
mailBody = getKey("process." + processName +
".mail.body.rollback.to.author", workflow, jParams, displayName, comment,
username,
curStep, nextStep, contentObjectInstance);
- mailService.sendMessage(from, workflow.getAuthorEmail(),
- cc, bcc, subject, mailBody);
+ mailService.sendMessage(from, workflow.getAuthorEmail(), cc,
bcc, subject, mailBody);
} else {
JahiaGroup group;
if (unTrimmedActionName.equals(rollback_action_name)) {
- mailBody = getKey("process." + processName +
".mail.body.rollback", workflow, jParams, displayName, comment, username,
curStep,
- nextStep, contentObjectInstance);
- group =
workflowService.getRoleGroup(jParams.getContentPage(),
trimActionName(curStep.getName()), true);
+ mailBody = getKey("process." + processName +
".mail.body.rollback", workflow, jParams, displayName, comment, username,
nextStep,
+ null, contentObjectInstance);
+// group =
workflowService.getRoleGroup(jParams.getContentPage(),
trimActionName(curStep.getName()), true);
+// sendMails(group, mailService, from, cc, bcc, subject,
mailBody);
+ // Send mail to group who refuse to validate
+ group =
workflowService.getRoleGroup(jParams.getContentPage(),
trimActionName(nextStep.getName()), true);
sendMails(group, mailService, from, cc, bcc, subject,
mailBody);
} else if (finished) {
if (contentObjectInstance.hasActiveEntries()) {