Example usage for org.hibernate ScrollableResults getInteger

List of usage examples for org.hibernate ScrollableResults getInteger

Introduction

In this page you can find the example usage for org.hibernate ScrollableResults getInteger.

Prototype

Integer getInteger(int col);

Source Link

Document

Convenience method to read an integer.

Usage

From source file:org.dcm4chee.archive.ejb.query.StudyQueryImpl.java

License:LGPL

@Override
protected Attributes toAttributes(ScrollableResults results) {
    int numberOfStudyRelatedSeries = results.getInteger(0);
    int numberOfStudyRelatedInstances = results.getInteger(1);
    String modalitiesInStudy = results.getString(2);
    String sopClassesInStudy = results.getString(3);
    String retrieveAETs = results.getString(4);
    String externalRetrieveAET = results.getString(5);
    Availability availability = (Availability) results.get(6);
    byte[] studyAttributes = results.getBinary(7);
    byte[] patientAttributes = results.getBinary(8);
    Attributes attrs = new Attributes();
    Utils.decodeAttributes(attrs, patientAttributes);
    Utils.decodeAttributes(attrs, studyAttributes);
    Utils.setStudyQueryAttributes(attrs, numberOfStudyRelatedSeries, numberOfStudyRelatedInstances,
            modalitiesInStudy, sopClassesInStudy);
    Utils.setRetrieveAET(attrs, retrieveAETs, externalRetrieveAET);
    Utils.setAvailability(attrs, availability);
    return attrs;
}

From source file:org.dcm4chee.archive.query.dao.SeriesQuery.java

License:LGPL

@Override
protected Attributes toAttributes(ScrollableResults results) {
    Long studyPk = results.getLong(0);
    Long seriesPk = results.getLong(1);
    int[] a = { results.getInteger(6), // series.numberOfInstances
            results.getInteger(7) }; // series.numberOfInstancesA
    String retrieveAETs = results.getString(10);
    String externalRetrieveAET = results.getString(11);
    Availability availability = (Availability) results.get(12);
    byte[] seriesAttributes = results.getBinary(13);
    if (!studyPk.equals(this.studyPk)) {
        this.studyAttrs = toStudyAttributes(studyPk, results);
        this.studyPk = studyPk;
    }/*  w w  w . j a v a 2s.c o  m*/
    Attributes attrs = new Attributes(studyAttrs);
    Utils.decodeAttributes(attrs, seriesAttributes);
    if (a[0] == -1)
        a = queryService.seriesService().calculateNumberOfSeriesRelatedInstances(seriesPk);
    int numberOfSeriesRelatedInstances = queryParam.isShowRejectedInstances() ? a[1] : a[0];

    // skip match for empty Series
    if (numberOfSeriesRelatedInstances == 0)
        return null;

    Utils.setSeriesQueryAttributes(attrs, numberOfSeriesRelatedInstances);
    Utils.setRetrieveAET(attrs, retrieveAETs, externalRetrieveAET);
    Utils.setAvailability(attrs, availability);

    return attrs;
}

From source file:org.dcm4chee.archive.query.dao.SeriesQuery.java

License:LGPL

private Attributes toStudyAttributes(Long studyPk, ScrollableResults results) {
    int[] a = { results.getInteger(2), // study.numberOfSeries
            results.getInteger(3), // study.numberOfSeriesA
            results.getInteger(4), // study.numberOfInstances
            results.getInteger(5) }; // study.numberOfInstancesA
    String modalitiesInStudy = results.getString(8);
    String sopClassesInStudy = results.getString(9);
    byte[] studyAttributes = results.getBinary(14);
    byte[] patientAttributes = results.getBinary(15);
    Attributes attrs = new Attributes();
    Utils.decodeAttributes(attrs, patientAttributes);
    Utils.decodeAttributes(attrs, studyAttributes);
    if ((a[0] | a[1] | a[2] | a[3]) < 0)
        a = queryService.seriesService().calculateNumberOfStudyRelatedInstances(studyPk);

    boolean showRejectedInstances = queryParam.isShowRejectedInstances();
    Utils.setStudyQueryAttributes(attrs, showRejectedInstances ? a[1] : a[0],
            queryParam.isShowRejectedInstances() ? a[3] : a[2], modalitiesInStudy, sopClassesInStudy);

    return attrs;
}

From source file:org.dcm4chee.archive.query.dao.StudyQuery.java

License:LGPL

