Search in sources :

Example 21 with ProjectElementException

use of com.developmentontheedge.be5.metadata.exception.ProjectElementException in project be5 by DevelopmentOnTheEdge.

the class Project method mergeTemplate.

public ParseResult mergeTemplate(TemplateElement element) {
    boolean besql = element instanceof Query && ((Query) element).getEntity().isBesql() && ((Query) element).isSqlQuery();
    try {
        sqlMacros.clear();
        if (" ".equals(element.getTemplateCode()))
            return new ParseResult(" ");
        final DataElementPath path = element.getCompletePath();
        final String merged = FreemarkerUtils.mergeTemplateByPath(path.toString(), getContext(element), getConfiguration());
        if (besql)
            enterSQL();
        return new ParseResult(besql ? translateSQL(merged) : merged);
    } catch (ProjectElementException e) {
        return new ParseResult(e);
    } catch (Throwable e) {
        return new ParseResult(new ProjectElementException(getCompletePath(), "source", e));
    } finally {
        beSQL = 0;
        sqlMacros.clear();
    }
}
Also used : ProjectElementException(com.developmentontheedge.be5.metadata.exception.ProjectElementException) DataElementPath(com.developmentontheedge.be5.metadata.model.base.DataElementPath)

Aggregations

ProjectElementException (com.developmentontheedge.be5.metadata.exception.ProjectElementException)13 DataElementPath (com.developmentontheedge.be5.metadata.model.base.DataElementPath)6 ArrayList (java.util.ArrayList)6 MojoFailureException (org.apache.maven.plugin.MojoFailureException)6 FreemarkerSqlException (com.developmentontheedge.be5.metadata.exception.FreemarkerSqlException)3 FreemarkerScript (com.developmentontheedge.be5.metadata.model.FreemarkerScript)3 Project (com.developmentontheedge.be5.metadata.model.Project)3 PrintStream (java.io.PrintStream)3 Test (org.junit.Test)3 Module (com.developmentontheedge.be5.metadata.model.Module)2 BeSqlExecutor (com.developmentontheedge.be5.metadata.sql.BeSqlExecutor)2 SqlExecutor (com.developmentontheedge.dbms.SqlExecutor)2 File (java.io.File)2 IOException (java.io.IOException)2 ProjectLoadException (com.developmentontheedge.be5.metadata.exception.ProjectLoadException)1 ProjectSaveException (com.developmentontheedge.be5.metadata.exception.ProjectSaveException)1 FreemarkerSqlHandler (com.developmentontheedge.be5.metadata.freemarker.FreemarkerSqlHandler)1 DdlElement (com.developmentontheedge.be5.metadata.model.DdlElement)1 Entity (com.developmentontheedge.be5.metadata.model.Entity)1 FreemarkerCatalog (com.developmentontheedge.be5.metadata.model.FreemarkerCatalog)1