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));
}
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");
}
}
}
}
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);
}
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();
}
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;
}
Aggregations