Search in sources :

Example 1 with OperationProvidedRole

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);
        }
    }
}
Also used : EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole)

Example 2 with OperationProvidedRole

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();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 3 with OperationProvidedRole

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));
}
Also used : Repository(org.palladiosimulator.pcm.repository.Repository) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) Interface(org.palladiosimulator.pcm.repository.Interface) Test(org.junit.Test)

Example 4 with OperationProvidedRole

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);
            }
        }
    }
}
Also used : OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) ProvidedRole(org.palladiosimulator.pcm.repository.ProvidedRole) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) Interface(org.palladiosimulator.pcm.repository.Interface) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Example 5 with OperationProvidedRole

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;
}
Also used : EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Aggregations

OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)14 ProvidedRole (org.palladiosimulator.pcm.repository.ProvidedRole)8 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)5 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)5 ArrayList (java.util.ArrayList)4 Interface (org.palladiosimulator.pcm.repository.Interface)4 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)4 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)4 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)4 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)3 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)3 EObject (org.eclipse.emf.ecore.EObject)2 EReference (org.eclipse.emf.ecore.EReference)2 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)2 Repository (org.palladiosimulator.pcm.repository.Repository)2 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1