Class XmlRecordPipelineOutput

All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, DataWriterFactory, JavaCodeGenerator, Serializable

public class XmlRecordPipelineOutput extends FileSinkPipelineOutput
Writes a pipeline's records as XML elements to a FileSink using an XmlRecordWriter.
See Also:
  • Constructor Details

    • XmlRecordPipelineOutput

      public XmlRecordPipelineOutput()
  • Method Details

    • createDataWriter

      public DataWriter createDataWriter()
    • getFileSink

      public FileSink getFileSink()
      Specified by:
      getFileSink in class FileSinkPipelineOutput
    • setFileSink

      public XmlRecordPipelineOutput setFileSink(FileSink fileSink)
      Specified by:
      setFileSink in class FileSinkPipelineOutput
    • getName

      public String getName()
      Description copied from class: PipelineOutput
      Returns a display name for this output, such as the destination's name followed by its format.
      Overrides:
      getName in class FileSinkPipelineOutput
    • isPretty

      public boolean isPretty()
      Indicates if line breaks and indentation are added to the output (defaults to false).
    • setPretty

      public XmlRecordPipelineOutput setPretty(boolean pretty)
      Indicates if line breaks and indentation are added to the output (defaults to false).
    • getCharset

      public String getCharset()
      Returns the character set used to write the file (defaults to UTF-8); blank uses the platform default.
    • setCharset

      public XmlRecordPipelineOutput setCharset(String charset)
      Sets the character set used to write the file (defaults to UTF-8); blank uses the platform default.
    • getRootTagName

      public String getRootTagName()
      Returns the name of the element wrapping all records or blank for none (defaults to document).
    • setRootTagName

      public XmlRecordPipelineOutput setRootTagName(String rootTagName)
      Sets the name of the element wrapping all records or blank for none (defaults to document).
    • getRecordTagName

      public String getRecordTagName()
      Returns the name of the element written for each record (defaults to record); it must not be blank.
    • setRecordTagName

      public XmlRecordPipelineOutput setRecordTagName(String recordTagName)
      Sets the name of the element written for each record (defaults to record); it must not be blank.
    • isWriteXmlDeclaration

      public boolean isWriteXmlDeclaration()
      Indicates if an XML declaration is written first (defaults to false).
    • setWriteXmlDeclaration

      public XmlRecordPipelineOutput setWriteXmlDeclaration(boolean writeXmlDeclaration)
      Indicates if an XML declaration is written first (defaults to false).
    • isWriteFieldsAsAttributes

      public boolean isWriteFieldsAsAttributes()
      Indicates if null and single-value fields are written as attributes instead of child elements (defaults to true).
    • setWriteFieldsAsAttributes

      public XmlRecordPipelineOutput setWriteFieldsAsAttributes(boolean writeFieldsAsAttributes)
      Indicates if null and single-value fields are written as attributes instead of child elements (defaults to true).
    • isAutoCloseWriter

      public boolean isAutoCloseWriter()
      Indicates if the file's stream is closed when the writer is closed (defaults to true).
    • setAutoCloseWriter

      public XmlRecordPipelineOutput setAutoCloseWriter(boolean autoCloseWriter)
      Indicates if the file's stream is closed when the writer is closed (defaults to true).
    • isFlushOnWrite

      public boolean isFlushOnWrite()
      Indicates if the output is flushed after each record (defaults to false).
    • setFlushOnWrite

      public XmlRecordPipelineOutput setFlushOnWrite(boolean flushOnWrite)
      Indicates if the output is flushed after each record (defaults to false).
    • generateSaveCode

      public void generateSaveCode(JavaCodeBuilder javaCodeBuilder)
      Description copied from class: FileSinkPipelineOutput
      Writes the generated code that saves the output after Job.run(reader, writer); does nothing by default.
      Overrides:
      generateSaveCode in class FileSinkPipelineOutput
    • generateJavaCode

      public void generateJavaCode(JavaCodeBuilder code)
      Description copied from interface: JavaCodeGenerator
      Appends Java source code representing this object to the given builder.
    • toRecord

      public Record toRecord()
      Description copied from interface: RecordSerializable
      Converts this object's state to a record that RecordSerializable.fromRecord(Record) can load.
      Specified by:
      toRecord in interface RecordSerializable
      Overrides:
      toRecord in class Bean
    • fromRecord

      public XmlRecordPipelineOutput fromRecord(Record source)
      Description copied from interface: RecordSerializable
      Loads this instance's state from a record and returns this (for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.
      Specified by:
      fromRecord in interface RecordSerializable
      Overrides:
      fromRecord in class PipelineOutput
      Parameters:
      source -
      Returns:
      this instance.
    • toXmlElement

      public Element toXmlElement(Document document)
      Description copied from interface: XmlSerializable
      Returns an element, created with document, describing this object; the default implementation throws a DataException.
      Specified by:
      toXmlElement in interface XmlSerializable
      Overrides:
      toXmlElement in class PipelineOutput
    • fromXmlElement

      public XmlRecordPipelineOutput fromXmlElement(Element pipelineInputElement)