Organizational tree

Purpose

Read-only access to the organizational tree.

Methods

Binding name: org


Method:

List< Tuple < String, Map< String, Content > > > getProperties( String orgPath, Level level, String... keys )

  1. Get properties stored within the organizational tree at the given path: orgPath.
  2. Properties have a key and a Content. A Content has a Content-Type and Bytes.
  3. Only those properties that have a key that matches one of the provided keys will be returned.
  4. The depth of a search for properties is governed by the Level parameter and can be one of three values:
  • orgLevel.USER - only the properties of the single node pointed to by orgPath
  • orgLevel.UNIT - the single node and all immediate child nodes of the node pointed to by orgPath
  • orgLevel.BRANCH - the single node and all nodes beneath within the tree

The Content class has the following structure:

class Content {
    byte[] data
    String contentType

    String toString()
    InputStream toStream()
}

Method:

List< Tuple < String, Map< String, Content > > > getProperties( String orgPath, Level level, Closure<Content> includeFilter, String... keys )

  1. This variant of the getProperties method allows an includeFilter closure to be passed as a parameter.
  2. Note the includeFilter will reduce the results returned however this should not be regarded as equivalent to a search facility. The server still returns all properties found while navigating the specified org path.

    Note

    Tables are still the most efficient, indexed, data structures to use with Platform 6.

  3. The includeFilter will be passed a Content object that may be evaluated by the given closure and when the result is true the Content will be included in the results.

Examples

def orgResults = org.getProperties '/*/Company Index/ANADARKO CORP', orgLevel.UNIT, 'DUNS','ANOTHER'
println orgResults

orgResults = org.getProperties '/*/Company Index/ANADARKO CORP', orgLevel.UNIT, {c -> c.toString() == '008824133'}, 'DUNS'
println orgResults

orgResults = org.getProperties '/*/Company Index/ANADARKO CORP/ANADARKO US OFFSHORE LLC', orgLevel.USER, '_Amalto Ops_DUNS_Customers.xlsx'
orgResults.each{ tpl ->
    // Print the node name where the property was found
    println tpl[0]

    tpl[1].each { key, content ->
        // Stream the property to a file as it's an xlsx
        println uri.streamTo ( content.toStream(), null, content.contentType )
    }
}