1 20 21 package org.apache.directory.ldapstudio.dsmlv2.request; 22 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 27 import org.apache.directory.shared.ldap.codec.LdapMessage; 28 29 30 36 public class BatchRequest 37 { 38 41 private List <LdapMessage> requests; 42 43 46 private int requestID; 47 48 54 public enum Processing 55 { 56 SEQUENTIAL, PARALLEL 57 }; 58 59 62 private Processing processing; 63 64 70 public enum OnError 71 { 72 RESUME, EXIT 73 }; 74 75 78 private OnError onError; 79 80 86 public enum ResponseOrder 87 { 88 SEQUENTIAL, UNORDERED 89 }; 90 91 94 private ResponseOrder responseOrder; 95 96 97 100 public BatchRequest() 101 { 102 requests = new ArrayList <LdapMessage>(); 103 responseOrder = ResponseOrder.SEQUENTIAL; 104 processing = Processing.SEQUENTIAL; 105 onError = OnError.EXIT; 106 } 107 108 109 117 public boolean addRequest( LdapMessage request ) 118 { 119 return requests.add( request ); 120 } 121 122 123 129 public LdapMessage getCurrentRequest() 130 { 131 return requests.get( requests.size() - 1 ); 132 } 133 134 135 141 public int getRequestID() 142 { 143 return requestID; 144 } 145 146 147 153 public void setRequestID( int requestID ) 154 { 155 this.requestID = requestID; 156 } 157 158 159 165 public Processing getProcessing() 166 { 167 return processing; 168 } 169 170 171 177 public void setProcessing( Processing processing ) 178 { 179 this.processing = processing; 180 } 181 182 183 189 public OnError getOnError() 190 { 191 return onError; 192 } 193 194 195 201 public void setOnError( OnError onError ) 202 { 203 this.onError = onError; 204 } 205 206 207 213 public ResponseOrder getResponseOrder() 214 { 215 return responseOrder; 216 } 217 218 219 225 public void setResponseOrder( ResponseOrder responseOrder ) 226 { 227 this.responseOrder = responseOrder; 228 } 229 230 231 237 public List getRequests() 238 { 239 return requests; 240 } 241 242 243 246 @Override 247 public String toString() 248 { 249 StringBuffer sb = new StringBuffer (); 250 251 sb.append( "[" ); 252 sb.append( "processing: " + processing ); 253 sb.append( " - " ); 254 sb.append( "onError: " + onError ); 255 sb.append( " - " ); 256 sb.append( "responseOrder: " + responseOrder ); 257 sb.append( "]" ); 258 259 return sb.toString(); 260 } 261 } 262 | Popular Tags |