@Test public void shouldSetViewDefinitionAttributes() { InternalViewDefinition viewDefinition = parseAndGetViewDefinition(); assertEquals("simpleView", viewDefinition.getName()); assertEquals("sample", viewDefinition.getPluginIdentifier()); assertEquals(userRoleMock, viewDefinition.getAuthorizationRole()); assertThat(viewDefinition.getComponentByReference("mainWindow"), instanceOf(WindowComponentPattern.class)); }
public SecurityRole getAuthorizationRole(final Node node) throws ViewDefinitionParserNodeException { String authorizationRole = getStringAttribute(node, "defaultAuthorizationRole"); SecurityRole role; if (authorizationRole != null) { role = securityRolesService.getRoleByIdentifier(authorizationRole); if (role == null) { throw new ViewDefinitionParserNodeException(node, "no such role: '" + authorizationRole + "'"); } } else { role = securityRolesService.getRoleByIdentifier("ROLE_USER"); } return role; }
ViewDefinitionParserImpl implements ViewDefinitionParser { public SecurityRole getAuthorizationRole(final Node node) throws ViewDefinitionParserNodeException { String authorizationRole = getStringAttribute(node, "defaultAuthorizationRole"); SecurityRole role; if (authorizationRole != null) { role = securityRolesService.getRoleByIdentifier(authorizationRole); if (role == null) { throw new ViewDefinitionParserNodeException(node, "no such role: '" + authorizationRole + "'"); } } else { role = securityRolesService.getRoleByIdentifier("ROLE_USER"); } return role; } }
ViewDefinitionParserImpl implements ViewDefinitionParser { public SecurityRole getAuthorizationRole(final Node node) throws ViewDefinitionParserNodeException { String authorizationRole = getStringAttribute(node, "defaultAuthorizationRole"); SecurityRole role; if (authorizationRole != null) { role = securityRolesService.getRoleByIdentifier(authorizationRole); if (role == null) { throw new ViewDefinitionParserNodeException(node, "no such role: '" + authorizationRole + "'"); } } else { role = securityRolesService.getRoleByIdentifier("ROLE_USER"); } return role; }  }
ViewDefinitionParserImpl implements ViewDefinitionParser { public SecurityRole getAuthorizationRole(final Node node) throws ViewDefinitionParserNodeException { String authorizationRole = getStringAttribute(node, "defaultAuthorizationRole"); SecurityRole role; if (authorizationRole != null) { role = securityRolesService.getRoleByIdentifier(authorizationRole); if (role == null) { throw new ViewDefinitionParserNodeException(node, "no such role: '" + authorizationRole + "'"); } } else { role = securityRolesService.getRoleByIdentifier("ROLE_USER"); } return role; }  @Override InternalViewDefinition parseViewXml(final Resource viewXml, final String pluginIdentifier); SecurityRole getAuthorizationRole(final Node node); @Override Boolean getBooleanAttribute(final Node node, final String name, final boolean defaultValue); @Override String getStringAttribute(final Node node, final String name); @Override String getStringNodeContent(final Node node); @Override Node getRootOfXmlDocument(final Resource xmlFile); @Override ComponentOption parseOption(final Node optionNode); ComponentPattern parseComponent(final Node componentNode, final ViewDefinition viewDefinition,
            final ContainerPattern parent, final String pluginIdentifier); @Override ComponentDefinition getComponentDefinition(final Node componentNode, final ContainerPattern parent,
            final ViewDefinition viewDefinition); @Override ComponentPattern parseComponent(final Node componentNode, final ContainerPattern parent); @Override ViewEventListenerHook parseEventListener(final Node listenerNode); ViewLifecycleHook parseLifecycleHook(final Node hookNode); ViewConstructionHook parseConstructionHook(final Node hookNode); ViewEventListenerHook parseEventListenerHook(final Node hookNode); int getCurrentIndexOrder(); @Override List<Node> geElementChildren(final Node node); @Override ViewExtension getViewExtensionNode(final InputStream resource, final String tagType); @Override InternalRibbon parseRibbon(final Node groupNode, final ViewDefinition viewDefinition); @Override InternalRibbonGroup parseRibbonGroup(final Node groupNode, final ViewDefinition viewDefinition); @Override InternalRibbonActionItem parseRibbonItem(final Node itemNode, final ViewDefinition viewDefinition); @Override void checkState(final boolean state, final Node node, final String message); }
ViewDefinitionParserImpl implements ViewDefinitionParser { public SecurityRole getAuthorizationRole(final Node node) throws ViewDefinitionParserNodeException { String authorizationRole = getStringAttribute(node, "defaultAuthorizationRole"); SecurityRole role; if (authorizationRole != null) { role = securityRolesService.getRoleByIdentifier(authorizationRole); if (role == null) { throw new ViewDefinitionParserNodeException(node, "no such role: '" + authorizationRole + "'"); } } else { role = securityRolesService.getRoleByIdentifier("ROLE_USER"); } return role; }  @Override InternalViewDefinition parseViewXml(final Resource viewXml, final String pluginIdentifier); SecurityRole getAuthorizationRole(final Node node); @Override Boolean getBooleanAttribute(final Node node, final String name, final boolean defaultValue); @Override String getStringAttribute(final Node node, final String name); @Override String getStringNodeContent(final Node node); @Override Node getRootOfXmlDocument(final Resource xmlFile); @Override ComponentOption parseOption(final Node optionNode); ComponentPattern parseComponent(final Node componentNode, final ViewDefinition viewDefinition,
            final ContainerPattern parent, final String pluginIdentifier); @Override ComponentDefinition getComponentDefinition(final Node componentNode, final ContainerPattern parent,
            final ViewDefinition viewDefinition); @Override ComponentPattern parseComponent(final Node componentNode, final ContainerPattern parent); @Override ViewEventListenerHook parseEventListener(final Node listenerNode); ViewLifecycleHook parseLifecycleHook(final Node hookNode); ViewConstructionHook parseConstructionHook(final Node hookNode); ViewEventListenerHook parseEventListenerHook(final Node hookNode); int getCurrentIndexOrder(); @Override List<Node> geElementChildren(final Node node); @Override ViewExtension getViewExtensionNode(final InputStream resource, final String tagType); @Override InternalRibbon parseRibbon(final Node groupNode, final ViewDefinition viewDefinition); @Override InternalRibbonGroup parseRibbonGroup(final Node groupNode, final ViewDefinition viewDefinition); @Override InternalRibbonActionItem parseRibbonItem(final Node itemNode, final ViewDefinition viewDefinition); @Override void checkState(final boolean state, final Node node, final String message);  }