List of usage examples for org.hibernate ScrollableResults getBinary
byte[] getBinary(int col);
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; }// w ww. ja v a 2 s . 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.PatientNameQueryBean.java
License:LGPL
@Override public String[] query(IDWithIssuer[] pids) { HashSet<String> c = new HashSet<String>(pids.length * 4 / 3 + 1); BooleanBuilder builder = new BooleanBuilder(); builder.and(Builder.pids(pids, false)); builder.and(QPatient.patient.mergedWith.isNull()); ScrollableResults results = new HibernateQuery(session).from(QPatient.patient).where(builder) .scroll(ScrollMode.FORWARD_ONLY, QPatient.patient.pk, QPatient.patient.encodedAttributes); try {// www .ja v a 2s . c o m while (results.next()) c.add(Utils.decodeAttributes(results.getBinary(1)).getString(Tag.PatientName)); } finally { results.close(); } c.remove(null); return c.isEmpty() ? null : c.toArray(new String[c.size()]); }
From source file:org.dcm4chee.archive.ejb.query.PatientQueryImpl.java
License:LGPL
@Override protected Attributes toAttributes(ScrollableResults results) { Attributes attrs = new Attributes(); Utils.decodeAttributes(attrs, results.getBinary(1)); 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; }/* w w w .ja v a 2s .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 ww w. ja va 2 s. co 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.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; }//w ww. ja va 2 s .c o 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; }