Search in sources :

Example 61 with Project

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

the class ModuleLoader2 method mergeAllModules.

public static void mergeAllModules(final Project model, List<Project> modules, final LoadContext context) throws ProjectLoadException {
    modules = new LinkedList<>(modules);
    for (Project module : modules) {
        module.mergeHostProject(model);
    }
    final Project compositeModule = foldModules(model, modules, context);
    if (compositeModule != null) {
        model.merge(compositeModule);
    }
}
Also used : Project(com.developmentontheedge.be5.metadata.model.Project)

Example 62 with Project

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

the class ModuleLoader2 method mergeModules.

public static void mergeModules(Project be5Project, ProcessController logger) throws ProjectLoadException {
    long startTime = System.nanoTime();
    LoadContext loadContext = new LoadContext();
    try {
        ModuleLoader2.mergeAllModules(be5Project, logger, loadContext);
    } catch (ProjectLoadException e) {
        throw new ProjectLoadException("Merge modules", e);
    }
    loadContext.check();
    log.info(ModuleLoader2.logLoadedProject(be5Project, startTime));
}
Also used : ProjectLoadException(com.developmentontheedge.be5.metadata.exception.ProjectLoadException)

Example 63 with Project

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

the class ModuleLoader2 method findAndLoadProjectWithModules.

public static Project findAndLoadProjectWithModules() throws ProjectLoadException {
    loadAllProjects(true);
    Project project = null;
    for (Map.Entry<String, Project> module : modulesMap.entrySet()) {
        if (module.getValue() != null && !module.getValue().isModuleProject()) {
            if (project != null) {
                throw new RuntimeException("Several projects were found: " + project + ", " + module);
            } else {
                project = module.getValue();
            }
        }
    }
    if (project == null) {
        // todo create new not module project for tests?
        log.info("Project not found, try load main module.");
        project = new ProjectTopologicalSort(modulesMap.values()).getRoot();
    }
    ModuleLoader2.mergeModules(project, new JULLogger(log));
    return project;
}
Also used : Project(com.developmentontheedge.be5.metadata.model.Project) JULLogger(com.developmentontheedge.be5.metadata.util.JULLogger) HashMap(java.util.HashMap) Map(java.util.Map)

Example 64 with Project

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

the class TableDef method getCreateDdl.

@Override
public String getCreateDdl() {
    StringBuilder sb = new StringBuilder();
    Project project = getProject();
    Rdbms dbms = project.getDatabaseSystem();
    DbmsTypeManager typeManager = dbms.getTypeManager();
    sb.append(typeManager.getCreateTableClause(getEntityName()) + " (\n");
    StringBuilder triggers = new StringBuilder();
    for (ColumnDef column : getColumns().getAvailableElements()) {
        sb.append(typeManager.getColumnDefinitionClause(column));
        sb.append(",\n");
        triggers.append(typeManager.getColumnTriggerDefinition(column));
    }
    if (getColumnsCount() > 0) {
        sb.delete(sb.length() - 2, sb.length());
    }
    sb.append(");\n");
    ColumnDef autoincrementColumn = getAutoincrementColumn();
    if (autoincrementColumn != null) {
        String value = getStartId();
        if (value != null)
            sb.append(typeManager.getStartingIncrementDefinition(getEntityName(), autoincrementColumn.getName(), Long.parseLong(value)));
    }
    sb.append(triggers);
    List<String> indexDdls = new ArrayList<>();
    for (IndexDef index : getIndices().getAvailableElements()) {
        if (!typeManager.isFunctionalIndexSupported() && index.isFunctional())
            continue;
        if (dbms == Rdbms.DB2 && index.getName().length() > Rdbms.DB2_INDEX_LENGTH)
            continue;
        indexDdls.add(index.getCreateDdl() + "\n");
    }
    Collections.sort(indexDdls);
    sb.append(String.join("", indexDdls));
    return sb.toString();
}
Also used : Rdbms(com.developmentontheedge.be5.metadata.sql.Rdbms) ArrayList(java.util.ArrayList) DbmsTypeManager(com.developmentontheedge.be5.metadata.sql.type.DbmsTypeManager)

Example 65 with Project

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

the class ConnectionProfileNameSelector method getTags.

/**
 * @return local and remote profiles, sorted by name
 */
@Override
public String[] getTags() {
    final Project project = (Project) getBean();
    final String[] profileNames = project.getProfileNames();
    return profileNames;
}
Also used : Project(com.developmentontheedge.be5.metadata.model.Project)

Aggregations

Project (com.developmentontheedge.be5.metadata.model.Project)40 Module (com.developmentontheedge.be5.metadata.model.Module)19 Test (org.junit.Test)19 Entity (com.developmentontheedge.be5.metadata.model.Entity)14 Path (java.nio.file.Path)13 Query (com.developmentontheedge.be5.metadata.model.Query)12 LoadContext (com.developmentontheedge.be5.metadata.serialization.LoadContext)7 ArrayList (java.util.ArrayList)7 ProjectLoadException (com.developmentontheedge.be5.metadata.exception.ProjectLoadException)6 FreemarkerScript (com.developmentontheedge.be5.metadata.model.FreemarkerScript)5 URL (java.net.URL)5 Map (java.util.Map)5 ReadException (com.developmentontheedge.be5.metadata.exception.ReadException)4 BeConnectionProfile (com.developmentontheedge.be5.metadata.model.BeConnectionProfile)4 Operation (com.developmentontheedge.be5.metadata.model.Operation)4 IOException (java.io.IOException)4 MojoFailureException (org.apache.maven.plugin.MojoFailureException)4 WriteException (com.developmentontheedge.be5.metadata.exception.WriteException)3 FreemarkerCatalog (com.developmentontheedge.be5.metadata.model.FreemarkerCatalog)3 Localizations (com.developmentontheedge.be5.metadata.model.Localizations)3