use of com.developmentontheedge.be5.metadata.model.EntityType in project be5 by DevelopmentOnTheEdge.
the class MetaImpl method getOrderedEntitiesByModules.
@Override
public Map<String, List<Entity>> getOrderedEntitiesByModules(EntityType entityType, String language) {
HashMap<String, List<Entity>> result = new HashMap<>();
for (Module module : getProject().getModulesAndApplication()) {
List<OrderedEntity> entities = new ArrayList<>();
for (Entity entity : module.getEntities()) {
if (entityType == null || entity.getType() == entityType) {
entities.add(new OrderedEntity(entity, getTitle(entity, language)));
}
}
Collections.sort(entities);
result.put(module.getName(), entities.stream().map(e -> e.entity).collect(Collectors.toList()));
}
return result;
}
use of com.developmentontheedge.be5.metadata.model.EntityType in project be5 by DevelopmentOnTheEdge.
the class MetaImpl method getOrderedEntities.
@Override
public List<Entity> getOrderedEntities(EntityType entityType, String language) {
List<OrderedEntity> entities = new ArrayList<>();
for (Module module : getProject().getModulesAndApplication()) {
for (Entity entity : module.getEntities()) {
if (entityType == null || entity.getType() == entityType) {
entities.add(new OrderedEntity(entity, getTitle(entity, language)));
}
}
}
Collections.sort(entities);
return entities.stream().map(e -> e.entity).collect(Collectors.toList());
}
use of com.developmentontheedge.be5.metadata.model.EntityType in project be5 by DevelopmentOnTheEdge.
the class Menu method generateMenu.
private MenuResponse generateMenu(Injector injector, boolean withIds, EntityType entityType) {
UserAwareMeta userAwareMeta = injector.get(UserAwareMeta.class);
List<String> roles = UserInfoHolder.getCurrentRoles();
String language = UserInfoHolder.getLanguage();
List<RootNode> entities = collectEntities(injector.getMeta(), userAwareMeta, language, roles, withIds, entityType);
return new MenuResponse(entities);
}
use of com.developmentontheedge.be5.metadata.model.EntityType in project be5 by DevelopmentOnTheEdge.
the class Menu method getDefaultAction.
private Action getDefaultAction(Injector injector, EntityType entityType) {
UserAwareMeta userAwareMeta = injector.get(UserAwareMeta.class);
List<String> roles = UserInfoHolder.getCurrentRoles();
String language = UserInfoHolder.getLanguage();
List<RootNode> entities = collectEntities(injector.getMeta(), userAwareMeta, language, roles, false, entityType);
for (RootNode rootNode : entities) {
if (rootNode.action != null) {
if (rootNode.isDefault)
return rootNode.action;
} else if (rootNode.children != null) {
for (QueryNode node : rootNode.children) {
if (node.isDefault)
return node.action;
}
}
}
for (RootNode rootNode : entities) {
if (rootNode.action != null) {
return rootNode.action;
} else if (rootNode.children != null) {
for (QueryNode node : rootNode.children) {
return node.action;
}
}
}
return null;
}
Aggregations