static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) { if (roleGrants == null || roleGrants.isEmpty()) { return ""; } StringBuilder builder = new StringBuilder(); //sort the list to get sorted (deterministic) output (for ease of testing) Collections.sort(roleGrants); for (RolePrincipalGrant roleGrant : roleGrants) { appendNonNull(builder, roleGrant.getRoleName(), true); appendNonNull(builder, roleGrant.isGrantOption()); appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L); appendNonNull(builder, roleGrant.getGrantorName()); } return builder.toString(); }
static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) { if (roleGrants == null || roleGrants.isEmpty()) { return ""; } StringBuilder builder = new StringBuilder(); //sort the list to get sorted (deterministic) output (for ease of testing) Collections.sort(roleGrants); for (RolePrincipalGrant roleGrant : roleGrants) { appendNonNull(builder, roleGrant.getRoleName(), true); appendNonNull(builder, roleGrant.isGrantOption()); appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L); appendNonNull(builder, roleGrant.getGrantorName()); } return builder.toString(); }
public Object getFieldValue(_Fields field) { switch (field) { case ROLE_NAME: return getRoleName(); case PRINCIPAL_NAME: return getPrincipalName(); case PRINCIPAL_TYPE: return getPrincipalType(); case GRANT_OPTION: return isGrantOption(); case GRANT_TIME: return getGrantTime(); case GRANTOR_NAME: return getGrantorName(); case GRANTOR_PRINCIPAL_TYPE: return getGrantorPrincipalType(); } throw new IllegalStateException(); }
public HiveRoleGrant(RolePrincipalGrant thriftRoleGrant) { this.roleName = thriftRoleGrant.getRoleName(); this.principalName = thriftRoleGrant.getPrincipalName(); this.principalType = thriftRoleGrant.getPrincipalType().name(); this.grantOption = thriftRoleGrant.isGrantOption(); this.grantTime = thriftRoleGrant.getGrantTime(); this.grantor = thriftRoleGrant.getGrantorName(); this.grantorType = thriftRoleGrant.getGrantorPrincipalType() == null ? null : thriftRoleGrant.getGrantorPrincipalType().name(); }
public HiveRoleGrant(RolePrincipalGrant thriftRoleGrant) { this.roleName = thriftRoleGrant.getRoleName(); this.principalName = thriftRoleGrant.getPrincipalName(); this.principalType = thriftRoleGrant.getPrincipalType().name(); this.grantOption = thriftRoleGrant.isGrantOption(); this.grantTime = thriftRoleGrant.getGrantTime(); this.grantor = thriftRoleGrant.getGrantorName(); this.grantorType = thriftRoleGrant.getGrantorPrincipalType() == null ? null : thriftRoleGrant.getGrantorPrincipalType().name(); }
static String writeRoleGrantsInfo(List<RolePrincipalGrant> roleGrants, boolean testMode) { if (roleGrants == null || roleGrants.isEmpty()) { return ""; } StringBuilder builder = new StringBuilder(); //sort the list to get sorted (deterministic) output (for ease of testing) Collections.sort(roleGrants); for (RolePrincipalGrant roleGrant : roleGrants) { appendNonNull(builder, roleGrant.getRoleName(), true); appendNonNull(builder, roleGrant.isGrantOption()); appendNonNull(builder, testMode ? -1 : roleGrant.getGrantTime() * 1000L); appendNonNull(builder, roleGrant.getGrantorName()); } return builder.toString(); }
public Object getFieldValue(_Fields field) { switch (field) { case ROLE_NAME: return getRoleName(); case PRINCIPAL_NAME: return getPrincipalName(); case PRINCIPAL_TYPE: return getPrincipalType(); case GRANT_OPTION: return Boolean.valueOf(isGrantOption()); case GRANT_TIME: return Integer.valueOf(getGrantTime()); case GRANTOR_NAME: return getGrantorName(); case GRANTOR_PRINCIPAL_TYPE: return getGrantorPrincipalType(); } throw new IllegalStateException(); }
public Object getFieldValue(_Fields field) { switch (field) { case ROLE_NAME: return getRoleName(); case PRINCIPAL_NAME: return getPrincipalName(); case PRINCIPAL_TYPE: return getPrincipalType(); case GRANT_OPTION: return Boolean.valueOf(isGrantOption()); case GRANT_TIME: return Integer.valueOf(getGrantTime()); case GRANTOR_NAME: return getGrantorName(); case GRANTOR_PRINCIPAL_TYPE: return getGrantorPrincipalType(); } throw new IllegalStateException(); }
public Object getFieldValue(_Fields field) { switch (field) { case ROLE_NAME: return getRoleName(); case PRINCIPAL_NAME: return getPrincipalName(); case PRINCIPAL_TYPE: return getPrincipalType(); case GRANT_OPTION: return isGrantOption(); case GRANT_TIME: return getGrantTime(); case GRANTOR_NAME: return getGrantorName(); case GRANTOR_PRINCIPAL_TYPE: return getGrantorPrincipalType(); } throw new IllegalStateException(); }
public HiveRoleGrant(RolePrincipalGrant thriftRoleGrant) { this.roleName = thriftRoleGrant.getRoleName(); this.principalName = thriftRoleGrant.getPrincipalName(); this.principalType = thriftRoleGrant.getPrincipalType().name(); this.grantOption = thriftRoleGrant.isGrantOption(); this.grantTime = thriftRoleGrant.getGrantTime(); this.grantor = thriftRoleGrant.getGrantorName(); this.grantorType = thriftRoleGrant.getGrantorPrincipalType() == null ? null : thriftRoleGrant.getGrantorPrincipalType().name(); }