private CifsShareACL queryACLByIndex(String index) { _log.info("Querying ACL in DB by alternate Id: {}", index); URIQueryResultList result = new URIQueryResultList(); CifsShareACL acl = null; if (this.fs != null) { dbClient.queryByConstraint( AlternateIdConstraint.Factory.getFileSystemShareACLConstraint(index), result); } else { dbClient.queryByConstraint( AlternateIdConstraint.Factory.getSnapshotShareACLConstraint(index), result); } Iterator<URI> it = result.iterator(); while (it.hasNext()) { if (result.iterator().hasNext()) { acl = dbClient.queryObject(CifsShareACL.class, it.next()); if (acl != null && !acl.getInactive()) { _log.info("Existing ACE found in DB: {}", acl); break; } } } return acl; }
public List<ShareACL> queryExistingShareACLs() { List<ShareACL> aclList = new ArrayList<ShareACL>(); List<CifsShareACL> dbShareAclList = queryDBShareACLs(); if (dbShareAclList != null) { Iterator<CifsShareACL> shareAclIter = dbShareAclList.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()); if (this.fs != null) { acl.setFileSystemId(this.fs.getId()); } else { acl.setSnapshotId(this.snapshot.getId()); } aclList.add(acl); } } } return aclList; }