You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/12/27 00:18:31 UTC

svn commit: r729559 - in /lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases: Publish.java Reject.java

Author: andreas
Date: Fri Dec 26 15:18:24 2008
New Revision: 729559

URL: http://svn.apache.org/viewvc?rev=729559&view=rev
Log:
Improved notification message options of Publish and Reject usecases.

Modified:
    lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java
    lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Reject.java

Modified: lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java?rev=729559&r1=729558&r2=729559&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java (original)
+++ lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java Fri Dec 26 15:18:24 2008
@@ -80,12 +80,21 @@
      */
     public static final String PARAM_CHECK_MISSING_ANCESTORS = "checkMissingAncestors";
 
+    /**
+     * If a notification message shall be sent.
+     */
+    public static final String PARAM_SEND_NOTIFICATION = "sendNotification";
+
+    /**
+     * The notification message to send in addition to the default message.
+     */
+    public static final String PARAM_USER_NOTIFICATION_MESSAGE = "userNotificationMessage";
+
     protected static final String MESSAGE_SUBJECT = "notification-message";
     protected static final String MESSAGE_DOCUMENT_PUBLISHED = "document-published";
     protected static final String SCHEDULE = "schedule";
     protected static final String SCHEDULE_TIME = "schedule.time";
     protected static final String CAN_SEND_NOTIFICATION = "canSendNotification";
-    protected static final String SEND_NOTIFICATION = "sendNotification";
     protected static final String UNPUBLISHED_LINKS = "unpublishedLinks";
     
     /**
@@ -104,7 +113,7 @@
 
         Boolean canSendNotification = Boolean.valueOf(canNotifySubmitter());
         setParameter(CAN_SEND_NOTIFICATION, canSendNotification);
-        setParameter(SEND_NOTIFICATION, canSendNotification);
+        setParameter(PARAM_SEND_NOTIFICATION, canSendNotification);
         
         setParameter(UNPUBLISHED_LINKS, new LinkList(this.manager, getSourceDocument()));
         
@@ -349,7 +358,7 @@
             documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
             documentManager.copyToArea(authoringDocument, Publication.LIVE_AREA);
 
-            boolean notify = Boolean.valueOf(getBooleanCheckboxParameter(SEND_NOTIFICATION))
+            boolean notify = Boolean.valueOf(getBooleanCheckboxParameter(PARAM_SEND_NOTIFICATION))
                     .booleanValue();
             if (notify) {
                 sendNotification(authoringDocument);
@@ -393,8 +402,10 @@
         User sender = getSession().getIdentity().getUser();
         
         Text[] subjectParams = { new Text(getEvent(), true) };
-        Text[] params = { new Text(url, false) };
         Text subject = new Text(MESSAGE_SUBJECT, subjectParams);
+        
+        String userMessage = getParameterAsString(PARAM_USER_NOTIFICATION_MESSAGE, "");
+        Text[] params = { new Text(url, false), new Text(userMessage, false) };
         Text body = new Text(MESSAGE_DOCUMENT_PUBLISHED, params);
         Message message = new Message(subject, body, sender, recipients);
 

Modified: lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Reject.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Reject.java?rev=729559&r1=729558&r2=729559&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Reject.java (original)
+++ lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Reject.java Fri Dec 26 15:18:24 2008
@@ -42,11 +42,19 @@
  * Reject usecase handler.
  */
 public class Reject extends InvokeWorkflow {
+    
+    /**
+     * The reason for rejection.
+     */
+    public static final String PARAM_REJECT_REASON = "rejectReason";
+    
+    /**
+     * If a notification message shall be sent. 
+     */
+    public static final String PARAM_SEND_NOTIFICATION = "sendNotification";
 
     protected static final String MESSAGE_SUBJECT = "notification-message";
     protected static final String MESSAGE_DOCUMENT_REJECTED = "document-rejected";
-    protected static final String REJECT_REASON = "rejectReason";
-    protected static final String SEND_NOTIFICATION = "sendNotification";
 
     /**
      * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
@@ -55,7 +63,7 @@
 
         super.doExecute();
 
-        boolean notify = Boolean.valueOf(getBooleanCheckboxParameter(SEND_NOTIFICATION))
+        boolean notify = Boolean.valueOf(getBooleanCheckboxParameter(PARAM_SEND_NOTIFICATION))
                 .booleanValue();
         if (notify) {
             sendNotification(getSourceDocument());
@@ -67,7 +75,7 @@
 
         User sender = getSession().getIdentity().getUser();
 
-        String reason = getParameterAsString(REJECT_REASON);
+        String reason = getParameterAsString(PARAM_REJECT_REASON);
         Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                 getLogger(), authoringDocument);
         Version versions[] = workflowable.getVersions();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org