use of com.developmentontheedge.be5.metadata.model.Entity in project be5 by DevelopmentOnTheEdge.
the class MetaImpl method getColumns.
@Override
@SuppressWarnings(value = "unchecked")
public Map<String, ColumnDef> getColumns(Entity entity) {
BeModelElement scheme = entity.getAvailableElement("Scheme");
if (scheme == null)
return new HashMap<>();
BeCaseInsensitiveCollection<ColumnDef> columns = (BeCaseInsensitiveCollection<ColumnDef>) ((TableDef) scheme).get("Columns");
return StreamSupport.stream(columns.spliterator(), false).collect(Utils.toLinkedMap(ColumnDef::getName, Function.identity()));
}
use of com.developmentontheedge.be5.metadata.model.Entity in project be5 by DevelopmentOnTheEdge.
the class MetaImpl method getLocalization.
private String getLocalization(Project project, String language, String entity, Predicate<LocalizationElement> accept) {
for (Module module : project.getModulesAndApplication()) {
Localizations localizations = module.getLocalizations();
LanguageLocalizations languageLocalizations = localizations.get(language);
if (languageLocalizations == null)
continue;
EntityLocalizations entityLocalizations = languageLocalizations.get(entity);
if (entityLocalizations == null)
continue;
for (LocalizationElement element : entityLocalizations.elements()) if (accept.test(element))
return element.getValue();
}
return "";
}
use of com.developmentontheedge.be5.metadata.model.Entity 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.model.Entity in project be5 by DevelopmentOnTheEdge.
the class ModuleLoader2MergeModulesTest method setUp.
@Before
public void setUp() throws Exception {
Path tpmProjectPath = tmp.newFolder().toPath();
project = ProjectTestUtils.getProject("test");
// Entity entity = ProjectTestUtils.createEntity( project, "entity", "ID" );
// ProjectTestUtils.createScheme( entity );
// ProjectTestUtils.createScript( project, "delete from entity;\nINSERT INTO entity (name) VALUES ('foo')" );
ProjectTestUtils.createH2Profile(project, "profileTestMavenPlugin");
// Query query = ProjectTestUtils.createQuery(entity, "All records", Arrays.asList('@' + SpecialRoleGroup.ALL_ROLES_EXCEPT_GUEST_GROUP, "-User"));
// query.getOperationNames().setValues( Collections.singleton( "op" ) );
// ProjectTestUtils.createOperation( entity );
Path modulePath = tmp.newFolder().toPath();
Project moduleProject1 = createModuleWithQueryRoles(project, null, "testModule1", "testQuery1", "testRole1", modulePath);
Path modulePath2 = tmp.newFolder().toPath();
Project moduleProject2 = createModuleWithQueryRoles(project, moduleProject1, "testModule2", "testQuery2", "testRole2", modulePath2);
project.setRoles(Arrays.asList("testRole1", "testRole2"));
Serialization.save(project, tpmProjectPath);
ArrayList<URL> urls = new ArrayList<>();
urls.add(modulePath.resolve("project.yaml").toUri().toURL());
urls.add(modulePath2.resolve("project.yaml").toUri().toURL());
urls.add(tpmProjectPath.resolve("project.yaml").toUri().toURL());
ModuleLoader2.loadAllProjects(urls);
LoadContext ctx = new LoadContext();
ModuleLoader2.mergeAllModules(project, Arrays.asList(moduleProject1, moduleProject2), ctx);
}
use of com.developmentontheedge.be5.metadata.model.Entity in project be5 by DevelopmentOnTheEdge.
the class BaseTypeManagerTest method createTable.
protected TableDef createTable(Rdbms dbms) {
Project proj = new Project("test");
proj.setDatabaseSystem(dbms);
Entity ent = new Entity("table", proj.getApplication(), EntityType.TABLE);
DataElementUtils.save(ent);
TableDef def = new TableDef(ent);
DataElementUtils.save(def);
return def;
}
Aggregations