Search in sources :

Example 1 with OperationSignature

use of org.palladiosimulator.pcm.repository.OperationSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddExternalCallAction method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    ExternalCallAction extCall = (ExternalCallAction) parameters.get("instance");
    HashMap<OperationInterface, OperationRequiredRole> requiredRolesMap = new HashMap<OperationInterface, OperationRequiredRole>();
    OperationSignature os = getOperationSignature(extCall, requiredRolesMap);
    if (os != null) {
        extCall.setCalledService_ExternalService(os);
        extCall.setRole_ExternalService(requiredRolesMap.get(os.getInterface__OperationSignature()));
    }
}
Also used : HashMap(java.util.HashMap) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) ExternalCallAction(org.palladiosimulator.pcm.seff.ExternalCallAction) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) OperationRequiredRole(org.palladiosimulator.pcm.repository.OperationRequiredRole)

Example 2 with OperationSignature

use of org.palladiosimulator.pcm.repository.OperationSignature 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 3 with OperationSignature

use of org.palladiosimulator.pcm.repository.OperationSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class EntryLevelSystemCallDialog method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    EntryLevelSystemCall element = (EntryLevelSystemCall) parameters.get("instance");
    OperationProvidedRole oldRole = element.getProvidedRole_EntryLevelSystemCall();
    OperationProvidedRole role = getOperationProvidedRole(element);
    if (role != null) {
        element.setProvidedRole_EntryLevelSystemCall(role);
        OperationSignature signature = getOperationSignature(element);
        if (signature != null) {
            element.setOperationSignature__EntryLevelSystemCall(signature);
        } else {
            element.setProvidedRole_EntryLevelSystemCall(oldRole);
        }
    }
}
Also used : EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole)

Example 4 with OperationSignature

use of org.palladiosimulator.pcm.repository.OperationSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class Services method printParameters.

public String printParameters(Signature sig) {
    String result = "";
    EList<Parameter> parameters = null;
    if (sig instanceof OperationSignature)
        parameters = ((OperationSignature) sig).getParameters__OperationSignature();
    else if (sig instanceof InfrastructureSignature) {
        parameters = ((InfrastructureSignature) sig).getParameters__InfrastructureSignature();
    }
    if (// invalid list
    parameters == null)
        return "";
    for (Parameter p : parameters) {
        DataType parameterType = p.getDataType__Parameter();
        String type = getDataTypeName(parameterType);
        result += type + " " + p.getParameterName() + ", ";
    }
    if (result.endsWith(", "))
        result = result.substring(0, result.length() - 2);
    return result;
}
Also used : OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) Parameter(org.palladiosimulator.pcm.repository.Parameter) PrimitiveDataType(org.palladiosimulator.pcm.repository.PrimitiveDataType) DataType(org.palladiosimulator.pcm.repository.DataType) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType)

Example 5 with OperationSignature

use of org.palladiosimulator.pcm.repository.OperationSignature in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddCollectionIteratorAction method getParameter.

private Parameter getParameter(CollectionIteratorAction action, ServiceEffectSpecification seff) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(Interface.class);
    filter.add(Signature.class);
    filter.add(Parameter.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, action.eResource().getResourceSet());
    dialog.setProvidedService(Parameter.class);
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        if (o instanceof Signature) {
            if (!o.equals(seff.getDescribedService__SEFF())) {
                dialog.getTreeViewer().remove(o);
                continue;
            }
            EList<Parameter> parameters = null;
            if (o instanceof OperationSignature)
                parameters = ((OperationSignature) o).getParameters__OperationSignature();
            else if (o instanceof InfrastructureSignature) {
                parameters = ((InfrastructureSignature) o).getParameters__InfrastructureSignature();
            }
            for (Parameter p : parameters) {
                if (!(p.getDataType__Parameter() instanceof CollectionDataType))
                    dialog.getTreeViewer().remove(p);
            }
        }
    }
    dialog.open();
    return (Parameter) dialog.getResult();
}
Also used : OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) InfrastructureSignature(org.palladiosimulator.pcm.repository.InfrastructureSignature) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) Signature(org.palladiosimulator.pcm.repository.Signature) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) ArrayList(java.util.ArrayList) Parameter(org.palladiosimulator.pcm.repository.Parameter) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)6 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 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)3 CollectionDataType (org.palladiosimulator.pcm.repository.CollectionDataType)2 InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)2 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)2 Parameter (org.palladiosimulator.pcm.repository.Parameter)2 HashMap (java.util.HashMap)1 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)1 DataType (org.palladiosimulator.pcm.repository.DataType)1 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)1 PrimitiveDataType (org.palladiosimulator.pcm.repository.PrimitiveDataType)1 Signature (org.palladiosimulator.pcm.repository.Signature)1 ExternalCallAction (org.palladiosimulator.pcm.seff.ExternalCallAction)1 ResourceDemandingBehaviour (org.palladiosimulator.pcm.seff.ResourceDemandingBehaviour)1 ServiceEffectSpecification (org.palladiosimulator.pcm.seff.ServiceEffectSpecification)1 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)1