public static AdhocQueryResponse emptyAdhocQueryResponse() { AdhocQueryResponse rsp = objFac.createAdhocQueryResponse(); rsp.setRegistryObjectList(objFac.createRegistryObjectListType()); return rsp; }
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); ArrayList<RegistryObject> objects = new ArrayList<RegistryObject>(); objects.addAll(getDocuments()); objects.addAll(getSubmissionSets()); objects.addAll(getFolders()); objects.addAll(getAssociations(objects)); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, isLeafClass())); return rsp; }
@Override @Action(input="urn:ihe:iti:2007:RegistryStoredQuery", output="urn:ihe:iti:2007:RegistryStoredQueryResponse") public AdhocQueryResponse documentRegistryRegistryStoredQuery( AdhocQueryRequest req) { log.info("################ documentRegistryRegistryStoredQuery called!"); log.debug("ReturnType:"+req.getResponseOption().getReturnType()); AdhocQueryResponse rsp; StoredQuery qry = null; try { qry = StoredQuery.getStoredQuery(req, this); rsp = qry.query(); } catch (Exception x) { log.error("Unexpected error in XDS service (query)!: "+x.getMessage(),x); rsp = factory.createAdhocQueryResponse(); XDSException e = (x instanceof XDSException) ? (XDSException) x : new XDSException(XDSException.XDS_ERR_REGISTRY_ERROR, "Unexpected error in XDS service !: "+x.getMessage(),x); XDSUtil.addError(rsp, e); rsp.setRegistryObjectList(factory.createRegistryObjectListType()); } XDSAudit.logRegistryQuery(req, new AuditRequestInfo(LogHandler.getInboundSOAPHeader(), wsContext), XDSConstants.XDS_B_STATUS_SUCCESS.equals(rsp.getStatus())); return rsp; }
public AdhocQueryResponse query() throws XDSException { String[] values = getQueryParam(XDSConstants.QRY_UUID).getValues(); AdhocQueryResponse rsp = initAdhocQueryResponse(); JPAQuery query = new JPAQuery(getSession().getEntityManager()); QRegistryObject target = new QRegistryObject("target"); QRegistryObject source = new QRegistryObject("source"); Predicate uuidPredicate = values.length == 1 ? target.id.eq(values[0]) : target.id.in(values); List<Association> assocs = query .from(QAssociation.association, QClassificationNode.classificationNode, target, source) .where( QClassificationNode.classificationNode.pk.eq(QAssociation.association.assocType.pk), QClassificationNode.classificationNode.id.eq(XDSConstants.HAS_MEMBER), target.pk.eq(QAssociation.association.targetObject.pk), uuidPredicate, source.pk.eq(QAssociation.association.sourceObject.pk), source.instanceOf(XDSSubmissionSet.class)) .list(QAssociation.association); log.info("#### Found Associations:"+assocs); List<RegistryObject> objects = new ArrayList<RegistryObject>(assocs.size()); for (Association assoc : assocs) { if (!objects.contains(assoc.getSourceObject())) objects.add(assoc.getSourceObject()); objects.add(assoc); } log.info("#### Found SubmissionSets and Associations:"+objects); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, isLeafClass())); return rsp; }
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); ArrayList<Identifiable> objects = new ArrayList<Identifiable>(); XDSDocumentEntry doc = getDocumentEntry(); if (doc != null) { List<Association> assocs = new JPAQuery(getSession().getEntityManager()) .from(QAssociation.association) .where(ExpressionUtils.anyOf(QAssociation.association.targetObject.eq(doc), QAssociation.association.sourceObject.eq(doc)), QAssociation.association.sourceObject.instanceOf(XDSDocumentEntry.class), QAssociation.association.targetObject.instanceOf(XDSDocumentEntry.class), QAssociation.association.assocType.id.in(getQueryParam(XDSConstants.QRY_ASSOCIATION_TYPES).getMultiValues(0))) .list(QAssociation.association); log.info("#### Found Associations:"+assocs); if (assocs.size() > 0) { objects.add(doc); Identifiable obj; for (Association assoc : assocs) { obj = assoc.getSourceObject().equals(doc) ? assoc.getTargetObject() : assoc.getSourceObject(); if (!objects.contains(obj)) { objects.add(obj); } } objects.addAll(assocs); } } rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, isLeafClass())); return rsp; }
objects.addAll(docs); objects.addAll(associations); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, isLeafClass()));
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); XDSDocumentEntry doc = getDocumentEntry(); if (doc != null) { List<RegistryObject> objects = new JPAQuery(getSession().getEntityManager()) .from(QAssociation.association) .where(QAssociation.association.targetObject.eq(doc), QAssociation.association.sourceObject.instanceOf(XDSFolder.class), QAssociation.association.assocType.id.eq(XDSConstants.HAS_MEMBER)) .list(QAssociation.association.sourceObject); log.info("#### Found Folders:"+objects); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, isLeafClass())); } return rsp; }
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); XDSSubmissionSet ss = null; log.debug("######### session:{}",getSession()); if (getQueryParam(XDSConstants.QRY_SUBMISSIONSET_UNIQUE_ID) != null) { if (getQueryParam(XDSConstants.QRY_SUBMISSIONSET_ENTRY_UUID) != null) { throw new XDSException(XDSException.XDS_ERR_REGISTRY_ERROR, "Both $XDSSubmissionSetEntryUUID and $XDSSubmissionSetUniqueId are specified!", null); } ss = getSession().getSubmissionSetByUniqueId(getQueryParam(XDSConstants.QRY_SUBMISSIONSET_UNIQUE_ID).getStringValue()); } else if (getQueryParam(XDSConstants.QRY_SUBMISSIONSET_ENTRY_UUID) != null) { ss = getSession().getSubmissionSetByUUID(getQueryParam(XDSConstants.QRY_SUBMISSIONSET_ENTRY_UUID).getStringValue()); } log.info("#### Found Submissionset:{}",ss); List<Identifiable> objects = getObjectsFor(ss); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, this.isLeafClass())); return rsp; }
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); XDSFolder folder = null; if (getQueryParam(XDSConstants.QRY_FOLDER_UNIQUE_ID) != null) { if (getQueryParam(XDSConstants.QRY_FOLDER_ENTRY_UUID) != null) { throw new XDSException(XDSException.XDS_ERR_REGISTRY_ERROR, "Both $XDSFolderEntryUUID and $XDSFolderUniqueId are specified!", null); } folder = getSession().getFolderByUniqueId(getQueryParam(XDSConstants.QRY_FOLDER_UNIQUE_ID).getStringValue()); } else if (getQueryParam(XDSConstants.QRY_FOLDER_ENTRY_UUID) != null) { folder = getSession().getFolderByUUID(getQueryParam(XDSConstants.QRY_FOLDER_ENTRY_UUID).getStringValue()); } log.info("#### Found Folder:"+folder); List<Identifiable> objects = getObjectsFor(folder); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(objects, this.isLeafClass())); return rsp; }
public AdhocQueryResponse query() throws XDSException { String[] values = getQueryParam(XDSConstants.QRY_UUID).getValues(); BooleanBuilder builder = new BooleanBuilder(); builder.or(values.length == 1 ? QAssociation.association.sourceObject.id.eq(values[0]) : QAssociation.association.sourceObject.id.in(values)); builder.or(values.length == 1 ? QAssociation.association.targetObject.id.eq(values[0]) : QAssociation.association.targetObject.id.in(values)); AdhocQueryResponse rsp = initAdhocQueryResponse(); JPAQuery query = new JPAQuery(getSession().getEntityManager()); List<Association> associations = query.from(QAssociation.association) .where(builder) .list(QAssociation.association); log.info("#### Found Associations:"+associations); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(associations, isLeafClass())); return rsp; }
if (xcaRsp.getRegistryObjectList() != null) { if (rsp.getRegistryObjectList() == null) { rsp.setRegistryObjectList(xcaRsp.getRegistryObjectList()); } else { rsp.getRegistryObjectList().getIdentifiable().addAll(xcaRsp.getRegistryObjectList().getIdentifiable());
public AdhocQueryResponse query() throws XDSException { Predicate predicate = null; StoredQueryParam param; if ((param = getQueryParam(XDSConstants.QRY_DOCUMENT_UNIQUE_ID)) != null) { if (getQueryParam(XDSConstants.QRY_DOCUMENT_ENTRY_UUID) != null) { throw new XDSException(XDSException.XDS_ERR_REGISTRY_ERROR, "Both $XDSDocumentEntryEntryUUID and $XDSDocumentEntryUniqueId are specified!", null); } String[] values = param.getValues(); predicate = values.length == 1 ? QXDSDocumentEntry.xDSDocumentEntry.uniqueId.eq(values[0]) : QXDSDocumentEntry.xDSDocumentEntry.uniqueId.in(values); } else if ((param = getQueryParam(XDSConstants.QRY_DOCUMENT_ENTRY_UUID)) != null) { String[] values = param.getValues(); predicate = values.length == 1 ? QXDSDocumentEntry.xDSDocumentEntry.id.eq(values[0]) : QXDSDocumentEntry.xDSDocumentEntry.id.in(values); } AdhocQueryResponse rsp = initAdhocQueryResponse(); JPAQuery query = new JPAQuery(getSession().getEntityManager()); List<XDSDocumentEntry> docs = query.from(QXDSDocumentEntry.xDSDocumentEntry) .where(predicate) .list(QXDSDocumentEntry.xDSDocumentEntry); log.info("#### Found Documents:"+docs); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(docs, isLeafClass())); return rsp; }
public AdhocQueryResponse query() throws XDSException { Predicate predicate = null; StoredQueryParam param; if ((param = getQueryParam(XDSConstants.QRY_FOLDER_UNIQUE_ID)) != null) { if (getQueryParam(XDSConstants.QRY_FOLDER_ENTRY_UUID) != null) { throw new XDSException(XDSException.XDS_ERR_REGISTRY_ERROR, "Both $XDSFolderEntryUUID and $XDSFolderEntryUniqueId are specified!", null); } String[] values = param.getValues(); predicate = values.length == 1 ? QXDSFolder.xDSFolder.uniqueId.eq(values[0]) : QXDSFolder.xDSFolder.uniqueId.in(values); } else if ((param = getQueryParam(XDSConstants.QRY_FOLDER_ENTRY_UUID)) != null) { String[] values = param.getValues(); predicate = values.length == 1 ? QXDSFolder.xDSFolder.id.eq(values[0]) : QXDSFolder.xDSFolder.id.in(values); } AdhocQueryResponse rsp = initAdhocQueryResponse(); JPAQuery query = new JPAQuery(getSession().getEntityManager()); List<XDSFolder> folders = query.from(QXDSFolder.xDSFolder) .where(predicate) .list(QXDSFolder.xDSFolder); log.info("#### Found Folders:"+folders); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(folders, isLeafClass())); return rsp; }
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); BooleanBuilder builder = new BooleanBuilder(); addPatientIdMatch(builder, getQueryParam(XDSConstants.QRY_FOLDER_PATIENT_ID)); addStatusMatch(builder, QXDSFolder.xDSFolder.status, getQueryParam(XDSConstants.QRY_FOLDER_STATUS)); addFromToMatch(builder, getQueryParam(XDSConstants.QRY_FOLDER_LAST_UPDATE_TIME_FROM), getQueryParam(XDSConstants.QRY_FOLDER_LAST_UPDATE_TIME_TO), QXDSFolder.xDSFolder.pk, XDSConstants.SLOT_NAME_LAST_UPDATE_TIME); addExternalIdentifierMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_SOURCE_ID), XDSConstants.UUID_XDSSubmissionSet_sourceId, QXDSSubmissionSet.xDSSubmissionSet.pk); addSlotValueInClassificationMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_AUTHOR_PERSON), XDSConstants.UUID_XDSSubmissionSet_autor, XDSConstants.SLOT_NAME_AUTHOR_PERSON, QXDSSubmissionSet.xDSSubmissionSet.pk); addXdsCodeMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_CONTENT_TYPE), XDSConstants.UUID_XDSSubmissionSet_contentTypeCode, QXDSSubmissionSet.xDSSubmissionSet.xdsCodes); JPAQuery query = new JPAQuery(getSession().getEntityManager()); List<XDSFolder> folders = query.from(QXDSFolder.xDSFolder) .innerJoin(QXDSFolder.xDSFolder.patient, QXADPatient.xADPatient) .innerJoin(QXADPatient.xADPatient.issuerOfPatientID, QXADIssuer.xADIssuer) .where(builder) .list(QXDSFolder.xDSFolder); log.info("#### Found Folders:"+folders); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(folders, isLeafClass())); return rsp; }
public AdhocQueryResponse query() throws XDSException { AdhocQueryResponse rsp = initAdhocQueryResponse(); BooleanBuilder builder = new BooleanBuilder(); addPatientIdMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_PATIENT_ID)); addStatusMatch(builder, QXDSSubmissionSet.xDSSubmissionSet.status, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_STATUS)); addFromToMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_SUBMISSION_TIME_FROM), getQueryParam(XDSConstants.QRY_SUBMISSIONSET_SUBMISSION_TIME_TO), QXDSSubmissionSet.xDSSubmissionSet.pk, XDSConstants.SLOT_NAME_SUBMISSION_TIME); addExternalIdentifierMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_SOURCE_ID), XDSConstants.UUID_XDSSubmissionSet_sourceId, QXDSSubmissionSet.xDSSubmissionSet.pk); addSlotValueInClassificationMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_AUTHOR_PERSON), XDSConstants.UUID_XDSSubmissionSet_autor, XDSConstants.SLOT_NAME_AUTHOR_PERSON, QXDSSubmissionSet.xDSSubmissionSet.pk); addXdsCodeMatch(builder, getQueryParam(XDSConstants.QRY_SUBMISSIONSET_CONTENT_TYPE), XDSConstants.UUID_XDSSubmissionSet_contentTypeCode, QXDSSubmissionSet.xDSSubmissionSet.xdsCodes); JPAQuery query = new JPAQuery(getSession().getEntityManager()); List<XDSSubmissionSet> submissionSets = query.from(QXDSSubmissionSet.xDSSubmissionSet) .innerJoin(QXDSSubmissionSet.xDSSubmissionSet.patient, QXADPatient.xADPatient) .innerJoin(QXADPatient.xADPatient.issuerOfPatientID, QXADIssuer.xADIssuer) .where(builder) .list(QXDSSubmissionSet.xDSSubmissionSet); log.info("#### Found SubmissionSet:"+submissionSets); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(submissionSets, isLeafClass())); return rsp; }
.list(QXDSDocumentEntry.xDSDocumentEntry); log.info("#### Found Documents:"+docs); rsp.setRegistryObjectList(new XDSPersistenceWrapper(getSession()).toRegistryObjectListType(docs, isLeafClass())); log.info("#### Return rsp:"+rsp); return rsp;