use of com.developmentontheedge.be5.model.Action 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;
}
use of com.developmentontheedge.be5.model.Action in project be5 by DevelopmentOnTheEdge.
the class MenuTest method testDefaultActionAdmin.
@Test
public void testDefaultActionAdmin() {
initUserWithRoles(RoleType.ROLE_ADMINISTRATOR, RoleType.ROLE_SYSTEM_DEVELOPER);
Response response = mock(Response.class);
component.generate(getMockRequest("defaultAction"), response, injector);
verify(response).sendAsRawJson(eq(new Action("call", "table/testtableAdmin/All records")));
initUserWithRoles(RoleType.ROLE_GUEST);
}
use of com.developmentontheedge.be5.model.Action in project be5 by DevelopmentOnTheEdge.
the class MenuTest method testDefaultActionTestUser2.
@Test
public void testDefaultActionTestUser2() {
initUserWithRoles("TestUser2");
Response response = mock(Response.class);
component.generate(getMockRequest("defaultAction"), response, injector);
verify(response).sendAsRawJson(eq(new Action("call", "table/atest/Test1")));
initUserWithRoles(RoleType.ROLE_GUEST);
}
Aggregations