Search in sources :

Example 6 with DataElementPath

use of com.developmentontheedge.be5.metadata.model.base.DataElementPath 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

DataElementPath (com.developmentontheedge.be5.metadata.model.base.DataElementPath)6 ProjectElementException (com.developmentontheedge.be5.metadata.exception.ProjectElementException)4 ArrayList (java.util.ArrayList)2 FreemarkerSqlHandler (com.developmentontheedge.be5.metadata.freemarker.FreemarkerSqlHandler)1 Project (com.developmentontheedge.be5.metadata.model.Project)1 MultiSqlConsumer (com.developmentontheedge.dbms.MultiSqlConsumer)1