Search in sources :

Example 1 with IRODSQueryResultRow

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

the class DataGridUtils method mapQueryResultSetToDataGridObjectsForSearch.

/**
 * 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> mapQueryResultSetToDataGridObjectsForSearch(SpecificQueryResultSet queryResultSet) throws JargonException {
    List<CollectionAndDataObjectListingEntry> dataGridCollectionAndDataObjects = new ArrayList<CollectionAndDataObjectListingEntry>();
    List<IRODSQueryResultRow> results = queryResultSet.getResults();
    for (IRODSQueryResultRow irodsQueryResultRow : results) {
        CollectionAndDataObjectListingEntry collectionAndDataObject = new CollectionAndDataObjectListingEntry();
        collectionAndDataObject.setId(Integer.valueOf(irodsQueryResultRow.getColumn("data_id")));
        collectionAndDataObject.setPathOrName(irodsQueryResultRow.getColumn("data_name"));
        collectionAndDataObject.setParentPath(irodsQueryResultRow.getColumn("coll_name"));
        collectionAndDataObject.setObjectType(ObjectType.DATA_OBJECT);
        collectionAndDataObject.setDataSize(Long.valueOf(irodsQueryResultRow.getColumn("data_size")));
        collectionAndDataObject.setOwnerName(irodsQueryResultRow.getColumn("data_owner_name"));
        collectionAndDataObject.setOwnerZone(irodsQueryResultRow.getColumn("data_owner_zone"));
        collectionAndDataObject.setModifiedAt(IRODSDataConversionUtil.getDateFromIRODSValue(irodsQueryResultRow.getColumn("create_ts")));
        collectionAndDataObject.setModifiedAt(IRODSDataConversionUtil.getDateFromIRODSValue(irodsQueryResultRow.getColumn("modify_ts")));
        dataGridCollectionAndDataObjects.add(collectionAndDataObject);
    }
    return dataGridCollectionAndDataObjects;
}
Also used : IRODSQueryResultRow(org.irods.jargon.core.query.IRODSQueryResultRow) CollectionAndDataObjectListingEntry(org.irods.jargon.core.query.CollectionAndDataObjectListingEntry)

Example 2 with IRODSQueryResultRow

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

the class DataGridUtils method mapMetadataResultSetToDataGridObjects.

/**
 * Maps a query result set coming from a metadata search into a list of data objects.
 *
 * @param queryResultSet
 *            sql result set returned from the execution of a specific query
 * @return List of data objects
 * @throws JargonException
 */
public static List<DataGridCollectionAndDataObject> mapMetadataResultSetToDataGridObjects(SpecificQueryResultSet queryResultSet) throws JargonException {
    List<DataGridCollectionAndDataObject> objs = new ArrayList<DataGridCollectionAndDataObject>();
    if (queryResultSet != null) {
        List<IRODSQueryResultRow> results = queryResultSet.getResults();
        for (IRODSQueryResultRow row : results) {
            String objName = row.getColumn("obj_name");
            String parentPath = row.getColumn("parent_path");
            String dataObjDisplaySize = MiscIRODSUtils.humanReadableByteCount(Long.valueOf(row.getColumn("size")));
            String path = parentPath + "/" + objName;
            if (parentPath.compareTo("/") == 0)
                path = parentPath + objName;
            DataGridCollectionAndDataObject obj = new DataGridCollectionAndDataObject();
            obj.setName(objName);
            obj.setPath(path);
            obj.setParentPath(parentPath);
            obj.setSize(Long.valueOf(row.getColumn("size")));
            obj.setDisplaySize(dataObjDisplaySize);
            obj.setOwner(row.getColumn("obj_owner"));
            obj.setCollection(false);
            obj.setReplicaNumber(row.getColumn("repl_num"));
            obj.setCreatedAt(IRODSDataConversionUtil.getDateFromIRODSValue(row.getColumn("create_ts")));
            obj.setModifiedAt(IRODSDataConversionUtil.getDateFromIRODSValue(row.getColumn("modify_ts")));
            obj.setResourceName(row.getColumn("resc_name"));
            obj.setNumberOfMatches(Integer.valueOf(row.getColumn("totalMatches")));
            objs.add(obj);
        }
    }
    return objs;
}
Also used : IRODSQueryResultRow(org.irods.jargon.core.query.IRODSQueryResultRow) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)

