Search in sources :

Example 11 with DataEntity

use of org.whole.lang.models.model.DataEntity in project whole by wholeplatform.

the class RewriteQueriesTest method testDelete1.

@Test
public void testDelete1() {
    Model model = new ModelsModel().create();
    ITemplateManager tm = RewriteQueriesTemplateManager.instance();
    PathExpression query = (PathExpression) tm.create("delete1");
    for (DataEntity dataEntity : BehaviorUtils.<DataEntity>compileAndLazyEvaluate(query, model)) assertTrue(Matcher.match(ModelsEntityDescriptorEnum.DataEntity, dataEntity));
    assertFalse(BehaviorUtils.compileAndLazyEvaluate(query, model).hasNext());
}
Also used : PathExpression(org.whole.lang.queries.model.PathExpression) ModelsModel(org.whole.lang.models.codebase.ModelsModel) Model(org.whole.lang.models.model.Model) ITemplateManager(org.whole.lang.templates.ITemplateManager) DataEntity(org.whole.lang.models.model.DataEntity) ModelsModel(org.whole.lang.models.codebase.ModelsModel) Test(org.junit.Test)

Example 12 with DataEntity

use of org.whole.lang.models.model.DataEntity in project whole by wholeplatform.

the class RewriteQueriesTest method testUpdate1.

@Test
public void testUpdate1() {
    Model model = new ModelsModel().create();
    ModelDeclarations declarations = model.getDeclarations();
    ITemplateManager tm = RewriteQueriesTemplateManager.instance();
    PathExpression query = (PathExpression) tm.create("update1");
    for (IEntity entity : BehaviorUtils.compileAndLazyEvaluate(query, model)) assertTrue(Matcher.match(ModelsEntityDescriptorEnum.SimpleName, entity) || Matcher.match(ModelsEntityDescriptorEnum.DataType, entity));
    assertEquals("MyModelName", model.getName().getValue());
    int j = 0;
    for (int i = 0; i < declarations.wSize(); i++) {
        IEntity decl = declarations.wGet(i);
        if (Matcher.match(ModelsEntityDescriptorEnum.DataEntity, decl)) {
            if (j++ == 0) {
                assertEquals("MyFirstName", ((DataEntity) decl).getName().getValue());
                assertEquals("MyFirstDataType", ((DataEntity) decl).getDataType().getValue());
            } else {
                assertEquals("MySecondName", ((DataEntity) decl).getName().getValue());
                return;
            }
        }
    }
}
Also used : ModelDeclarations(org.whole.lang.models.model.ModelDeclarations) PathExpression(org.whole.lang.queries.model.PathExpression) IEntity(org.whole.lang.model.IEntity) ModelsModel(org.whole.lang.models.codebase.ModelsModel) Model(org.whole.lang.models.model.Model) ITemplateManager(org.whole.lang.templates.ITemplateManager) DataEntity(org.whole.lang.models.model.DataEntity) ModelsModel(org.whole.lang.models.codebase.ModelsModel) Test(org.junit.Test)

Example 13 with DataEntity

use of org.whole.lang.models.model.DataEntity in project whole by wholeplatform.

the class DataEntityTablePart method refreshVisuals.

@Override
protected void refreshVisuals() {
    DataEntity entity = getModelEntity();
    getFigure().showKeyword(!EntityUtils.isNotResolver(entity.getDataType()));
}
Also used : DataEntity(org.whole.lang.models.model.DataEntity)

Aggregations

DataEntity (org.whole.lang.models.model.DataEntity)13 Test (org.junit.Test)10 IEntity (org.whole.lang.model.IEntity)10 ModelsModel (org.whole.lang.models.codebase.ModelsModel)10 Model (org.whole.lang.models.model.Model)10 PathExpression (org.whole.lang.queries.model.PathExpression)10 ITemplateManager (org.whole.lang.templates.ITemplateManager)10 ModelDeclarations (org.whole.lang.models.model.ModelDeclarations)9 CompositeEntity (org.whole.lang.models.model.CompositeEntity)5 SimpleEntity (org.whole.lang.models.model.SimpleEntity)5 XmlModel (org.whole.lang.models.codebase.XmlModel)4 EnumEntity (org.whole.lang.models.model.EnumEntity)4 Features (org.whole.lang.models.model.Features)3 IBindingManager (org.whole.lang.bindings.IBindingManager)2 EnumValues (org.whole.lang.models.model.EnumValues)2 ArrayList (java.util.ArrayList)1 As (org.whole.lang.grammars.model.As)1 NonTerminal (org.whole.lang.grammars.model.NonTerminal)1 Repeat (org.whole.lang.grammars.model.Repeat)1 Rule (org.whole.lang.grammars.model.Rule)1