Aras Innovator Platform

Programming Notes

For details on any subjects in this section, refer to the Aras Innovator - Programmer’s Guide. This section is only meant to be a reference to areas of interest for programmers.

An example of an external program to execute scheduled replication is provided on the Aras Community Projects site under Vault Replication Examples (https://github.com/ArasLabs/vault-replication-examples).

The example automatically creates files and submits them to Aras Innovator, which generates replication transactions if a replication rule is properly set. Next, a sample process runs on the queue until it is empty. See the ProcessReplicationQueueSample.cs file in the download for more information.

An example of an Aras Innovator action to execute manual replication transactions is provided on the Aras Community Projects site under Vault Replication Examples (https://github.com/ArasLabs/vault-replication-examples).

See the readme file in the download for instructions on installing this example. An ‘Execute Manual Transactions’ Action is added, which calls a client method, which in turn calls the server method repeatedly to process all outstanding Manual replication transactions in the queue.

Here is an example of VB code to request replication on a specific file. It triggers the server to check through the Replication Rules for a matching onEvent replication rule for that requesting user’s Identity and Vault. This example would be run through an Item Action on a file item to call this method. You would run this as an administrator by navigating to Administration>Files, locating the file through a search, and running the action on a file.

’ FileId refers to the file to be replicated, in this case, the File selected when the action is run
Dim FileId As String = Me.getID()
Dim inn As Innovator = Me.getInnovator()
Dim innrep, innresult As Item
innrep = inn.newItem(“File”,"replicate”)
innrep.setId(FileId)
innresult = innrep.apply()

Here is an example of a server method to request replication for file(s) attached to a document which is transitioning to Released state. It would be specified as the Post Server Method on the transition(s) to Released state on the document’s Lifecycle Map.

Dim inn As Innovator = Me.getInnovator()
Dim thisDoc As String = Me.getID()
Dim innrep, innresult As Item
Dim myQry As Item = Me.newItem(“Document File”,"get”)
myQry.setProperty(“source_id”, thisDoc)
myQry.setAttribute(“select”,"related_id”)
Dim results As Item = myQry.apply()
Dim docfiles As Item = results.getItemsByXPath("//Item[@type='Document File’]”)
Dim w As Integer = 0
For w=0 To DocFiles.getItemCount()-1
 Dim DocFile As Item = DocFiles.getItemByIndex(w)
 Dim FileId As String = DocFile.getProperty(“related_id”)
 innrep = inn.newItem(“File”,"replicate”)
 innrep.setId(FileId)
 innresult = innrep.apply()
Next w
Return Me 

An example of an external program to execute scheduled replication is provided on the Aras Community Projects site under Vault Replication Examples https://github.com/ArasLabs/vault-replication-examples).

The example gets a list of files with the filename starting with ‘file’ in the Default vault on the Aras Innovator server, and requests onEvent replication for each. If an appropriate onEvent replication rule exists on the Default vault, replication transactions should be created. These can then be processed a number of ways, including those shown in 6.1 or 6.2, depending on the Replication Mode set in the replication rule. See the CreateReplicationTxnsSample.cs file in the download for more information.

Here is a sample of VB server method code to determine if a file should be replicated. Based on the ID of the file, other properties and relationships can be determined and used to make the decision.

’ FileId refers to the file to be replicated
Dim FileId As String = Me.getID()
Dim FileSize as Integer = Me.getProperty(“file_size”)
Dim inn As Innovator = Me.getInnovator()
Dim innresult As Item
’ put your code here to determine if the file should be replicated or if 
’ replication transaction should be discarded
If (FileSize > 1000) Then ' put your test condition here
’ return a 1 if the file should be replicated
 innresult = inn.newResult(“1")
Else
’ return an error message for the log if file should not be replicated
 innresult = inn.newResult(“Error Message for Replication Log”)
End If
Return innresult