Search in sources :

Example 16 with OperationProvidedRole

use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project iobserve-analysis by research-iobserve.

the class SystemGeneration method matchingInterface.

private boolean matchingInterface(final ProvidedRole providedRole, final String interfaceID) {
    boolean equalInterface = false;
    if (providedRole instanceof OperationProvidedRole) {
        final OperationProvidedRole provInterface = (OperationProvidedRole) providedRole;
        equalInterface = provInterface.getProvidedInterface__OperationProvidedRole().getId().equals(interfaceID);
    }
    return equalInterface;
}
Also used : OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole)

Example 17 with OperationProvidedRole

use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddOperationProvidedRole method execute.

@Override
public void execute(final Collection<? extends EObject> selection, final Map<String, Object> parameters) {
    final OperationProvidedRole role = (OperationProvidedRole) parameters.get("instance");
    // get OptionalSystem
    final var optSystem = selection.stream().filter(org.palladiosimulator.pcm.system.System.class::isInstance).map(org.palladiosimulator.pcm.system.System.class::cast).findAny();
    final OperationInterface oInterface = this.getOperationInterface(role);
    if (optSystem.isPresent()) {
        role.setEntityName(this.findNameOperationProvidedRole(optSystem.get(), oInterface));
    } else {
        role.setEntityName(oInterface.getEntityName());
    }
    role.setProvidedInterface__OperationProvidedRole(oInterface);
}
Also used : OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Example 18 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 operationSignature
 *            operation id of the EntryLevelSystemCall
 * @return null, if the creation failed, the instance if not.
 */
public static EntryLevelSystemCall createEntryLevelSystemCall(final RepositoryLookupModelProvider repositoryLookupModel, final OperationSignature operationSignature) {
    final EntryLevelSystemCall eSysCall = UsagemodelFactory.eINSTANCE.createEntryLevelSystemCall();
    eSysCall.setEntityName(operationSignature.getEntityName());
    eSysCall.setOperationSignature__EntryLevelSystemCall(operationSignature);
    final OperationInterface opInf = operationSignature.getInterface__OperationSignature();
    final OperationProvidedRole providedRole = repositoryLookupModel.getOperationProvidedRole(opInf);
    eSysCall.setProvidedRole_EntryLevelSystemCall(providedRole);
    return eSysCall;
}
Also used : EntryLevelSystemCall(org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Example 19 with OperationProvidedRole

use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project iobserve-analysis by research-iobserve.

the class RepositoryModelDataFactory method createProvidedRole.

private static OperationProvidedRole createProvidedRole(final String name, final OperationInterface iface) {
    final OperationProvidedRole providedRole = RepositoryFactory.eINSTANCE.createOperationProvidedRole();
    providedRole.setEntityName(name);
    providedRole.setProvidedInterface__OperationProvidedRole(iface);
    return providedRole;
}
Also used : OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole)

Example 20 with OperationProvidedRole

use of org.palladiosimulator.pcm.repository.OperationProvidedRole in project iobserve-analysis by research-iobserve.

the class RepositoryModelProviderTest method createThenReadReferencing.

@Override
@Test
public void createThenReadReferencing() throws DBException {
    final Neo4JModelResource<Repository> resource = ModelProviderTestUtils.prepareResource("createThenReadReferencing", this.prefix, this.ePackage);
    resource.storeModelPartition(this.testModel);
    final RepositoryComponent object = RepositoryModelDataFactory.findComponentByName(this.repository, RepositoryModelDataFactory.SEARCH_COMPONENT);
    final OperationProvidedRole providedSearchRole = RepositoryModelDataFactory.findProvidedRole(object, RepositoryModelDataFactory.CATALOG_SEARCH_PROVIDED_ROLE);
    final String id = ModelGraphFactory.getIdentification(object);
    final List<EObject> readReferencingObjects = resource.collectReferencingObjectsByTypeAndProperty(BasicComponent.class, RepositoryPackage.Literals.BASIC_COMPONENT, id);
    // Only the providedSearchOperation role is referencing the catalogSearch component
    Assert.assertTrue(readReferencingObjects.size() == 1);
    Assert.assertTrue(this.equalityHelper.comparePartition(providedSearchRole, readReferencingObjects.get(0), providedSearchRole.eClass()));
    resource.getGraphDatabaseService().shutdown();
}
Also used : Repository(org.palladiosimulator.pcm.repository.Repository) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) EObject(org.eclipse.emf.ecore.EObject) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) Test(org.junit.Test)

Aggregations

OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)22 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)10 ProvidedRole (org.palladiosimulator.pcm.repository.ProvidedRole)9 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)9 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)7 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)5 Interface (org.palladiosimulator.pcm.repository.Interface)5 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)5 Repository (org.palladiosimulator.pcm.repository.Repository)5 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)5 Test (org.junit.Test)4 AssemblyConnector (org.palladiosimulator.pcm.core.composition.AssemblyConnector)4 ArrayList (java.util.ArrayList)3 Connector (org.palladiosimulator.pcm.core.composition.Connector)3 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)3 EntryLevelSystemCall (org.palladiosimulator.pcm.usagemodel.EntryLevelSystemCall)3 EObject (org.eclipse.emf.ecore.EObject)2 System (org.palladiosimulator.pcm.system.System)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1