Organizational Tree
Purpose¶
Read-only access to the organizational tree.
Methods¶
Binding name: p6.org and p6.orglevel
Method:
List< Tuple < String, Map< String, Content > > > getProperties(String orgPath, orglevel level, String... keys)
- Get properties stored within the organizational tree at the given path:
orgPath. - Properties have a key and a
Content. AContenthas a Content-Type and Bytes. - Only those properties that have a key that matches one of the provided keys will be returned.
- The depth of a search for properties is governed by the
levelparameter and can be one of three values:
p6.orglevel.USER- only the properties of the single node pointed to by orgPathp6.orglevel.UNIT- the single node and all immediate child nodes of the node pointed to by orgPathp6.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, orglevel level, Closure<Boolean> includeFilter, String... keys)
- This variant of the
getPropertiesmethod allows anincludeFilterclosure to be passed as a parameter. -
Note the
includeFilterwill 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.
-
The
includeFilterwill be passed aContentobject that may be evaluated by the given closure and when the result is true theContentwill be included in the results.
Examples¶
def orgResults = p6.org.getProperties '/*/Company Index/ANADARKO CORP', p6.orglevel.UNIT, 'DUNS','ANOTHER'
println orgResults
orgResults = p6.org.getProperties '/*/Company Index/ANADARKO CORP', p6.orglevel.UNIT, {c -> c.toString() == '008824133'}, 'DUNS'
println orgResults
orgResults = p6.org.getProperties '/*/Company Index/ANADARKO CORP/ANADARKO US OFFSHORE LLC', p6.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 p6.uri.streamTo ( content.toStream(), null, content.contentType )
}
}