@Override protected Void visitGrantRoles(GrantRoles node, Integer context) { builder.append("GRANT "); builder.append(node.getRoles().stream() .map(Identifier::toString) .collect(joining(", "))); builder.append(" TO "); builder.append(node.getGrantees().stream() .map(Formatter::formatPrincipal) .collect(joining(", "))); if (node.isWithAdminOption()) { builder.append(" WITH ADMIN OPTION"); } if (node.getGrantor().isPresent()) { builder.append(" GRANTED BY ").append(formatGrantor(node.getGrantor().get())); } return null; }
@Override protected Void visitCreateRole(CreateRole node, Integer context) { builder.append("CREATE ROLE ").append(node.getName()); if (node.getGrantor().isPresent()) { builder.append(" WITH ADMIN ").append(formatGrantor(node.getGrantor().get())); } return null; }
@Override protected Void visitRevokeRoles(RevokeRoles node, Integer context) { builder.append("REVOKE "); if (node.isAdminOptionFor()) { builder.append("ADMIN OPTION FOR "); } builder.append(node.getRoles().stream() .map(Identifier::toString) .collect(joining(", "))); builder.append(" FROM "); builder.append(node.getGrantees().stream() .map(Formatter::formatPrincipal) .collect(joining(", "))); if (node.getGrantor().isPresent()) { builder.append(" GRANTED BY ").append(formatGrantor(node.getGrantor().get())); } return null; }
@Override protected Void visitRevokeRoles(RevokeRoles node, Integer context) { builder.append("REVOKE "); if (node.isAdminOptionFor()) { builder.append("ADMIN OPTION FOR "); } builder.append(node.getRoles().stream() .map(Identifier::toString) .collect(joining(", "))); builder.append(" FROM "); builder.append(node.getGrantees().stream() .map(Formatter::formatPrincipal) .collect(joining(", "))); if (node.getGrantor().isPresent()) { builder.append(" GRANTED BY ").append(formatGrantor(node.getGrantor().get())); } return null; }
@Override protected Void visitGrantRoles(GrantRoles node, Integer context) { builder.append("GRANT "); builder.append(node.getRoles().stream() .map(Identifier::toString) .collect(joining(", "))); builder.append(" TO "); builder.append(node.getGrantees().stream() .map(Formatter::formatPrincipal) .collect(joining(", "))); if (node.isWithAdminOption()) { builder.append(" WITH ADMIN OPTION"); } if (node.getGrantor().isPresent()) { builder.append(" GRANTED BY ").append(formatGrantor(node.getGrantor().get())); } return null; }
@Override protected Void visitCreateRole(CreateRole node, Integer context) { builder.append("CREATE ROLE ").append(node.getName()); if (node.getGrantor().isPresent()) { builder.append(" WITH ADMIN ").append(formatGrantor(node.getGrantor().get())); } return null; }