Search in sources :

Example 1 with Component

use of org.obeonetwork.dsl.soa.Component in project InformationSystem by ObeoNetwork.

the class WireItemProvider method getRequiredServices.

/**
 * Return the required services in a System.
 * @param system
 * @return requiredServices
 * @generated NOT
 * @added
 */
private List<Service> getRequiredServices(System system) {
    List<Service> requiredServices = new ArrayList<Service>();
    List<Component> ownedComponents = system.getOwnedComponents();
    for (Component component : ownedComponents) {
        requiredServices.addAll(component.getRequiredServices());
    }
    return requiredServices;
}
Also used : ArrayList(java.util.ArrayList) Service(org.obeonetwork.dsl.soa.Service) Component(org.obeonetwork.dsl.soa.Component)

Example 2 with Component

use of org.obeonetwork.dsl.soa.Component in project InformationSystem by ObeoNetwork.

the class ComponentComponentPropertiesEditionComponent method initPart.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
        editingPart.setContext(elt, allResource);
        final Component component = (Component) elt;
        final ComponentPropertiesEditionPart componentPart = (ComponentPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(SoaViewsRepository.Component.Properties.name))
            componentPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, component.getName()));
        if (isAccessible(SoaViewsRepository.Component.Properties.description))
            componentPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, component.getDescription()));
    // init filters
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ComponentPropertiesEditionPart(org.obeonetwork.dsl.soa.parts.ComponentPropertiesEditionPart) SinglePartPropertiesEditingComponent(org.eclipse.emf.eef.runtime.impl.components.SinglePartPropertiesEditingComponent) Component(org.obeonetwork.dsl.soa.Component)

Example 3 with Component

use of org.obeonetwork.dsl.soa.Component in project InformationSystem by ObeoNetwork.

the class SOAService method allReferencedComponents.

public List<Component> allReferencedComponents(System context) {
    List<Component> allReferencedComponents = new ArrayList<Component>();
    List<Wire> ownedWires = context.getOwnedWires();
    // Add Components parent of source and dest of westWire
    for (Wire wire : ownedWires) {
        Component componentSource = (Component) wire.getSource().eContainer();
        allReferencedComponents.add(componentSource);
        Component componentDest = (Component) wire.getDest().eContainer();
        allReferencedComponents.add(componentDest);
    }
    Set<Component> componentsSet = new HashSet<Component>();
    // Remove duplicates
    componentsSet.addAll(allReferencedComponents);
    return new ArrayList<Component>(componentsSet);
}
Also used : ArrayList(java.util.ArrayList) Component(org.obeonetwork.dsl.soa.Component) Wire(org.obeonetwork.dsl.soa.Wire) HashSet(java.util.HashSet)

Example 4 with Component

use of org.obeonetwork.dsl.soa.Component in project InformationSystem by ObeoNetwork.

the class SOAService method allSelectableExternalComponents.

public List<Component> allSelectableExternalComponents(System context, DSemanticDiagram semanticDiagram) {
    List<Component> allNonReferencedExternalComponents = allNonReferencedExternalComponents(context);
    List<Component> allComponentToRemove = new ArrayList<Component>();
    // "DNodeContainer"
    for (EObject obj : EcoreService.eContents(semanticDiagram, DNodeContainer.class)) {
        // Retrieve and add the target of DNodeContainer type of Component
        if (((DNodeContainer) obj).getTarget() instanceof Component) {
            allComponentToRemove.add((Component) ((DNodeContainer) obj).getTarget());
        }
    }
    allNonReferencedExternalComponents.removeAll(allComponentToRemove);
    return allNonReferencedExternalComponents;
}
Also used : DNodeContainer(org.eclipse.sirius.diagram.DNodeContainer) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) Component(org.obeonetwork.dsl.soa.Component)

Example 5 with Component

use of org.obeonetwork.dsl.soa.Component in project InformationSystem by ObeoNetwork.

the class SOAService method allSelectableExternalComponentsAndAncestors.

/**
 * Return all selectable externable components and their ancestors
 * @param semanticDiagram
 * @return
 */
public List<EObject> allSelectableExternalComponentsAndAncestors(DSemanticDiagram semanticDiagram) {
    Set<EObject> result = new HashSet<EObject>();
    EObject rootObject = semanticDiagram.getTarget();
    if (rootObject instanceof System) {
        System system = (System) rootObject;
        // retrieve all selectable external components
        List<Component> components = allSelectableExternalComponents(system, semanticDiagram);
        for (Component component : components) {
            // retrieve ancestors of each component
            result.addAll(getAncestorsAndSelf(component));
        }
    }
    return new ArrayList<EObject>(result);
}
Also used : EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) Component(org.obeonetwork.dsl.soa.Component) System(org.obeonetwork.dsl.soa.System) HashSet(java.util.HashSet)

Aggregations

Component (org.obeonetwork.dsl.soa.Component)7 ArrayList (java.util.ArrayList)6 EObject (org.eclipse.emf.ecore.EObject)3 HashSet (java.util.HashSet)2 Service (org.obeonetwork.dsl.soa.Service)2 SinglePartPropertiesEditingComponent (org.eclipse.emf.eef.runtime.impl.components.SinglePartPropertiesEditingComponent)1 DNodeContainer (org.eclipse.sirius.diagram.DNodeContainer)1 System (org.obeonetwork.dsl.soa.System)1 Wire (org.obeonetwork.dsl.soa.Wire)1 ComponentPropertiesEditionPart (org.obeonetwork.dsl.soa.parts.ComponentPropertiesEditionPart)1