private List buildSecurityRoles()

in src/main/java/org/apache/maven/plugins/ear/GenerateApplicationXmlMojo.java [288:319]


    private List<SecurityRole> buildSecurityRoles()
        throws EarPluginException
    {
        final List<SecurityRole> result = new ArrayList<SecurityRole>();
        if ( security == null )
        {
            return result;
        }
        final PlexusConfiguration[] securityRoles = security.getChildren( SecurityRole.SECURITY_ROLE );

        for ( PlexusConfiguration securityRole : securityRoles )
        {
            final String id = securityRole.getAttribute( SecurityRole.ID_ATTRIBUTE );
            final String childRoleName = securityRole.getChild( SecurityRole.ROLE_NAME ).getValue();
            final String childRoleNameId =
                securityRole.getChild( SecurityRole.ROLE_NAME ).getAttribute( SecurityRole.ID_ATTRIBUTE );
            final String childDescription = securityRole.getChild( SecurityRole.DESCRIPTION ).getValue();
            final String childDescriptionId =
                securityRole.getChild( SecurityRole.DESCRIPTION ).getAttribute( SecurityRole.ID_ATTRIBUTE );

            if ( childRoleName == null )
            {
                throw new EarPluginException( "Invalid security-role configuration, role-name could not be null." );
            }
            else
            {
                result.add( new SecurityRole( childRoleName, childRoleNameId, id, childDescription,
                                              childDescriptionId ) );
            }
        }
        return result;
    }