com.hurence.logisland.record.Field.getRawValue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.hurence.logisland.record.Field.getRawValue()方法的一些代码示例,展示了Field.getRawValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Field.getRawValue()方法的具体详情如下:
包路径:com.hurence.logisland.record.Field
类名称:Field
方法名:getRawValue

Field.getRawValue介绍

暂无

代码示例

代码示例来源:origin: com.hurence.logisland/logisland-api

@Override
public Date getTime() {
  try {
    return new Date((long) getField(FieldDictionary.RECORD_TIME).getRawValue());
  } catch (Exception ex) {
    return null;
  }
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

private void extractAndParsePropertiesField(Record outputRecord, String propertiesField) {
  Field field = outputRecord.getField(propertiesField);
  if (field != null) {
    String str = field.getRawValue().toString();
    Matcher matcher = PROPERTIES_SPLITTER_PATTERN.matcher(str);
    while (matcher.find()) {
      if (matcher.groupCount() == 2) {
        String key = matcher.group(1);
        String value = matcher.group(2).trim();
        // logger.debug(String.format("field %s = %s", key, value));
        outputRecord.setField(key, FieldType.STRING, value);
      }
    }
    outputRecord.removeField("properties");
  }
}

代码示例来源:origin: com.hurence.logisland/logisland-api

switch (field.getType()) {
  case STRING:
    isValid = field.getRawValue() instanceof String;
    break;
  case INT:
    isValid = field.getRawValue() instanceof Integer;
    break;
  case LONG:
    isValid = field.getRawValue() instanceof Long;
    break;
  case FLOAT:
    isValid = field.getRawValue() instanceof Float;
    break;
  case DOUBLE:
    isValid = field.getRawValue() instanceof Double;
    break;
  case BOOLEAN:
    isValid = field.getRawValue() instanceof Boolean;
    break;
  case ARRAY:
    isValid = field.getRawValue() instanceof Collection;
    break;
  case RECORD:
    isValid = field.getRawValue() instanceof Record;
    break;
  default:

代码示例来源:origin: com.hurence.logisland/logisland-api

/**
 * Method that applies a record to an expression language
 * @param record
 * @return
 * @throws InterpreterEngineException
 */
protected Object getRawValue(Record record) throws InterpreterEngineException {
  ScriptContext context = new SimpleScriptContext();
  record.getFieldsEntrySet().forEach(entry -> context.setAttribute(entry.getKey(), entry.getValue().getRawValue(), ScriptContext.ENGINE_SCOPE));
  return getRawValue(context);
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

@Override
public Collection<Record> process(ProcessContext context, Collection<Record> records) {
  List<Record> outputRecords = (List<Record>) super.process(context, records);
  String propertiesField = context.getPropertyValue(PROPERTIES_FIELD).asString();
  for (Record outputRecord : outputRecords) {
    Field field = outputRecord.getField(propertiesField);
    if (field != null) {
      String str = field.getRawValue().toString();
      Matcher matcher = PROPERTIES_SPLITTER_PATTERN.matcher(str);
      while (matcher.find()) {
        if (matcher.groupCount() == 2) {
          String key = matcher.group(1);
          String value = matcher.group(2);
          // logger.debug(String.format("field %s = %s", key, value));
          outputRecord.setField(key, FieldType.STRING, value);
        }
      }
      outputRecord.removeField("properties");
    }
  }
  return outputRecords;
}

代码示例来源:origin: com.hurence.logisland/logisland-api

Object fieldValue = field.getRawValue();
FieldType fieldType = field.getType();

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

private void extractValueFields(String[] valueFields, boolean keepRawContent, StandardRecord outputRecord, Matcher valueMatcher,
                TimeZone timezone) {
  if (keepRawContent) {
    outputRecord.setField(FieldDictionary.RECORD_VALUE, FieldType.STRING, valueMatcher.group(0));
  }
  for (int i = 0; i < Math.min(valueMatcher.groupCount() + 1, valueFields.length); i++) {
    String content = valueMatcher.group(i + 1);
    String fieldName = valueFields[i];
    if (content != null) {
      outputRecord.setStringField(fieldName, content.replaceAll("\"", ""));
    }
  }
  // TODO removeField this ugly stuff with EL
  if (outputRecord.getField(FieldDictionary.RECORD_TIME) != null) {
    try {
      long eventTime = Long.parseLong(outputRecord.getField(FieldDictionary.RECORD_TIME).getRawValue().toString());
    } catch (Exception ex) {
      Date eventDate = null;
      try {
        eventDate = DateUtil.parse(outputRecord.getField(FieldDictionary.RECORD_TIME).getRawValue().toString(), timezone);
      } catch (ParseException e) {
        logger.info("issue while parsing date : {} ", e.toString());
      }
      if (eventDate != null) {
        outputRecord.setField(FieldDictionary.RECORD_TIME, FieldType.LONG, eventDate.getTime());
      }
    }
  }
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

templateParams[index] = field.getRawValue();

代码示例来源:origin: com.hurence.logisland/logisland-solr_6_4

return field.asBoolean();
default:
  return field.getRawValue();

代码示例来源:origin: com.hurence.logisland/logisland-elasticsearch-plugin

if (context.getPropertyValue(ES_INDEX_FIELD).isSet()) {
  Field eventIndexField = record.getField(context.getPropertyValue(ES_INDEX_FIELD).asString());
  if (eventIndexField != null && eventIndexField.getRawValue() != null) {
    docIndex = eventIndexField.getRawValue().toString();
if (context.getPropertyValue(ES_TYPE_FIELD).isSet()) {
  Field eventTypeField = record.getField(context.getPropertyValue(ES_TYPE_FIELD).asString());
  if (eventTypeField != null && eventTypeField.getRawValue() != null) {
    docType = eventTypeField.getRawValue().toString();

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

private void overwriteObsoleteFieldName(Record record, String normalizedFieldName, String obsoleteFieldName) {
  // remove old badly named field
  if (record.hasField(obsoleteFieldName)) {
    final Field fieldToRename = record.getField(obsoleteFieldName);
    record.removeField(obsoleteFieldName);
    record.setField(normalizedFieldName, fieldToRename.getType(), fieldToRename.getRawValue());
  }
}

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

if (context.getPropertyValue(COLLECTION_FIELD).isSet()) {
  Field eventIndexField = record.getField(context.getPropertyValue(COLLECTION_FIELD).asString());
  if (eventIndexField != null && eventIndexField.getRawValue() != null) {
    collection = eventIndexField.getRawValue().toString();

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

@Override
  public void buildId(Record record) {
    final Object[] valuesForFormat = new Object[fieldsForFormat.length];
    for (int i = 0; i < valuesForFormat.length; i++) {
      if (!record.hasField(fieldsForFormat[i])) {
        List<String> fieldsName = Lists.newArrayList(fieldsForFormat);
        record.addError(ProcessError.CONFIG_SETTING_ERROR.getName(),
            String.format("could not build id with format : '%s' \nfields: '%s' \n because " +
                "field: '%s' does not exist", format, fieldsName, fieldsForFormat[i]));
        return;
      }
      valuesForFormat[i] = record.getField(fieldsForFormat[i]).getRawValue();
    }
    try {
      record.setId(String.format(local, format, valuesForFormat));
    } catch (IllegalFormatException e) {
      // If a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments,
      // insufficient arguments given the format string, or other illegal conditions.
      // For specification of all possible formatting errors, see the Details section of the formatter class specification.
      record.addError(ProcessError.STRING_FORMAT_ERROR.getName(), e.getMessage());
    } catch (NullPointerException e) {//should not happen
      record.addError(ProcessError.CONFIG_SETTING_ERROR.getName(), e.getMessage());
    }
  }
};

代码示例来源:origin: com.hurence.logisland/logisland-querymatcher-plugin

for (final String fieldName : record.getAllFieldNames()) {
  if (luceneAttrsToQuery.contains(fieldName) &&
      record.getField(fieldName).getRawValue() != null) {
    String ip = record.getField(fieldName).asString();
              (inputRecords.get(k).getField(ipAttrName).getRawValue() != null)) {
            HashSet<Pair<String, Pattern>> ipRegexHashset = ipRegexps.get(ipAttrName);
            ipRegexHashset.forEach(p -> {

代码示例来源:origin: com.hurence.logisland/logisland-common-processors-plugin

if (record.hasField(obsoleteFieldName)) {
  final Field oldField = record.getField(obsoleteFieldName);
  record.setField(normalizedFieldName, oldField.getType(), oldField.getRawValue());

代码示例来源:origin: com.hurence.logisland/logisland-solr-client-service-api

public SolrInputDocument toSolrInputDocument(Record record, String uniqueKey) {
  SolrInputDocument document = createNewSolrInputDocument();
  document.addField(uniqueKey, record.getId());
  for (Field field : record.getAllFields()) {
    if (field.isReserved()) {
      continue;
    }
    document.addField(field.getName(), field.getRawValue());
  }
  return document;
}

代码示例来源:origin: com.hurence.logisland/logisland-elasticsearch_5_4_0-client-service

break;
default:
  document.field(fieldName, field.getRawValue());
  break;

代码示例来源:origin: com.hurence.logisland/logisland-elasticsearch-plugin

|| record.getField(indexFieldName).getRawValue() == null // index field raw value is null
    || record.getField(indexFieldName).getRawValue().toString().isEmpty() // index field is empty
    ) {
  StandardRecord outputRecord = new StandardRecord(record);
    || record.getField(idsFieldName) == null
    || !record.getField(idsFieldName).getType().equals(FieldType.STRING)
    || record.getField(idsFieldName).getRawValue() == null
    || record.getField(idsFieldName).getRawValue().toString().isEmpty() ) {
  StandardRecord outputRecord = new StandardRecord(record);
  outputRecord.addError(ProcessError.BAD_RECORD.getName(), "record must have the field " + idsFieldName + " containing the Ids to use in the multiget query. This field must be of STRING type and cannot be empty.");
if(record.getField(includesFieldName) != null && record.getField(includesFieldName).getRawValue() != null) {
  String includesString = record.getField(includesFieldName).asString();
  List<String> includesList = new ArrayList<>(Arrays.asList(includesString.split("\\s*,\\s*")));
if(record.getField(excludesFieldName) != null && record.getField(excludesFieldName).getRawValue() != null) {
  String excludesString = record.getField(excludesFieldName).asString();
  List<String> excludesList = new ArrayList<>(Arrays.asList(excludesString.split("\\s*,\\s*")));

代码示例来源:origin: com.hurence.logisland/logisland-querymatcher-plugin

String[] names = (String[])outRecord.getField(ALERT_MATCH_NAME).getRawValue();
names = Arrays.copyOf(names, names.length+1);
names[names.length-1] = matchingRule.getName();
nameField = new com.hurence.logisland.record.Field(ALERT_MATCH_NAME, FieldType.ARRAY, names);
String[] queries = (String[])outRecord.getField(ALERT_MATCH_QUERY).getRawValue();
queries = Arrays.copyOf(queries, queries.length+1);
queries[names.length-1] = matchingRule.getLegacyQuery();

代码示例来源:origin: com.hurence.logisland/logisland-useragent-plugin

String recordValue = (String) uaField.getRawValue();
UserAgentAnalyzerPool pool = null;
UserAgentAnalyzer uaa = null;

相关文章