diff --git a/ingrid/src/model_processing/patterns/CapabilityConfiguration.json b/ingrid/src/model_processing/patterns/CapabilityConfiguration.json new file mode 100644 index 0000000..1e07893 --- /dev/null +++ b/ingrid/src/model_processing/patterns/CapabilityConfiguration.json @@ -0,0 +1,94 @@ +{ + "Columns to Navigation Map": { + "Mission Thread": [ + "Connection", + "owner", + "CapConfig" + ], + "OrganizationEchelon": [ + "Connection", + "type", + "Org" + ], + "Interaction": [ + "Connection" + ] + + }, + "Pattern Graph Edges": [ + [ + "composite owner", + "CapConfig", + "type" + ], + [ + "Connection", + "Org", + "type" + ], + [ + "A_composite owner_Connection", + "composite owner", + "memberEnd" + ], + [ + "A_composite owner_Connection", + "Connection", + "memberEnd" + ], + [ + "Connection", + "CapConfig", + "owner" + ], + [ + "composite owner", + "A_composite owner_Connection", + "owner" + ] + ], + "Root Node": "Connection", + "Vertex MetaTypes": { + "CapConfig": "Class", + "Org": "Class", + "A_composite owner_Connection": "Association", + "composite owner": "Property", + "Connection": "Property" + }, + "Vertex Settings": { + "CapConfig": null, + "Org": null, + "A_composite owner_Connection": null, + "composite owner": null, + "Connection": { + "aggregation": "composite" + } + }, + "Vertex Stereotypes": { + "CapConfig": [ + { + "stereotype": "CapabilityConfiguration" + } + ], + "Org": [ + { + "stereotype": "Organization" + } + ], + "A_composite owner_Connection": [ + { + "stereotype": "ResourceAssociation" + } + ], + "composite owner": [ + { + "stereotype": null + } + ], + "Connection":[ + { + "stereotype": null + } + ] + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/OrgAssociation.json b/ingrid/src/model_processing/patterns/OrgAssociation.json new file mode 100644 index 0000000..7233a67 --- /dev/null +++ b/ingrid/src/model_processing/patterns/OrgAssociation.json @@ -0,0 +1,93 @@ +{ + "Columns to Navigation Map": { + "Organization": [ + "First Connection", + "owner", + "First Owner" + ], + "System": [ + "First Connection", + "type", + "Second Owner" + ], + "Association": [ + "First Connection" + ] + }, + "Pattern Graph Edges": [ + [ + "composite owner1", + "First Owner", + "type" + ], + [ + "First Connection", + "Second Owner", + "type" + ], + [ + "A_composite owner1_First Connection", + "composite owner1", + "memberEnd" + ], + [ + "A_composite owner1_First Connection", + "First Connection", + "memberEnd" + ], + [ + "First Connection", + "First Owner", + "owner" + ], + [ + "composite owner1", + "A_composite owner1_First Connection", + "owner" + ] + ], + "Root Node": "First Connection", + "Vertex MetaTypes": { + "First Owner": "Class", + "Second Owner": "Class", + "A_composite owner1_First Connection": "Association", + "composite owner1": "Property", + "First Connection": "Property" + }, + "Vertex Settings": { + "First Owner": null, + "Second Owner": null, + "A_composite owner1_First Connection": null, + "composite owner1": null, + "First Connection": { + "aggregation": "shared" + } + }, + "Vertex Stereotypes": { + "First Owner": [ + { + "stereotype": "Organization" + } + ], + "Second Owner": [ + { + "stereotype": "System" + } + ], + "A_composite owner1_First Connection": [ + { + "stereotype": "ResourceAssociation" + } + ], + "composite owner1": [ + { + "stereotype": null + } + ], + "First Connection": [ + { + "stereotype": null + } + ] + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/OrgComposition.json b/ingrid/src/model_processing/patterns/OrgComposition.json new file mode 100644 index 0000000..1d3432d --- /dev/null +++ b/ingrid/src/model_processing/patterns/OrgComposition.json @@ -0,0 +1,93 @@ +{ + "Columns to Navigation Map": { + "Organization1": [ + "First Connection", + "owner", + "First Owner" + ], + "Organization2": [ + "First Connection", + "type", + "Second Owner" + ], + "Composition": [ + "First Connection" + ] + }, + "Pattern Graph Edges": [ + [ + "composite owner1", + "First Owner", + "type" + ], + [ + "First Connection", + "Second Owner", + "type" + ], + [ + "A_composite owner1_First Connection", + "composite owner1", + "memberEnd" + ], + [ + "A_composite owner1_First Connection", + "First Connection", + "memberEnd" + ], + [ + "First Connection", + "First Owner", + "owner" + ], + [ + "composite owner1", + "A_composite owner1_First Connection", + "owner" + ] + ], + "Root Node": "First Connection", + "Vertex MetaTypes": { + "First Owner": "Class", + "Second Owner": "Class", + "A_composite owner1_First Connection": "Association", + "composite owner1": "Property", + "First Connection": "Property" + }, + "Vertex Settings": { + "First Owner": null, + "Second Owner": null, + "A_composite owner1_First Connection": null, + "composite owner1": null, + "First Connection": { + "aggregation": "composite" + } + }, + "Vertex Stereotypes": { + "First Owner": [ + { + "stereotype": "Organization" + } + ], + "Second Owner": [ + { + "stereotype": "Organization" + } + ], + "A_composite owner1_First Connection": [ + { + "stereotype": "ResourceAssociation" + } + ], + "composite owner1": [ + { + "stereotype": null + } + ], + "First Connection": [ + { + "stereotype": null + } + ] + } +} \ No newline at end of file diff --git a/ingrid/src/model_processing/patterns/RInterLifeline.json b/ingrid/src/model_processing/patterns/RInterLifeline.json new file mode 100644 index 0000000..581eee5 --- /dev/null +++ b/ingrid/src/model_processing/patterns/RInterLifeline.json @@ -0,0 +1,91 @@ +{ + "Columns to Navigation Map": { + "CapConfig": [ + "MiddleInter", + "owner", + "CapConfig" + ], + "MiddleInter": [ + "RInter", + "owner", + "MiddleInter" + ], + "System1": [ + "MiddleInter", + "context", + "Sys1" + ], + "System2": [ + "Sys2" + ], + "Message": [ + "Async" + ] + }, + "Pattern Graph Edges": [ + [ + "MiddleInter", + "CapConfig", + "owner" + ], + [ + "Sys1", + "CapConfig", + "owner" + ], + [ + "Sys2", + "CapConfig", + "owner" + ], + [ + "Async", + "MiddleInter", + "owner" + ] + ], + "Root Node": "CapConfig", + "Vertex MetaTypes": { + "CapConfig": "Class", + "MiddleInter": "Interaction", + "Sys1": "Property", + "Sys2": "Property", + "Async": "Message" + }, + "Vertex Settings": { + "CapConfig": null, + "MiddleInter": null, + "Sys1": null, + "Sys2": null, + "Async": { + "Message Sort": "asynchSignal" + } + }, + "Vertex Stereotypes": { + "CapConfig": [ + { + "stereotype": "CapabilityConfiguration" + } + ], + "Sys1": [ + { + "stereotype": ["PartProperty", "ResourceRole"] + } + ], + "Sys2": [ + { + "stereotype": ["PartProperty", "ResourceRole"] + } + ], + "MiddleInter": [ + { + "stereotype": null + } + ], + "Async": [ + { + "stereotype": "ResourceMessage" + } + ] + } +} \ No newline at end of file diff --git a/player-piano/player-piano-script.groovy b/player-piano/player-piano-script.groovy index 2137fb2..ac30e8a 100644 --- a/player-piano/player-piano-script.groovy +++ b/player-piano/player-piano-script.groovy @@ -802,6 +802,48 @@ try { ele_to_mod.setUpperValue(upper_element); break; + case 'interaction': + interaction_element = null; + + if (op_to_execute['value'].split('_')[0] == 'new') { + interaction_element = temp_elements[op_to_execute['value']]; + } + else { + interaction_element = live_project.getElementByID(op_to_execute['value']); + } + + // item_edited_value_reported = upper_element.getID() + '(' + upper_element.getHumanName() + ')'; + + replace_log.add('(' + attribute_to_hit + ') Element ' + item_edited_value_reported + ' is set to own ' + + item_to_edit_reported); + + ele_to_mod.setInteraction(interaction_element); + + if (homeless_elements.contains(ele_to_mod)) { + homeless_elements.remove(ele_to_mod); + } + + break; + case 'context': + context_element = null; + if (op_to_execute['value'].split('_')[0] == 'new') { + context_element = temp_elements[op_to_execute['value']]; + } + else { + context_element = live_project.getElementByID(op_to_execute['value']); + } + + item_edited_value_reported = context_element.getID() + '(' + context_element.getHumanName() + ')'; + + replace_log.add('(' + attribute_to_hit + ') Element ' + item_edited_value_reported + ' is set to context ' + + item_to_edit_reported); + + ele_to_mod.setContext(context_element); + + if (homeless_elements.contains(ele_to_mod)) { + homeless_elements.remove(ele_to_mod); + } + break; // End of new stereotype definition // ======================================= @@ -987,6 +1029,41 @@ try { new_element.setName(new_name); homeless_elements.add(new_element); break; + case 'Interface': + new_element = ele_factory.createInterfaceInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Interaction': + new_element = ele_factory.createInteractionInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Message': + new_element = ele_factory.createMessageInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Diagram': + new_element = ele_factory.createDiagramInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; + case 'Lifeline': + new_element = ele_factory.createLifelineInstance(); + temp_ids[item_to_edit] = new_element.getID(); + temp_elements[item_to_edit] = new_element; + new_element.setName(new_name); + homeless_elements.add(new_element); + break; case 'Abstraction': new_element = ele_factory.createAbstractionInstance(); temp_ids[item_to_edit] = new_element.getID(); @@ -1161,7 +1238,6 @@ try { // ================================================ create_list.add([old_name, new_element]); - if (new_stereo != null && new_stereo != "") { StereotypesHelper.createStereotypeInstance(new_element); @@ -1183,25 +1259,50 @@ try { //lookup profile from the given id profile = live_project.getElementByID(stereo_dict['profile']) //get the stereotype object to apply - apply_stereo = StereotypesHelper.getStereotype(live_project, stereo_name, profile) - //add the stereotype to the list of classifiers for the applied stereotype instance - class_list.add(apply_stereo) - // if stereotype is a particular SysML stereotype, see if it is generating additional elements + //if list of multiple stereotypes, apply all sterotypes in the list + if (stereo_name.class == ArrayList) { + for (int i = 0; i < stereo_name.size(); i++) { + apply_stereo = StereotypesHelper.getStereotype(live_project, stereo_name[i], profile) + //add the stereotype to the list of classifiers for the applied stereotype instance + class_list.add(apply_stereo) + + // if stereotype is a particular SysML stereotype, see if it is generating additional elements - if (stereo_name.equals("Block") && new_assoc) { - execution_status_log.add("Making AssociationBlock"); - for (attr in new_element.getOwnedAttribute()) { - execution_status_log.add("Have an owned attribute called " + attr.getName()); + if (stereo_name[i].equals("Block") && new_assoc) { + execution_status_log.add("Making AssociationBlock"); + for (attr in new_element.getOwnedAttribute()) { + execution_status_log.add("Have an owned attribute called " + attr.getName()); + } + assocs_to_clean.add(new_element); + } + + if (stereo_name[i].equals("ParticipantProperty") && new_prop) { + execution_status_log.add("Making ParticipantProperty"); + pps_to_save.add(new_element); + } } - assocs_to_clean.add(new_element); } + else { + apply_stereo = StereotypesHelper.getStereotype(live_project, stereo_name, profile) + //add the stereotype to the list of classifiers for the applied stereotype instance + class_list.add(apply_stereo) - if (stereo_name.equals("ParticipantProperty") && new_prop) { - execution_status_log.add("Making ParticipantProperty"); - pps_to_save.add(new_element); - } + // if stereotype is a particular SysML stereotype, see if it is generating additional elements + if (stereo_name.equals("Block") && new_assoc) { + execution_status_log.add("Making AssociationBlock"); + for (attr in new_element.getOwnedAttribute()) { + execution_status_log.add("Have an owned attribute called " + attr.getName()); + } + assocs_to_clean.add(new_element); + } + + if (stereo_name.equals("ParticipantProperty") && new_prop) { + execution_status_log.add("Making ParticipantProperty"); + pps_to_save.add(new_element); + } + } } //execution_status_log.add("Got stereotype " + new_stereo + " from project"); @@ -1381,6 +1482,4 @@ finally { // render created names and id's into a file for slotting into other files - - -} +} \ No newline at end of file