Skip to content

Commit

Permalink
Merge branch 'niehs-development' of gitlab.niehs.nih.gov:conwaymc/met…
Browse files Browse the repository at this point in the history
…alnx-web into niehs-development
  • Loading branch information
Hetal Patel committed Feb 1, 2018
2 parents 3bcfb15 + 5e90621 commit b1f64e5
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,10 @@ Set<String> listWritePermissionsForPathAndGroupRecursive(String path, String gro
* @param collPath
* @return the boolean
* @throws DataGridConnectionRefusedException
* @throws JargonException
*/
boolean getInheritanceOptionForCollection(String collPath) throws DataGridConnectionRefusedException;
boolean getInheritanceOptionForCollection(String collPath)
throws DataGridConnectionRefusedException, JargonException;

/**
* Gets the replica number of a collection or data object in the grid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,16 +748,24 @@ public String prepareFilesForDownload(List<String> sourcePaths) throws IOExcepti
}

@Override
public boolean getInheritanceOptionForCollection(String collPath) throws DataGridConnectionRefusedException {
public boolean getInheritanceOptionForCollection(String collPath)
throws DataGridConnectionRefusedException, JargonException {
logger.info("getInheritanceOptionForCollection()");

if (collPath == null || collPath.isEmpty()) {
throw new IllegalArgumentException("null or empty collPath");
}

logger.info("collPath:{}", collPath);

CollectionAO collectionAO = irodsServices.getCollectionAO();
try {
return collectionAO.isCollectionSetForPermissionInheritance(collPath);
} catch (FileNotFoundException e) {
logger.error("Collection {} does not exist: {}", collPath, e.getMessage());
logger.warn("Collection {} does not exist: {}", collPath, e.getMessage());
} catch (JargonException e) {
logger.error("Could not retrieve inheritance option value for", collPath, e.getMessage());
throw e;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;

import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.core.exception.FileNotFoundException;
import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.utils.MiscIRODSUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -240,25 +242,24 @@ else if (currentMode.equalsIgnoreCase(UI_USER_MODE)) {
* @return treeView template that renders all nodes of certain path (parent)
* @throws DataGridException
* if Metalnx cannot find collections and objects inside the path
* @throws JargonException
*/
@RequestMapping(value = "/getSubDirectories/", method = RequestMethod.POST)
public String getSubDirectories(final Model model, @RequestParam("path") String path) throws DataGridException {
public String getSubDirectories(final Model model, @RequestParam("path") String path)
throws DataGridException, JargonException {

logger.info("getSubDirectories()");
logger.info("model:{}", model);
logger.info("path:{}", path);

// removes all ocurrences of "/" at the end of the path string
while (path.endsWith("/") && !"/".equals(path)) {
path = path.substring(0, path.lastIndexOf("/"));
}

logger.info("Get subdirectories of {}", path);

System.out.println("In GetSubdirectories!!");
System.out.println("path :: " + path);

return getCollBrowserView(model, path);
try {
return getCollBrowserView(model, path);
} catch (Exception e) {
logger.error("exception getting coll browser view", e);
throw e;
}
}

/**
Expand Down Expand Up @@ -980,21 +981,27 @@ private void setBreadcrumbToModel(final Model model, final DataGridCollectionAnd
* @throws DataGridConnectionRefusedException
* if Metalnx cannot connect to the grid.
*/
private String getCollBrowserView(final Model model, String path) throws DataGridException {
private String getCollBrowserView(final Model model, String path) throws JargonException, DataGridException {
logger.info("getCollBrowserView()");

logger.info("model:{}", model);
logger.info("path:{}", path);

if (cs.isPathValid(path)) {
if (path.endsWith("/") && path.compareTo("/") != 0) {
path = path.substring(0, path.length() - 1);
}
currentPath = path;

} else {
model.addAttribute("invalidPath", path);
path = currentPath;
// I don't have a path so use the user home
model.addAttribute("invalidPath", path); // TODO: refactor into something more elegant - mcc
IRODSAccount irodsAccount = irodsServices.getCollectionAO().getIRODSAccount();
path = MiscIRODSUtils.buildIRODSUserHomeForAccountUsingDefaultScheme(irodsAccount);

}

currentPath = path;

DataGridUser user = loggedUserUtils.getLoggedDataGridUser();
logger.info("find collection by name:{}", path);
DataGridCollectionAndDataObject dataGridObj = cs.findByName(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,11 @@ public ResponseEntity<String> emptyTrash() throws DataGridConnectionRefusedExcep
* @return collectionForm with fields set
* @throws DataGridException
* if item cannot be modified
* @throws JargonException
*/
@RequestMapping(value = "modify/", method = RequestMethod.GET)
public String showModifyForm(final Model model, @RequestParam("path") final String path) throws DataGridException {
public String showModifyForm(final Model model, @RequestParam("path") final String path)
throws DataGridException, JargonException {
String currentPath = browseController.getCurrentPath();
String parentPath = browseController.getParentPath();

Expand Down
Loading

0 comments on commit b1f64e5

Please sign in to comment.