Organizational Tree
Purpose¶
Read-only access to the organizational tree.
Methods¶
Binding name: p6.org
and p6.orglevel
getProperties¶
Get properties stored within the organizational tree
Syntax
List<Tuple<String, Map<String, OrgPropertyContent>>> p6.org.getProperties(
String orgPath,
p6.orglevel level,
String... keys
)
OrgPropertyContent definition
class OrgPropertyContent {
byte[] data
String contentType
String toString()
InputStream toStream()
}
- Get properties stored within the organizational tree at the given path:
orgPath
. - Properties have a key and a
OrgPropertyContent
. AOrgPropertyContent
has 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
level
parameter 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
Example
println p6.org.getProperties ('/*/Company Index/ANADARKO CORP', p6.orglevel.UNIT, 'DUNS','ANOTHER')
getProperties¶
This variant of the getProperties
method allows an includeFilter
closure to be passed as a parameter.
Syntax
List<Tuple<String, Map<String, OrgPropertyContent>>> p6.org.getProperties(
String orgPath,
p6.orglevel level,
Closure<Boolean> includeFilter,
String... keys
)
- This variant of the
getProperties
method allows anincludeFilter
closure to be passed as a parameter. -
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.
-
The
includeFilter
will be passed aOrgPropertyContent
object that may be evaluated by the given closure and when the result is true theOrgPropertyContent
will be included in the results.
Examples
println p6.org.getProperties ('/*/Company Index/ANADARKO CORP', p6.orglevel.UNIT, {c -> c.toString() == '008824133'}, 'DUNS')
def 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 )
}
}
putOrgAndAssignUsers¶
Create an organisational element and optionally assign users.
Syntax
String p6.org.putOrgAndAssignUsers(Map<String, Object> configuration)
The return is the path to the organisational element inside the instance.
Parameter: configuration
Configuration Name | Description |
---|---|
name | The name of the element |
description | The description of the element |
parent | Optional. The path to the parent element (separated with / ) |
emails | Optional. List of user emails to be assigned to the org element |
Note
If an element already exist for the instanceName
, parentPath
and name
, the creation will be skipped but not the assigment.
Examples
Create a child at the root
println p6.org.putOrgAndAssignUsers([
"name": "child",
"description": "Child under root"
])
// Output: /instanceName/child
Create a child with a parent
println p6.org.putOrgAndAssignUsers([
"name": "sub",
"description": "Sub node",
"parent": "child"
])
// Output: /instanceName/child/sub
Create a child with a parent an assign users
println p6.org.putOrgAndAssignUsers([
"name": "leaf",
"description": "Leaf",
"parent": "child/sub",
"emails": ["user@server.com", "admin@server.com"]
])
// Output: /instanceName/child/sub/leaf