use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project Palladio-Editors-Sirius by PalladioSimulator.
the class EntryLevelSystemCallDialog method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
EntryLevelSystemCall element = (EntryLevelSystemCall) parameters.get("instance");
OperationProvidedRole oldRole = element.getProvidedRole_EntryLevelSystemCall();
OperationProvidedRole role = getOperationProvidedRole(element);
if (role != null) {
element.setProvidedRole_EntryLevelSystemCall(role);
OperationSignature signature = getOperationSignature(element);
if (signature != null) {
element.setOperationSignature__EntryLevelSystemCall(signature);
} else {
element.setProvidedRole_EntryLevelSystemCall(oldRole);
}
}
}
use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project Palladio-Editors-Sirius by PalladioSimulator.
the class EntryLevelSystemCallDialog method getOperationProvidedRole.
private OperationProvidedRole getOperationProvidedRole(EntryLevelSystemCall element) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(System.class);
filter.add(OperationProvidedRole.class);
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, element.eResource().getResourceSet());
dialog.setProvidedService(OperationProvidedRole.class);
dialog.open();
return (OperationProvidedRole) dialog.getResult();
}
use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project iobserve-analysis by research-iobserve.
the class RepositoryModelProviderTest method createThenUpdateThenReadUpdated.
@Override
@Test
public void createThenUpdateThenReadUpdated() {
final ModelProvider<Repository> modelProvider = new ModelProvider<>(RepositoryModelProviderTest.graph);
final TestModelBuilder testModelBuilder = new TestModelBuilder();
final Repository writtenModel = testModelBuilder.getRepository();
final Interface payInterface = testModelBuilder.getPayInterface();
final RepositoryComponent paymentComponent = testModelBuilder.getPaymentComponent();
final Repository readModel;
modelProvider.createComponent(writtenModel);
// Update the model by renaming and replacing the payment method
writtenModel.setEntityName("MyVideoOnDemandService");
final OperationProvidedRole providedPayOperation = RepositoryFactory.eINSTANCE.createOperationProvidedRole();
providedPayOperation.setEntityName("payPalPayment");
providedPayOperation.setProvidedInterface__OperationProvidedRole((OperationInterface) payInterface);
paymentComponent.getProvidedRoles_InterfaceProvidingEntity().clear();
paymentComponent.getProvidedRoles_InterfaceProvidingEntity().add(providedPayOperation);
modelProvider.updateComponent(Repository.class, writtenModel);
readModel = modelProvider.readOnlyRootComponent(Repository.class);
Assert.assertTrue(this.equalityHelper.equals(writtenModel, readModel));
}
use of org.palladiosimulator.pcm.repository.OperationProvidedRole 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.OperationProvidedRole in project iobserve-analysis by research-iobserve.
the class UsageModelFactory method createEntryLevelSystemCall.
/**
* Create an EntryLevelSystemCall with the given operation signature.
*
* @param repositoryLookupModel
* provides a lookup model for the repository
* @param operationID
* operation id of the EntryLevelSystemCall
* @return null, if the creation failed, the instance if not.
*/
public static EntryLevelSystemCall createEntryLevelSystemCall(final RepositoryLookupModelProvider repositoryLookupModel, final String operationID) {
final OperationSignature opSig = repositoryLookupModel.getOperationSignature(operationID);
final EntryLevelSystemCall eSysCall;
if (opSig != null) {
eSysCall = UsagemodelFactory.eINSTANCE.createEntryLevelSystemCall();
eSysCall.setEntityName(opSig.getEntityName());
eSysCall.setOperationSignature__EntryLevelSystemCall(opSig);
final OperationInterface opInf = opSig.getInterface__OperationSignature();
final OperationProvidedRole providedRole = repositoryLookupModel.getOperationProvidedRole(opInf);
eSysCall.setProvidedRole_EntryLevelSystemCall(providedRole);
} else {
eSysCall = null;
}
return eSysCall;
}
Aggregations