use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class FileOperationUtils method queryDBFSExports.
public static List<FileExportRule> queryDBFSExports(FileShare fs, DbClient dbClient) {
_log.info("Querying all ExportRules Using FsId {}", fs.getId());
try {
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileExportRulesConstraint(fs.getId());
List<FileExportRule> fileExportRules = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, FileExportRule.class, containmentConstraint);
return fileExportRules;
} catch (Exception e) {
_log.error("Error while querying {}", e);
}
return null;
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class InternalDbClientImpl method getReferUris.
public List<URI> getReferUris(URI targetUri, Class<? extends DataObject> type, Dependency dependency) {
List<URI> references = new ArrayList<>();
if (targetUri == null) {
return references;
}
ContainmentConstraint constraint = new ContainmentConstraintImpl(targetUri, dependency.getType(), dependency.getColumnField());
URIQueryResultList result = new URIQueryResultList();
this.queryByConstraint(constraint, result);
Iterator<URI> resultIt = result.iterator();
if (resultIt.hasNext()) {
references.add(resultIt.next());
}
return references;
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class BourneDbClient method findBy.
public <T extends DataObject> List<NamedElement> findBy(Class<T> clazz, String columnField, URI id) throws DataAccessException {
LOG.debug("findBy({}, {}, {})", new Object[] { clazz, columnField, id });
DataObjectType doType = TypeMap.getDoType(clazz);
ColumnField field = doType.getColumnField(columnField);
ContainmentConstraint constraint = new ContainmentConstraintImpl(id, clazz, field);
return queryNamedElementsByConstraint(constraint);
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class FileOrchestrationUtils method queryShareACLs.
/**
* This method queries ACLs for File System share.
*
* @param shareName Name of the share.
* @param fs URI of the file system.
* @param dbClient
* @return ListShareACL
*/
public static List<ShareACL> queryShareACLs(String shareName, URI fs, DbClient dbClient) {
List<ShareACL> aclList = new ArrayList<ShareACL>();
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileCifsShareAclsConstraint(fs);
List<CifsShareACL> shareAclList = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, CifsShareACL.class, containmentConstraint);
if (shareAclList != null) {
Iterator<CifsShareACL> shareAclIter = shareAclList.iterator();
while (shareAclIter.hasNext()) {
CifsShareACL dbShareAcl = shareAclIter.next();
if (shareName.equals(dbShareAcl.getShareName())) {
ShareACL acl = new ShareACL();
acl.setShareName(shareName);
acl.setDomain(dbShareAcl.getDomain());
acl.setUser(dbShareAcl.getUser());
acl.setGroup(dbShareAcl.getGroup());
acl.setPermission(dbShareAcl.getPermission());
acl.setFileSystemId(fs);
aclList.add(acl);
}
}
}
return aclList;
}
use of com.emc.storageos.db.client.constraint.ContainmentConstraint in project coprhd-controller by CoprHD.
the class FileOrchestrationUtils method queryNFSACL.
public static Map<String, List<NfsACE>> queryNFSACL(FileShare fs, DbClient dbClient) {
Map<String, List<NfsACE>> map = new HashMap<String, List<NfsACE>>();
ContainmentConstraint containmentConstraint = ContainmentConstraint.Factory.getFileNfsAclsConstraint(fs.getId());
List<NFSShareACL> nfsAclList = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, NFSShareACL.class, containmentConstraint);
if (nfsAclList != null) {
Iterator<NFSShareACL> aclIter = nfsAclList.iterator();
while (aclIter.hasNext()) {
NFSShareACL dbNFSAcl = aclIter.next();
String fsPath = dbNFSAcl.getFileSystemPath();
NfsACE ace = convertNFSShareACLToNfsACE(dbNFSAcl);
if (map.get(fsPath) == null) {
List<NfsACE> acl = new ArrayList<NfsACE>();
acl.add(ace);
map.put(fsPath, acl);
} else {
map.get(fsPath).add(ace);
}
}
}
return map;
}
Aggregations