Search in sources :

Example 6 with IRODSQueryResultRow

use of org.irods.jargon.core.query.IRODSQueryResultRow 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)

Example 7 with IRODSQueryResultRow

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

the class DataGridUtils method mapMetadataResultSetToDataGridCollections.

/**
 * Maps a query result set coming from a metadata search into a list of collections.
 *
 * @param queryResultSet
 *            sql result set returned from the execution of a specific query
 * @return List of collections
 * @throws JargonException
 */
public static List<DataGridCollectionAndDataObject> mapMetadataResultSetToDataGridCollections(SpecificQueryResultSet queryResultSet) throws JargonException {
    List<DataGridCollectionAndDataObject> colls = new ArrayList<>();
    if (queryResultSet != null) {
        List<IRODSQueryResultRow> results = queryResultSet.getResults();
        for (IRODSQueryResultRow row : results) {
            DataGridCollectionAndDataObject c = new DataGridCollectionAndDataObject();
            String collPath = row.getColumn("obj_name");
            String collName = collPath.substring(collPath.lastIndexOf("/") + 1, collPath.length());
            c.setName(collName);
            c.setPath(collPath);
            c.setParentPath(row.getColumn("parent_path"));
            c.setOwner(row.getColumn("obj_owner"));
            c.setCollection(true);
            c.setReplicaNumber("-");
            c.setCreatedAt(IRODSDataConversionUtil.getDateFromIRODSValue(row.getColumn("create_ts")));
            c.setModifiedAt(IRODSDataConversionUtil.getDateFromIRODSValue(row.getColumn("modify_ts")));
            c.setNumberOfMatches(Integer.valueOf(row.getColumn("totalMatches")));
            c.setResourceName(row.getColumn("resc_name"));
            colls.add(c);
        }
    }
    return colls;
}
Also used : IRODSQueryResultRow(org.irods.jargon.core.query.IRODSQueryResultRow) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)

Aggregations

IRODSQueryResultRow (org.irods.jargon.core.query.IRODSQueryResultRow)7 DataGridCollectionAndDataObject (com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)3 CollectionAndDataObjectListingEntry (org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)3