Class RoleUtil


  • public final class RoleUtil
    extends Object
    Helper methods for managing roles.
    • Method Detail

      • resolveRole

        public static Map<String,​Role> resolveRole​(String roleName,
                                                         String environmentContext,
                                                         Map<String,​Role> roles)
                                                  throws GeneratorException
        Resolve role inheritance. As a result one or multiple roles are returned that reflect the inheritanceship. File that are generated by both the sub and the super role are eliminated in the super role.
        Parameters:
        roleName - Role name - role may contain inheritance relations
        environmentContext - Context information.
        roles - All roles for the system
        Returns:
        Resolved role(s) without pending inheritance relations.
        Throws:
        GeneratorException - when role or any of it's inheritance relations is not found
      • matchesRoleFile

        public static boolean matchesRoleFile​(RoleFile roleFile,
                                              List<String> variants)
        Checks if the given role file should be generated for the given set of variants.
        Parameters:
        roleFile - Role file
        variants - Variants select for a node
        Returns:
        true if file should be rendered