Esempio n. 1
0
 public static RegistryPackageType getRegistryPackage(
     SubmitObjectsRequest sor, String classificationUUID) {
   List<JAXBElement<? extends IdentifiableType>> list =
       sor.getRegistryObjectList().getIdentifiable();
   String id = null;
   IdentifiableType identifiable;
   if (classificationUUID != null) {
     ClassificationType ct;
     for (int i = 0, len = list.size(); i < len; i++) {
       identifiable = list.get(i).getValue();
       if (identifiable instanceof ClassificationType) {
         ct = (ClassificationType) identifiable;
         if (classificationUUID.equals(ct.getClassificationNode())) {
           id = ct.getClassifiedObject();
           break;
         }
       }
     }
   }
   RegistryPackageType rp;
   for (int i = 0, len = list.size(); i < len; i++) {
     identifiable = list.get(i).getValue();
     if (identifiable instanceof RegistryPackageType) {
       rp = (RegistryPackageType) identifiable;
       if (id == null || id.equals(rp.getId())) {
         return rp;
       }
     }
   }
   return null;
 }
 private List<ExtrinsicObjectType> checkRequest(ProvideAndRegisterDocumentSetRequestType req)
     throws XDSException {
   SubmitObjectsRequest sor = req.getSubmitObjectsRequest();
   RegistryPackageType submissionSet =
       InfosetUtil.getRegistryPackage(sor, XDSConstants.UUID_XDSSubmissionSet);
   if (submissionSet == null) {
     log.error("No RegistryPackage id=SubmissionSet found!");
     throw new XDSException(
         XDSException.XDS_ERR_REPOSITORY_ERROR,
         XDSException.XDS_ERR_MISSING_REGISTRY_PACKAGE,
         null);
   } else if (submissionSet.getId() == null || submissionSet.getId().trim().length() == 0) {
     throw new XDSException(
         XDSException.XDS_ERR_REPOSITORY_METADATA_ERROR,
         "Missing XDSSubmissionSet.entryUUID!",
         null);
   }
   List<ExtrinsicObjectType> extrObjs =
       InfosetUtil.getExtrinsicObjects(req.getSubmitObjectsRequest());
   checkPatientIDs(req, submissionSet, extrObjs);
   Map<String, Document> docs = InfosetUtil.getDocuments(req);
   if (extrObjs.size() > docs.size()) {
     log.warn(
         "Missing Documents! Found more ExtrinsicObjects("
             + extrObjs.size()
             + ") than Documents("
             + docs.size()
             + ")!");
     throw new XDSException(XDSException.XDS_ERR_MISSING_DOCUMENT, "", null);
   } else if (extrObjs.size() < docs.size()) {
     log.warn(
         "Missing Document Metadata! Found less ExtrinsicObjects("
             + extrObjs.size()
             + ") than Documents("
             + docs.size()
             + ")!");
     throw new XDSException(XDSException.XDS_ERR_MISSING_DOCUMENT_METADATA, "", null);
   }
   return extrObjs;
 }