Search in sources :

Example 6 with CollectionAndDataObjectListingEntry

use of org.irods.jargon.core.query.CollectionAndDataObjectListingEntry in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method getSubCollectionsUnderPath.

@Override
public List<DataGridCollectionAndDataObject> getSubCollectionsUnderPath(String parent) throws DataGridConnectionRefusedException {
    logger.info("getSubCollectionsUnderPath()");
    CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
    List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = null;
    try {
        List<CollectionAndDataObjectListingEntry> collectionAndDataObjects = collectionAndDataObjectListAndSearchAO.listCollectionsUnderPath(parent, 0);
        dataGridCollectionAndDataObjects = this.mapListingEntryToDataGridCollectionAndDataObject(collectionAndDataObjects);
        return dataGridCollectionAndDataObjects;
    } catch (FileNotFoundException e) {
        logger.error("Could not locate file: ", e);
    } catch (JargonException e) {
        logger.error("Error: ", e);
    }
    return dataGridCollectionAndDataObjects;
}
Also used : CollectionAndDataObjectListAndSearchAO(org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO) JargonException(org.irods.jargon.core.exception.JargonException) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) FileNotFoundException(org.irods.jargon.core.exception.FileNotFoundException) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Example 7 with CollectionAndDataObjectListingEntry

use of org.irods.jargon.core.query.CollectionAndDataObjectListingEntry in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method getSubCollectionsAndDataObjectsUnderPath.

@Override
public List<DataGridCollectionAndDataObject> getSubCollectionsAndDataObjectsUnderPath(String parent) throws DataGridConnectionRefusedException, JargonException {
    logger.info("getSubCollectionsAndDataObjectsUnderPath()");
    if (parent == null || parent.isEmpty()) {
        throw new IllegalArgumentException("null or empty parent");
    }
    logger.info("parent:{}", parent);
    CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
    List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = null;
    try {
        List<CollectionAndDataObjectListingEntry> collectionAndDataObjects = collectionAndDataObjectListAndSearchAO.listDataObjectsAndCollectionsUnderPath(parent);
        dataGridCollectionAndDataObjects = new ArrayList<DataGridCollectionAndDataObject>();
        dataGridCollectionAndDataObjects = this.mapListingEntryToDataGridCollectionAndDataObject(collectionAndDataObjects);
        return dataGridCollectionAndDataObjects;
    } catch (FileNotFoundException e) {
        logger.error("Could not locate file: ", e);
        throw e;
    } catch (JargonException e) {
        logger.error("Error: ", e);
        throw e;
    }
}
Also used : CollectionAndDataObjectListAndSearchAO(org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO) JargonException(org.irods.jargon.core.exception.JargonException) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) FileNotFoundException(org.irods.jargon.core.exception.FileNotFoundException) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Example 8 with CollectionAndDataObjectListingEntry

use of org.irods.jargon.core.query.CollectionAndDataObjectListingEntry in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method findByName.

@Override
public DataGridCollectionAndDataObject findByName(String path) throws FileNotFoundException, DataGridException {
    logger.info("findByName()");
    if (path == null || path.isEmpty()) {
        logger.info("Could not find collection or data object by name: path is null");
        return null;
    }
    logger.info("Find collection or data object by name: {}", path);
    CollectionAndDataObjectListAndSearchAO objectsAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
    DataGridCollectionAndDataObject dataGridCollectionAndDataObject;
    try {
        CollectionAndDataObjectListingEntry entry = objectsAO.getCollectionAndDataObjectListingEntryAtGivenAbsolutePathWithHeuristicPathGuessing(path);
        dataGridCollectionAndDataObject = this.mapListingEntryToDataGridCollectionAndDataObject(entry);
    } catch (FileNotFoundException fnf) {
        logger.warn("file not found for path:{}", path);
        throw fnf;
    } catch (JargonException e) {
        logger.debug("error finding collection/data object by name: {}", path);
        throw new DataGridException("Could not find path " + path);
    }
    return dataGridCollectionAndDataObject;
}
Also used : CollectionAndDataObjectListAndSearchAO(org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO) DataGridException(com.emc.metalnx.core.domain.exceptions.DataGridException) JargonException(org.irods.jargon.core.exception.JargonException) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) FileNotFoundException(org.irods.jargon.core.exception.FileNotFoundException) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Example 9 with CollectionAndDataObjectListingEntry