@Override
protected Attributes toAttributes(ScrollableResults results) {
    Long studyPk = results.getLong(0);
    int[] a = { results.getInteger(1), // study.numberOfSeries
            results.getInteger(2), // study.numberOfSeriesA
            results.getInteger(3), // study.numberOfInstances
            results.getInteger(4) }; // study.numberOfInstancesA
    String modalitiesInStudy = results.getString(5);
    String sopClassesInStudy = results.getString(6);
    String retrieveAETs = results.getString(7);
    String externalRetrieveAET = results.getString(8);
    Availability availability = (Availability) results.get(9);
    byte[] studyAttributes = results.getBinary(10);
    byte[] patientAttributes = results.getBinary(11);
    Attributes attrs = new Attributes();
    Utils.decodeAttributes(attrs, patientAttributes);
    Utils.decodeAttributes(attrs, studyAttributes);
    if (a[2] == -1)
        a = queryService.seriesService().calculateNumberOfStudyRelatedInstances(studyPk);

    boolean showRejectedInstances = queryParam.isShowRejectedInstances();
    int numberOfStudyRelatedInstances = showRejectedInstances ? a[3] : a[2];

    // skip match for empty Study
    if (numberOfStudyRelatedInstances == 0)
        return null;

    Utils.setStudyQueryAttributes(attrs, showRejectedInstances ? a[1] : a[0], numberOfStudyRelatedInstances,
            modalitiesInStudy, sopClassesInStudy);
    Utils.setRetrieveAET(attrs, retrieveAETs, externalRetrieveAET);
    Utils.setAvailability(attrs, availability);

    return attrs;
}

From source file:org.dcm4chee.archive.query.impl.SeriesQuery.java

License:LGPL

@Override
public Attributes toAttributes(ScrollableResults results, QueryContext context) {
    Long studyPk = results.getLong(0);
    Long seriesPk = results.getLong(1);
    Integer numberOfInstancesI = results.getInteger(2);
    int numberOfSeriesRelatedInstances;
    String retrieveAETs;/*from w w  w  . j  a v a2 s.c  o m*/
    Availability availability;
    int numberOfSeriesVisibleInstances;
    Date seriesLastUpdateTime;
    if (numberOfInstancesI != null) {
        numberOfSeriesRelatedInstances = numberOfInstancesI;
        if (numberOfSeriesRelatedInstances == 0)
            return null;
        retrieveAETs = results.getString(9);
        availability = (Availability) results.get(10);
        numberOfSeriesVisibleInstances = results.getInteger(11);
        seriesLastUpdateTime = results.getDate(12);
    } else {
        SeriesQueryAttributes seriesView = context.getQueryService().createSeriesView(seriesPk,
                context.getQueryParam());
        numberOfSeriesRelatedInstances = seriesView.getNumberOfInstances();
        if (numberOfSeriesRelatedInstances == 0)
            return null;
        retrieveAETs = seriesView.getRawRetrieveAETs();
        availability = seriesView.getAvailability();
        numberOfSeriesVisibleInstances = seriesView.getNumberOfVisibleInstances();
        seriesLastUpdateTime = seriesView.getLastUpdateTime();
    }

    byte[] seriesAttributes = results.getBinary(13);
    if (!studyPk.equals(this.studyPk)) {
        this.studyAttrs = toStudyAttributes(studyPk, results, context);
        this.studyPk = studyPk;
    }
    Attributes seriesAttrs = new Attributes();
    Utils.decodeAttributes(seriesAttrs, seriesAttributes);
    Attributes attrs = Utils.mergeAndNormalize(studyAttrs, seriesAttrs);
    ArchiveDeviceExtension ade = context.getArchiveAEExtension().getApplicationEntity().getDevice()
            .getDeviceExtension(ArchiveDeviceExtension.class);
    Utils.setSeriesQueryAttributes(attrs, numberOfSeriesRelatedInstances, numberOfSeriesVisibleInstances,
            ade.getPrivateDerivedFields().findSeriesNumberOfVisibleInstancesTag(), seriesLastUpdateTime,
            ade.getPrivateDerivedFields().findSeriesUpdateTimeTag());
    Utils.setRetrieveAET(attrs, retrieveAETs);
    Utils.setAvailability(attrs, availability);

    return attrs;
}

From source file:org.dcm4chee.archive.query.impl.SeriesQuery.java

License:LGPL

