The File provider allows you to send data from a csv file and receive data into a csv file through synchronizations. To read and write the csv file contents in the source and destination applications respectively, Gateway has been equipped with parsers and generators.
Add a parser or a generator only if you choose to set up a synchronization to have the data read from or written into a csv, xls, or an xlsx file for specific objects and fields. Otherwise, use the Default Parser to read any object and any field in Gateway, or the Default Generator to write any object and field in Gateway.
Parsers enable Gateway to read the contents of a csv or Excel (xls /xlsx) file. The following parsers have been delivered in Gateway:
- Default Parser
The Default Parser allows Gateway to read any object and field from a csv file.
- Resource Parser
A Resource Parser is a parser created specifically to read only a Resource object from a csv file. Additional parsers for reading specific objects and fields can be created.
To use a parser in a synchronization, you must set up:
- A File deployment supporting a CSV file format.
- The File provider as the source application in a synchronization.
Generators enable Gateway to write and format data into a csv file. The following generators are delivered in Gateway:
- Default Generator
The Default Generator allows Gateway to write any object and any field into a csv file.
- Resource Generator
The Resource Generator is a generator created specifically to write only a Resource object from a csv file. Additional generators to write specific objects and fields into a csv file can be created.
To use a generator in a synchronization, you must set up:
- A File deployment supporting a CSV file format.
- The File provider as the destination application in a synchronization.
Prerequisite
A File deployment has been added to support csv, xls, or xlsx file format.
To add a parser or generator:
- Sign in to Primavera Gateway as an administrator or developer.
- In the sidebar, select Configuration.
- Select the File Converters tab.
- Select Add... and enter the following information in the File Converter wizard:
- Name: Enter a distinct name for the file parser being added.
- Type: Select the type of file converter being created. Choices include: Parser and Generator.
- Description: Enter a short description of the purpose of the parser or generator being created.
- Script: Enter the Groovy code to support specific provider objects in the parser or generator.
- Select Validate to ensure the Groovy syntax contains no errors.
- Select Save.
The new parser or generator is now listed in the File Converters tab.
Tips:
- Copy the Groovy source code of the Resource Parser or Resource Generator and only update the
ObjectName
to support the specific object in Gateway. - Use Groovy code to define objects and fields while creating additional parsers and generators.