EA's Java API is a wrapper for the underlying COM API, which is what's documented in the help file. The Java version is generally a step or two behind the COM version.
It would appear that this method has been left out of the Java API. Other properties in the COM classes have getters/setters in the Java API, but this one doesn't. The same is true in version 10.0.1009.
In EA 11.0.1105 (the first general release of EA 11), Element.SetCompositeDiagram() was added, but this too seems to be limited to the COM API: reverse-engineering eaapi.jar reveals no corresponding method.
From here there would appear to be three alternatives open to you:
- Report the issue to Sparx Systems and ask them to add the relevant methods to the Java API.
- Rewrite your code in C# to make use of the full API.
- Use the undocumented
Repository.Execute() method to manipulate the underlying database directly.
An element's "compositeness" is represented by the value 8 in the t_object.NType column, but this column is overloaded, that is to say the interpretation of its value depends on other columns as well, and furthermore is undocumented. So this is not a good solution if you want maintainability.
If you want to go this way, first add the diagram and then do something like this:
repository.Execute("update t_object set NType = 8 where Object_ID = " +
element.ElementID);
I think that would work, but I haven't tested it. If there are more than one diagrams in the element, I think the first one gets picked. But all this is essentially guesswork, so if you want to build something that you know will work, switch to C#.
myElement.IsComposite = true;- sybear