# (c) cavaliba.com 




# -----------------------------------------------------
# pipeline
# ----------------------------------------------------

- classname: _pipeline
  keyname: test_user
  displayname: test_user csv pipeline
  description: Pipeline to import user in csv format (delimiter ; and utf-8)
  content: |
      csv_delimiter: ';'
      #encoding: 'ISO-8859-1'
      encoding: 'utf-8'
      classname: _user
      keyfield: login
      tasks: 
          - field_lower: ['', email, login]
          - field_upper: ['', external_id]


# ----- test1


- classname: _pipeline
  keyname: test1_pipeline
  displayname: test_pipeline
  description: unittest pipeline
  content: |
      csv_delimiter: '|'
      classname: test1
      keyfield: keyname
      tasks: 
        - field_noop: ['']

- classname: _pipeline
  keyname: test1_pipeline_regexp
  displayname: test1_pipeline REGEXP
  description: Apply a REGEXP on mystring field
  content: |
      csv_delimiter: '|'
      classname: test1
      keyfield: keyname
      tasks: 
        - field_regexp_sub: ["", "mystring", "test", "TESTREGEXP-"]


- classname: _pipeline
  keyname: test1_pipeline_keep
  displayname: test1_pipeline Keep
  description: Keep some fields
  content: |
      csv_delimiter: '|'
      classname: test1
      keyfield: keyname
      tasks: 
        - field_keep: ["", "mystring", "myint"]

- classname: _pipeline
  keyname: test1_pipeline_timestamp
  displayname: test1_pipeline Timestamp 
  is_enabled: true
  description: Add timestamp
  content: |
      csv_delimiter: '|'
      classname: test1
      keyfield: keyname
      tasks: 
        - field_date_now: ["", date_auto_pipeline]
        - field_time_now: ["", time_auto_pipeline]
        - field_datetime_now: ["", datetime_auto_pipeline]


- classname: _pipeline
  keyname: test1_pipeline_uuid
  displayname: test1_pipeline UUID
  is_enabled: true
  description: Add a UUID field
  content: |
      csv_delimiter: '|'
      classname: test1
      keyfield: keyname
      tasks: 
        - field_uuid: ["", uuid_auto]

- classname: _pipeline
  keyname: test1_pipeline_utf8
  displayname: test1_pipeline UTF8
  is_enabled: true
  description: Use utf-8 encoding
  content: |
      csv_delimiter: '|'
      classname: test1
      encoding: utf-8

- classname: _pipeline
  keyname: test1_pipeline_iso8859_1
  displayname: test1_pipeline ISO-8859-1
  is_enabled: true
  description: Use ISO-8859-1 encoding
  content: |
      csv_delimiter: '|'
      classname: test1
      encoding: 'ISO-8859-1'


- classname: _pipeline
  keyname: test1_pipeline_toint
  displayname: test1_pipeline to_int
  is_enabled: true
  description: Convert to int
  content: |
      csv_delimiter: '|'
      classname: test1
      tasks: 
        - field_toint: ['',myint]

- classname: _pipeline
  keyname: test1_pipeline_tofloat
  displayname: test1_pipeline to_float
  is_enabled: true
  description: Convert to float
  content: |
      csv_delimiter: '|'
      classname: test1
      tasks: 
        - field_tofloat: ['',myfloat]

- classname: _pipeline
  keyname: test1_pipeline_nospace
  displayname: test1_pipeline_nospace
  is_enabled: true
  description: Remove all whitespaces
  content: |
      csv_delimiter: '|'
      classname: test1
      tasks: 
        - field_nospace: ['', myint, myfloat]


# ----- test

- classname: _pipeline
  keyname: test_pipeline
  displayname: test_pipeline
  description: unittest pipeline
  content: |
      csv_delimiter: '|'
      classname: test
      keyfield: keyname
      tasks: 
        - field_noop: ['']

- classname: _pipeline
  keyname: test_pipeline_regexp
  displayname: test_pipeline REGEXP
  description: Apply a REGEXP on mystring field
  content: |
      csv_delimiter: '|'
      classname: test
      keyfield: keyname
      tasks: 
        - field_regexp_sub: ["", "mystring", "test", "TESTREGEXP-"]


- classname: _pipeline
  keyname: test_pipeline_keep
  displayname: test_pipeline Keep
  description: Keep some fields
  content: |
      csv_delimiter: '|'
      classname: test
      keyfield: keyname
      tasks: 
        - field_keep: ["", "mystring", "myint"]

- classname: _pipeline
  keyname: test_pipeline_timestamp
  displayname: test_pipeline Timestamp 
  is_enabled: true
  description: Add timestamp
  content: |
      csv_delimiter: '|'
      classname: test
      keyfield: keyname
      tasks: 
        - field_date_now: ["", date_auto_pipeline]
        - field_time_now: ["", time_auto_pipeline]
        - field_datetime_now: ["", datetime_auto_pipeline]


- classname: _pipeline
  keyname: test_pipeline_uuid
  displayname: test_pipeline UUID
  is_enabled: true
  description: Add a UUID field
  content: |
      csv_delimiter: '|'
      classname: test
      keyfield: keyname
      tasks: 
        - field_uuid: ["", uuid_auto]

- classname: _pipeline
  keyname: test_pipeline_utf8
  displayname: test_pipeline UTF8
  is_enabled: true
  description: Use utf-8 encoding
  content: |
      csv_delimiter: '|'
      classname: test
      encoding: utf-8

- classname: _pipeline
  keyname: test_pipeline_iso8859_1
  displayname: test_pipeline ISO-8859-1
  is_enabled: true
  description: Use ISO-8859-1 encoding
  content: |
      csv_delimiter: '|'
      classname: test
      encoding: 'ISO-8859-1'


- classname: _pipeline
  keyname: test_pipeline_toint
  displayname: test_pipeline to_int
  is_enabled: true
  description: Convert to int
  content: |
      csv_delimiter: '|'
      classname: test
      tasks: 
        - field_toint: ['',myint]

- classname: _pipeline
  keyname: test_pipeline_tofloat
  displayname: test1_pipeline to_float
  is_enabled: true
  description: Convert to float
  content: |
      csv_delimiter: '|'
      classname: test1
      tasks: 
        - field_tofloat: ['',myfloat]

- classname: _pipeline
  keyname: test_pipeline_nospace
  displayname: test_pipeline_nospace
  is_enabled: true
  description: Remove all whitespaces
  content: |
      csv_delimiter: '|'
      classname: test1
      tasks: 
        - field_nospace: ['', myint, myfloat]


# pipeline: test1

- classname: _pipeline
  keyname: test1_csv
  displayname: Test - Load CSV Test1
  is_enabled: true
  description: Test - Load CSV Test1
  content: |
    csv_delimiter: '|'
    classname: test1
    keyfield: keyname
    tasks: 
        - field_noop: ['']
        