private Attributes toStudyAttributes(Long studyPk, ScrollableResults results, QueryContext context) {
    Integer numberOfInstancesI = results.getInteger(3);
    int numberOfStudyRelatedInstances;
    int numberOfStudyRelatedSeries;
    String modalitiesInStudy;//from ww  w .j  a  va  2  s  . co m
    String sopClassesInStudy;
    int numberOfStudyVisibleInstances;
    Date studyLastUpdateTime;
    if (numberOfInstancesI != null) {
        numberOfStudyRelatedInstances = numberOfInstancesI;
        numberOfStudyRelatedSeries = results.getInteger(4);
        modalitiesInStudy = results.getString(5);
        sopClassesInStudy = results.getString(6);
        numberOfStudyVisibleInstances = results.getInteger(7);
        studyLastUpdateTime = results.getDate(8);
    } else {
        StudyQueryAttributes studyView = context.getQueryService().createStudyView(studyPk,
                context.getQueryParam());
        numberOfStudyRelatedInstances = studyView.getNumberOfInstances();
        numberOfStudyRelatedSeries = studyView.getNumberOfSeries();
        modalitiesInStudy = studyView.getRawModalitiesInStudy();
        sopClassesInStudy = studyView.getRawSOPClassesInStudy();
        numberOfStudyVisibleInstances = studyView.getNumberOfVisibleInstances();
        studyLastUpdateTime = studyView.getLastUpdateTime();
    }

    byte[] studyByteAttributes = results.getBinary(14);
    byte[] patientByteAttributes = results.getBinary(15);
    Attributes patientAttrs = new Attributes();
    Attributes studyAttrs = new Attributes();
    Utils.decodeAttributes(patientAttrs, patientByteAttributes);
    Utils.decodeAttributes(studyAttrs, studyByteAttributes);
    Attributes attrs = Utils.mergeAndNormalize(patientAttrs, studyAttrs);
    ArchiveDeviceExtension ade = context.getArchiveAEExtension().getApplicationEntity().getDevice()
            .getDeviceExtension(ArchiveDeviceExtension.class);
    Utils.setStudyQueryAttributes(attrs, numberOfStudyRelatedSeries, numberOfStudyRelatedInstances,
            modalitiesInStudy, sopClassesInStudy, numberOfStudyVisibleInstances,
            ade.getPrivateDerivedFields().findStudyNumberOfVisibleInstancesTag(), studyLastUpdateTime,
            ade.getPrivateDerivedFields().findStudyUpdateTimeTag());

    return attrs;
}

From source file:org.dcm4chee.archive.query.impl.StudyQuery.java

License:LGPL

@Override
public Attributes toAttributes(ScrollableResults results, QueryContext context) {
    Long studyPk = results.getLong(0);
    Integer numberOfInstancesI = results.getInteger(1);
    int numberOfStudyRelatedInstances;
    int numberOfStudyRelatedSeries;
    String modalitiesInStudy;//from  w w  w.ja  va 2 s .co  m
    String sopClassesInStudy;
    String retrieveAETs;
    Availability availability;
    int numberOfStudyVisibleInstances;
    Date studyLastUpdateTime;
    if (numberOfInstancesI != null) {
        numberOfStudyRelatedInstances = numberOfInstancesI;
        if (numberOfStudyRelatedInstances == 0)
            return null;

        numberOfStudyRelatedSeries = results.getInteger(2);
        modalitiesInStudy = results.getString(3);
        sopClassesInStudy = results.getString(4);
        retrieveAETs = results.getString(5);
        availability = (Availability) results.get(6);
        numberOfStudyVisibleInstances = results.getInteger(7);
        studyLastUpdateTime = results.getDate(8);
    } else {
        StudyQueryAttributes studyView = context.getQueryService().createStudyView(studyPk,
                context.getQueryParam());
        numberOfStudyRelatedInstances = studyView.getNumberOfInstances();
        if (numberOfStudyRelatedInstances == 0)
            return null;

        numberOfStudyRelatedSeries = studyView.getNumberOfSeries();
        modalitiesInStudy = studyView.getRawModalitiesInStudy();
        sopClassesInStudy = studyView.getRawSOPClassesInStudy();
        retrieveAETs = studyView.getRawRetrieveAETs();
        availability = studyView.getAvailability();
        numberOfStudyVisibleInstances = studyView.getNumberOfVisibleInstances();
        studyLastUpdateTime = studyView.getLastUpdateTime();
    }

    byte[] studyByteAttributes = results.getBinary(9);
    byte[] patientByteAttributes = results.getBinary(10);
    Attributes patientAttrs = new Attributes();
    Attributes studyAttrs = new Attributes();
    Utils.decodeAttributes(patientAttrs, patientByteAttributes);
    Utils.decodeAttributes(studyAttrs, studyByteAttributes);
    Attributes attrs = Utils.mergeAndNormalize(patientAttrs, studyAttrs);
    ArchiveDeviceExtension ade = context.getArchiveAEExtension().getApplicationEntity().getDevice()
            .getDeviceExtension(ArchiveDeviceExtension.class);
    Utils.setStudyQueryAttributes(attrs, numberOfStudyRelatedSeries, numberOfStudyRelatedInstances,
            modalitiesInStudy, sopClassesInStudy, numberOfStudyVisibleInstances,
            ade.getPrivateDerivedFields().findStudyNumberOfVisibleInstancesTag(), studyLastUpdateTime,
            ade.getPrivateDerivedFields().findStudyUpdateTimeTag());
    Utils.setRetrieveAET(attrs, retrieveAETs);
    Utils.setAvailability(attrs, availability);
    return attrs;
}