use of org.apache.hadoop.hive.metastore.model.MTablePrivilege in project hive by apache.
the class ObjectStore method listAllMTableGrants.
@SuppressWarnings("unchecked")
public List<MTablePrivilege> listAllMTableGrants(String principalName, PrincipalType principalType, String dbName, String tableName) {
tableName = HiveStringUtils.normalizeIdentifier(tableName);
dbName = HiveStringUtils.normalizeIdentifier(dbName);
boolean success = false;
Query query = null;
List<MTablePrivilege> mSecurityTabPartList = new ArrayList<MTablePrivilege>();
try {
openTransaction();
LOG.debug("Executing listAllTableGrants");
query = pm.newQuery(MTablePrivilege.class, "principalName == t1 && principalType == t2 && table.tableName == t3 && table.database.name == t4");
query.declareParameters("java.lang.String t1, java.lang.String t2, java.lang.String t3, java.lang.String t4");
List<MTablePrivilege> mPrivs = (List<MTablePrivilege>) query.executeWithArray(principalName, principalType.toString(), tableName, dbName);
pm.retrieveAll(mPrivs);
success = commitTransaction();
mSecurityTabPartList.addAll(mPrivs);
LOG.debug("Done retrieving all objects for listAllTableGrants");
} finally {
if (!success) {
rollbackTransaction();
}
if (query != null) {
query.closeAll();
}
}
return mSecurityTabPartList;
}
Aggregations