use of com.developmentontheedge.be5.metadata.exception.ProjectSaveException in project be5 by DevelopmentOnTheEdge.
the class Serialization method save.
/**
* @param project
* @param root
* @param format
* @throws ProjectSaveException
*/
public static void save(final Project project, final Path root) throws ProjectSaveException {
Objects.requireNonNull(project);
Objects.requireNonNull(root);
try {
new YamlSerializer().serializeProjectTo(project, root);
} catch (final WriteException e) {
throw new ProjectSaveException(root, e);
}
}
use of com.developmentontheedge.be5.metadata.exception.ProjectSaveException in project be5 by DevelopmentOnTheEdge.
the class AppValidate method saveProject.
// private List<ProjectElementException> validateDeps( List<Project> moduleProjects )
// {
// List<ProjectElementException> moduleErrors = new ArrayList<>();
// Map<String, String> entityToModule = new HashMap<>();
// for(Project prj : moduleProjects)
// {
// for(Entity entity : prj.getApplication().getEntities())
// entityToModule.put( entity.getName(), prj.getName() );
// }
// for(Project prj : moduleProjects)
// {
// for(Entity entity : prj.getApplication().getEntities())
// {
// for(TableReference ref : entity.getAllReferences())
// {
// String moduleTo = entityToModule.get( ref.getTableTo() );
// if(moduleTo != null && prj.getModule( moduleTo ) == null)
// {
// moduleErrors.add( new ProjectElementException( ref, "Reference to entity '" + ref.getTableTo()
// + "' which is defined in module '" + moduleTo + "' which is not specified in dependencies of module '"
// + prj.getName() + "'" ) );
// }
// }
// }
// }
// return moduleErrors;
// }
private void saveProject() throws MojoFailureException {
if (saveProject) {
try {
getLog().info("Saving...");
Serialization.save(be5Project, be5Project.getLocation());
} catch (ProjectSaveException e) {
throw new MojoFailureException("Can not save project.", e);
}
}
}
use of com.developmentontheedge.be5.metadata.exception.ProjectSaveException in project be5 by DevelopmentOnTheEdge.
the class ModuleUtilsTest method getModule.
private Project getModule() throws ProjectSaveException {
Project module = new Project("module", true);
Entity entity = new Entity("mentity", module.getApplication(), EntityType.TABLE);
DataElementUtils.save(entity);
Query q1 = new Query("q1", entity);
q1.setQuery("QUERY1");
q1.setTitleName("Query1 title");
DataElementUtils.save(q1);
Query q2 = new Query("q2", entity);
q2.setQuery("QUERY2");
q2.setTitleName("Query2 title");
DataElementUtils.save(q2);
return module;
}
use of com.developmentontheedge.be5.metadata.exception.ProjectSaveException in project be5 by DevelopmentOnTheEdge.
the class ModuleUtilsTest method getProject.
private Project getProject() throws ProjectSaveException {
Project app = new Project("app");
Module appModule = new Module("module", app.getModules());
DataElementUtils.save(appModule);
Entity appEntity = new Entity("mentity", appModule, EntityType.DICTIONARY);
DataElementUtils.save(appEntity);
Query appQ1 = new Query("q1", appEntity);
appQ1.setQuery("QUERY1 customized");
DataElementUtils.save(appQ1);
Query appQ3 = new Query("q3", appEntity);
appQ3.setQuery("QUERY3");
appQ3.setTitleName("Query3 title");
DataElementUtils.save(appQ3);
return app;
}
use of com.developmentontheedge.be5.metadata.exception.ProjectSaveException in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2Test method loadAllProjectsTestWithDev.
@Test
public void loadAllProjectsTestWithDev() throws IOException, ProjectSaveException, ProjectLoadException {
try (PrintWriter out = new PrintWriter(path.resolve("dev.yaml").toFile())) {
out.println("paths:" + "\n test: " + path.toAbsolutePath());
}
ModuleLoader2.loadAllProjects(Collections.singletonList(path.resolve("project.yaml").toUri().toURL()));
ModuleLoader2.readDevPathsToSourceProjects(Collections.singletonList(path.resolve("dev.yaml").toUri().toURL()));
assertTrue(ModuleLoader2.getPathsToProjectsToHotReload().toString().startsWith("{test="));
assertEquals(1, ModuleLoader2.getPathsToProjectsToHotReload().size());
Project loadProject = ModuleLoader2.findAndLoadProjectWithModules();
assertEquals("test", loadProject.getAppName());
ModuleLoader2.getFileSystem(loadProject, "test");
}
Aggregations