Last active
December 1, 2017 17:29
-
-
Save YoannArasLab/54c11526acb173917a400708014eef6b to your computer and use it in GitHub Desktop.
onAfterGet Method for inter-Aras Instance federation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve Local Innovator instance | |
Innovator inn = this.getInnovator(); | |
// make connection | |
HttpServerConnection foreignAras = IomFactory.CreateHttpServerConnection("http://localhost/InnovatorServer","InnovatorDBName", "<loginName>", "<md5password>"); | |
Item login = foreignAras.Login(); | |
// test if login succeeded | |
if (login.isError()) { | |
// if failed return Error | |
return inn.newError("Couldn't Login to external Aras database"); | |
} else { | |
// retrieve existing items | |
Innovator innext = IomFactory.CreateInnovator(foreignAras); | |
Item ExternalCustomers = innext.newItem("customer","get"); | |
ExternalCustomers = ExternalCustomers.apply(); | |
// append foreign results to local result set of items | |
for (int i = 0; i < ExternalCustomers.getItemCount();++i ){ | |
ExternalCustomers.getItemByIndex(i).setProperty("_external","yes"); | |
this.appendItem(ExternalCustomers.getItemByIndex(i)); | |
} | |
// return full result | |
return ExternalCustomers; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment