| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.ken.postprocessor.kew; |
| 17 | |
|
| 18 | |
import java.rmi.RemoteException; |
| 19 | |
|
| 20 | |
import org.apache.log4j.Logger; |
| 21 | |
import org.kuali.rice.core.dao.GenericDao; |
| 22 | |
import org.kuali.rice.ken.bo.Notification; |
| 23 | |
import org.kuali.rice.ken.core.GlobalNotificationServiceLocator; |
| 24 | |
import org.kuali.rice.ken.document.kew.NotificationWorkflowDocument; |
| 25 | |
import org.kuali.rice.ken.service.NotificationMessageContentService; |
| 26 | |
import org.kuali.rice.ken.service.NotificationService; |
| 27 | |
import org.kuali.rice.ken.util.Util; |
| 28 | |
import org.kuali.rice.kew.dto.ActionTakenEventDTO; |
| 29 | |
import org.kuali.rice.kew.dto.AfterProcessEventDTO; |
| 30 | |
import org.kuali.rice.kew.dto.BeforeProcessEventDTO; |
| 31 | |
import org.kuali.rice.kew.dto.DeleteEventDTO; |
| 32 | |
import org.kuali.rice.kew.dto.DocumentLockingEventDTO; |
| 33 | |
import org.kuali.rice.kew.dto.DocumentRouteLevelChangeDTO; |
| 34 | |
import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO; |
| 35 | |
import org.kuali.rice.kew.dto.NetworkIdDTO; |
| 36 | |
import org.kuali.rice.kew.postprocessor.PostProcessorRemote; |
| 37 | |
import org.kuali.rice.kew.util.KEWConstants; |
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
public class NotificationSenderFormPostProcessor implements PostProcessorRemote { |
| 46 | 0 | private static final Logger LOG = Logger.getLogger(NotificationSenderFormPostProcessor.class); |
| 47 | |
|
| 48 | |
NotificationService notificationService; |
| 49 | |
GenericDao businessObjectDao; |
| 50 | |
NotificationMessageContentService messageContentService; |
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | 0 | public NotificationSenderFormPostProcessor() { |
| 56 | 0 | this.notificationService = GlobalNotificationServiceLocator.getInstance().getNotificationService(); |
| 57 | 0 | this.businessObjectDao = GlobalNotificationServiceLocator.getInstance().getGenericDao(); |
| 58 | 0 | this.messageContentService = GlobalNotificationServiceLocator.getInstance().getNotificationMessageContentService(); |
| 59 | 0 | } |
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | 0 | public NotificationSenderFormPostProcessor(NotificationService notificationService, GenericDao businessObjectDao) { |
| 67 | 0 | this.notificationService = notificationService; |
| 68 | 0 | this.businessObjectDao = businessObjectDao; |
| 69 | 0 | } |
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
public boolean doActionTaken(ActionTakenEventDTO arg0) throws RemoteException { |
| 75 | 0 | return true; |
| 76 | |
} |
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
public boolean doDeleteRouteHeader(DeleteEventDTO arg0) throws RemoteException { |
| 82 | 0 | return true; |
| 83 | |
} |
| 84 | |
|
| 85 | |
|
| 86 | |
|
| 87 | |
|
| 88 | |
public boolean doRouteLevelChange(DocumentRouteLevelChangeDTO arg0) throws RemoteException { |
| 89 | 0 | return true; |
| 90 | |
} |
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
|
| 97 | |
public boolean doRouteStatusChange(DocumentRouteStatusChangeDTO arg0) throws RemoteException { |
| 98 | 0 | LOG.debug("ENTERING NotificationSenderFormPostProcessor.doRouteStatusChange() for Notification Sender Form with route header ID: " + arg0.getRouteHeaderId()); |
| 99 | |
|
| 100 | 0 | if(arg0.getNewRouteStatus().equals(KEWConstants.ROUTE_HEADER_PROCESSED_CD)) { |
| 101 | 0 | LOG.debug("Workflow status has changed to RESOLVED for Notification Sender Form with route header ID: " + arg0.getRouteHeaderId() + |
| 102 | |
". We are now calling the NotificationService.sendNotification() service."); |
| 103 | |
|
| 104 | |
|
| 105 | 0 | NetworkIdDTO proxyUser = new NetworkIdDTO(Util.getNotificationSystemUser()); |
| 106 | |
|
| 107 | |
|
| 108 | |
NotificationWorkflowDocument document; |
| 109 | |
try { |
| 110 | 0 | document = new NotificationWorkflowDocument(proxyUser, arg0.getRouteHeaderId()); |
| 111 | |
|
| 112 | 0 | LOG.debug("XML:" + document.getApplicationContent()); |
| 113 | |
|
| 114 | |
|
| 115 | 0 | Notification notification = messageContentService.parseSerializedNotificationXml(document.getApplicationContent().getBytes()); |
| 116 | |
|
| 117 | 0 | LOG.debug("Notification Content: " + notification.getContent()); |
| 118 | |
|
| 119 | |
|
| 120 | 0 | notificationService.sendNotification(notification); |
| 121 | |
|
| 122 | 0 | LOG.debug("NotificationService.sendNotification() was successfully called for Notification Sender Form with route header ID: " + arg0.getRouteHeaderId()); |
| 123 | 0 | } catch(Exception e) { |
| 124 | 0 | throw new RuntimeException(e); |
| 125 | 0 | } |
| 126 | |
} |
| 127 | |
|
| 128 | 0 | LOG.debug("LEAVING NotificationSenderFormPostProcessor.doRouteStatusChange() for Notification Sender Form with route header ID: " + arg0.getRouteHeaderId()); |
| 129 | 0 | return true; |
| 130 | |
} |
| 131 | |
|
| 132 | |
|
| 133 | |
|
| 134 | |
|
| 135 | |
public boolean beforeProcess(BeforeProcessEventDTO beforeProcessEvent) throws Exception { |
| 136 | 0 | return true; |
| 137 | |
} |
| 138 | |
|
| 139 | |
|
| 140 | |
|
| 141 | |
|
| 142 | |
public boolean afterProcess(AfterProcessEventDTO afterProcessEvent) throws Exception { |
| 143 | 0 | return true; |
| 144 | |
} |
| 145 | |
|
| 146 | |
|
| 147 | |
|
| 148 | |
|
| 149 | |
public Long[] getDocumentIdsToLock(DocumentLockingEventDTO documentLockingEvent) throws Exception { |
| 150 | 0 | return null; |
| 151 | |
} |
| 152 | |
|
| 153 | |
} |