use of org.palladiosimulator.pcm.repository.Parameter in project iobserve-analysis by research-iobserve.
the class CreatePrivacyMain method addPrivacyAnnotations.
private static void addPrivacyAnnotations(final DataProtectionModel privacyModel, final Repository repository) {
for (final Interface iface : repository.getInterfaces__Repository()) {
if (iface instanceof OperationInterface) {
CreatePrivacyMain.LOGGER.debug(String.format("interface %s\n", iface.getEntityName()));
final OperationInterface operationInterface = (OperationInterface) iface;
final Map<String, OperationSignatureDataProtection> ifacePrivacy = CreatePrivacyMain.PRIVACY_LEVEL_MAPS.get(iface.getEntityName());
for (final OperationSignature signature : operationInterface.getSignatures__OperationInterface()) {
CreatePrivacyMain.LOGGER.debug(String.format("\tsignature %s\n", signature.getEntityName()));
final OperationSignatureDataProtection signaturePrivacy = ifacePrivacy.get(signature.getEntityName());
if (signature.getReturnType__OperationSignature() != null) {
final ReturnTypeDataProtection returnTypeDataProection = PrivacyFactory.eINSTANCE.createReturnTypeDataProtection();
returnTypeDataProection.setLevel(signaturePrivacy.getReturnTypePrivacy());
returnTypeDataProection.setOperationSignature(signature);
privacyModel.getDataProectionLevels().add(returnTypeDataProection);
}
for (final Parameter parameter : signature.getParameters__OperationSignature()) {
CreatePrivacyMain.LOGGER.debug(String.format("\t\tparameter %s\n", parameter.getParameterName()));
final ParameterDataProtection parameterPrivacy = PrivacyFactory.eINSTANCE.createParameterDataProtection();
parameterPrivacy.setLevel(signaturePrivacy.getParameterPrivacy().get(parameter.getParameterName()));
parameterPrivacy.setParameter(parameter);
privacyModel.getDataProectionLevels().add(parameterPrivacy);
}
}
}
}
}
use of org.palladiosimulator.pcm.repository.Parameter in project iobserve-analysis by research-iobserve.
the class ProbeMapper method computeAllocationComponentServletId.
/**
* Compute allocation component servlet id.
*
* @param entry
* @param allocation
* @param operationSignature
* @return
* @throws InvocationException
* @throws DBException
*/
private String computeAllocationComponentServletId(final AllocationEntry entry, final AllocationContext allocation, final OperationSignature operationSignature) throws InvocationException, DBException {
final EList<Parameter> parameterList = operationSignature.getParameters__OperationSignature();
String parameters = null;
for (final Parameter parameter : parameterList) {
if (parameters == null) {
parameters = parameter.getParameterName();
} else {
parameters += ", " + parameter.getParameterName();
}
}
AssemblyContext assemblyContext = this.assemblyResource.resolve(allocation.getAssemblyContext_AllocationContext());
assemblyContext = this.assemblyResource.resolve(assemblyContext);
String component = "ERROR";
for (final AssemblyEntry assemblyEntry : this.correspondenceResource.collectAllObjectsByType(AssemblyEntry.class, CorrespondencePackage.Literals.ASSEMBLY_ENTRY)) {
final AssemblyContext entryRelatedContext = this.assemblyResource.resolve(assemblyEntry.getAssembly());
// assemblyContext.eIsProxy());
if (entryRelatedContext.getId().equals(assemblyContext.getId())) {
component = assemblyEntry.getImplementationId();
}
}
final String methodId = String.format("%s.%s (%s)", component, operationSignature.getEntityName(), parameters);
this.logger.debug("Constructed method string: {}", methodId);
return methodId;
}
use of org.palladiosimulator.pcm.repository.Parameter in project iobserve-analysis by research-iobserve.
the class DataProtectionWarner method clearAndFillQueryMaps.
/**
* Fills the hash maps used for queries.
*
* @throws DBException
* @throws InvocationException
*/
private void clearAndFillQueryMaps() throws InvocationException, DBException {
DeploymentLock.lock();
this.vertices.clear();
this.geolocations.clear();
this.stereotypes.clear();
this.parameterprivacy.clear();
this.returntypeprivacy.clear();
this.interfaces.clear();
for (final GeoLocation location : this.privacyRootElement.getResourceContainerLocations()) {
this.geolocations.put(this.resourceEnvironmentResource.resolve(location.getResourceContainer()).getId(), location);
}
for (final EncapsulatedDataSource stereotype : this.privacyRootElement.getEncapsulatedDataSources()) {
if (stereotype != null) {
final BasicComponent resolvedComponent = this.repositoryResource.resolve(stereotype.getComponent());
this.stereotypes.put(resolvedComponent.getId(), stereotype);
} else {
this.logger.debug("missing {}", stereotype);
}
}
for (final IDataProtectionAnnotation dataProectionAnnocation : this.privacyRootElement.getDataProectionLevels()) {
if (dataProectionAnnocation instanceof ParameterDataProtection) {
final ParameterDataProtection parameterDataProtection = (ParameterDataProtection) dataProectionAnnocation;
final Parameter parameter = this.repositoryResource.resolve(parameterDataProtection.getParameter());
this.parameterprivacy.put(parameter.getParameterName(), parameterDataProtection);
}
if (dataProectionAnnocation instanceof ReturnTypeDataProtection) {
final ReturnTypeDataProtection returnTypeDataProection = (ReturnTypeDataProtection) dataProectionAnnocation;
this.returntypeprivacy.put(this.repositoryResource.resolve(returnTypeDataProection.getOperationSignature()).getId(), returnTypeDataProection);
}
}
for (final Interface inf : this.repositoryRootElement.getInterfaces__Repository()) {
if (inf instanceof OperationInterface) {
this.interfaces.put(inf.getEntityName(), (OperationInterface) inf);
}
}
DeploymentLock.unlock();
}
Aggregations