I had a search for this info, and while I can see a lot of great examples of using the SDK, these really just apply to a single universe.
I have created a java program to document a UNX universe and save it into JSON format so we can load it into Snowflake.
I wish to execute this against all unx universes initially, then periodically execute it against universes which have changed.
My question is, how do I get the paths of the unx files so that I can retrieve them using the SDK? Currently I’ve hard coded a universe path into the method do retrieve the universe. Is it just a case of running a CMS query to get the list of universes and their parents, and then for each parent recursively get the parent until you hit the universe root folder? From what I can see the only way to retrieve a unx is via the path. If memory serves, using the original designer (UDT) SDK you could do this by CUID which was a piece of cake.
I will need to do the same for connections, but if can figure out universes then I’m sure connections will follow suit.
I believe you’re correct – you need to pass the path as a string in order to load it. But you should only need to recurse up to the universe’s folder. Folder objects have an SI_PATH property that you can use to build the string, rather than recursing all the way up.
Thank you joepeters. If it’s just a case of getting the parent folder then building the path using SI_PATH, that doesn’t sound too onerous.
When I pick this back up and get it sorted I’ll post my code and mark your response as the solution.
This is what I had to do. This seems like something the SDK should be able to do. It’s not my proudest creation but it works (I find myself saying that a lot when working with the SAP SDKs).
IInfoStore iStore = (IInfoStore)enterpriseSession.getService("","InfoStore");
IInfoObjects IObjects = (IInfoObjects)iStore.query("select * from CI_APPOBJECTS where SI_KIND in ('CCIS.DataConnection', 'CommonConnection')");
for(int i=0; i<IObjects.size(); i++)
{
IInfoObject connObj = (IInfoObject)IObjects.get(i);
System.out.println("Connection Name :: " + connObj.getTitle());
String folderCUID = connObj.getParentCUID();
System.out.println("Connection Parent CUID :: " + folderCUID);
IInfoObjects connFolderObjs = (IInfoObjects)iStore.query("select * from CI_APPOBJECTS where SI_CUID = '" + folderCUID + "'");
IInfoObject connFolderObj = (IInfoObject)connFolderObjs.get(0);
System.out.println("Connection Parent Name :: " + connFolderObj.getTitle());
String connFolderPath = connRoot + "/";
if (!"Connections".equals(connFolderObj.getTitle())) {
IFolderBase connFolder = (IFolderBase)connFolderObjs.get(0);
String[] conFolderPaths = connFolder.getPath();
boolean startRecording = false;
for (int c=conFolderPaths.length-1; c>=0; c--) {
if (startRecording) {
connFolderPath = connFolderPath + conFolderPaths[c] + "/";
}
if ("Connections".equals(conFolderPaths[c])) {
startRecording = true;
}
}
connFolderPath = connFolderPath + connFolderObj.getTitle() + "/";
}
System.out.println("Connection Path :: " + connFolderPath);
}
I hear you. I see one spot that you can optimize. Instead of re-querying for the parent folder, you can use:
IIFolder connFolder = (IFolder)connObj.getParent(IInfoObject.PropertySet.ALL)
(I just typed this in without testing, but it should work)
Thanks @joepeters , I’ll give that a bash. Ran into some other issues to do with what I assume to be the fact that I don’t have a 32bit oracle client installed when running through the connections.