Uploaded image for project: 'Talend Component Kit'
  1. Talend Component Kit
  2. TCOMP-2410

Support of 'document' type

Apply templateInsert Lucidchart Diagram
    XMLWordPrintable

Details

    Description

      tRESTclient is able to return 'document' attribute. When it is replaced by a tck/tHTTPClient, we have to add a tMap to transform the XML string to a 'document' with this routine call:

      ParserUtils.parseTo_Document(incomingRow.body)
      

      It could be great if, when a tck connector send a record with String attribute and if this attribute is mapped to an attribute of the rwoStruct that have the 'document' type to directly call the 'parseTo_Document' routine.

      (maybe need to be discussed first since it will be a the first time the studio TCK integration will depends on a routine.)

      https://talend.slack.com/archives/C03DZP3A3EJ/p1679585835794769?thread_ts=1679557904.989739&cid=C03DZP3A3EJ
      ( Currently, when a tck connector receive a studio record with and attribute of document type, it generates a java exception with root cause:
      Caused by: java.lang.IllegalArgumentException: Unexpected class: routines.system.Document
      We was able to remove the document input attribute (it was not use finally).
      For the output, the tHTTPClient returns the XML payload as a String. We had to introduce a tMap to transform the String to a document using :
      ParserUtils.parseTo_Document(incomingRow.body)
      And it was ok after.)

      Solution 1: serialize/deserialize from/to record the document as an object, and parse the document in in rowstruct/record visitors of component-runtime-di. With the talend type id_document.

      Support case 2:
      if we've a string value and rowstruct destination field is a document , we need to create a document and assign it to the rowstruct field.

      Support case 3:
      handle document type in dynamic

      *Notes: *

      After supporting Document type, when the TCK record attribute contains a String that is not XML and the user has selected 'Document' in the studio schema, the"java.lang.reflect.InvocationTargetException" will be thrown in the job, if open the log trace message on the job, the detail log will like:

      [TRACE] 20:11:30 org.talend.sdk.component.runtime.di.record.DiRecordVisitor- [setField] Document#body.
      [TRACE] 20:11:30 org.talend.sdk.component.runtime.di.record.DiRecordVisitor- [setField] exception message: Error on line 24 of document : Attribute name "crossorigin" associated with an element type "link" must be followed by the ' = ' character.
      Exception in component tHTTPClient_1 (document2410)
      org.talend.sdk.component.api.exception.ComponentException: Exception raised during HTTP call: (class java.lang.IllegalStateException) java.lang.reflect.InvocationTargetException

      Attachments

        1. screenshot-1.png
          141 kB
          Yueyan Yin

        Activity

          People

            Unassigned Unassigned
            ypiel Yves Piel
            Axel Catoire Axel Catoire
            Axel Catoire, Liang Xia, Yueyan Yin
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h