Using CheckinManager

The CheckInManager is a function built into the IOM.dll which allows for the loading of large data structures into Aras Innovator that contain Images, Drawings, Documents, or other Items of the File Itemtype.The following use cases describe how to use CheckInManager to submit images and drawings, either individually or as a collection.

The following is the first step in submitting a File structure to CheckInManager to create a CAD item and add properties to it. The following code shows a typical AML query for creating a CAD item:

In this scenario, the setFileProperty method is required to add a property whose type is File. The parameters of setFileProperty include the Property’s name and the fully qualified path of the File. If you need to use the CheckinManager to load an Image Property, you must set the Attribute checkinManager-type on the Property (such as in the thumbnail, below) to “Image”. The following example shows the AML for the query:

If you are only importing one Item, you can then pass the Item directly to the CheckinManager. The following example uses cad0 from the previous scenario:

You can also use this code to import more than one item. For example, given two CAD Items, referenced as cad0 and cad1 in the following example, you can generate 1 AML that contains both Items, as demonstrated here:

The following is the AML code which would result from the loadAML statement:

The following code can then be used to apply the query contained in the configuration value:

You must make sure you observe the following requirements for the query to work correctly:

  • You must have at least one File or Image property otherwise CheckinManager will throw an exception.
  • The Item passed to CreateCheckinManager cannot be null.
  • A File item must have either an Add or a Create action associated with it.
  • CAD items only support the following actions:
    • Add
    • Update
    • Delete
    • Version
    • Skip

Specifying any other type of action results in an exception being thrown.

In this use case, the Items are set up the same way they were set up in the previous use case. The difference is that the items created here have multiple parents. You must instantiate the MultiParentConfigurationBuilder class to add more than one parent. The following code relies on an item configuration, as shown in the previous examples: The following is the AML for the cadA Item from the example:

The following shows the AML code for the drawingA Item:

