use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class SpecificQueryServiceImpl method findByAlias.
@Override
public DataGridSpecificQuery findByAlias(String alias) throws DataGridConnectionRefusedException {
SpecificQueryAO specificQueryAO = irodsServices.getSpecificQueryAO();
SpecificQueryDefinition query;
try {
query = specificQueryAO.findSpecificQueryByAlias(alias);
return createDataGridSpecificQuery(query);
} catch (JargonException e) {
logger.error("Could not retrieve specific query with alias {}", alias, e);
}
return null;
}
use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class SpecificQueryServiceImpl method updateSpecificQuery.
@Override
public boolean updateSpecificQuery(DataGridSpecificQuery specificQuery) throws DataGridConnectionRefusedException {
SpecificQueryAO specificQueryAO = irodsServices.getSpecificQueryAO();
try {
// Jargon does not support SpecificQueries update, so we'll remove and create
// a new one.
specificQueryAO.removeSpecificQueryByAlias(specificQuery.getAlias());
this.createSpecificQuery(specificQuery);
return true;
} catch (JargonException e) {
logger.error("Could not create specific query {}", specificQuery.getAlias(), e);
}
return false;
}
use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class TicketServiceImpl method modify.
@Override
public DataGridTicket modify(DataGridTicket t) throws DataGridConnectionRefusedException, DataGridTicketException {
logger.info("Modify ticket");
if (t == null) {
logger.error("Null ticket provided.");
throw new DataGridTicketException("Null ticket instance");
}
if (t.getTicketString().isEmpty()) {
logger.error("Ticket with empty string provided.");
throw new DataGridTicketException("Ticket string missing");
}
String ticketString = t.getTicketString();
DataGridTicket dgTicket;
try {
updateHostRestrictions(t);
updateUserRestrictions(t);
updateGroupRestrictions(t);
TicketAdminService tas = irodsServices.getTicketAdminService();
Ticket ticketUpdated = tas.compareGivenTicketToActualAndUpdateAsNeeded(convertDataGridTicketToTicket(t));
dgTicket = convertTicketToDataGridTicket(ticketUpdated);
dgTicket.setHosts(tas.listAllHostRestrictionsForSpecifiedTicket(ticketString, OFFSET));
dgTicket.setUsers(tas.listAllUserRestrictionsForSpecifiedTicket(ticketString, OFFSET));
dgTicket.setGroups(tas.listAllGroupRestrictionsForSpecifiedTicket(ticketString, OFFSET));
} catch (JargonException e) {
logger.error("Could not modify ticket");
throw new DataGridTicketException(e.getMessage());
}
return dgTicket;
}
use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class CollectionServiceImpl method getPermissionsForPath.
@Override
public String getPermissionsForPath(String path) throws DataGridConnectionRefusedException {
logger.info("getPermissionsForPath()");
FilePermissionEnum filePermissionEnum = null;
String permissionType = "none";
try {
String user = irodsServices.getCurrentUser();
String zone = irodsServices.getCurrentUserZone();
Object obj = irodsServices.getCollectionAndDataObjectListAndSearchAO().getFullObjectForType(path);
if (obj instanceof Collection) {
CollectionAO collectionAO = irodsServices.getCollectionAO();
filePermissionEnum = collectionAO.getPermissionForCollection(path, user, zone);
} else {
DataObjectAO dataObjectAO = irodsServices.getDataObjectAO();
filePermissionEnum = dataObjectAO.getPermissionForDataObject(path, user, zone);
}
if (filePermissionEnum != null) {
permissionType = filePermissionEnum.toString().toLowerCase();
}
} catch (FileNotFoundException e) {
logger.error("Could not find path: {}", e.getMessage());
} catch (JargonException e) {
logger.error("Could not get permission for path: {}", e.getMessage());
}
return permissionType;
}
use of org.irods.jargon.core.exception.JargonException in project metalnx-web by irods-contrib.
the class CollectionServiceImpl method listInheritanceForPath.
@Override
public Set<String> listInheritanceForPath(String path) throws DataGridConnectionRefusedException {
logger.info("listInheritanceForPath()");
Set<String> collections = new HashSet<String>();
CollectionAO collectionAO = irodsServices.getCollectionAO();
CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
try {
List<CollectionAndDataObjectListingEntry> collList = collectionAndDataObjectListAndSearchAO.listCollectionsUnderPathWithPermissions(path, 0);
for (CollectionAndDataObjectListingEntry collEntry : collList) {
String currentCollPath = collEntry.getPathOrName();
if (collectionAO.isCollectionSetForPermissionInheritance(currentCollPath)) {
collections.add(currentCollPath);
}
}
return collections;
} catch (JargonException e) {
logger.error("Could not get collections with inheritance option enabled: ", e);
}
return null;
}
Aggregations