Jon Chinitz

Creating Annotations with the HCP Connector

Blog Post created by Jon Chinitz Employee on Jan 31, 2018

There has been a lot of talk recently about how to use the HCP connector, specifically how/when to use the actions Output File, Write Annotation and Write File. Following is an example of how I used these actions in a series of simple workflows.


I started out with a namespace (Cars) that I knew had files in it with custom metadata (CM) already attached. I actually used this namespace years ago to do some HCP MQE demos with. What I didn’t realize was that it also had some other files that didn’t have CM.


Step 1: Make a copy of the Cars namespace to do my work on. I accomplished this with a simple workflow that I keep around (Figure 1) .



Figure 1

The output section of the workflow uses the Output File action because I want to copy the entire object along with its CM (Figure 2).



Figure 2


Step 2: Get rid of the files that didn’t have CM. I wanted to preserve the files so the workflow copies them to another namespace (‘Split’) and then deletes them from the source. I accomplished this with a simple pipeline. The pipeline has an Output File action for the copy and a Delete action. Both are tucked inside an IF block that checks for the presence of the HCP_customMetadata field. The field is created by the HCP Connector and is set to true when the file has one or more metadata annotations (Figure 3).


Copy_if_no_CM_and_Delete_from_Source.pngFigure 3


The workflow for the copy is in Figure 4. Note that it has no Output section since the actions are performed in the processing pipeline.



Figure 4


Step 3: To demonstrate adding a new annotation I first needed to create the annotation. The easiest way to do this is a simple pipeline that has two stages. The first creates a couple of fields using a Tagging stage (Figure 5).


writeAnnotation-2-tagging-stage.pngFigure 5


The second creates an XML stream using the fields in an XML Formatter stage. The stream will be used as the annotation. The CM is written to the object in the Output section of the workflow using the Write Annotation action (Figure 6). Note the fields and streams in the Write Annotation configuration.

Slide1.JPGFigure 6


The workflow that pulls all this together is in Figure 7.

Add_CM_Workflow.pngFigure 7