Example usage for org.hibernate ScrollableResults getString

List of usage examples for org.hibernate ScrollableResults getString

Introduction

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

Prototype

String getString(int col);

Source Link

Document

Convenience method to read a string.

Usage

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

License:LGPL

@Override
protected Attributes toAttributes(ScrollableResults results) {
    long seriesPk = results.getLong(0);
    String retrieveAETs = results.getString(1);
    String externalRetrieveAET = results.getString(2);
    Availability availability = (Availability) results.get(3);
    byte[] instAttributes = results.getBinary(4);
    if (this.seriesPk != seriesPk) {
        this.seriesAttrs = querySeriesAttrs(seriesPk);
        this.seriesPk = seriesPk;
    }/* www  .j a  v a2s .c o  m*/
    Attributes attrs = new Attributes(seriesAttrs);
    Utils.decodeAttributes(attrs, instAttributes);
    Utils.setRetrieveAET(attrs, retrieveAETs, externalRetrieveAET);
    Utils.setAvailability(attrs, availability);
    return attrs;
}

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

License:LGPL

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

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.InstanceQuery.java

License:LGPL

@Override
protected Attributes toAttributes(ScrollableResults results) {
    Long seriesPk = results.getLong(0);
    String retrieveAETs = results.getString(1);
    String externalRetrieveAET = results.getString(2);
    Availability availability = (Availability) results.get(3);
    byte[] instAttributes = results.getBinary(4);
    if (!seriesPk.equals(this.seriesPk)) {
        this.seriesAttrs = queryService.seriesService().getAttributes(seriesPk, queryParam);
        this.seriesPk = seriesPk;
    }//from ww w  .  ja va  2  s .c  om
    Attributes attrs = new Attributes(seriesAttrs);
    Utils.decodeAttributes(attrs, instAttributes);
    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;
    }/*from  w  w w  .  ja v a 2 s. com*/
    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.InstanceQuery.java

License:LGPL

@Override
public Attributes toAttributes(ScrollableResults results, QueryContext context) {
    Long seriesPk = results.getLong(0);
    String retrieveAETs = results.getString(1);
    Availability availability = (Availability) results.get(2);
    byte[] instByteAttributes = results.getBinary(3);
    if (!seriesPk.equals(this.seriesPk)) {
        this.seriesAttrs = context.getQueryService().getSeriesAttributes(seriesPk, context);
        this.seriesPk = seriesPk;
    }/*from w  ww.j  a  va2  s. co  m*/
    Attributes instanceAttrs = new Attributes();
    Utils.decodeAttributes(instanceAttrs, instByteAttributes);
    Attributes attrs = Utils.mergeAndNormalize(seriesAttrs, instanceAttrs);
    Utils.setRetrieveAET(attrs, retrieveAETs);
    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;/*  w  w  w  .j a  v  a  2s.c om*/
    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   w  w w . j a v  a2  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;
}