1 /* 2 * Copyright (C) 2007 ETH Zurich 3 * 4 * This file is part of Fosstrak (www.fosstrak.org). 5 * 6 * Fosstrak is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License version 2.1, as published by the Free Software Foundation. 9 * 10 * Fosstrak is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with Fosstrak; if not, write to the Free 17 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301 USA 19 */ 20 21 package org.fosstrak.epcis.captureclient; 22 23 import java.util.ArrayList; 24 25 /** 26 * Implements an example event object for the EPCIS Query Interface Client. 27 * 28 * @author David Gubler 29 */ 30 public class CaptureEvent { 31 /** 32 * Human readable description to be shown in the GUI. 33 */ 34 private String desc = null; 35 36 /** 37 * Type of the event.<br> 38 * 0 = ObjectEvent<br> 39 * 1 = AggregationEvent<br> 40 * 2 = QuantityEvent<br> 41 * 3 = TransactionEvent 42 */ 43 private int type = 0; 44 45 /** 46 * The time at which the event occurred. Null will insert the time when the 47 * example is selected. Used by all events. 48 */ 49 private String eventTime = null; 50 51 /** 52 * The event time zone offset. 53 */ 54 private String eventTimeZoneOffset = "+00:00"; 55 56 /** 57 * Action value. Not used for QuantityEvent.<br> 58 * 0 = ADD<br> 59 * 1 = OBSERVE<br> 60 * 2 = DELETE 61 */ 62 private int action = 1; 63 64 /** 65 * Business step. Optional for all events. 66 */ 67 private String bizStep = ""; 68 69 /** 70 * Disposition. Optional for all events. 71 */ 72 private String disposition = ""; 73 74 /** 75 * Read point. Optional for all events. 76 */ 77 private String readPoint = ""; 78 79 /** 80 * Business location. Optional for all events. 81 */ 82 private String bizLocation = ""; 83 84 /** 85 * Business transaction. Optional for all events except TransactionEvent. 86 */ 87 private ArrayList<BizTransaction> businessTransactions = new ArrayList<BizTransaction>(); 88 89 /** 90 * List of EPCs. Mandatory for ObjectEvent and used by TransactionEvent, not 91 * used by other events. 92 */ 93 private String epcList = ""; 94 95 /** 96 * List of children EPCs. Mandatory for AggregationEvent except if 97 * action=DELETE. Not used by other events. 98 */ 99 private String childEPCs = ""; 100 101 /** 102 * ID of the parent (URI, but not necessarily an EPC). Mandatory for 103 * AggregationEvent, not used by other events. 104 */ 105 private String parentID = ""; 106 107 /** 108 * Class part of the EPCs. Mandatory for QuantityEvent, not used by other 109 * events. 110 */ 111 private String epcClass = ""; 112 113 /** 114 * Quantity. Mandatory for QuantityEvent, not used by other events. 115 */ 116 private int quantity = 0; 117 118 /** 119 * @param description 120 * Sets the description. 121 */ 122 public void setDescription(final String description) { 123 desc = description; 124 } 125 126 /** 127 * @return The description of the event. 128 */ 129 public String getDescription() { 130 return desc; 131 } 132 133 /** 134 * @param type 135 * Sets the event type.<br> 136 * 0 = ObjectEvent<br> 137 * 1 = AggregationEvent<br> 138 * 2 = QuantityEvent<br> 139 * 3 = TransactionEvent 140 */ 141 public void setType(final int type) { 142 this.type = type; 143 } 144 145 /** 146 * @return The type of the event.<br> 147 * 0 = ObjectEvent<br> 148 * 1 = AggregationEvent<br> 149 * 2 = QuantityEvent<br> 150 * 3 = TransactionEvent 151 */ 152 public int getType() { 153 return type; 154 } 155 156 /** 157 * @param time 158 * Sets the event time. Use ISO8601, i.e. 2006-05-23T17:45:25 159 */ 160 public void setEventTime(final String time) { 161 eventTime = time; 162 } 163 164 /** 165 * @return The time of the event. 166 */ 167 public String getEventTime() { 168 return eventTime; 169 } 170 171 /** 172 * @param timeZoneOffset 173 * Sets the event time zone offset. 174 */ 175 public void setEventTimeZoneOffset(final String timeZoneOffset) { 176 eventTimeZoneOffset = timeZoneOffset; 177 } 178 179 /** 180 * @return The time zone offset of the event. 181 */ 182 public String getEventTimeZoneOffset() { 183 return eventTimeZoneOffset; 184 } 185 186 /** 187 * @param action 188 * Sets the action value.<br> 189 * 0 = ADD<br> 190 * 1 = OBSERVE<br> 191 * 2 = DELETE 192 */ 193 public void setAction(final int action) { 194 this.action = action; 195 } 196 197 /** 198 * @return The action value.<br> 199 * 0 = ADD<br> 200 * 1 = OBSERVE<br> 201 * 2 = DELETE 202 */ 203 public int getAction() { 204 return action; 205 } 206 207 /** 208 * @param step 209 * Sets the business step. 210 */ 211 public void setBizStep(final String step) { 212 bizStep = step; 213 } 214 215 /** 216 * @return The business step. 217 */ 218 public String getBizStep() { 219 return bizStep; 220 } 221 222 /** 223 * @param disp 224 * Sets the disposition. 225 */ 226 public void setDisposition(final String disp) { 227 disposition = disp; 228 } 229 230 /** 231 * @return The disposition. 232 */ 233 public String getDisposition() { 234 return disposition; 235 } 236 237 /** 238 * @param readp 239 * Sets the read point. 240 */ 241 public void setReadPoint(final String readp) { 242 readPoint = readp; 243 } 244 245 /** 246 * @return The read point. 247 */ 248 public String getReadPoint() { 249 return readPoint; 250 } 251 252 /** 253 * @param location 254 * Sets the business location. 255 */ 256 public void setBizLocation(final String location) { 257 bizLocation = location; 258 } 259 260 /** 261 * @return The business location. 262 */ 263 public String getBizLocation() { 264 return bizLocation; 265 } 266 267 /** 268 * Sets the business transaction. 269 * 270 * @param t 271 * The type of the business transaction. 272 * @param id 273 * The id of the business transaction. 274 */ 275 public void setBizTransaction(final String t, final String id) { 276 BizTransaction bizTrans = new BizTransaction(t, id); 277 businessTransactions.add(bizTrans); 278 } 279 280 /** 281 * @return The business transaction. 282 */ 283 public ArrayList<BizTransaction> getBizTransaction() { 284 return businessTransactions; 285 } 286 287 /** 288 * @param list 289 * Sets the list of EPCs (for object and transaction events). 290 */ 291 public void setEpcList(final String list) { 292 epcList = list; 293 } 294 295 /** 296 * @return list The list of EPCs (for object and transaction events). 297 */ 298 public String getEpcList() { 299 return epcList; 300 } 301 302 /** 303 * @param epcs 304 * Sets the list of children EPCs (for aggregation events). 305 */ 306 public void setChildEPCs(final String epcs) { 307 childEPCs = epcs; 308 } 309 310 /** 311 * @return epcs The list of children EPCs (for aggregation events). 312 */ 313 public String getChildEPCs() { 314 return childEPCs; 315 } 316 317 /** 318 * @param id 319 * Sets the id of the parent object (for aggregation events). 320 */ 321 public void setParentID(final String id) { 322 parentID = id; 323 } 324 325 /** 326 * @return id The id of the parent object (for aggregation events). 327 */ 328 public String getParentID() { 329 return parentID; 330 } 331 332 /** 333 * @param cls 334 * Sets the EPC class (for quantity events). 335 */ 336 public void setEpcClass(final String cls) { 337 epcClass = cls; 338 } 339 340 /** 341 * @return cls The EPC class (for quantity events). 342 */ 343 public String getEpcClass() { 344 return epcClass; 345 } 346 347 /** 348 * @param n 349 * Sets the quantity (for quantity events). 350 */ 351 public void setQuantity(final int n) { 352 quantity = n; 353 } 354 355 /** 356 * @return quantity The quantity (for quantity events). 357 */ 358 public int getQuantity() { 359 return quantity; 360 } 361 362 /** 363 * A BusinessTransaction conists of two elements, the BizTransTypeID and the 364 * BizTransID which are Vocabularies. 365 * 366 * @author Alain Remund 367 */ 368 public class BizTransaction { 369 /** 370 * The private Variable for the BizTransTypeID. 371 */ 372 private String type; 373 374 /** 375 * The private Variable for the BizTransID. 376 */ 377 private String id; 378 379 /** 380 * Constructor for a new BusinessTransaction. 381 * 382 * @param aType 383 * with the value of the BizTransTypeID. 384 * @param aId 385 * with the value of the BizTransID. 386 */ 387 public BizTransaction(final String aType, final String aId) { 388 type = aType; 389 id = aId; 390 } 391 392 /** 393 * @return value of the BizTransTypeID. 394 */ 395 public String getBizTransType() { 396 return type; 397 } 398 399 /** 400 * @return value of the BizTransID. 401 */ 402 public String getBizTransID() { 403 return id; 404 } 405 } 406 }