Open topic with navigation

TIBCO® Enterprise Administrator 2.4.2

# How to Get Shared TeaObject Along with All the References

A TeaObject has references to all its members. When you get a TeaObject from the database, you have the option to get the high-level object or you can request the object with all the references included (Closure).

To retrieve a TeaObject Closure use the following code:

    @TeaOperation(name = "getJohnClosure", description = "getJohnClosure")
    public String getJohnClosure() throws IOException {
    TeaPersistence persistence = ShareReaderAgent.server.getPersistence();
    Map<String, JSONObject> johnClosure = persistence.getObjectClosure("ShareWriterAgent", "Person", "john");
    return Joiner.on(",").join(johnClosure.values());
    }

The object returned by this method is in JSON format. Below is an example that is returned by the sample code above:

    [
    {
      "@objectId":"ShareWriterAgent::Person:Peter",
      "name":"Peter",
      "description":"Peter Person",
      "key":"Peter",
      "config":{
         "status":"Single",
         "address":"3303 Hillview Avenue"
    },
      "members":[
         "ShareWriterAgent::Person:Adam",
         "ShareWriterAgent::Person:Sarah"
    ],
      "references":[
        {
         "name":"cousins",
         "elements":[
           "ShareWriterAgent::Person:Brian",
           "ShareWriterAgent::Person:Anna"
           ]
         },
         {
           "name":"parent",
           "elements":[
             "ShareWriterAgent::Person:John"
           ]
         },
         {
           "name":"cars",
           "elements":[
             "ShareWriterAgent::Car:BMW"
             ]
           }
          ]
         },
         {
           "@objectId":"ShareWriterAgent::Person:Adam",
           "name":"Adam",
           "description":"Adam Person",
           "key":"Adam",
           "config":{
              "status":"Single",
              "address":"3303 Hillview Avenue"
            }
         },
         {
           "@objectId":"ShareWriterAgent::Person:Sarah",
           "name":"Sarah",
           "description":"Sarah Person",
           "key":"Sarah",
           "config":{
              "status":"Single",
              "address":"3303 Hillview Avenue"
             }
         },
         {
           "@objectId":"ShareWriterAgent::Person:Brian",
           "name":"Brian",
           "description":"Brian Person",
           "key":"Brian",
           "config":{
              "status":"Single",
              "address":"3303 Hillview Avenue"
           }
         },
         {
           "@objectId":"ShareWriterAgent::Person:Anna",
           "name":"Anna",
           "description":"Anna Person",
           "key":"Anna",
           "config":{
              "status":"Single",
              "address":"3303 Hillview Avenue"
            }
         },
         {
           "@objectId":"ShareWriterAgent::Person:John",
           "name":"John",
           "description":"John Person",
           "key":"John",
           "config":{
              "status":"Single",
              "address":"3303 Hillview Avenue"
             }
         },
         {
           "@objectId":"ShareWriterAgent::Car:BMW",
           "name":"BMW",
           "description":"BMW Car",
           "key":"BMW",
           "config":{
              "color":"blue",
              "license":"6VHM435"
            }
          }
         ]

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Enterprise Administrator

Copyright © 1996-2025. Cloud Software Group, Inc. All Rights Reserved.