1 18 19 package sync4j.framework.engine.dm; 20 21 import java.util.Date ; 22 23 import java.io.Serializable ; 24 import org.apache.commons.lang.builder.ToStringBuilder; 25 26 34 public class DeviceDMState implements Serializable { 35 36 38 public static final byte STATE_UNKNOWN = '-'; 39 public static final byte STATE_UNMANAGEABLE = 'U'; 40 public static final byte STATE_MANAGEABLE = 'M'; 41 public static final byte STATE_NOTIFIED = 'N'; 42 public static final byte STATE_IN_PROGRESS = 'P'; 43 public static final byte STATE_COMPLETED = 'C'; 44 public static final byte STATE_ERROR = 'E'; 45 public static final byte STATE_ABORTED = 'A'; 46 47 public static final String PROPERTY_STATE = "state" ; 48 public static final String PROPERTY_SESSION_ID = "mssid" ; 49 public static final String PROPERTY_DEVICE_ID = "device"; 50 51 53 public String id ; 54 public String deviceId ; 55 public String mssid ; 56 public byte state ; 57 public Date start ; 58 public Date end ; 59 public String operation ; 60 public String info ; 61 62 64 65 public DeviceDMState() { 66 init(null, null, STATE_UNKNOWN, null, null, null, null); 67 } 68 69 74 public DeviceDMState(String deviceId) { 75 init(deviceId, null, STATE_UNKNOWN, null, null, null, null); 76 } 77 78 80 85 public void copyFrom(DeviceDMState dms) { 86 this.id = dms.id ; 87 this.deviceId = dms.deviceId ; 88 this.mssid = dms.mssid ; 89 this.state = dms.state ; 90 this.start = dms.start ; 91 this.end = dms.end ; 92 this.operation = dms.operation; 93 this.info = dms.info ; 94 } 95 97 109 private void init(String deviceId , 110 String mmsid , 111 byte state , 112 Date start , 113 Date end , 114 String operation, 115 String info ) { 116 this.deviceId = deviceId ; 117 this.mssid = mssid ; 118 this.state = state ; 119 this.start = start ; 120 this.end = end ; 121 this.operation = operation; 122 this.info = info ; 123 } 124 125 126 public String toString() { 128 ToStringBuilder sb = new ToStringBuilder(this); 129 130 sb.append("deviceId", deviceId ); 131 sb.append("mssid", mssid ); 132 sb.append("state", (char)state); 133 sb.append("start", start ); 134 sb.append("end", end ); 135 sb.append("operation", operation ); 136 sb.append("info", info ); 137 138 return sb.toString(); 139 } 140 141 } | Popular Tags |