public static AdhocQueryResponse emptyAdhocQueryResponse() { AdhocQueryResponse rsp = objFac.createAdhocQueryResponse(); rsp.setRegistryObjectList(objFac.createRegistryObjectListType()); return rsp; }
public static void addOrOverwriteSlot(RegistryObjectType ro, Map<String, SlotType1> slots, String slotName, String... val) throws JAXBException { if ( slots.containsKey(slotName) ) { SlotType1 oldSlot = (SlotType1)slots.get(slotName); ro.getSlot().remove(oldSlot); } SlotType1 slot = objFac.createSlotType1(); slot.setName(slotName); ValueListType valueList = objFac.createValueListType(); for ( int i = 0 ; i < val.length ; i++) { valueList.getValue().add(val[i]); } slot.setValueList(valueList); ro.getSlot().add(slot); }
public static void addAssociation(List<JAXBElement<? extends IdentifiableType>> list, XDSAssociation xdsAssoc) { list.add(rimFactory.createAssociation(createAssociation(xdsAssoc))); } public static AssociationType1 createAssociation(XDSAssociation xdsAssoc) {
private JAXBElement<? extends IdentifiableType> toJAXBExtrinsicObject( ExtrinsicObject eo) { ExtrinsicObjectType eoType = factory.createExtrinsicObjectType(); toEbXmlObj(eo, eoType); eoType.setMimeType(eo.getMimeType()); eoType.setIsOpaque(eo.isOpaque()); return factory.createExtrinsicObject(eoType); } private JAXBElement<? extends IdentifiableType> toJAXBRegistryPackage(
public PnRRequest(String sourceID, String submissionSetUID, String patID, String srcPatID) { if (sourceID == null || submissionSetUID == null || patID == null || srcPatID == null) { StringBuilder sb = new StringBuilder(); sb.append("Parameter values must not be null! ("); if (sourceID == null) sb.append("sourceID,"); if (submissionSetUID == null) sb.append("submissionSetUID,"); if (patID == null) sb.append("patID,"); if (srcPatID == null) sb.append("srcPatID,"); sb.setCharAt(sb.length()-1, ')'); throw new IllegalArgumentException(sb.toString()); } this.submissionSetUID = submissionSetUID; patientID = patID; srcPatIDSlot = Util.createSlot(XDSConstants.SLOT_NAME_SOURCE_PATIENT_ID, null, srcPatID); provideAndRegisterDocumentSetRequest = iheFactory.createProvideAndRegisterDocumentSetRequestType(); SubmitObjectsRequest sor = Util.rimFactory.createSubmitObjectsRequest(); registryObjectList = Util.rimFactory.createRegistryObjectListType(); sor.setRegistryObjectList(registryObjectList); provideAndRegisterDocumentSetRequest.setSubmitObjectsRequest(sor); submissionSet = Util.rimFactory.createRegistryPackageType(); submissionSet.setId(SUBMISSION_SET_ID); submissionSet.getExternalIdentifier().add(Util.createExternalIdentifier(nextID(), XDSConstants.UUID_XDSSubmissionSet_uniqueId, SUBMISSION_SET_ID, submissionSetUID, "XDSSubmissionSet.uniqueId")); submissionSet.getExternalIdentifier().add(Util.createExternalIdentifier(nextID(), XDSConstants.UUID_XDSSubmissionSet_patientId, SUBMISSION_SET_ID, patID, "XDSSubmissionSet.patientId")); submissionSet.getExternalIdentifier().add(Util.createExternalIdentifier(nextID(), XDSConstants.UUID_XDSSubmissionSet_sourceId, SUBMISSION_SET_ID, sourceID, "XDSSubmissionSet.sourceId")); registryObjectList.getIdentifiable().add(Util.rimFactory.createRegistryPackage(submissionSet)); submissionSet.getClassification().add(Util.createClassification(nextID(), XDSConstants.UUID_XDSSubmissionSet, SUBMISSION_SET_ID)); }
public static ExternalIdentifierType createExternalIdentifier(String id, String scheme, String registryObject, String value, String name) { ExternalIdentifierType ei = rimFactory.createExternalIdentifierType(); ei.setId(id); ei.setIdentificationScheme(scheme); ei.setObjectType("urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier"); ei.setRegistryObject(registryObject); ei.setValue(value); InternationalStringType is = rimFactory.createInternationalStringType(); LocalizedStringType v = rimFactory.createLocalizedStringType(); v.setValue(name); is.getLocalizedString().add(v); ei.setName(is); return ei; }
private JAXBElement<? extends IdentifiableType> toJAXBAssociation( Association assoc) { AssociationType1 assocType = factory.createAssociationType1(); toEbXmlObj(assoc, assocType); if (assoc.getAssocType() != null) { assocType.setAssociationType(assoc.getAssocType().getId()); } else { log.error("AssocType is null! Association id:"+assoc.getId()); assocType.setAssociationType("urn:willi:123-abc-123"); } if (assoc.getSourceObject() != null) { assocType.setSourceObject(assoc.getSourceObject().getId()); } else { log.error("SourceObject is null! Association id:"+assoc.getId()); assocType.setSourceObject("urn:willi:123-abc-456"); } if (assoc.getTargetObject() != null) { assocType.setTargetObject(assoc.getTargetObject().getId()); } else { log.error("TargetObject is null! Association id:"+assoc.getId()); assocType.setTargetObject("urn:willi:123-abc-789"); } return factory.createAssociation(assocType); } private JAXBElement<? extends IdentifiableType> toJAXBClassification(
public RegistryObjectListType toRegistryObjectListType(List<? extends Identifiable> objects, boolean isLeafClass, boolean allowMultiPatientResponse) throws XDSException { RegistryObjectListType objListType = factory.createRegistryObjectListType(); List<JAXBElement<? extends IdentifiableType>> objList = objListType.getIdentifiable(); if (objects != null) {
public static ClassificationType createClassification(String id, String classificationNode, String classifiedObject) { ClassificationType cl = rimFactory.createClassificationType(); cl.setId(id); cl.setClassificationNode(classificationNode); cl.setClassifiedObject(classifiedObject); cl.setObjectType(OBJECT_TYPE_CLASSIFICATION); return cl; } public static ClassificationType removeClassification(RegistryObjectType ro, String id) {
protected AdhocQueryResponse initAdhocQueryResponse() { AdhocQueryResponse rsp = factory.createAdhocQueryResponse(); rsp.setStatus(XDSConstants.XDS_B_STATUS_SUCCESS); return rsp; }
public static AssociationType1 createNonDocumentAssociation(XDSAssociation xdsAssoc) { AssociationType1 assoc = rimFactory.createAssociationType1(); assoc.setId(xdsAssoc.getID()); assoc.setSourceObject(xdsAssoc.getSourceObject()); assoc.setTargetObject(xdsAssoc.getTargetObject()); assoc.setAssociationType(xdsAssoc.getAssociationType()); assoc.setObjectType("urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association"); return assoc; }
private void copyExternalIdentifierType(Set<ExternalIdentifier> externalIdentifiers, RegistryObjectType roType) { if (externalIdentifiers != null) { List<ExternalIdentifierType> eiTypes = roType.getExternalIdentifier(); ExternalIdentifierType eiType; for (ExternalIdentifier ei : externalIdentifiers) { eiType = factory.createExternalIdentifierType(); toEbXmlObj(ei, eiType); if (ei.getIdentificationScheme() != null) { eiType.setIdentificationScheme(ei.getIdentificationScheme().getId()); } else { log.error("IdentificationScheme is null! ExternalIdentifier id:"+ei.getId()); eiType.setIdentificationScheme("urn:willi:12345-abcd-123"); } eiType.setValue(ei.getValue()); if (ei.getRegistryObject() != null) { eiType.setRegistryObject(ei.getRegistryObject().getId()); } else { log.error("RegistryObject is null! ExternalIdentifier id:"+ei.getId()); eiType.setRegistryObject("urn:willi:12345-abcd-456"); } eiTypes.add(eiType); } } }
public DocumentEntry(PnRRequest pnrReq, String uniqueID, byte[] content, String mime) { this.pnrRequest = pnrReq; doc = PnRRequest.iheFactory.createProvideAndRegisterDocumentSetRequestTypeDocument(); ProvideAndRegisterDocumentSetRequestType pnr = pnrRequest.getProvideAndRegisterDocumentSetRequest(); pnr.getDocument().add(doc); id = pnrReq.nextDocumentID(); doc.setId(id); doc.setValue(content); metadata = Util.rimFactory.createExtrinsicObjectType(); metadata.setObjectType(XDSConstants.UUID_XDSDocumentEntry); metadata.setId(id); metadata.setMimeType(mime); List<JAXBElement<? extends IdentifiableType>> list = pnrRequest.getRegistryObjectList().getIdentifiable(); list.add(Util.rimFactory.createExtrinsicObject(metadata)); metadata.getExternalIdentifier().add(Util.createExternalIdentifier(pnrRequest.nextID(), XDSConstants.UUID_XDSDocumentEntry_patientId, id, pnrRequest.getPatientID(), XDS_DOCUMENT_ENTRY_PATIENT_ID)); metadata.getSlot().add(pnrRequest.getSrcPatIDSlot()); if (pnrRequest.getSrcPatInfo() != null) { metadata.getSlot().add(pnrRequest.getSrcPatInfo()); } metadata.getExternalIdentifier().add(Util.createExternalIdentifier(pnrRequest.nextID(), XDSConstants.UUID_XDSDocumentEntry_uniqueId, id, uniqueID, XDS_DOCUMENT_ENTRY_UNIQUE_ID)); this.uniqueID = uniqueID; assoc = pnrReq.addAssociation(PnRRequest.SUBMISSION_SET_ID, id, XDSConstants.HAS_MEMBER); }
public static ClassificationType createClassification(String id, String classificationScheme, String classifiedObject, String nodeRepresentation) { ClassificationType cl = rimFactory.createClassificationType(); cl.setId(id); cl.setClassificationScheme(classificationScheme); cl.setClassifiedObject(classifiedObject); cl.setObjectType(OBJECT_TYPE_CLASSIFICATION); cl.setNodeRepresentation(nodeRepresentation); return cl; }
public static SlotType1 createSlot(String name, String type, String...values) { SlotType1 slot = Util.rimFactory.createSlotType1(); slot.setName(name); slot.setSlotType(type); ValueListType valueList = rimFactory.createValueListType(); slot.setValueList(valueList); if (values != null) { List<String> l = valueList.getValue(); for (int i = 0 ; i < values.length ; i++) { l.add(values[i]); } } return slot; }
@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; }
private ClassificationType toClassificationType(Classification cl) { ClassificationType clType = factory.createClassificationType(); toEbXmlObj(cl, clType); clType.setNodeRepresentation(cl.getNodeRepresentation()); if (cl.getClassificationScheme() != null) { clType.setClassificationScheme(cl.getClassificationScheme().getId()); } else if (cl.getClassificationNode() != null) { clType.setClassificationNode(cl.getClassificationNode().getId()); } else { log.error("Missing ClassificationNode and ClassificationScheme! Classification id:"+cl.getId()); clType.setClassificationScheme("urn:willi:987-abc-456"); } if (cl.getClassifiedObject() != null) { clType.setClassifiedObject(cl.getClassifiedObject().getId()); } else { log.error("Missing ClassifiedObject! Classification id:"+cl.getId()); clType.setClassifiedObject("urn:willi:987-abc-789"); } return clType; }
public static void addNonDocumentAssociation(List<JAXBElement<? extends IdentifiableType>> list, XDSAssociation xdsAssoc) { list.add(rimFactory.createAssociation(createNonDocumentAssociation(xdsAssoc))); }
private void copySlotType(List<Slot> slots, RegistryObjectType roType) { if (slots != null) { SlotType1 slotType; HashMap<String, SlotType1> slotTypeMap = new HashMap<String, SlotType1>(); for (Slot slot : slots) { slotType = slotTypeMap.get(slot.getName()); if (log.isDebugEnabled()) log.debug("########add slot name:"+slot.getName()+" value:"+slot.getValue()+" parent.pk:"+slot.getParent().getPk()+" pk:"+slot.getPk()); if (slotType == null) { slotType = factory.createSlotType1(); slotType.setName(slot.getName()); slotType.setSlotType(slot.getType()); slotType.setValueList(factory.createValueListType()); slotTypeMap.put(slot.getName(), slotType); } slotType.getValueList().getValue().add(slot.getValue()); } roType.getSlot().addAll(slotTypeMap.values()); } }