use of org.irods.jargon.core.query.CollectionAndDataObjectListingEntry in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method searchCollectionAndDataObjectsByName.

@Override
public List<DataGridCollectionAndDataObject> searchCollectionAndDataObjectsByName(String collectionName) throws DataGridConnectionRefusedException {
    logger.info("searchCollectionAndDataObjectsByName()");
    CollectionAndDataObjectListAndSearchAO collectionAndDataObjectListAndSearchAO = irodsServices.getCollectionAndDataObjectListAndSearchAO();
    List<CollectionAndDataObjectListingEntry> collectionAndDataObjects = null;
    List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = null;
    try {
        collectionAndDataObjects = collectionAndDataObjectListAndSearchAO.searchCollectionsAndDataObjectsBasedOnName(collectionName);
        dataGridCollectionAndDataObjects = this.mapListingEntryToDataGridCollectionAndDataObject(collectionAndDataObjects);
        return dataGridCollectionAndDataObjects;
    } catch (JargonException e) {
        logger.error("Could not search collections: {}", e.getMessage());
    }
    return null;
}
Also used : CollectionAndDataObjectListAndSearchAO(org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO) JargonException(org.irods.jargon.core.exception.JargonException) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Example 10 with CollectionAndDataObjectListingEntry

use of org.irods.jargon.core.query.CollectionAndDataObjectListingEntry in project metalnx-web by irods-contrib.

the class CollectionServiceImpl method mapListingEntryToDataGridCollectionAndDataObject.

@Override
public List<DataGridCollectionAndDataObject> mapListingEntryToDataGridCollectionAndDataObject(List<CollectionAndDataObjectListingEntry> entries) {
    logger.info("mapListingEntryToDataGridCollectionAndDataObject()");
    logger.debug("Mapping a CollectionAndDataObjectListingEntry list into a DataGridCollectionAndDataObject list");
    List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = new ArrayList<DataGridCollectionAndDataObject>();
    for (CollectionAndDataObjectListingEntry entry : entries) {
        dataGridCollectionAndDataObjects.add(mapListingEntryToDataGridCollectionAndDataObject(entry));
    }
    return dataGridCollectionAndDataObjects;
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) ArrayList(java.util.ArrayList) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Aggregations

CollectionAndDataObjectListingEntry (org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)13 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)8 JargonException (org.irods.jargon.core.exception.JargonException)8 CollectionAndDataObjectListAndSearchAO (org.irods.jargon.core.pub.CollectionAndDataObjectListAndSearchAO)6 ArrayList (java.util.ArrayList)3 FileNotFoundException (org.irods.jargon.core.exception.FileNotFoundException)3 IRODSQueryResultRow (org.irods.jargon.core.query.IRODSQueryResultRow)3 UnsupportedDataGridFeatureException (com.emc.metalnx.core.domain.exceptions.UnsupportedDataGridFeatureException)2 SpecificQueryProvider (com.emc.metalnx.services.irods.utils.SpecificQueryProvider)2 HashSet (java.util.HashSet)2 SpecificQueryAO (org.irods.jargon.core.pub.SpecificQueryAO)2 ClientHints (org.irods.jargon.core.pub.domain.ClientHints)2 SpecificQueryDefinition (org.irods.jargon.core.pub.domain.SpecificQueryDefinition)2 SpecificQuery (org.irods.jargon.core.query.SpecificQuery)2 SpecificQueryResultSet (org.irods.jargon.core.query.SpecificQueryResultSet)2 DataGridFilePermission (com.emc.metalnx.core.domain.entity.DataGridFilePermission)1 DataGridGroupPermission (com.emc.metalnx.core.domain.entity.DataGridGroupPermission)1 DataGridUserPermission (com.emc.metalnx.core.domain.entity.DataGridUserPermission)1 DataGridException (com.emc.metalnx.core.domain.exceptions.DataGridException)1 CollectionAO (org.irods.jargon.core.pub.CollectionAO)1