- // Check all diagram monitor elements.
- // Any components referenced that are external to the exported diagrams must be excluded from the export.
- // This will leave the monitors without a monitored component but export and import will work anyway.
- for (Resource ref : graph.syncRequest(new ObjectsWithType(diagram, L0.ConsistsOf, DIA.Monitor))) {
- for (Resource monitoredComponent : graph.getObjects(ref, DIA.HasMonitorComponent)) {
- Resource monitoredComponentComposite = graph.getPossibleObject(monitoredComponent, L0.PartOf);
- if (monitoredComponentComposite != null && !resourceSet.contains(monitoredComponentComposite)) {
- exclusions.add(monitoredComponent);
+ // Check all diagram monitor elements.
+ // Any components referenced that are external to the exported diagrams must be excluded from the export.
+ // This will leave the monitors without a monitored component but export and import will work anyway.
+ if (types.contains(DIA.Monitor)) {
+ for (Resource monitoredComponent : graph.getObjects(element, DIA.HasMonitorComponent)) {
+ Resource monitoredComponentComposite = graph.getPossibleObject(monitoredComponent, L0.PartOf);
+ if (monitoredComponentComposite != null && !resourceSet.contains(monitoredComponentComposite)) {
+ exclusions.add(monitoredComponent);
+ }
+ }
+ }
+
+ // Check all diagram reference elements for necessary exclusions.
+ if (types.contains(MOD.ReferenceElement)) {
+ for (Resource rel : graph.getObjects(element, L0.ConsistsOf)) {
+ identifierExcluder.accept(rel);
+ for (Resource invRel : graph.getObjects(rel, L0.ConsistsOf)) {
+ identifierExcluder.accept(invRel);
+ }