本文整理汇总了Java中org.fosstrak.epcis.model.EventListType类的典型用法代码示例。如果您正苦于以下问题:Java EventListType类的具体用法?Java EventListType怎么用?Java EventListType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventListType类属于org.fosstrak.epcis.model包,在下文中一共展示了EventListType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDocument
import org.fosstrak.epcis.model.EventListType; //导入依赖的package包/类
/**
* @return the assembled EPCIS document.
*/
public EPCISDocumentType getDocument() {
// create the EPCISDocument
EPCISDocumentType epcisDoc = new EPCISDocumentType();
EPCISBodyType epcisBody = new EPCISBodyType();
EventListType eventList = new EventListType();
for (ObjectEventType objEvent : objectEvents) {
eventList.getObjectEventOrAggregationEventOrQuantityEvent().
add(objEvent);
}
epcisBody.setEventList(eventList);
epcisDoc.setEPCISBody(epcisBody);
epcisDoc.setSchemaVersion(new BigDecimal("1.0"));
epcisDoc.setCreationDate(getNow());
return epcisDoc;
}
示例2: checkOrdering
import org.fosstrak.epcis.model.EventListType; //导入依赖的package包/类
/**
* @param eventList
* @param limit
* @param orderDirection
* @param orderBy
* @return
*/
private EventListType checkOrdering(EventListType eventList, String orderBy, OrderDirection orderDirection,
int limit) {
if (orderBy == null) {
// no ordering specified
return eventList;
}
if ("quantity".equals(orderBy)) {
// order by quantity can only return QuantityEvents
return eventList;
}
int size = eventList.getObjectEventOrAggregationEventOrQuantityEvent().size();
if (limit > -1 && size == limit) {
// there was only a single event type to be ordered - this has been
// taken care of appropriately by the previous query
return eventList;
}
LOG.debug("Need to apply sorting across the different event types (sortBy=" + orderBy + ")");
boolean orderByEventTime = "eventTime".equals(orderBy);
Comparator<Object> comparator = new EventComparator(orderByEventTime, orderDirection);
Collections.sort(eventList.getObjectEventOrAggregationEventOrQuantityEvent(), comparator);
if (limit > -1 && size > limit) {
LOG.debug("Need to apply global limit to events (limit=" + limit + ")");
// clear everything beyond limit
eventList.getObjectEventOrAggregationEventOrQuantityEvent().subList(limit, size).clear();
}
return eventList;
}
示例3: checkOrdering
import org.fosstrak.epcis.model.EventListType; //导入依赖的package包/类
/**
* @param eventList
* @param limit
* @param orderDirection
* @param orderBy
* @return
*/
private EventListType checkOrdering(EventListType eventList, String orderBy, OrderDirection orderDirection,
int limit) {
LOG.debug("Check Ordering is running now! ");
if (orderBy == null) {
// no ordering specified
return eventList;
}
if ("quantity".equals(orderBy)) {
// order by quantity can only return QuantityEvents
return eventList;
}
int size = eventList.getObjectEventOrAggregationEventOrQuantityEvent().size();
if (limit > -1 && size == limit) {
// there was only a single event type to be ordered - this has been
// taken care of appropriately by the previous query
return eventList;
}
LOG.debug("Need to apply sorting across the different event types (sortBy=" + orderBy + ")");
boolean orderByEventTime = "eventTime".equals(orderBy);
Comparator<Object> comparator = new EventComparator(orderByEventTime, orderDirection);
Collections.sort(eventList.getObjectEventOrAggregationEventOrQuantityEvent(), comparator);
if (limit > -1 && size > limit) {
LOG.debug("Need to apply global limit to events (limit=" + limit + ")");
// clear everything beyond limit
eventList.getObjectEventOrAggregationEventOrQuantityEvent().subList(limit, size).clear();
}
return eventList;
}
示例4: createEpcisDocument
import org.fosstrak.epcis.model.EventListType; //导入依赖的package包/类
/**
* Creates a simple EPCIS object event using the API objects from the EPCIS
* schema.
*/
private static EPCISDocumentType createEpcisDocument() {
ObjectEventType objEvent = new ObjectEventType();
// set the eventTime and eventTimeZoneOffset
XMLGregorianCalendar eventTime = getCurrentDateTime();
String timeZoneOffset = getTimeZoneOffset(eventTime);
objEvent.setEventTime(eventTime);
objEvent.setEventTimeZoneOffset(timeZoneOffset);
// set the EPCs
EPC epc = new EPC();
epc.setValue("urn:epc:id:sgtin:0057000.123780.7788");
EPCListType epcList = new EPCListType();
epcList.getEpc().add(epc);
objEvent.setEpcList(epcList);
// set the action
objEvent.setAction(ActionType.ADD);
// set the bizStep
objEvent.setBizStep("urn:fosstrak:demo:bizstep:fmcg:production");
// set the disposition
objEvent.setDisposition("urn:fosstrak:demo:disp:fmcg:pendingQA");
// set the readPoint
ReadPointType readPoint = new ReadPointType();
readPoint.setId("urn:fosstrak:demo:fmcg:ssl:0037000.00729.210,432");
objEvent.setReadPoint(readPoint);
// set the bizLocation
BusinessLocationType bizLocation = new BusinessLocationType();
bizLocation.setId("urn:fosstrak:demo:fmcg:ssl:0037000.00729.210");
objEvent.setBizLocation(bizLocation);
// optionally add an event field extension
addEventFieldExtension(objEvent);
// create the EPCISDocument containing the ObjectEvent
EPCISDocumentType epcisDoc = new EPCISDocumentType();
EPCISBodyType epcisBody = new EPCISBodyType();
EventListType eventList = new EventListType();
eventList.getObjectEventOrAggregationEventOrQuantityEvent().add(objEvent);
epcisBody.setEventList(eventList);
epcisDoc.setEPCISBody(epcisBody);
epcisDoc.setSchemaVersion(new BigDecimal("1.0"));
epcisDoc.setCreationDate(eventTime);
return epcisDoc;
}