Search in sources :

Example 1 with EDataProtectionLevel

use of org.iobserve.model.privacy.EDataProtectionLevel in project iobserve-analysis by research-iobserve.

the class ReturnTypeDataProtectionImpl method setLevel.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setLevel(EDataProtectionLevel newLevel) {
    EDataProtectionLevel oldLevel = level;
    level = newLevel == null ? LEVEL_EDEFAULT : newLevel;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, PrivacyPackage.RETURN_TYPE_DATA_PROTECTION__LEVEL, oldLevel, level));
}
Also used : EDataProtectionLevel(org.iobserve.model.privacy.EDataProtectionLevel) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 2 with EDataProtectionLevel

use of org.iobserve.model.privacy.EDataProtectionLevel 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 EDataProtectionLevel

use of org.iobserve.model.privacy.EDataProtectionLevel in project iobserve-analysis by research-iobserve.

the class ParameterDataProtectionImpl method setLevel.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setLevel(EDataProtectionLevel newLevel) {
    EDataProtectionLevel oldLevel = level;
    level = newLevel == null ? LEVEL_EDEFAULT : newLevel;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, PrivacyPackage.PARAMETER_DATA_PROTECTION__LEVEL, oldLevel, level));
}
Also used : EDataProtectionLevel(org.iobserve.model.privacy.EDataProtectionLevel) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

EDataProtectionLevel (org.iobserve.model.privacy.EDataProtectionLevel)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 IDataProtectionAnnotation (org.iobserve.model.privacy.IDataProtectionAnnotation)1 Edge (org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)1 Vertex (org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex)1 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)1 Parameter (org.palladiosimulator.pcm.repository.Parameter)1 ParameterModifier (org.palladiosimulator.pcm.repository.ParameterModifier)1