Package com.cloudera.cdk.morphline.api

Examples of com.cloudera.cdk.morphline.api.Record.replaceValues()


    protected boolean doProcess(Record inputRecord) {
      Record outputRecord = inputRecord.copy();

      // change key
      Text myTextKey = (Text)inputRecord.getFirstValue(this.keyField);
      outputRecord.replaceValues(this.keyField, MyWritable.keyStr(myTextKey));
      // change value
      MyWritable myWritableValue = (MyWritable)inputRecord.getFirstValue(this.valueField);
      outputRecord.replaceValues(this.valueField, MyWritable.valueStr(myWritableValue));
      return super.doProcess(outputRecord);
    }
View Full Code Here


      // change key
      Text myTextKey = (Text)inputRecord.getFirstValue(this.keyField);
      outputRecord.replaceValues(this.keyField, MyWritable.keyStr(myTextKey));
      // change value
      MyWritable myWritableValue = (MyWritable)inputRecord.getFirstValue(this.valueField);
      outputRecord.replaceValues(this.valueField, MyWritable.valueStr(myWritableValue));
      return super.doProcess(outputRecord);
    }
  }

  /**
 
View Full Code Here

  }
 
  private Record createEvent(InputStream in, ListMultimap<String, Object> headers) {
    Record record = new Record();
    record.getFields().putAll(headers);
    record.replaceValues(Fields.ATTACHMENT_BODY, in);
    return record;
  }
 
  private String detect(Record event, boolean includeMetaData) throws IOException {
    return detect(event, includeMetaData, false);
View Full Code Here

     
      xmlReader.parse(source); // push the HTML through tagsoup into the output byte array
     
      Record outputRecord = inputRecord.copy();
      removeAttachments(outputRecord);
      outputRecord.replaceValues(Fields.ATTACHMENT_BODY, out.toByteArray());     
      incrementNumRecords();
       
      // pass record to next command in chain:
      if (!getChild().process(outputRecord)) {
        return false;
View Full Code Here

    jdoc1.put("intField", "notAnInteger");
    collector.reset();
    assertFalse(morphline.process(jdoc1)); // can't convert

    jdoc1.replaceValues("intField", "20");
    jdoc1.put("longField", "200");
    jdoc1.put("stringField", "abc");
    jdoc1.put("boolField", "true");
    jdoc1.put("floatField", "200");
    jdoc1.put("doubleField","200");
View Full Code Here

      while ((len = reader.read(buffer)) >= 0) {
        clob.append(buffer, 0, len);
      }
      Record outputRecord = inputRecord.copy();
      removeAttachments(outputRecord);
      outputRecord.replaceValues(Fields.MESSAGE, clob.toString());
       
      // pass record to next command in chain:
      return getChild().process(outputRecord);
    }
     
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.