Example 3 with IRODSQueryResultRow

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

the class DataGridUtils method mapPropertiesResultSetToDataGridObjects.

/**
 * Maps a query result set coming from a file properties search into a list of data objects.
 *
 * @param queryResultSet
 *            sql result set returned from the execution of a specific query
 * @return List of data objects
 * @throws JargonException
 */
public static List<DataGridCollectionAndDataObject> mapPropertiesResultSetToDataGridObjects(SpecificQueryResultSet queryResultSet) throws JargonException {
    List<DataGridCollectionAndDataObject> dataGridCollectionAndDataObjects = new ArrayList<DataGridCollectionAndDataObject>();
    if (queryResultSet != null) {
        List<IRODSQueryResultRow> results = queryResultSet.getResults();
        for (IRODSQueryResultRow irodsQueryResultRow : results) {
            DataGridCollectionAndDataObject dataGridObj = new DataGridCollectionAndDataObject();
            String objName = irodsQueryResultRow.getColumn(0);
            String dataObjDisplaySize = MiscIRODSUtils.humanReadableByteCount(Long.valueOf(irodsQueryResultRow.getColumn(4)));
            dataGridObj.setName(objName);
            dataGridObj.setPath(irodsQueryResultRow.getColumn(6));
            dataGridObj.setSize(Long.valueOf(irodsQueryResultRow.getColumn(4)));
            dataGridObj.setDisplaySize(dataObjDisplaySize);
            dataGridObj.setOwner(irodsQueryResultRow.getColumn(2));
            dataGridObj.setCollection(dataGridObj.getSize() == 0 ? true : false);
            dataGridObj.setReplicaNumber(irodsQueryResultRow.getColumn(1));
            dataGridObj.setCreatedAt(IRODSDataConversionUtil.getDateFromIRODSValue(irodsQueryResultRow.getColumn(8)));
            dataGridObj.setModifiedAt(IRODSDataConversionUtil.getDateFromIRODSValue(irodsQueryResultRow.getColumn(9)));
            dataGridObj.setNumberOfMatches(0);
            dataGridObj.setResourceName(irodsQueryResultRow.getColumn(5));
            dataGridObj.setChecksum(irodsQueryResultRow.getColumn(7));
            dataGridCollectionAndDataObjects.add(dataGridObj);
        }
    }
    return dataGridCollectionAndDataObjects;
}
Also used : IRODSQueryResultRow(org.irods.jargon.core.query.IRODSQueryResultRow) DataGridCollectionAndDataObject(com.emc.metalnx.core.domain.entity.DataGridCollectionAndDataObject)

Example 4 with IRODSQueryResultRow

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

the class DataGridUtils method mapCountQueryResultSetToInteger.

/**
 * Maps the COUNT from the specific query into an integer
 * for collections
 *
 * @param queryResultSet
 *            result set returned from a query
 * @return list of data grid objects
 * @throws JargonException
 */
public static int mapCountQueryResultSetToInteger(SpecificQueryResultSet queryResultSet) throws JargonException {
    int totalNumberOfItems = 0;
    if (queryResultSet != null && !queryResultSet.getResults().isEmpty()) {
        IRODSQueryResultRow irodsQueryResultRow = queryResultSet.getResults().get(0);
        totalNumberOfItems = Integer.valueOf(irodsQueryResultRow.getColumnAsIntOrZero(0));
    }
    return totalNumberOfItems;
}
Also used : IRODSQueryResultRow(org.irods.jargon.core.query.IRODSQueryResultRow)

Example 5 with IRODSQueryResultRow

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

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