1 package org.enhydra.shark; 2 3 import org.enhydra.shark.api.SharkTransaction; 4 import org.enhydra.shark.api.TransactionException; 5 import org.enhydra.shark.api.client.timebase.UtcT; 6 import org.enhydra.shark.api.client.wfbase.BaseException; 7 import org.enhydra.shark.api.client.wfmodel.SourceNotAvailable; 8 import org.enhydra.shark.api.client.wfmodel.WfExecutionObject; 9 import org.enhydra.shark.api.client.wfservice.WfPackageEventAudit; 10 import org.enhydra.shark.persistence.PackageEventAuditPersistenceInterface; 11 import org.enhydra.shark.utilities.MiscUtilities; 12 13 14 17 public class WfPackageEventAuditImpl extends WfEventAuditWrapper 18 implements WfPackageEventAudit, PackageEventAuditPersistenceInterface { 19 20 private String packageVersion; 21 private String resourceUsername; 22 23 protected WfPackageEventAuditImpl(org.enhydra.shark.xpdl.elements.Package pkg, 24 String eventType,String resourceUsername) throws BaseException{ 25 this.timeStamp = new UtcT( 26 MiscUtilities.getAbsoluteTimeInUTCFormat(),0,(short)0,(short)0); 27 this.eventType=eventType; 28 this.packageId=pkg.getId(); 29 this.packageVersion=pkg.getInternalVersion(); 30 this.resourceUsername=resourceUsername; 31 try { 32 persist(null); 33 } catch (Exception ex) { 34 throw new BaseException(ex); 35 } 36 } 37 38 public String package_version () { 39 return packageVersion; 40 } 41 42 public String resource_username () { 43 return resourceUsername; 44 } 45 46 public WfExecutionObject source () throws BaseException, SourceNotAvailable { 47 throw new SourceNotAvailable("The source of WfPackageEventAudit is not available!"); 48 } 49 50 52 55 public WfPackageEventAuditImpl () { 56 } 58 59 public void setPackageVersion (String pkgVersion) { 60 packageVersion=pkgVersion; 61 } 62 63 public String getPackageVersion () { 64 return packageVersion; 65 } 66 67 public void setResourceUsername (String resUsername) { 68 resourceUsername=resUsername; 69 } 70 71 public String getResourceUsername () { 72 return resourceUsername; 73 } 74 75 public void setUTCTime (String time) { 76 try { 77 timeStamp = new UtcT(Long.parseLong(time),0,(short)0,(short)0); 78 } catch (Exception ex) {} 79 } 80 81 public String getUTCTime () { 82 return String.valueOf(timeStamp.time); 83 } 84 85 public void setType (String type) { 86 this.eventType=type; 87 } 88 89 public String getType () { 90 return eventType; 91 } 92 93 public void setActivityId (String aId) {} 94 95 public String getActivityId () { 96 return null; 97 } 98 99 public void setActivityName (String an) {} 100 101 public String getActivityName () { 102 return null; 103 } 104 105 public void setProcessId (String pId) {} 106 107 public String getProcessId () { 108 return null; 109 } 110 111 public void setProcessName (String n) {} 112 113 public String getProcessName () { 114 return null; 115 } 116 117 public void setProcessDefinitionName (String pn) {} 118 119 public String getProcessDefinitionName () { 120 return null; 121 } 122 123 public void setProcessDefinitionVersion (String pdv) {} 124 125 public String getProcessDefinitionVersion () { 126 return null; 127 } 128 129 public void setActivityDefinitionId (String adId) {} 130 131 public String getActivityDefinitionId () { 132 return null; 133 } 134 135 public void setActivitySetDefinitionId (String asdId) {} 136 137 public String getActivitySetDefinitionId () { 138 return null; 139 } 140 141 public void setProcessDefinitionId (String pdId) {} 142 143 public String getProcessDefinitionId () { 144 return null; 145 } 146 147 public void setPackageId (String pkgId) { 148 packageId=pkgId; 149 } 150 151 public String getPackageId () { 152 return packageId; 153 } 154 155 public void persist (SharkTransaction t) throws TransactionException { 156 String log="UTCTime="+getUTCTime()+",EventType="+getType()+ 157 ",PackageId="+getPackageId()+",PackageVersion="+getPackageVersion()+ 158 ",EventPerformedBy="+getResourceUsername(); 159 SharkEngineManager.getInstance().getCallbackUtilities().info("PackageEventLogger",log); 160 } 161 162 public void refresh () { 163 } 164 165 public void delete (SharkTransaction t) throws TransactionException { 166 } 167 168 } 169 | Popular Tags |