use of com.developmentontheedge.be5.api.helpers.UserAwareMeta 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