Search in sources :

Example 11 with CollectionAndDataObjectListingEntry

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

the class DataGridUtils method mapListingEntryToDataGridCollectionAndDataObject.

/**
 * Maps a CollectionAndDataObjectListingEntry list into a DataGridCollectionAndDataObject list
 *
 * @param entries
 *            CollectionAndDataObjectListingEntry objects to map
 * @return list of DataGridCollectionAndDataObject objects
 */
public static List<DataGridCollectionAndDataObject> mapListingEntryToDataGridCollectionAndDataObject(List<CollectionAndDataObjectListingEntry> entries) {
    logger.debug("Mapping a CollectionAndDataObjectListingEntry list into a " + "DataGridCollectionAndDataObject list");
    List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = new ArrayList<DataGridCollectionAndDataObject>();
    for (CollectionAndDataObjectListingEntry entry : entries) {
        if ("/".equals(entry.getPathOrName()))
            continue;
        DataGridCollectionAndDataObject dataGridCollectionAndDataObject = mapListingEntryToDataGridCollectionAndDataObject(entry);
        dataGridCollectionAndDataObjects.add(dataGridCollectionAndDataObject);
    }
    return dataGridCollectionAndDataObjects;
}
Also used : DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Example 12 with CollectionAndDataObjectListingEntry

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

the class DataGridUtils method mapCollectionQueryResultSetToDataGridObjects.

/**
 * Maps the results from the specific query for listing files in a collection into data objects
 * for collections
 *
 * @param queryResultSet
 *            result set returned from a query
 * @return list of data grid objects
 * @throws JargonException
 */
public static List<CollectionAndDataObjectListingEntry> mapCollectionQueryResultSetToDataGridObjects(SpecificQueryResultSet queryResultSet) throws JargonException {
    List<CollectionAndDataObjectListingEntry> dataGridCollectionAndDataObjects = new ArrayList<CollectionAndDataObjectListingEntry>();
    List<IRODSQueryResultRow> results = queryResultSet.getResults();
    for (IRODSQueryResultRow irodsQueryResultRow : results) {
        CollectionAndDataObjectListingEntry collectionAndDataObject = new CollectionAndDataObjectListingEntry();
        collectionAndDataObject.setParentPath(irodsQueryResultRow.getColumn("c.parent_coll_name"));
        collectionAndDataObject.setPathOrName(irodsQueryResultRow.getColumn("c.coll_name"));
        collectionAndDataObject.setOwnerName(irodsQueryResultRow.getColumn("c.coll_owner_name"));
        collectionAndDataObject.setOwnerZone(irodsQueryResultRow.getColumn("c.coll_owner_zone"));
        collectionAndDataObject.setObjectType(ObjectType.COLLECTION);
        collectionAndDataObject.setCreatedAt(IRODSDataConversionUtil.getDateFromIRODSValue(irodsQueryResultRow.getColumn("c.create_ts")));
        collectionAndDataObject.setModifiedAt(IRODSDataConversionUtil.getDateFromIRODSValue(irodsQueryResultRow.getColumn("c.modify_ts")));
        dataGridCollectionAndDataObjects.add(collectionAndDataObject);
    }
    return dataGridCollectionAndDataObjects;
}
Also used : IRODSQueryResultRow(org.irods.jargon.core.query.IRODSQueryResultRow) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Example 13 with CollectionAndDataObjectListingEntry

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

the class DataGridUtils method mapQueryResultSetToDataGridObjects.

/**
 * Maps the results from the specific query for listing files in a collection into DataGrid
 * objects
 *
 * @param queryResultSet
 * @return
 * @throws JargonException
 */
public static List<CollectionAndDataObjectListingEntry> mapQueryResultSetToDataGridObjects(SpecificQueryResultSet queryResultSet) throws JargonException {
    List<CollectionAndDataObjectListingEntry> dataGridCollectionAndDataObjects = new ArrayList<CollectionAndDataObjectListingEntry>();
    List<IRODSQueryResultRow> results = queryResultSet.getResults();
    for (IRODSQueryResultRow irodsQueryResultRow : results) {
        CollectionAndDataObjectListingEntry collectionAndDataObject = new CollectionAndDataObjectListingEntry();
        collectionAndDataObject.setParentPath(irodsQueryResultRow.getColumn("c.coll_name"));
        collectionAndDataObject.setPathOrName(irodsQueryResultRow.getColumn("d.data_name"));
        collectionAndDataObject.setDataSize(Long.parseLong(irodsQueryResultRow.getColumn("d.data_size")));
        collectionAndDataObject.setOwnerName(irodsQueryResultRow.getColumn("d.data_owner_name"));
        collectionAndDataObject.setOwnerZone(irodsQueryResultRow.getColumn("d.data_owner_zone"));
        collectionAndDataObject.setModifiedAt(IRODSDataConversionUtil.getDateFromIRODSValue(irodsQueryResultRow.getColumn("d.modify_ts")));
        dataGridCollectionAndDataObjects.add(collectionAndDataObject);
    }
    return dataGridCollectionAndDataObjects;
}
Also used : IRODSQueryResultRow(org.irods.jargon.core.query.IRODSQueryResultRow) 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