1 18 19 20 package sync4j.framework.core; 21 22 import java.util.*; 23 24 31 public abstract class ResponseCommand 32 extends ItemizedCommand 33 implements java.io.Serializable { 34 35 37 40 protected String msgRef; 41 42 45 protected String cmdRef; 46 47 50 protected ArrayList targetRef = new ArrayList(); 51 52 55 protected ArrayList sourceRef = new ArrayList(); 56 57 59 62 protected ResponseCommand() {} 63 64 76 public ResponseCommand( 77 final CmdID cmdID , 78 final String msgRef , 79 final String cmdRef , 80 final TargetRef[] targetRefs, 81 final SourceRef[] sourceRefs, 82 final Item[] items ) { 83 super(cmdID, items); 84 85 setCmdRef(cmdRef); 86 87 this.msgRef = msgRef; 88 89 setTargetRef(targetRefs); 90 setSourceRef(sourceRefs); 91 } 92 93 95 101 public String getMsgRef() { 102 return this.msgRef; 103 } 104 105 110 public void setMsgRef(String msgRef) { 111 this.msgRef = msgRef; 112 } 113 114 120 public String getCmdRef() { 121 return cmdRef; 122 } 123 124 131 public void setCmdRef(String cmdRef) { 132 if (cmdRef == null) { 133 throw new IllegalArgumentException ("cmdRef cannot be null"); 134 } 135 this.cmdRef = cmdRef; 136 } 137 138 144 public ArrayList getTargetRef() { 145 return this.targetRef; 146 } 147 148 153 public void setTargetRef(TargetRef[] targetRefs) { 154 if (targetRefs == null) { 155 this.targetRef = null; 156 } else { 157 this.targetRef.clear(); 158 this.targetRef.addAll(Arrays.asList(targetRefs)); 159 } 160 } 161 162 168 public ArrayList getSourceRef() { 169 return this.sourceRef; 170 } 171 172 177 public void setSourceRef(SourceRef[] sourceRefs) { 178 if (sourceRefs == null) { 179 this.sourceRef = null; 180 } else { 181 this.sourceRef.clear(); 182 this.sourceRef.addAll(Arrays.asList(sourceRefs)); 183 } 184 } 185 186 191 abstract public String getName(); 192 193 } 194 | Popular Tags |