The addParent function creates a link between these two structures that generates the complete structure, as shown in the final CAD structure shown here: The following is the AML code for multiParentConfiguration: <AML> <Item isNew="1" isTemp="1" type="CAD” action="add” id="4C8DD7F5785E4E9D97461BDF2D1228D3"> <item_number>7C9FD065FAAC4D4F955820E0FEC5CB5A</item_number> <name>submitting-drawings-cadA</name> <Relationships> <Item isNew="1" isTemp="1" type="CAD Structure” action="add"> <related_id> <Item isNew="1" isTemp="1" type="CAD” action="add” id="774A4C99DDC7454E9D5A0BB84EA60459"> <item_number>C8CB6EB081A24945A100C3CE8FE0BFA6</item_number> <name>submitting-drawings-cadB</name> </Item> </related_id> </Item> <Item isNew="1" isTemp="1" type="CAD Structure” action="add"> <related_id> <Item isNew="1" isTemp="1" type="CAD” action="add” id="B236FBFD63CA4BD89AEF8A443E5942FE"> <item_number>DCCA69BB52AE4CC185FBD3B450EF314B</item_number> <name>submitting-drawings-cadC</name> </Item> </related_id> </Item> </Relationships> </Item> <Item isNew="1" isTemp="1" type="CAD” action="add” id="AF1763AA429D41119C896E5170D1A725"> <item_number>4816709F699946B595B4FBDF55FCE313</item_number> <native_file> <Item isNew="1" isTemp="1" type="File” action="add” id="8C83A9DD1EED4AA586CF6A53E7D542B3"> <filename>native-A.cad</filename> <actual_filename>C:\Sandbox\pbellis\checkinmanagerexamples\CompilableCode\examples\submitting- drawings\bin\Debug\input\native-A.cad</actual_filename> <checkedout_path>C:\Sandbox\pbellis\checkinmanagerexamples\CompilableCode\examples\submitting- drawings\bin\Debug\input</checkedout_path> <Relationships> <Item type="Located” action="add” where="related_id='67BBB9204FE84A8981ED8313049BA06C’"> <related_id>67BBB9204FE84A8981ED8313049BA06C</related_id> </Item> </Relationships> </Item> </native_file> <name>submitting-drawings-drawingA</name> <Relationships> <Item isNew="1" isTemp="1" type="CAD Structure” action="add"> <related_id>4C8DD7F5785E4E9D97461BDF2D1228D3</related_id> </Item> </Relationships> </Item> <Item isNew="1" isTemp="1" type="CAD” action="add” id="D0AD5B11F58F4CB79978C2FB4BFD1A71"> <item_number>D54200E995B9410F808EEB26FB9E04AB</item_number> <native_file> <Item isNew="1" isTemp="1" type="File” action="add” id="DFE1AA07106B4AC4B63595E8CC89833F"> <filename>native-B.cad</filename> <actual_filename>C:\Sandbox\pbellis\checkinmanagerexamples\CompilableCode\examples\submitting- drawings\bin\Debug\input\native-B.cad</actual_filename> <checkedout_path>C:\Sandbox\pbellis\checkinmanagerexamples\CompilableCode\examples\submitting- drawings\bin\Debug\input</checkedout_path> <Relationships> <Item type="Located” action="add” where="related_id='67BBB9204FE84A8981ED8313049BA06C’"> <related_id>67BBB9204FE84A8981ED8313049BA06C</related_id> </Item> </Relationships> </Item> </native_file> <name>submitting-drawings-drawingB</name> <Relationships> <Item isNew="1" isTemp="1" type="CAD Structure” action="add"> <related_id>774A4C99DDC7454E9D5A0BB84EA60459</related_id> </Item> </Item> <Item isNew="1" isTemp="1" type="CAD” action="add” id="E5F643DCC71A4740AC29189B064C9AC6"> <item_number>5FE746744D8C433281F32C9588F2D64B</item_number> <native_file> <Item isNew="1" isTemp="1" type="File” action="add” id="8C4C44D934B14CE0A8779008F4395F89"> <filename>native-C.cad</filename> <actual_filename>C:\Sandbox\pbellis\checkinmanagerexamples\CompilableCode\examples\submitting- drawings\bin\Debug\input\native-C.cad</actual_filename> <checkedout_path>C:\Sandbox\pbellis\checkinmanagerexamples\CompilableCode\examples\submitting-drawings\bin\Debug\input</checkedout_path> <Relationships> <Item type="Located” action="add” where="related_id='67BBB9204FE84A8981ED8313049BA06C’"> <related_id>67BBB9204FE84A8981ED8313049BA06C</related_id> </Item> </Relationships> </Item> </native_file> <name>submitting-drawings-drawingC</name> <Relationships> <Item isNew="1" isTemp="1" type="CAD Structure” action="add"> <related_id>B236FBFD63CA4BD89AEF8A443E5942FE</related_id> </Item> </Relationships> </Item> </AML> In this case, cadA is equal to configuration. The last line of code creates a CAD Structure relationship between drawingA and cadA. The example repeats similar logic for cadB and cadC. The following code then applies the query: The first line converts the Builder’s query into a query that supports multiple parents as determined by the calls to builder.addParent. After the first line of code, query execution is applied in the same way as a standard CheckInManager query.

The previous use cases allow the main thread to do the processing. In this use case, the class offloads all logic to a separate thread from the executing thread. Because of this, you need to keep the following in mind:

  • Using the Dispose pattern as the main thread continues execution and disposes of the CheckInManager will cause a NullReferenceException.
  • Retrieving the results from the CheckinManager requires a callback for either UploadFilesCompleted or CheckinCompleted. UploadFilesCompleted loops through all the files and writes out which files have been added. If an error is encountered, an exception is thrown. CheckInCompleted stores a list of all the results.
  • In CheckinCompleted, you must dispose of the CheckInManager to prevent a resource leak.