Search in sources :

Example 1 with ServiceEffectSpecification

use of org.palladiosimulator.pcm.seff.ServiceEffectSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddCollectionIteratorAction method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    CollectionIteratorAction action = (CollectionIteratorAction) parameters.get("instance");
    ResourceDemandingBehaviour resourceDemandingBehaviour = (ResourceDemandingBehaviour) parameters.get("resourceDemandingBehaviour");
    ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(resourceDemandingBehaviour);
    Parameter parameter = getParameter(action, seff);
    action.setParameter_CollectionIteratorAction(parameter);
}
Also used : ResourceDemandingBehaviour(org.palladiosimulator.pcm.seff.ResourceDemandingBehaviour) CollectionIteratorAction(org.palladiosimulator.pcm.seff.CollectionIteratorAction) Parameter(org.palladiosimulator.pcm.repository.Parameter) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification)

Example 2 with ServiceEffectSpecification

use of org.palladiosimulator.pcm.seff.ServiceEffectSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddEmitEventAction method getEventType.

private EventType getEventType(EmitEventAction emitEventAction) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(EventGroup.class);
    filter.add(EventType.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, emitEventAction.eResource().getResourceSet());
    dialog.setProvidedService(EventType.class);
    // Only show EventTypes from EventGroups from SourceRoles of the parent BasicComponent
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (!(o instanceof EventGroup))
            continue;
        ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(emitEventAction.getResourceDemandingBehaviour_AbstractAction());
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        boolean found = false;
        for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
            if (!(r instanceof SourceRole))
                continue;
            SourceRole sourceRole = (SourceRole) r;
            if (sourceRole.getEventGroup__SourceRole().equals(o)) {
                found = true;
                emitEventAction.setSourceRole__EmitEventAction(sourceRole);
            }
        }
        if (!found)
            dialog.getTreeViewer().remove(o);
    }
    dialog.open();
    return (EventType) dialog.getResult();
}
Also used : SourceRole(org.palladiosimulator.pcm.repository.SourceRole) RequiredRole(org.palladiosimulator.pcm.repository.RequiredRole) EventType(org.palladiosimulator.pcm.repository.EventType) ArrayList(java.util.ArrayList) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) EventGroup(org.palladiosimulator.pcm.repository.EventGroup) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 3 with ServiceEffectSpecification

use of org.palladiosimulator.pcm.seff.ServiceEffectSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddExternalCallAction method getOperationSignature.

private OperationSignature getOperationSignature(ExternalCallAction extCall, HashMap<OperationInterface, OperationRequiredRole> requiredRolesMap) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(OperationInterface.class);
    filter.add(OperationSignature.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, extCall.eResource().getResourceSet());
    dialog.setProvidedService(OperationSignature.class);
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (// if the current object is not an OperationInterface, skip.
        !(o instanceof OperationInterface))
            continue;
        ResourceDemandingBehaviour rd = extCall.getResourceDemandingBehaviour_AbstractAction();
        ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(rd);
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        // if o is not referenced by any OperationRequiredRole, remove it from the tree viewer
        OperationRequiredRole requiredRole = getOperationRequiredRole(parent.getRequiredRoles_InterfaceRequiringEntity(), (OperationInterface) o);
        if (requiredRole != null)
            requiredRolesMap.put((OperationInterface) o, requiredRole);
        else
            dialog.getTreeViewer().remove(o);
    }
    dialog.open();
    return (OperationSignature) dialog.getResult();
}
Also used : ResourceDemandingBehaviour(org.palladiosimulator.pcm.seff.ResourceDemandingBehaviour) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) EReference(org.eclipse.emf.ecore.EReference) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) OperationRequiredRole(org.palladiosimulator.pcm.repository.OperationRequiredRole)

Example 4 with ServiceEffectSpecification

use of org.palladiosimulator.pcm.seff.ServiceEffectSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetInfrastructureSignature method getSignature.

private InfrastructureSignature getSignature(InfrastructureCall call) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(InfrastructureInterface.class);
    filter.add(InfrastructureSignature.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, call.eResource().getResourceSet());
    dialog.setProvidedService(InfrastructureSignature.class);
    // only take required InfrastructureInterfaces
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (!(o instanceof InfrastructureInterface))
            continue;
        ServiceEffectSpecification seff = (ServiceEffectSpecification) call.getAction__InfrastructureCall().getResourceDemandingBehaviour_AbstractAction();
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        boolean found = false;
        for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
            if (!(r instanceof InfrastructureRequiredRole))
                continue;
            InfrastructureRequiredRole ir = (InfrastructureRequiredRole) r;
            if (ir.getRequiredInterface__InfrastructureRequiredRole().equals(o)) {
                found = true;
                call.setRequiredRole__InfrastructureCall(ir);
            }
        }
        if (!found)
            dialog.getTreeViewer().remove(o);
    }
    dialog.open();
    return (InfrastructureSignature) dialog.getResult();
}
Also used : InfrastructureRequiredRole(org.palladiosimulator.pcm.repository.InfrastructureRequiredRole) RequiredRole(org.palladiosimulator.pcm.repository.RequiredRole) ArrayList(java.util.ArrayList) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) InfrastructureInterface(org.palladiosimulator.pcm.repository.InfrastructureInterface) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) InfrastructureRequiredRole(org.palladiosimulator.pcm.repository.InfrastructureRequiredRole) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 5 with ServiceEffectSpecification

use of org.palladiosimulator.pcm.seff.ServiceEffectSpecification in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddSEFF method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    ResourceDemandingSEFF seff = (ResourceDemandingSEFF) parameters.get("instance");
    Signature signature = getSignature(seff);
    for (ServiceEffectSpecification s : seff.getBasicComponent_ServiceEffectSpecification().getServiceEffectSpecifications__BasicComponent()) {
        if (s.getDescribedService__SEFF() != null && s.getDescribedService__SEFF().equals(signature))
            // do nothing if the chosen signature already has a corresponding SEFF
            return;
    }
    seff.setDescribedService__SEFF(signature);
}
Also used : ResourceDemandingSEFF(org.palladiosimulator.pcm.seff.ResourceDemandingSEFF) Signature(org.palladiosimulator.pcm.repository.Signature) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification)

Aggregations

ServiceEffectSpecification (org.palladiosimulator.pcm.seff.ServiceEffectSpecification)5 ArrayList (java.util.ArrayList)3 EObject (org.eclipse.emf.ecore.EObject)3 EReference (org.eclipse.emf.ecore.EReference)3 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)3 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)3 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)2 ResourceDemandingBehaviour (org.palladiosimulator.pcm.seff.ResourceDemandingBehaviour)2 EventGroup (org.palladiosimulator.pcm.repository.EventGroup)1 EventType (org.palladiosimulator.pcm.repository.EventType)1 InfrastructureInterface (org.palladiosimulator.pcm.repository.InfrastructureInterface)1 InfrastructureRequiredRole (org.palladiosimulator.pcm.repository.InfrastructureRequiredRole)1 InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)1 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)1 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)1 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)1 Parameter (org.palladiosimulator.pcm.repository.Parameter)1 Signature (org.palladiosimulator.pcm.repository.Signature)1 SourceRole (org.palladiosimulator.pcm.repository.SourceRole)1 CollectionIteratorAction (org.palladiosimulator.pcm.seff.CollectionIteratorAction)1