cancel
Showing results for 
Search instead for 
Did you mean: 

Get Objects of a specific MetaClass from a generic MetaAssociation

Solved
Highlighted
Contributor

Get Objects of a specific MetaClass from a generic MetaAssociation

For example the IT Cityplan area MetaClass has the MetaAssociation "Hosted Element". We now want to get only the hosted elements of the MetaClass "Application" using Java API. How can this be done?

 

cpa.getCollection("Hosted Element")

 

returns a MegaCollection of a generic MetaClass with multiple SubMetaClasses (For example Application, Server, Database, etc.)

2 Replies
MEGA

Re: Get Objects of a specific MetaClass from a generic MetaAssociation

Hello alros

 

You should us GetType to filter the collection.

 

Example (VB script)

 

Set cBE = GetCollection("~JW7j6VRt9H40[BPMN Element]")
Print "Number of BPMN Element objects: " & cBE.count()
Set cOP = cBE.GetType("~gsUiU9B5iiR0[Organizational Process]")
Print "Number of Organizational Process objects: " & cOP.count()

 

Jerome
Contributor

Re: Get Objects of a specific MetaClass from a generic MetaAssociation

Thanks for your reply. The Javadoc marks getType() as deprecated but says that filter() is the way to go. Thus

cpa.getCollection("Hosted Element").filter("Application")

 

does the trick in the example provided above.