Search in sources :

Example 1 with Session

use of com.haulmont.chile.core.model.Session in project cuba by cuba-platform.

the class MetadataTest method test.

@Test
public void test() {
    Session session = AppBeans.get(Metadata.class).getSession();
    assertNotNull(session);
    Collection<MetaModel> models = session.getModels();
    for (MetaModel model : models) {
        System.out.println("Model: " + model.getName());
        System.out.println(PrintUtils.printClassHierarchy(model));
    }
}
Also used : MetaModel(com.haulmont.chile.core.model.MetaModel) Metadata(com.haulmont.cuba.core.global.Metadata) Session(com.haulmont.chile.core.model.Session) Test(org.junit.Test)

Example 2 with Session

use of com.haulmont.chile.core.model.Session in project cuba by cuba-platform.

the class EntityInspectorBrowse method init.

@Override
public void init(Map<String, Object> params) {
    String entityName = (String) params.get("entity");
    if (entityName != null) {
        Session session = metadata.getSession();
        selectedMeta = session.getClass(entityName);
        createEntitiesTable(selectedMeta);
        if (frame instanceof Lookup) {
            setLookupComponent(entitiesTable);
        }
        lookupBox.setVisible(false);
    } else {
        entitiesLookup.setOptionsMap(getEntitiesLookupFieldOptions());
        entitiesLookup.addValueChangeListener(e -> showEntities());
        removedRecords.addValueChangeListener(e -> showEntities());
    }
}
Also used : Session(com.haulmont.chile.core.model.Session)

Example 3 with Session

use of com.haulmont.chile.core.model.Session in project cuba by cuba-platform.

the class TestMetadataLoader method loadMetadata.

@Override
public void loadMetadata() {
    initDatatypes(null);
    MetaModelLoader modelLoader = createModelLoader(session);
    for (Map.Entry<String, List<String>> entry : packages.entrySet()) {
        List<EntityClassInfo> classInfos = entry.getValue().stream().map(name -> new EntityClassInfo(null, name, false)).collect(Collectors.toList());
        modelLoader.loadModel(entry.getKey(), classInfos);
    }
    for (MetaClass metaClass : session.getClasses()) {
        postProcessClass(metaClass);
        initMetaAnnotations(metaClass);
    }
}
Also used : List(java.util.List) MetaModelLoader(com.haulmont.cuba.core.sys.MetaModelLoader) Map(java.util.Map) EntityClassInfo(com.haulmont.cuba.core.sys.EntityClassInfo) MetadataLoader(com.haulmont.cuba.core.sys.MetadataLoader) Element(org.dom4j.Element) DatatypeRegistry(com.haulmont.chile.core.datatypes.DatatypeRegistry) Collectors(java.util.stream.Collectors) MetaClass(com.haulmont.chile.core.model.MetaClass) Session(com.haulmont.chile.core.model.Session) MetaClass(com.haulmont.chile.core.model.MetaClass) MetaModelLoader(com.haulmont.cuba.core.sys.MetaModelLoader) List(java.util.List) Map(java.util.Map) EntityClassInfo(com.haulmont.cuba.core.sys.EntityClassInfo)

Aggregations

Session (com.haulmont.chile.core.model.Session)3 DatatypeRegistry (com.haulmont.chile.core.datatypes.DatatypeRegistry)1 MetaClass (com.haulmont.chile.core.model.MetaClass)1 MetaModel (com.haulmont.chile.core.model.MetaModel)1 Metadata (com.haulmont.cuba.core.global.Metadata)1 EntityClassInfo (com.haulmont.cuba.core.sys.EntityClassInfo)1 MetaModelLoader (com.haulmont.cuba.core.sys.MetaModelLoader)1 MetadataLoader (com.haulmont.cuba.core.sys.MetadataLoader)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Element (org.dom4j.Element)1 Test (org.junit.Test)1