本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例7: InEvent
import org.wso2.siddhi.core.event.Event; //导入方法依赖的package包/类
public InEvent(Event event) {
super(event.getStreamId(),event.getTimeStamp(),event.getData());
}
示例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;
}