So far we have built some sophisticated types. To create instances, we have the following options:
For this exercise, we will choose the second option (which allows us to get started much faster), and run the createOrg Groovy script in the script editor. This script populates our Org Chart model with interesting data.
This function uses the topology service to create or update an object instance. To do that, it requires a typeName and a collection of propertyValues. The typeName is used to create a potential instance of an object of that type. The TopologyService is used to create the instance. The propertyValues are a map of (name, value) pairs. The script iterates over the properties, inspects each one and tries to set that property on the object using the appropriate API.
What happens at the end is critical. Using the topSvc.mergeData() call, we send a potential instance of an object with several properties set. The TopologyService decides whether we need to create an object or simply update the definition for an existing one.
The following is an example call to this function:
This creates a new Employee object. When using this function, you must include all the identity properties at least. You can include additional properties if you want.
The delete function is defined as follows:
Note that we use the createOrUpdateObject call to return the original object. Then we make a TopologyService call to delete it.
...where topologyObject is the object that the user has chosen as interesting. This is pretty much what is done in the Services Operations Console. It is all done using Dashboards and Groovy.
The last step is to build dashboards to visualize the data. The createOrg Groovy script provided in the appendix creates a nice organization.
This appendix includes Groovy scripts used in the Data modeling tutorials.
© ALL RIGHTS RESERVED. 利用規約 プライバシー Cookie Preference Center