class Role extends RightOwner {

    private final boolean system;

    public Role(Database database, int id, String roleName, boolean system) {
        super(database, id, roleName);
        this.system = system;
    }

    @Override
    public DbObjectType getType() {
        return DbObjectType.ROLE;
    }

    /**
     * Get the CREATE SQL statement for this object.
     *
     * @param ifNotExists true if IF NOT EXISTS should be used
     * @return the SQL statement
     */
    public String getCreateSQL(boolean ifNotExists) {
        if (system) {
            return null;
        }
        StringBuilder buff = new StringBuilder("CREATE ROLE ");
        if (ifNotExists) {
            buff.append("IF NOT EXISTS ");
        }
        buff.append(getSQL());
        return buff.toString();
    }

    @Override
    public String getCreateSQL() {
        return getCreateSQL(false);
    }

    @Override
    public void removeChildrenAndResources(ServerSession session, DbObjectLock lock) {<FILL_FUNCTION_BODY>}
}

        for (User user : database.getAllUsers()) {
            Right right = user.getRightForRole(this);
            if (right != null) {
                database.removeDatabaseObject(session, right, lock);
            }
        }
        for (Role r2 : database.getAllRoles()) {
            Right right = r2.getRightForRole(this);
            if (right != null) {
                database.removeDatabaseObject(session, right, lock);
            }
        }
        for (Right right : database.getAllRights()) {
            if (right.getGrantee() == this) {
                database.removeDatabaseObject(session, right, lock);
            }
        }
        super.removeChildrenAndResources(session, lock);
    
<methods>public com.lealone.db.auth.Right getRightForObject(com.lealone.db.DbObject) ,public com.lealone.db.auth.Right getRightForRole(com.lealone.db.auth.Role) ,public void grantRight(com.lealone.db.DbObject, com.lealone.db.auth.Right) ,public void grantRole(com.lealone.db.auth.Role, com.lealone.db.auth.Right) ,public boolean isRoleGranted(com.lealone.db.auth.Role) <variables>private HashMap<com.lealone.db.DbObject,com.lealone.db.auth.Right> grantedRights,private HashMap<com.lealone.db.auth.Role,com.lealone.db.auth.Right> grantedRoles