Search in sources :

Example 1 with Parameter

use of org.palladiosimulator.pcm.repository.Parameter in project iobserve-analysis by research-iobserve.

the class ParameterDataProtectionImpl method setParameter.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setParameter(Parameter newParameter) {
    Parameter oldParameter = parameter;
    parameter = newParameter;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, PrivacyPackage.PARAMETER_DATA_PROTECTION__PARAMETER, oldParameter, parameter));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Parameter(org.palladiosimulator.pcm.repository.Parameter)

Example 2 with Parameter

use of org.palladiosimulator.pcm.repository.Parameter in project iobserve-analysis by research-iobserve.

the class DataProtectionWarner method computePrivacyLevelsAndAddEdge.

private void computePrivacyLevelsAndAddEdge(final PrivacyGraph graph, final OperationInterface operationInterface, final RepositoryComponent providingComponent, final RepositoryComponent requiringComponent) throws InvocationException, DBException {
    for (final OperationSignature operationSignature : operationInterface.getSignatures__OperationInterface()) {
        final IDataProtectionAnnotation operationSignaturePrivacyAnnotation = this.returntypeprivacy.get(operationSignature.getId());
        EDataProtectionLevel inEdgeDataProtectionLevel = null;
        EDataProtectionLevel outEdgePrivacyLevel = null;
        /**
         * Check parameter.
         */
        for (final Parameter proxyParameter : operationSignature.getParameters__OperationSignature()) {
            final Parameter parameter = this.repositoryResource.resolve(proxyParameter);
            final ParameterModifier mod = parameter.getModifier__Parameter();
            if (mod == ParameterModifier.IN || mod == ParameterModifier.INOUT) {
                final String parameterName = parameter.getParameterName();
                outEdgePrivacyLevel = this.updateDataProtectionLevel(outEdgePrivacyLevel, this.parameterprivacy.get(parameterName).getLevel());
            }
            if (mod == ParameterModifier.OUT || mod == ParameterModifier.INOUT) {
                inEdgeDataProtectionLevel = this.updateDataProtectionLevel(inEdgeDataProtectionLevel, this.parameterprivacy.get(parameter.getParameterName()).getLevel());
            }
        }
        /**
         * Check return type.
         */
        if (operationSignaturePrivacyAnnotation != null) {
            inEdgeDataProtectionLevel = this.updateDataProtectionLevel(inEdgeDataProtectionLevel, operationSignaturePrivacyAnnotation.getLevel());
        }
        final Vertex providingComponentVertex = this.vertices.get(providingComponent.getId());
        final Vertex requiringComponentVertex = this.vertices.get(requiringComponent.getId());
        if (providingComponentVertex != null && requiringComponentVertex != null) {
            // Add Edges
            if (inEdgeDataProtectionLevel != null) {
                final Edge edge = new Edge(providingComponentVertex, requiringComponentVertex);
                edge.setDPC(Policy.getDataClassification(inEdgeDataProtectionLevel));
                edge.setOperationSignature(operationSignature);
                graph.addEdge(edge);
            }
            if (outEdgePrivacyLevel != null) {
                final Edge edge = new Edge(requiringComponentVertex, providingComponentVertex);
                edge.setDPC(Policy.getDataClassification(outEdgePrivacyLevel));
                edge.setOperationSignature(operationSignature);
                graph.addEdge(edge);
            }
            if (inEdgeDataProtectionLevel == null && outEdgePrivacyLevel == null) {
                this.logger.error("Missing privacy level");
            }
        }
    }
}
Also used : Vertex(org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex) EDataProtectionLevel(org.iobserve.model.privacy.EDataProtectionLevel) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) ParameterModifier(org.palladiosimulator.pcm.repository.ParameterModifier) Parameter(org.palladiosimulator.pcm.repository.Parameter) Edge(org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge) IDataProtectionAnnotation(org.iobserve.model.privacy.IDataProtectionAnnotation)

Example 3 with Parameter

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

use of org.palladiosimulator.pcm.repository.Parameter 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)

Example 5 with Parameter

use of org.palladiosimulator.pcm.repository.Parameter 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) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) DataType(org.palladiosimulator.pcm.repository.DataType)

Aggregations

Parameter (org.palladiosimulator.pcm.repository.Parameter)8 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)4 IDataProtectionAnnotation (org.iobserve.model.privacy.IDataProtectionAnnotation)2 ParameterDataProtection (org.iobserve.model.privacy.ParameterDataProtection)2 ReturnTypeDataProtection (org.iobserve.model.privacy.ReturnTypeDataProtection)2 CollectionDataType (org.palladiosimulator.pcm.repository.CollectionDataType)2 InfrastructureSignature (org.palladiosimulator.pcm.repository.InfrastructureSignature)2 Interface (org.palladiosimulator.pcm.repository.Interface)2 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)2 ArrayList (java.util.ArrayList)1 EObject (org.eclipse.emf.ecore.EObject)1 EReference (org.eclipse.emf.ecore.EReference)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 AssemblyEntry (org.iobserve.model.correspondence.AssemblyEntry)1 EDataProtectionLevel (org.iobserve.model.privacy.EDataProtectionLevel)1 EncapsulatedDataSource (org.iobserve.model.privacy.EncapsulatedDataSource)1 GeoLocation (org.iobserve.model.privacy.GeoLocation)1 Edge (org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)1 Vertex (org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex)1 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)1