8 Replies Latest reply on Apr 21, 2012 1:36 AM by 580267

    Adding tree data programmatically in metadata field

      Hi All,

      I have created a custom metadata field of tree type and added data into it and it works fine. But my requirement is to add/update this tree data programmatically with data coming from a spreadsheet so that tree can be updated on a periodic basis. I figured out two ways of doing that: 1) inserting data into underlying database table of UCM using some java method 2) Adding nodes to UCM tree using some UCM service API.
      But i couldn't find any information in the documentation. Could not see some services starting with 'COLLECTION_' and i am not sure if they could be helpful.

      Please guide me how to achieve this.

      Note : I am using UCM 11g+SSXA
        • 1. Re: Adding tree data programmatically in metadata field
          COLLECTION_ services work with folders, which indeed have tree-like hierarchy. You could use this structure, but as folders have also other connotations (their hierarchy is used to visualize data in Desktop application, or WebDAV), so it probably not wise to "waste" them on a general tree data. Besides, your task is to upgrade the whole structure available services, and available services work (I think all of them) with a single node.

          As for updating the database it sounds better, but you should consider all details - e.g. what should happen documents are assigned a node that no longer exists? Disadvantage of using the direct database inserts might also be considered as security violation in some organizations (even though you could have a user authorized to update this single table, which will be completely yours, so it could be safe). If you face such an issue, you will probably have to create your own service to do the same, or some kind of "batch loader"/an application that can be called to the work.
          • 2. Re: Adding tree data programmatically in metadata field

            However, it's certain that there exist some services which UCM uses internally to modify(Add Child node, Delete node) the taxonomy tree. Does anyone has any information on that?
            • 3. Re: Adding tree data programmatically in metadata field
              Hi Pooja,
              Let me see if I have understood your problem.
              Below is the steps you have done to get tree structure in metadata field.
              You have created table and corresponding view.
              Created relationship's in config manager and assigned to a metadata.
              Once this is done you are seeing the values in front end.

              What you want to do is add additional nodes to this tree structure?
              There is no UCM services that does Add Child node to this tree.The view that you see in front end is done using Java Script so it is only to view. To add values to tree you have to create a custom component and update
              your tables in back end, like how Jiri has mentioned.

              Let me know if this answers your questions.

              1 person found this helpful
              • 4. Re: Adding tree data programmatically in metadata field
                Yes, i created table,views,relationship and metadata field with option list - tree enabled. Then we can either add nodes to the tree from db end or we can edit the tree(or views) from ucm config mgr ui.
                As in the ucm ui, we have button for 'Add Child Node', 'Delete node' etc when we are on edit metadata field screen, ucm must be using some service internally to perform these tasks. I wanted to know about those, and if we can make a call to the same pre-existing services of ucm from our code so as to modify the tree programmatically.
                • 5. Re: Adding tree data programmatically in metadata field
                  Actually, there are none. And you can verify if - either read the definition of standard COLLECTION_ services, or in system-wide tracing.

                  I'd suggest you take a look at the database table COLLECTIONS. The taxonomy is achieved by 2 fields: dCollectionId and dParentCollectionId (which equals dCollectionId of the parent node) - as simple as that.

                  With this setup you may add a node by inserting a record; delete is a bit trickier - it's a cascading operation. If you use Oracle DB, there is actually support for such operations directly in the db. Read this link for reference: http://docs.oracle.com/cd/E11882_01/server.112/e10592/queries003.htm
                  1 person found this helpful
                  • 6. Re: Adding tree data programmatically in metadata field
                    Thank you both.

                    So, Could you tell me which service is being used by ucm to 'Publish Schema', so that i can refresh the tree programatically?
                    • 7. Re: Adding tree data programmatically in metadata field
                      ryan sullivan2

                      Make sure you're aware of the Service documentation that Oracle supplies. Most services are well documented.

                      • 8. Re: Adding tree data programmatically in metadata field
                        I haven't tried this yet but i just set up the db and will be exploring it over the next couple weeks when i have time;
                        Built into Oracle DB but needing usually to be turned on is Oracle XML DB. It has a number of interesting features and sounds like it may be a pathway for ingesting XML, having tables made reflecting the DTD and having SQL or XQuery run against it.
                        Id like to see if they can be included as either external tables with Views or some other mechanism to make the XML usable in Content Server.
                        Any thoughts or experience from anyone else would be appreciated.