/**
   * Method description
   *
   * @param registryResponse
   * @param context
   * @return
   */
  private boolean checkForSuccess(
      GetDocumentsSQResponseMessage registryResponse, SDRActivityContext context) {

    boolean result = false;

    SubmitDocumentResponse sdrResponse = context.getSubmitDocumentResponse();
    Document document = context.getDocument();

    List<String> objectRefs = null;

    try {

      objectRefs = parseObjectRefs(registryResponse, context);

    } catch (XdsException e) {

      // Downstream XDS returned an error
      String msg = String.format("Document id can not be validated as unique: %s", e.getMessage());

      sdrResponse.addResponse(document, ResponseTypeStatus.Failure, msg);
    }

    if (objectRefs != null) {

      if (objectRefs.isEmpty()) {

        result = true;

      } else {

        String errmsg = "Document already exists in the registry. It will not be processed.";

        logger.error(errmsg);
        sdrResponse.addResponse(document, ResponseTypeStatus.Failure, errmsg);
      }
    }

    return result;
  }
Esempio n. 2
0
 /**
  * @param sor
  * @return
  */
 public OMElement run(OMElement sor) {
   try {
     sor.build();
     // AUDIT:POINT
     // call to audit message for document registry
     // for Transaction id = ITI-42. (Register Document set-b)
     // NOTE!!: Moved above "SubjectObjectsRequestInternal()" method call since the "sor" instance
     // is changed during the execution of "SubjectObjectsRequestInternal() method.  Otherwise,
     // we would need to pay the penalty for a deep copy of the "sor" instance.
     this.auditSubmitObjectsRequest(sor);
     // performAudit(
     //        XATNALogger.TXN_ITI42,
     //        sor,
     //        null,
     //        XATNALogger.ActorType.REGISTRY,
     //        XATNALogger.OutcomeIndicator.SUCCESS);
     this.handleSubmitObjectsRequest(sor);
   } catch (XdsDeprecatedException e) {
     response.add_error(
         "XDSRegistryDeprecatedDocumentError",
         e.getMessage(),
         this.getClass().getName(),
         log_message);
     logger.warn(logger_exception_details(e));
   } catch (XdsUnknownPatientIdException e) {
     response.add_error(
         MetadataSupport.XDSUnknownPatientId,
         e.getMessage(),
         this.getClass().getName(),
         log_message);
     logger.warn(logger_exception_details(e));
   } catch (XdsPatientIdDoesNotMatchException e) {
     response.add_error(
         MetadataSupport.XDSPatientIdDoesNotMatch,
         e.getMessage(),
         this.getClass().getName(),
         log_message);
     logger.warn(logger_exception_details(e));
   } catch (XDSNonIdenticalHashException e) {
     response.add_error(
         MetadataSupport.XDSNonIdenticalHash,
         e.getMessage(),
         this.getClass().getName(),
         log_message);
     logger.warn(logger_exception_details(e));
   } catch (MetadataException e) {
     response.add_error(
         MetadataSupport.XDSRegistryMetadataError,
         e.getMessage(),
         this.getClass().getName(),
         log_message);
     logger.warn(logger_exception_details(e));
   } catch (MetadataValidationException e) {
     response.add_error(
         MetadataSupport.XDSRegistryMetadataError,
         e.getMessage(),
         this.getClass().getName(),
         log_message);
     logger.warn(logger_exception_details(e));
   } catch (XdsInternalException e) {
     response.add_error(
         MetadataSupport.XDSRegistryError, e.getMessage(), this.getClass().getName(), log_message);
     logger.warn(logger_exception_details(e));
   } catch (XdsException e) {
     response.add_error(
         MetadataSupport.XDSRegistryError, e.getMessage(), this.getClass().getName(), log_message);
     logger.warn(logger_exception_details(e));
   } catch (Exception e) {
     response.add_error(
         MetadataSupport.XDSRegistryError, e.getMessage(), this.getClass().getName(), log_message);
     logger.warn(logger_exception_details(e));
   }
   OMElement res = null;
   try {
     res = response.getResponse();
     this.log_response();
   } catch (XdsInternalException e) {
   }
   return res;
 }