Search in sources :

Example 1 with DomainClass

use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.

the class DomainClassDomainClassPropertiesEditionComponent 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 DomainClass domainClass = (DomainClass) elt;
        final DomainClassPropertiesEditionPart domainClassPart = (DomainClassPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(GraalViewsRepository.DomainClass.Properties.name))
            domainClassPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, domainClass.getName()));
        if (isAccessible(GraalViewsRepository.DomainClass.Properties.superType)) {
            // init part
            superTypeSettings = new EObjectFlatComboSettings(domainClass, EnvironmentPackage.eINSTANCE.getStructuredType_Supertype());
            domainClassPart.initSuperType(superTypeSettings);
            // set the button mode
            domainClassPart.setSuperTypeButtonMode(ButtonsModeEnum.BROWSE);
        }
        if (isAccessible(GraalViewsRepository.DomainClass.Properties.description))
            domainClassPart.setDescription(EcoreUtil.convertToString(EcorePackage.Literals.ESTRING, domainClass.getDescription()));
        if (isAccessible(GraalViewsRepository.DomainClass.Properties.associatedTypes)) {
            associatedTypesSettings = new ReferencesTableSettings(domainClass, EnvironmentPackage.eINSTANCE.getStructuredType_AssociatedTypes());
            domainClassPart.initAssociatedTypes(associatedTypesSettings);
        }
        if (isAccessible(GraalViewsRepository.DomainClass.Properties.associatedTypes)) {
            domainClassPart.addFilterToAssociatedTypes(new EObjectFilter(EnvironmentPackage.Literals.STRUCTURED_TYPE));
        // Start of user code for additional businessfilters for associatedTypes
        // End of user code
        }
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : EObjectFilter(org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter) ReferencesTableSettings(org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings) DomainClass(org.obeonetwork.graal.DomainClass) EObjectFlatComboSettings(org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings) DomainClassPropertiesEditionPart(org.obeonetwork.graal.parts.DomainClassPropertiesEditionPart)

Example 2 with DomainClass

use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.

the class DomainClassPersistencePropertiesEditionComponent 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 DomainClass domainClass = (DomainClass) elt;
        final PersistencePropertiesEditionPart persistencePart = (PersistencePropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(GraalViewsRepository.Persistence.Properties.estimatedVolumetry)) {
            persistencePart.setEstimatedVolumetry(EEFConverterUtil.convertToString(EcorePackage.Literals.EINT, domainClass.getEstimatedVolumetry()));
        }
        if (isAccessible(GraalViewsRepository.Persistence.Properties.historized)) {
            persistencePart.setHistorized(domainClass.isHistorized());
        }
    // init filters
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : DomainClass(org.obeonetwork.graal.DomainClass) PersistencePropertiesEditionPart(org.obeonetwork.graal.parts.PersistencePropertiesEditionPart)

Example 3 with DomainClass

use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.

the class DomainClassServicesTest method testAnnotationWithNoMetadataContainer.

@Test
public void testAnnotationWithNoMetadataContainer() {
    System system = loadRoot("AnnotationWithNoMetadataContainer.graal", System.class);
    DomainClass domainClass = query(() -> {
        return (DomainClass) system.getOwnedNamespaces().get(0).getTypes().get(0);
    });
    assertEquals("", getPhysicalSize(domainClass));
}
Also used : DomainClass(org.obeonetwork.graal.DomainClass) System(org.obeonetwork.graal.System) Test(org.junit.Test)

Example 4 with DomainClass

use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.

the class DomainClassServicesTest method testAnnotationNotPresent.

@Test
public void testAnnotationNotPresent() {
    System system = loadRoot("AnnotationNotPresent.graal", System.class);
    DomainClass domainClass = query(() -> {
        return (DomainClass) system.getOwnedNamespaces().get(0).getTypes().get(0);
    });
    assertEquals("", getPhysicalSize(domainClass));
}
Also used : DomainClass(org.obeonetwork.graal.DomainClass) System(org.obeonetwork.graal.System) Test(org.junit.Test)

Example 5 with DomainClass

use of org.obeonetwork.graal.DomainClass in project InformationSystem by ObeoNetwork.

the class UseCaseServicesTest method verifyAllDomainClasses.

private void verifyAllDomainClasses(UseCase uc, String[] expectedClassesNames) {
    UseCaseServices service = new UseCaseServices();
    List<DomainClass> allDomainClasses = service.allDomainClasses(uc);
    Stream<String> domainClassesNames = allDomainClasses.stream().map((domainClass) -> service.fullQualifiedName(domainClass));
    assertArrayEquals("", expectedClassesNames, domainClassesNames.toArray());
}
Also used : UseCaseServices(org.obeonetwork.dsl.graal.m2doc.services.UseCaseServices) DomainClass(org.obeonetwork.graal.DomainClass)

Aggregations

DomainClass (org.obeonetwork.graal.DomainClass)9 Test (org.junit.Test)5 System (org.obeonetwork.graal.System)5 Collator (java.text.Collator)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 EObjectFilter (org.eclipse.emf.eef.runtime.impl.filters.EObjectFilter)1 EObjectFlatComboSettings (org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)1 ReferencesTableSettings (org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings)1 Namespace (org.obeonetwork.dsl.environment.Namespace)1 StructuredType (org.obeonetwork.dsl.environment.StructuredType)1 UseCaseServices (org.obeonetwork.dsl.graal.m2doc.services.UseCaseServices)1 DomainClassPropertiesEditionPart (org.obeonetwork.graal.parts.DomainClassPropertiesEditionPart)1 PersistencePropertiesEditionPart (org.obeonetwork.graal.parts.PersistencePropertiesEditionPart)1