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;
}
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);
}
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;
}
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;
}
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();
}
Aggregations