use of org.palladiosimulator.pcm.repository.InfrastructureSignature in project Palladio-Editors-Sirius by PalladioSimulator.
the class SetInfrastructureSignature method getSignature.
private InfrastructureSignature getSignature(InfrastructureCall call) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(InfrastructureInterface.class);
filter.add(InfrastructureSignature.class);
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, call.eResource().getResourceSet());
dialog.setProvidedService(InfrastructureSignature.class);
// only take required InfrastructureInterfaces
for (Object o : dialog.getTreeViewer().getExpandedElements()) {
if (!(o instanceof InfrastructureInterface))
continue;
ServiceEffectSpecification seff = (ServiceEffectSpecification) call.getAction__InfrastructureCall().getResourceDemandingBehaviour_AbstractAction();
BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
boolean found = false;
for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
if (!(r instanceof InfrastructureRequiredRole))
continue;
InfrastructureRequiredRole ir = (InfrastructureRequiredRole) r;
if (ir.getRequiredInterface__InfrastructureRequiredRole().equals(o)) {
found = true;
call.setRequiredRole__InfrastructureCall(ir);
}
}
if (!found)
dialog.getTreeViewer().remove(o);
}
dialog.open();
return (InfrastructureSignature) dialog.getResult();
}
use of org.palladiosimulator.pcm.repository.InfrastructureSignature in project Palladio-Editors-Sirius by PalladioSimulator.
the class SetInfrastructureSignature method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
InfrastructureCall call = (InfrastructureCall) parameters.get("instance");
InfrastructureSignature sig = getSignature(call);
call.setSignature__InfrastructureCall(sig);
}
use of org.palladiosimulator.pcm.repository.InfrastructureSignature 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.InfrastructureSignature 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