Find or create a part, upload or replace a file

This example pipeline demonstrates how to find or create a part and then upload or replace its file.


Pipeline consisting of twenty-four snaps to demonstrate how to upload and replace files in Teamcenter.

Steps

1: Configure the JSON Generator Snap and edit json file including metadata for Item and binary data for file.

Snap configuration

Snap output


JSON Generator Snap settings. JSON File stored behind 'Edit JSON'.


JSON document stored on JSON Generator snap.

2: Configure a Copy Snap to save a copy of request file for later.

Snap configuration


Settings of Copy Snap.

3: Configure a Mapper Snap to extract metadata for Teamcenter object. On validation, the Snap displays JSON document only containing metadata information.

Snap configuration

Snap output


Mapper settings including Mapping table for source target mappings with six rows.


JSON output document with mapping result.

4: Configure a Router Snap to check request information for property which includes TeamcenterInternalID of existing object. Expression for this example is

$.hasPath('TeamcenterInternalID') && $.TeamcenterInternalID != ""

Snap configuration


Router Snap settings to route to Info branch in case condition matches. Otherwise create branch will be routed to.

5.1: Branch “Info” - Configure a Tc Info Snap to get data of existing object in Teamcenter.

Snap configuration


Tc Info Snap settings using values from Mapper output as intpu for fields 'Object ID' and 'Expand Attributes Path'.

6.1: Branch “Create” - Configure a Tc Create And Update Snap to create Item for given attributes and type. On validation, the Snap displays the newly created revision.

Snap configuration

Snap output


TC Create And Update Snap settings using result of Mapper Snap to fill fields 'Object Type', 'Object Attributes Path' and 'Expand Attributes Path'.


JSON document including metadata of newly created object.

7: Configure a Join Snap to merge “Info” and “Create” branch.

Snap configuration


Settings of Join Snap where Join Type is 'Merge'.

8: Configure a Copy Snap to save a copy of item revision metadata for later.

Snap configuration


Settings of Copy Snap.

9: Configure a Tc Get Downloadable Files Snap to get a list of downloadables files for object. On validation, the Snap displays the empty Datasets result for newly created object.

Snap configuration

Snap output


Tc Get Downloadable Files Snap settings using _id property from input document as 'Object ID' and defining two primary relation files are related with object. 'Mode' is defined as inline.


JSON output document being copy of input document including empty 'Datasets' list object.

10: Configure a Join Snap to merge the copy of request message and the Tc Get Downloadables Files response to one document.

Snap configuration


Join Snap settings defining Join type 'Merge'.

11: Configure a Router Snap to decide for upload or replace branch based on Datasets result. Expression for this example is

$.Datasets.length == 0

Snap configuration


Router Snap settings leading to upload branch if first expression is true. Otherwise replace branch is routed to.

12.1: Branch “Upload” - Configure a Pipeline Execution Snap to call child pipeline to manage file for object. On validation, the Snap displays the response of the child pipeline including the information for the uploaded File.

Snap configuration

Snap output


Pipeline excecute Snap settings with defined Pipeline 'z_TC_ManageFile' and a set of parameters including id of object and names for dataset and file.


JSON ouput document including result of child pipeline execution.

13.1: Branch “Replace” - Configure a Splitter Snap to get all datasets out of document.

Snap configuration


Splitter Snap settings with path to split leading to list object Datasets in input document. 'Include Paths' contains rows for dataset and file name and content.

13.2: Branch “Replace” - Configure a Filter Snap to filter the one dataset with correct name.

Snap configuration


Filter Snap settings with expression object_name property equals DatasetName property.

13.3: Branch “Replace” - Configure a Pipeline Execution Snap to call child pipeline to manage file for object.

Snap configuration


Pipeline excecute Snap settings with defined Pipeline 'z_TC_ManageFile' and a set of parameters including id of dataset and file and names for dataset and file.

14: Configure a Join Snap to merge branches for managing file data together.

Snap configuration


Join Snap settings using Join type 'Merge'.

15: Configure a Mapper Snap to map metadata of prior made copy for item object into a single object “itemRevision”. On validation, the Snap displays the mapped data.

Snap configuration

Snap output


Mapper settings including Mapping table with five rows to copy properties into object ItemRevision.


JSON output document of Mapper Snap.

16: Configure a Join Snap to merge item revision metadata to file transfer result. On validation, the Snap displays the joined information.

Snap configuration

Snap output


