use of org.palladiosimulator.pcm.repository.BasicComponent in project iobserve-analysis by research-iobserve.
the class RepositoryModelHandler method loadData.
/**
* Loading and initializing the maps for data access.
*
* @param model
* repository model
* @deprecated this functionality now resides in {@link RepositoryLookupModelProvier}
*/
@Deprecated
public void loadData(final Repository model) {
this.opInfToProvInfMap = new HashMap<>();
this.opProvidedRoleMap = new HashMap<>();
this.operationInterfaceMap = new HashMap<>();
this.operationSignatureMap = new HashMap<>();
// loading OperationProvidedRoles and OperationInterfaces in dedicated maps
for (final RepositoryComponent nextRepoCmp : model.getComponents__Repository()) {
if (nextRepoCmp instanceof BasicComponent) {
final BasicComponent basicCmp = (BasicComponent) nextRepoCmp;
for (final ProvidedRole providedRole : basicCmp.getProvidedRoles_InterfaceProvidingEntity()) {
if (providedRole instanceof OperationProvidedRole) {
final OperationProvidedRole opProvRole = (OperationProvidedRole) providedRole;
final OperationInterface opInterface = opProvRole.getProvidedInterface__OperationProvidedRole();
this.opInfToProvInfMap.put(opInterface.getId(), opProvRole.getId());
this.opProvidedRoleMap.put(opProvRole.getId(), opProvRole);
}
}
}
}
// loading OperationInterfaces and OperationSignatures in dedicated maps
for (final Interface nextInterface : model.getInterfaces__Repository()) {
if (nextInterface instanceof OperationInterface) {
final OperationInterface opInf = (OperationInterface) nextInterface;
this.operationInterfaceMap.put(opInf.getId(), opInf);
for (final OperationSignature opSig : opInf.getSignatures__OperationInterface()) {
this.operationSignatureMap.put(opSig.getId(), opSig);
}
}
}
}
use of org.palladiosimulator.pcm.repository.BasicComponent in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddEmitEventAction method getEventType.
private EventType getEventType(EmitEventAction emitEventAction) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(EventGroup.class);
filter.add(EventType.class);
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, emitEventAction.eResource().getResourceSet());
dialog.setProvidedService(EventType.class);
// Only show EventTypes from EventGroups from SourceRoles of the parent BasicComponent
for (Object o : dialog.getTreeViewer().getExpandedElements()) {
if (!(o instanceof EventGroup))
continue;
ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(emitEventAction.getResourceDemandingBehaviour_AbstractAction());
BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
boolean found = false;
for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
if (!(r instanceof SourceRole))
continue;
SourceRole sourceRole = (SourceRole) r;
if (sourceRole.getEventGroup__SourceRole().equals(o)) {
found = true;
emitEventAction.setSourceRole__EmitEventAction(sourceRole);
}
}
if (!found)
dialog.getTreeViewer().remove(o);
}
dialog.open();
return (EventType) dialog.getResult();
}
use of org.palladiosimulator.pcm.repository.BasicComponent in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddExternalCallAction method getOperationSignature.
private OperationSignature getOperationSignature(ExternalCallAction extCall, HashMap<OperationInterface, OperationRequiredRole> requiredRolesMap) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(OperationInterface.class);
filter.add(OperationSignature.class);
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, extCall.eResource().getResourceSet());
dialog.setProvidedService(OperationSignature.class);
for (Object o : dialog.getTreeViewer().getExpandedElements()) {
if (// if the current object is not an OperationInterface, skip.
!(o instanceof OperationInterface))
continue;
ResourceDemandingBehaviour rd = extCall.getResourceDemandingBehaviour_AbstractAction();
ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(rd);
BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
// if o is not referenced by any OperationRequiredRole, remove it from the tree viewer
OperationRequiredRole requiredRole = getOperationRequiredRole(parent.getRequiredRoles_InterfaceRequiringEntity(), (OperationInterface) o);
if (requiredRole != null)
requiredRolesMap.put((OperationInterface) o, requiredRole);
else
dialog.getTreeViewer().remove(o);
}
dialog.open();
return (OperationSignature) dialog.getResult();
}
use of org.palladiosimulator.pcm.repository.BasicComponent 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.BasicComponent in project iobserve-analysis by research-iobserve.
the class RepositoryLookupModelProvider method initializeLookupMaps.
/**
* Initializing the maps for data access.
*/
private void initializeLookupMaps() {
this.opInfToProvInfMap = new HashMap<>();
this.opProvidedRoleMap = new HashMap<>();
this.operationInterfaceMap = new HashMap<>();
this.operationSignatureMap = new HashMap<>();
// loading OperationProvidedRoles and OperationInterfaces in dedicated maps
for (final RepositoryComponent nextRepoCmp : this.repositoryModel.getComponents__Repository()) {
if (nextRepoCmp instanceof BasicComponent) {
final BasicComponent basicCmp = (BasicComponent) nextRepoCmp;
for (final ProvidedRole providedRole : basicCmp.getProvidedRoles_InterfaceProvidingEntity()) {
if (providedRole instanceof OperationProvidedRole) {
final OperationProvidedRole opProvRole = (OperationProvidedRole) providedRole;
final OperationInterface opInterface = opProvRole.getProvidedInterface__OperationProvidedRole();
this.opInfToProvInfMap.put(opInterface.getId(), opProvRole.getId());
this.opProvidedRoleMap.put(opProvRole.getId(), opProvRole);
}
}
}
}
// loading OperationInterfaces and OperationSignatures in dedicated maps
for (final Interface nextInterface : this.repositoryModel.getInterfaces__Repository()) {
if (nextInterface instanceof OperationInterface) {
final OperationInterface opInf = (OperationInterface) nextInterface;
this.operationInterfaceMap.put(opInf.getId(), opInf);
for (final OperationSignature opSig : opInf.getSignatures__OperationInterface()) {
this.operationSignatureMap.put(opSig.getId(), opSig);
}
}
}
}
Aggregations