Search in sources :

Example 1 with Module

use of com.developmentontheedge.be5.metadata.model.Module in project be5 by DevelopmentOnTheEdge.

the class ProjectGenerator method addModules.

private void addModules(final Project project) {
    final String[] modules;
    {
        final List<String> ms = Lists.newArrayList(parameters.getModules());
        ms.remove(SYSTEM_MODULE);
        ms.add(0, SYSTEM_MODULE);
        modules = Iterables.toArray(ms, String.class);
    }
    for (final String module : modules) {
        final Module newModule = new Module(module, project.getModules());
        DataElementUtils.saveQuiet(newModule);
    }
}
Also used : List(java.util.List) Module(com.developmentontheedge.be5.metadata.model.Module)

Example 2 with Module

use of com.developmentontheedge.be5.metadata.model.Module in project be5 by DevelopmentOnTheEdge.

the class ProjectGenerator method addIncludes.

public static void addIncludes(final Project project) {
    final StringBuilder sb = new StringBuilder();
    for (final Module module : project.getModules()) {
        final FreemarkerCatalog collection = module.getMacroCollection();
        if (collection == null)
            continue;
        final FreemarkerScript script = collection.optScript(FreemarkerCatalog.MAIN_MACRO_LIBRARY);
        if (script == null)
            continue;
        sb.append("<#include \"../../Modules/" + module.getName() + "/Macros/common\"/>\n");
    }
    final String includes = sb.toString();
    if (!includes.isEmpty()) {
        final FreemarkerScript script = new FreemarkerScript(FreemarkerCatalog.MAIN_MACRO_LIBRARY, project.getMacroCollection());
        script.setSource(includes);
        DataElementUtils.saveQuiet(script);
    }
}
Also used : FreemarkerCatalog(com.developmentontheedge.be5.metadata.model.FreemarkerCatalog) FreemarkerScript(com.developmentontheedge.be5.metadata.model.FreemarkerScript) Module(com.developmentontheedge.be5.metadata.model.Module)

Example 3 with Module

use of com.developmentontheedge.be5.metadata.model.Module in project be5 by DevelopmentOnTheEdge.

the class Entity method getErrors.

@Override
public List<ProjectElementException> getErrors() {
    final List<ProjectElementException> errors = new ArrayList<>();
    if (getName().length() > Constants.MAX_ID_LENGTH) {
        errors.add(new ProjectElementException(getCompletePath(), "name", "Entity name is too long."));
    }
    for (final Module module : getProject().getModulesAndApplication()) {
        final Module thisModule = getModule();
        if (module == thisModule)
            break;
        final Entity duplicate = module.getEntity(getName());
        if (duplicate != null) {
            errors.add(new ProjectElementException(getCompletePath(), "name", "Entity with name '" + getName() + "' already exists."));
            break;
        }
    }
    final TableDef tableDef = findTableDefinition();
    if (tableDef != null) {
        errors.addAll(tableDef.getErrors());
    }
    for (final Query query : getQueries()) {
        errors.addAll(query.getErrors());
    }
    for (final Operation operation : getOperations()) {
        errors.addAll(operation.getErrors());
    }
    return errors;
}
Also used : ProjectElementException(com.developmentontheedge.be5.metadata.exception.ProjectElementException) ArrayList(java.util.ArrayList)

Example 4 with Module

use of com.developmentontheedge.be5.metadata.model.Module in project be5 by DevelopmentOnTheEdge.

the class Serialization method reloadMassChanges.

public static MassChanges reloadMassChanges(final Path file, final Module application) throws ReadException {
    checkProject(application.getProject());
    turnOffAutomaticSerialization();
    try {
        return new YamlDeserializer(new LoadContext()).reloadMassChanges(file, application);
    } finally {
        turnOnAutomaticSerialization();
    }
}
Also used : YamlDeserializer(com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)

Example 5 with Module

use of com.developmentontheedge.be5.metadata.model.Module in project be5 by DevelopmentOnTheEdge.

the class Serialization method reloadForms.

public static JavaScriptForms reloadForms(final Path file, final Module target) throws ReadException {
    checkProject(target.getProject());
    turnOffAutomaticSerialization();
    try {
        return new YamlDeserializer(new LoadContext()).reloadForms(file, target);
    } finally {
        turnOnAutomaticSerialization();
    }
}
Also used : YamlDeserializer(com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)

Aggregations

Module (com.developmentontheedge.be5.metadata.model.Module)26 Project (com.developmentontheedge.be5.metadata.model.Project)21 Entity (com.developmentontheedge.be5.metadata.model.Entity)19 Query (com.developmentontheedge.be5.metadata.model.Query)12 Test (org.junit.Test)9 Path (java.nio.file.Path)8 ArrayList (java.util.ArrayList)6 Operation (com.developmentontheedge.be5.metadata.model.Operation)5 YamlDeserializer (com.developmentontheedge.be5.metadata.serialization.yaml.YamlDeserializer)5 HashMap (java.util.HashMap)5 ProjectElementException (com.developmentontheedge.be5.metadata.exception.ProjectElementException)4 TableDef (com.developmentontheedge.be5.metadata.model.TableDef)4 Map (java.util.Map)4 FreemarkerCatalog (com.developmentontheedge.be5.metadata.model.FreemarkerCatalog)3 FreemarkerScript (com.developmentontheedge.be5.metadata.model.FreemarkerScript)3 BeModelElement (com.developmentontheedge.be5.metadata.model.base.BeModelElement)3 List (java.util.List)3 FreemarkerSqlException (com.developmentontheedge.be5.metadata.exception.FreemarkerSqlException)2 ReadException (com.developmentontheedge.be5.metadata.exception.ReadException)2 ColumnDef (com.developmentontheedge.be5.metadata.model.ColumnDef)2