This is the VBScript code I use.
Translating to Java seems straightforward.
'set the given diagram as composite diagram for this element
function setCompositeDiagram (element, diagram)
if not diagram is nothing then
'Tell EA this element is composite
dim objectQuery
objectQuery = "update t_object set NType = 8 where Object_ID = " & element.ElementID
Repository.Execute objectQuery
if element.Type = "Object" then
'Tell EA which diagram is the composite diagram
dim xrefQuery
xrefquery = "insert into t_xref (XrefID, Name, Type, Visibility, Partition, Client, Supplier) values ('"&CreateGuid&"', 'DefaultDiagram', 'element property', 'Public', '0', '"& element.ElementGUID & "', '"& diagram.DiagramGUID &"')"
Repository.Execute xrefquery
elseif element.Type = "Activity" then
'for activities we need to update PDATA1 with the diagramID
dim updatequery
updatequery = "update t_object set PDATA1 = "& diagram.DiagramID & " where Object_ID = " & element.ElementID
Repository.Execute updatequery
end if
end if
end function
You might need to adapt for other element types.
Geert