use of com.developmentontheedge.be5.metadata.model.base.DataElementPath in project be5 by DevelopmentOnTheEdge.
the class FreemarkerScript method getErrors.
@Override
public List<ProjectElementException> getErrors() {
List<ProjectElementException> result = new ArrayList<>();
ProjectElementException error = getResult().getError();
if (error != null && !error.isNoError()) {
DataElementPath path = getCompletePath();
if (error.getPath().equals(path.toString()))
result.add(error);
else
result.add(new ProjectElementException(path, "source", error));
}
return result;
}
use of com.developmentontheedge.be5.metadata.model.base.DataElementPath in project be5 by DevelopmentOnTheEdge.
the class Query method getErrors.
@Override
public List<ProjectElementException> getErrors() {
List<ProjectElementException> result = super.getErrors();
try {
ModelValidationUtils.checkValueInSet(this, "type", getType().getName(), getQueryTypes());
} catch (ProjectElementException e) {
result.add(e);
}
String templateQueryName = getTemplateQueryName();
if (!templateQueryName.isEmpty()) {
int pos = templateQueryName.indexOf('.');
if (pos < 0) {
result.add(new ProjectElementException(getCompletePath(), "templateQueryName", new IllegalArgumentException("templateQueryName must have format <entity>:<query>")));
}
}
Set<String> missingEntries = getRoles().getMissingEntries();
if (!missingEntries.isEmpty()) {
result.add(new ProjectElementException(getCompletePath(), "roles", "Unknown role(s): " + missingEntries));
}
ProjectElementException error = getQueryCompiled().getError();
if (error != null && !error.isNoError()) {
DataElementPath path = getCompletePath();
if (error.getPath().equals(path.toString()))
result.add(error);
else
result.add(new ProjectElementException(path, "query", error));
}
return result;
}
use of com.developmentontheedge.be5.metadata.model.base.DataElementPath in project be5 by DevelopmentOnTheEdge.
the class PageCustomization method getErrors.
@Override
public List<ProjectElementException> getErrors() {
List<ProjectElementException> result = new ArrayList<>();
try {
ModelValidationUtils.checkValueInSet(this, "domain", domain, getDomains());
} catch (ProjectElementException e) {
result.add(e);
}
try {
ModelValidationUtils.checkValueInSet(this, "type", type, TYPES);
} catch (ProjectElementException e) {
result.add(e);
}
ProjectElementException error = getResult().getError();
if (error != null && !error.isNoError()) {
DataElementPath path = getCompletePath();
if (error.getPath().equals(path.toString()))
result.add(error);
else
result.add(new ProjectElementException(path, "query", error));
}
return result;
}
use of com.developmentontheedge.be5.metadata.model.base.DataElementPath in project be5 by DevelopmentOnTheEdge.
the class AppData method executeScript.
protected void executeScript(final SqlExecutor sqlExecutor, FreemarkerScript freemarkerScript) throws ProjectElementException, IOException {
String compiled = freemarkerScript.getResult().validate();
if (logPath != null) {
Files.write(logPath.toPath().resolve(be5Project.getName() + "_script_" + freemarkerScript.getModule().getName() + "_" + freemarkerScript.getName() + ".compiled"), compiled.getBytes(StandardCharsets.UTF_8));
}
String sql = compiled.trim();
if (sql.isEmpty())
return;
DataElementPath path = freemarkerScript.getCompletePath();
if (debug)
System.err.println(sql);
sqlExecutor.comment("Execute " + path);
new FreemarkerSqlHandler(sqlExecutor, debug, logger).execute(freemarkerScript);
}
use of com.developmentontheedge.be5.metadata.model.base.DataElementPath in project be5 by DevelopmentOnTheEdge.
the class FreemarkerSqlHandler method execute.
public void execute(FreemarkerScript freemarkerScript) throws ProjectElementException, FreemarkerSqlException {
DataElementPath path = freemarkerScript.getCompletePath();
if (log != null) {
log.setOperationName("[>] " + path);
}
sqlExecutor.comment("Execute " + path);
Project project = freemarkerScript.getProject();
ResultToConsumerWriter out = new ResultToConsumerWriter(new MultiSqlConsumer(project.getDatabaseSystem().getType(), this));
FreemarkerUtils.mergeTemplateByPath(path.toString(), project.getContext(freemarkerScript), project.getConfiguration(), out);
for (int j = includeChain.size() - 1; j >= 0; j--) {
sqlExecutor.comment("End of included " + includeChain.get(j), false);
}
}
Aggregations