当前位置: 首页>>代码示例>>Java>>正文


Java Event.getData方法代码示例

本文整理汇总了Java中org.wso2.siddhi.core.event.Event.getData方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getData方法的具体用法?Java Event.getData怎么用?Java Event.getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.siddhi.core.event.Event的用法示例。


在下文中一共展示了Event.getData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: constructSingleEventForDefaultMapping

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
private JsonObject constructSingleEventForDefaultMapping(Event event) {
    Object[] data = event.getData();
    JsonObject jsonEventObject = new JsonObject();
    JsonObject innerParentObject = new JsonObject();
    String attributeName;
    Object attributeValue;
    Gson gson = new Gson();
    for (int i = 0; i < data.length; i++) {
        attributeName = attributeNameArray[i];
        attributeValue = data[i];
        if (attributeValue != null) {
            if (attributeValue.getClass() == String.class) {
                innerParentObject.addProperty(attributeName, attributeValue.toString());
            } else if (attributeValue instanceof Number) {
                innerParentObject.addProperty(attributeName, (Number) attributeValue);
            } else if (attributeValue instanceof Boolean) {
                innerParentObject.addProperty(attributeName, (Boolean) attributeValue);
            } else if (attributeValue instanceof Map) {
                if (!((Map) attributeValue).isEmpty()) {
                    innerParentObject.add(attributeName, gson.toJsonTree(attributeValue));
                }
            }
        }
    }
    jsonEventObject.add(EVENT_PARENT_TAG, innerParentObject);
    return jsonEventObject;
}
 
开发者ID:wso2-extensions,项目名称:siddhi-map-json,代码行数:28,代码来源:JsonSinkMapper.java

示例2: doPartialProcessing

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
private Event doPartialProcessing(Event event) {
    Object[] data = event.getData();
    for (int i = 0; i < data.length; i++) {
        if (data[i] == null) {
            data[i] = UNDEFINED;
        }
    }
    return event;
}
 
开发者ID:wso2-extensions,项目名称:siddhi-map-json,代码行数:10,代码来源:JsonSinkMapper.java

示例3: convertToEventArrayForDefaultMapping

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
private Event[] convertToEventArrayForDefaultMapping(Object eventObject) {
    Gson gson = new Gson();
    JsonObject[] eventObjects = gson.fromJson(eventObject.toString(), JsonObject[].class);
    Event[] events = new Event[eventObjects.length];
    int index = 0;
    JsonObject eventObj = null;
    for (JsonObject jsonEvent : eventObjects) {
        if (jsonEvent.has(DEFAULT_JSON_EVENT_IDENTIFIER)) {
            eventObj = jsonEvent.get(DEFAULT_JSON_EVENT_IDENTIFIER).getAsJsonObject();
            if (failOnMissingAttribute && eventObj.size() < streamAttributes.size()) {
                log.error("Json message " + eventObj.toString() + " contains missing attributes. " +
                        "Hence dropping the message.");
                continue;
            }
        } else {
            log.error("Default json message " + eventObj.toString()
                    + " in the array does not have the valid event identifier \"event\". " +
                    "Hence dropping the message.");
            continue;
        }
        Event event = new Event(streamAttributes.size());
        Object[] data = event.getData();


        int position = 0;
        for (Attribute attribute : streamAttributes) {
            String attributeName = attribute.getName();
            Attribute.Type type = attribute.getType();
            String attributeValue = eventObj.get(attributeName).getAsString();
            if (attributeValue == null) {
                data[position++] = null;
            } else {
                data[position++] = attributeConverter.getPropertyValue(
                        attributeValue, type);
            }
        }
        events[index++] = event;
    }
    return Arrays.copyOfRange(events, 0, index);
}
 
开发者ID:wso2-extensions,项目名称:siddhi-map-json,代码行数:41,代码来源:JsonSourceMapper.java

示例4: processCustomEvent

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
private Event processCustomEvent(ReadContext readContext) {
    Configuration conf = Configuration.defaultConfiguration();
    Event event = new Event(attributesSize);
    Object[] data = event.getData();
    Object childObject = readContext.read(DEFAULT_ENCLOSING_ELEMENT);
    readContext = JsonPath.using(conf).parse(childObject);
    for (MappingPositionData mappingPositionData : this.mappingPositions) {
        int position = mappingPositionData.getPosition();
        Object mappedValue;
        try {
            mappedValue = readContext.read(mappingPositionData.getMapping());
            if (mappedValue == null) {
                data[position] = null;
            } else {
                data[position] = attributeConverter.getPropertyValue(mappedValue.toString(),
                        streamAttributes.get(position).getType());
            }
        } catch (PathNotFoundException e) {
            if (failOnMissingAttribute) {
                log.error("Json message " + childObject.toString() +
                        " contains missing attributes. Hence dropping the message.");
                return null;
            }
            data[position] = null;
        }
    }
    return event;
}
 
开发者ID:wso2-extensions,项目名称:siddhi-map-json,代码行数:29,代码来源:JsonSourceMapper.java

示例5: compare

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
@Override
public int compare(Event e1, Event e2) {
    int comparisonResult;
    for (int i=0 ; i<attributeList.size(); i++){
        int[] listItem = attributeList.get(i);
        int attributePosition = listItem[0];
        Comparable comparableVariable1 = (Comparable)e1.getData(attributePosition);
        Comparable comparableVariable2 = (Comparable)e2.getData(attributePosition);
        comparisonResult = comparableVariable1.compareTo(comparableVariable2);
        if(comparisonResult != 0){
            return listItem[1]*comparisonResult;
        }
    }
    return 0;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:16,代码来源:SortWindowProcessor.java

示例6: createNewSendEvent

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
protected InEvent createNewSendEvent(Event originalEvent, Map<Integer, Object> aggregateAttributeValueMap) {
    Object[] newData = new Object[originalEvent.getData().length];
    System.arraycopy(originalEvent.getData(), 0, newData, 0, originalEvent.getData().length);
    for (Integer position : aggregateAttributePositionList) {
        newData[position] = aggregateAttributeValueMap.get(position);
    }
    return new InEvent(originalEvent.getStreamId(), originalEvent.getTimeStamp(), newData);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:9,代码来源:AggregationWindowedPerSnapshotOutputRateManager.java

示例7: InEvent

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
public InEvent(Event event) {
    super(event.getStreamId(),event.getTimeStamp(),event.getData());
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:4,代码来源:InEvent.java

示例8: RemoveEvent

import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
public RemoveEvent(Event event, long expiryTime) {
    super(event.getStreamId(), event.getTimeStamp(), event.getData());
    this.expiryTime = expiryTime;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:5,代码来源:RemoveEvent.java


注:本文中的org.wso2.siddhi.core.event.Event.getData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。