1 2 Previous Next 15 Replies Latest reply: Oct 7, 2013 1:19 PM by 987117 RSS

    Export OIM 11g Resource object with dependencies

    906007
      Hi All,

      I am looking for sample code that will export all OIM 11g Resource objects along with dependencies into XML format. Can somebody help?

      I am using the below code to retreive all resource objects but don't have dependencies.

      FileWriter fstream = new FileWriter("OIMResources.xml");
      BufferedWriter out = new BufferedWriter(fstream);
      tcExportOperationsIntf moExportUtility = (tcExportOperationsIntf) ioUtilityFactory
                .getUtility("Thor.API.Operations.tcExportOperationsIntf");
      Collection lstObjects = moExportUtility.findObjects(export_object, "*");
      String s = moExportUtility.getExportXML(lstObjects, "*");
      out.write(s);


      Thanks
      Mahendra.
        • 1. Re: Export OIM 11g Resource object with dependencies
          906007
          Hi All,

          I have tried with below code snippet, but just wants to get a word from OIM experts whether this willl get all dependencies.

          tcExportOperationsIntf moExportUtility = (tcExportOperationsIntf) ioUtilityFactory.getUtility("Thor.API.Operations.tcExportOperationsIntf");
               Collection lstObjects = moExportUtility.findObjects("Resource", "*");
               lstObjects.addAll(moExportUtility.getDependencies(lstObjects));
               String s = moExportUtility.getExportXML(lstObjects, "*");

          Observed that XML content generated with this code is more compared to previous code.

          Basically, I am exporting Resource object with all dependencies which will retrieve UDFs, process definitions etc., so that I don't have to export other objects independently. Please confirm if this is the right approach to do export and import of OIM objects in 11g.

          Please let me know your thoughts.

          -Mahendra.
          • 2. Re: Export OIM 11g Resource object with dependencies
            user12841694
            Hi

            You can validate this way:

            you should have

            Resource Object
            -Reconciliation Rule
            -Recon Fields

            Process Definition
            -Adapters

            Process Form
            All the process forms
            Prepopulate adapters

            IT Resource Definition & Instances

            My suggestion is u open the XML with XML Marker to better view the objects.

            Regards
            user12841694
            • 3. Re: Export OIM 11g Resource object with dependencies
              906007
              Hi user12841694,

              Appreciate your response.

              From the exported Resource XML, I can see the objects Resource, UserGroup, PasswordPolicy and Rule.

              In the Resource block of XML, I can see ReconFields, Recon Rules.

              However it seems that just Resources XML with depdencies does not contain all the OIM data in one environment, Please validate. Also, do I have to use the abvoe code snippet to retrieve Process Definition, Process Forms and IT Resources with dependencies?

              Please let me know your thoughts.

              Thanks
              Mahendra.
              • 4. Re: Export OIM 11g Resource object with dependencies
                user12841694
                Hi

                Yes, u can try the option to export other objects as well. But out of curiosity I would like to know why u are not using Deployment Manager utility from OIM Advanced Console.

                Basically exporting resource XML brings up all the depencies like form, definition etc...

                Regards
                user12841694
                • 5. Re: Export OIM 11g Resource object with dependencies
                  906007
                  It is a requirement to export and import all objects using OIM API unfortunately :(
                  • 6. Re: Export OIM 11g Resource object with dependencies
                    madhatter
                    903004 wrote:

                    tcExportOperationsIntf moExportUtility = (tcExportOperationsIntf) ioUtilityFactory.getUtility("Thor.API.Operations.tcExportOperationsIntf");
                         Collection lstObjects = moExportUtility.findObjects("Resource", "*");
                         lstObjects.addAll(moExportUtility.getDependencies(lstObjects));
                         String s = moExportUtility.getExportXML(lstObjects, "*");

                    Observed that XML content generated with this code is more compared to previous code.
                    That's because you should not add the list returned by getDependencies() to your result set, this procedure seems to do it itself.
                    • 7. Re: Export OIM 11g Resource object with dependencies
                      906007
                      Hi Madhatter,

                      Thanks for your reply. Here are my further observations. When I try to export the Resources object with all dependencies from OIM Deployment manager console, the size of xml is around 3 MB. So it exports all the dependent objects such as process definition, task adapters etc.,

                      However if I use the below code snippet even with getDependencies(), the size of file is just 300 kb and it does not fetch its dependencies.

                      Basically I want to export Resources object with all its dependencies at one go. Can you please help?

                      Thanks
                      Mahendra.
                      • 8. Re: Export OIM 11g Resource object with dependencies
                        madhatter
                        903004 wrote:
                        Hi Madhatter,

                        Thanks for your reply. Here are my further observations. When I try to export the Resources object with all dependencies from OIM Deployment manager console, the size of xml is around 3 MB. So it exports all the dependent objects such as process definition, task adapters etc.,

                        However if I use the below code snippet even with getDependencies(), the size of file is just 300 kb and it does not fetch its dependencies.

                        Basically I want to export Resources object with all its dependencies at one go. Can you please help?

                        Thanks
                        Mahendra.
                        Use the retrieveDependencyTree() instead.

                        The getDependencies() just returns only the directly dependant objects, so you could do whatever you want with this list.

                        The retrieveDependencyTree() method not only recursively retrieves all the dependencies and descendants, but also installs these into the root objects (the Resources in your case).

                        Take a look at my page http://idmclub.wikidot.com/import-export-deployment-artifacts for more info and a complete example on how to export all data for MS Active Directory connector.

                        Regards,
                        Vladimir
                        • 9. Re: Export OIM 11g Resource object with dependencies
                          906007
                          Hi Vladimir,

                          Thanks for your reply. In fact I did refer your blog earlier. Even when I try to use just retrieveDependencyTree, I am just seeing the resource objects but not its dependencies. Can you please help?

                               tcExportOperationsIntf moExportUtility = (tcExportOperationsIntf) ioUtilityFactory.getUtility("Thor.API.Operations.tcExportOperationsIntf");
                               Collection lstObjects = moExportUtility.findObjects("Resource", "*");
                               lstObjects.addAll(moExportUtility.retrieveDependencyTree(lstObjects));
                               String s = moExportUtility.getExportXML(lstObjects, "*");     

                          Thanks
                          Mahendra.
                          • 10. Re: Export OIM 11g Resource object with dependencies
                            906007
                            Hi Vladimir,

                            I am referring to your post and I have a question on step "Complete example: export all connector data"

                            So the below code snippet will export all the AD connector data along with dependencies + children automatically? Or should dependencies be exported seperately?

                            Also, don't we have to install AD connector prior to importing AD connector configurations into target environment? Please confirm.

                            Thanks for your help.

                            Edited by: 903004 on Jun 18, 2012 9:16 AM
                            • 11. Re: Export OIM 11g Resource object with dependencies
                              madhatter
                              Hi Mahendra,
                              903004 wrote:
                              Hi Vladimir,

                              I am referring to your post and I have a question on step "Complete example: export all connector data"

                              So the below code snippet will export all the AD connector data along with dependencies + children automatically? Or should dependencies be exported separately?
                              1. All the children data is always automatically exported along with RootObjects
                              2. Only the objects directly listed in the argument to getExportXML() are exported
                              3. Right now I do not know any other objects that shall be part of the connector, and which are not listed in the example, if you notice one, let me know
                              >
                              Also, don't we have to install AD connector prior to importing AD connector configurations into target environment? Please confirm.
                              OIM tries to build adapters automatically just after their data it installed in repository. So you will probably want to have all hand-made Java code installed prior importing data that refers this code.
                              >
                              Thanks for your help.
                              Now that I understand much better how import/export works I'm going to renew my page at wikidot significantly. Stay tuned!
                              • 12. Re: Export OIM 11g Resource object with dependencies
                                madhatter
                                I've just updated my page http://idmclub.wikidot.com/import-export-deployment-artifacts regarding the subject.

                                Edited by: madhatter on Jun 19, 2012 4:51 PM
                                • 13. Re: Export OIM 11g Resource object with dependencies
                                  906007
                                  Hi Vladimir,

                                  I am using the below code snippet to do the export of Resources.

                                  public Boolean export() {
                                       
                                       Boolean result = true;
                                       //String export_object = Util.config.getProperty(Constants.EXPORT_PATH);
                                       String export_object="Resource";
                                       /*if (export_object != null && !export_object.endsWith(File.separator)) {
                                       export_object = export_object.concat(File.separator);
                                       }*/
                                       //String export_object_path = export_object.concat(xmlFile);
                                       try {

                                       FileWriter fstream = new FileWriter("OIMResources.xml");
                                       BufferedWriter out = new BufferedWriter(fstream);
                                       tcExportOperationsIntf moExportUtility = (tcExportOperationsIntf) ioUtilityFactory.getUtility("Thor.API.Operations.tcExportOperationsIntf");
                                       Collection<RootObject> lstObjects = moExportUtility.findObjects(export_object, "*");
                                       System.out.println(lstObjects);
                                       lstObjects.addAll(moExportUtility.getDependencies(lstObjects));
                                       lstObjects.addAll(moExportUtility.retrieveChildren(lstObjects));
                                       lstObjects.addAll(moExportUtility.retrieveDependencyTree(lstObjects));
                                       String s = moExportUtility.getExportXML(lstObjects, "*");     
                                       
                                       out.write(s);
                                       LOG.info(Resource + " Objects are successfully exported --------------->");
                                       out.close();

                                       } catch (Exception e) {
                                       LOG.log(Level.SEVERE, "Exception occured while exporting OIM object - " + Resource, e);
                                       }
                                       return result;
                                  }

                                  I am not getting its dependent objects as I was getting through OIM Deployment manager console. If I export the details through OIM console, the file size is around 3 MB. If I exported through above java code, file size is 300 KB only.

                                  Please let me know if I am missing anything.

                                  Edited by: Mahendra K on Jun 19, 2012 10:19 AM
                                  • 14. Re: Export OIM 11g Resource object with dependencies
                                    madhatter
                                    the retriveChildren() and retrieveDependencyTree() return no more objects than you pass to them as arguments. To get more data exported to XML, you need to pass more object in the argument collection. So the calls of retriveChildren() and retrieveDependencyTree() methods in your code do not make any sense. Moreover, same object will be exported more than once.

                                    Please follow the connector export example on the page I referred and explicitly pass all objects you want to export to getExportXML().

                                    Also I noticed you pass the "*" string as the second argument to getExportXML(). The second argument for getExportXML() is arbitrary description text which just stored as an attribute of the top XML element.

                                    Regards,
                                    Vladimir
                                    1 2 Previous Next