1 56 package org.opencrx.kernel.workflow; 57 58 import java.util.Iterator ; 59 import java.util.Map ; 60 import java.util.Map.Entry; 61 62 import org.opencrx.kernel.layer.application.OpenCrxKernel_1; 63 import org.opencrx.kernel.layer.application.SynchWorkflow_1_0; 64 import org.openmdx.base.exception.ServiceException; 65 import org.openmdx.compatibility.base.dataprovider.cci.DataproviderObject; 66 import org.openmdx.compatibility.base.dataprovider.cci.DataproviderObject_1_0; 67 import org.openmdx.compatibility.base.dataprovider.cci.RequestCollection; 68 import org.openmdx.compatibility.base.dataprovider.cci.ServiceHeader; 69 import org.openmdx.compatibility.base.naming.Path; 70 71 public class SendAlert 72 implements SynchWorkflow_1_0 { 73 74 77 public void execute( 78 DataproviderObject_1_0 userHome, 79 Path targetObjectIdentity, 80 Map params, 81 Path wfProcessInstanceIdentity, 82 ServiceHeader header, 83 RequestCollection delegation, 84 OpenCrxKernel_1 plugin 85 ) throws ServiceException { 86 DataproviderObject sendAlertParams = new DataproviderObject(new Path("")); 87 sendAlertParams.values("toUsers").add( 88 userHome.path().getBase() 89 ); 90 sendAlertParams.values("name").add("SendAlert notification"); 91 String description = ""; 92 for( 93 Iterator i = params.entrySet().iterator(); 94 i.hasNext(); 95 ) { 96 Entry e = (Entry)i.next(); 97 description += e.getKey() + "=" + e.getValue() + "\n"; 98 } 99 sendAlertParams.values("description").add(description); 100 sendAlertParams.values("importance").add(new Integer (5)); 101 sendAlertParams.values("reference").add(targetObjectIdentity); 102 try { 103 plugin.sendAlert( 104 header, 105 targetObjectIdentity, 106 sendAlertParams 107 ); 108 } 109 catch(ServiceException e) { 110 System.out.println("can not execute workflow SendAlert. Reason " + e.getMessage()); 111 } 112 } 113 114 } 115 116 | Popular Tags |