Join Snap settings using Join type 'Merge'.


JSON document output of Join Snap.

17: Configure a TC Info Snap to get fresh data for item revision. On validation, the Snap displays the current metadata.

Snap configuration

Snap output


Tc Info Snap setting using _id property of ItemRevision object as value for field 'Object ID'. Some hard written expand attributes are configured.


JSON output document of Tc Info Snap including metadata of ItemRevision.

18: Configure a Tc Get Downloadable Files Snap to get again current downlodables for item revision. On validation, the Snap displays the dataset which was created by file transfer.

Snap configuration

Snap output


Tc Get Downloadable Files Snap settings using _id property from input document as 'Object ID' and defining two primary relation files are related with object. 'Mode' is defined as inline.


JSON output document being copy of input document including 'Datasets' list object with one dataset object.

19: Configure a Splitter Snap to extract Datasets from JSON document. On validation, the Snap displays the dataset.

Snap configuration

Snap output


Splitter Snap settings with path to split leading to list object Datasets in input document.


JSON output document of Splitter Snap including one object.

20: Configure a Splitter Snap to get NamedReferences of dataset to get UID of file object. On validation, the Snap displays the NamedReference.

Snap configuration

Snap output


Splitter Snap settings with path to split leading to list object NamedReferences in input document.


JSON output document of Splitter Snap including one object including metadata of ImanFile.

21: Configure a Tc File Download Snap to download binary file. On validation, the Snap displays a preview File.

Snap configuration

Snap output


Settings of Tc File Download Snap with _id property value of input document used for field 'Object ID'.


Preview Type table of validation output.

22: Configure a File Writer Snap to store downloaded file to file system.

Snap configuration


Settings of File Writer Snap with configured 'File name'.

Child pipeline to extract binary data of file

This example pipeline demonstrates how to extract binary data from JSON Document and send binary data and parameter to child pipeline.


Child pipeline consisting of three snaps to reduce JSON document to content and transform it to binary before sending it to another child pipeline.

Pipeline properties include all possible parameters for child pipeline.


Pipeline settings including parameters for id, fileName, datasetName, datasetID and fileID.

1: Configure the Mapper Snap to extract binary data stored in one field of JSON document. On validation, the Snap displays the content.

Snap configuration

Snap output


Mapper Snap settings including Mapping table to map source content to target content.


JSON output document of Mapper Snap.

2: Configure a Document to Binary Snap to create a binary file based on input document. On validation, the Snap displays a preview.

Snap configuration

Snap output


Document to Binary Snap settingswhere Decode is set to DECODE BASE 64.


Preview Type table of validation output.

3: Configure a Pipeline Execute Snap to call childpipeline for loading binary file to Teamcenter. Pipeline routes given parameter from parent pipeline down to the child pipeline. On validation, the Snap displays the result of child pipeline execution.

Snap configuration

Snap output


Pipeline excecute Snap settings with defined Pipeline 'z_Binary_File2TC' and a set of parameters including id of object, dataset and file and names for dataset and file.


JSON output document of Pipeline Execute Snap.

Child pipeline to upload or replace a file

This example pipeline demonstrates how to load binary data sent to start pipeline to Teamcenter object which ID was given by parameter.


Child pipeline consisting of snaps to replace file or upload it to Teamcenter.

1: Configure the Binary Router Snap to evaluate parameter. If ID of dataset is given a replace of file shall happen. If datasetID is empty a new dataset shall be created while uploading file.

Snap configuration


Binary Router Snap settings where first expression checks value of parameter datasetID is empty and leads to upload branch. Otherwise replace branch is routed.

2.1: Branch “Upload” - Configure a Tc File Upload Snap to upload file to Teamcenter object. Name of dataset and file are given by parameter values.

Snap configuration


Tc File Upload Snap settings using parameter _id in field 'Parent ID'. Mandatory fields for dataset and relation configuration are defined.

2.2: Branch “Replace” - Configure a Tc File Replace Snap to replace file of existing Teamcenter dataset. On validation, the Snap displays the dataset and file information.

Snap configuration

Snap output


Tc File Replace Snap settings using parameter _datasetID in field 'Dataset ID' and fileID in 'File ID'. 'Delete replaced file' and 'Retain original filename' is set to true.


JSON output document including ImanFile metadata of in JSON object 'NewFile'.

3: Configure a Join Snap to move the branches together.

Snap configuration


Join Snap settings using Join type 'Merge'.