예제 #1
0
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument xmlDocResponse = null;
            XmlDocument xmlDocAdHocQueryResponse;
            List <SubmissionSetDocumentFolder> lstSubmissionSetDocumentFolders = null;
            List <Folder> lstFolders   = null;
            List <string> lstFolderIDs = null;

            //Validate Parameters (Either EntryUUID or UniqueID has to be passed)
            if (base.IsEmptyParametersExists(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "No parameters passed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            if (base.IsBothParametersPassed(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Both entryUUID and uniqueUUID parameters are passed. Only one parameter is allowed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            //SubmissionSetDocumentFolder/Associations
            lstSubmissionSetDocumentFolders = GetSubmissionSetDocumentFolderDetails(objStoredQueryRequest.ParameterList);

            //Folders
            lstFolderIDs = base.GetFolderIDs(lstSubmissionSetDocumentFolders);
            lstFolders   = GetFoldersByFolderIDs(lstFolderIDs);

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            xmlDocResponse = ConstructRegistryObjectList(xmlDocAdHocQueryResponse, lstFolders);

            return(xmlDocResponse);
        }
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument   xmlDocResponse = null;
            XmlDocument   xmlDocAdHocQueryResponse;
            List <Folder> lstFolder = null;


            //Get folders
            lstFolder = GetFolders(objStoredQueryRequest.ParameterList);
            lstFolder = FilterResults(objStoredQueryRequest.ParameterList, lstFolder);

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            if (objStoredQueryRequest.ReturnType.ToLower() == "leafclass")
            {
                // Construct LeafClass - RegistryObjectList Element
                xmlDocResponse = ConstructLeafClassFolder(xmlDocAdHocQueryResponse, lstFolder);
            }
            else
            {
                //Default ObjectRef

                // Construct ObjectRef - RegistryObjectList Element
                xmlDocResponse = ConstructObjectRefFolder(xmlDocAdHocQueryResponse, lstFolder);
            }


            return(xmlDocResponse);
        }
        public override XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument   xmlDocResponse = null;
            XmlDocument   xmlDocAdHocQueryResponse;
            List <Folder> lstFolders = null;

            //string sSqlCode = string.Empty;
            //RegistryStoredQueryDataAccess objDAL = null;

            //Special Validations
            if (IsEmptyParametersExists(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "No parameters passed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            if (IsBothParametersPassed(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Both entryUUID and uniqueUUID parameters are passed. Only one parameter is allowed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            //Construct SQL Query
            //sSqlCode = base.ConstructDynamicSQLQuery(objStoredQueryRequest);

            //Get Folders
            lstFolders = GetFoldersByEntryUUIDOrUniqueID(objStoredQueryRequest.ParameterList);

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            if (objStoredQueryRequest.ReturnType.ToLower() == "leafclass")
            {
                //objDAL = new RegistryStoredQueryDataAccess();
                //lstFolders = objDAL.GetFoldersLeafClass(sSqlCode);

                // Construct LeafClass - RegistryObjectList Element
                xmlDocResponse = ConstructLeafClassRegistryObjectList(xmlDocAdHocQueryResponse, lstFolders);
            }
            else
            {
                //Default ObjectRef

                //List<string> lstEntryUUIds = null;
                //Execute SQL & Get Document IDs
                //objDAL = new RegistryStoredQueryDataAccess();
                //lstEntryUUIds = objDAL.GetFoldersObjectRef(sSqlCode);

                // Construct ObjectRef - RegistryObjectList Element
                xmlDocResponse = ConstructObjectRefRegistryObjectList(xmlDocAdHocQueryResponse, lstFolders);
            }


            return(xmlDocResponse);
        }
예제 #4
0
        public override XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument          xmlDocResponse = null;
            XmlDocument          xmlDocAdHocQueryResponse;
            List <DocumentEntry> lstDocumentEntries = null;
            string        patientUID            = null;
            string        availabilityStatus    = null;
            List <string> lstAvailabilityStatus = null;

            patientUID            = GetParameterValue(objStoredQueryRequest.ParameterList, "$XDSDocumentEntryPatientId");
            availabilityStatus    = GetParameterValue(objStoredQueryRequest.ParameterList, "$XDSDocumentEntryStatus");
            lstAvailabilityStatus = GetSqlInStatementValues(availabilityStatus);

            //Get DocumentEntries
            lstDocumentEntries = GetDocumentEntries(patientUID, lstAvailabilityStatus);

            if (lstDocumentEntries != null && lstDocumentEntries.Count > 0)
            {
                //Filter By DocumentEntryEventCodeList
                lstDocumentEntries = FilterByDocumentEntryEventCodeList(lstDocumentEntries, objStoredQueryRequest.ParameterList);

                //Filter By Code & CodeScheme
                lstDocumentEntries = FilterByCode(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryClassCode", "$XDSDocumentEntryClassCodeScheme");
                lstDocumentEntries = FilterByCode(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryPracticeSettingCode", "$XDSDocumentEntryPracticeSettingCodeScheme");
                lstDocumentEntries = FilterByCode(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryHealthcareFacilityTypeCode", "$XDSDocumentEntryHealthcareFacilityTypeCodeScheme");
                lstDocumentEntries = FilterByCode(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryConfidentialityCode", "$XDSDocumentEntryConfidentialityCodeScheme");
                lstDocumentEntries = FilterByCode(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryFormatCode", "$XDSDocumentEntryFormatCodeScheme");

                //Filter By Time
                lstDocumentEntries = FilterByTime(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryCreationTimeFrom", "$XDSDocumentEntryCreationTimeTo");
                lstDocumentEntries = FilterByTime(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryServiceStartTimeFrom", "$XDSDocumentEntryServiceStartTimeTo");
                lstDocumentEntries = FilterByTime(lstDocumentEntries, objStoredQueryRequest.ParameterList, "$XDSDocumentEntryServiceStopTimeFrom", "$XDSDocumentEntryServiceStopTimeTo");
            }

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            if (objStoredQueryRequest.ReturnType.ToLower() == "leafclass")
            {
                // Construct LeafClass - RegistryObjectList Element
                xmlDocResponse = ConstructLeafClassRegistryObjectList(xmlDocAdHocQueryResponse, lstDocumentEntries);
            }
            else
            {
                //Default ObjectRef

                // Construct ObjectRef - RegistryObjectList Element
                xmlDocResponse = ConstructObjectRefRegistryObjectList(xmlDocAdHocQueryResponse, lstDocumentEntries);
            }


            return(xmlDocResponse);
        }
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument xmlDocResponse = null;
            XmlDocument xmlDocAdHocQueryResponse;
            List <SubmissionSetDocumentFolder> lstSubmissionSetDocumentFolder = null;

            //Get Associations
            lstSubmissionSetDocumentFolder = GetAssociationsBySourceObjectOrTargetObject(objStoredQueryRequest.ParameterList);

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            xmlDocResponse = ConstructRegistryObjectList(xmlDocAdHocQueryResponse, lstSubmissionSetDocumentFolder);

            return(xmlDocResponse);
        }
예제 #6
0
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument          xmlDocResponse = null;
            XmlDocument          xmlDocAdHocQueryResponse;
            List <SubmissionSet> lstSubmissionSet = null;
            List <DocumentEntry> lstDocumentEntry = null;
            List <Folder>        lstFolder        = null;
            List <Association>   lstAssociation   = null;
            string patientUID          = null;
            string submissionSetStatus = null;
            string documentEntryStatus = null;
            string folderStatus        = null;
            string documentEntryUUIDs  = null;
            RegistryStoredQueryDataAccess objStoredQueryDAL = new RegistryStoredQueryDataAccess();

            patientUID          = base.RemoveSingleQuotes(GetParameterValue(objStoredQueryRequest.ParameterList, "$patientId"));
            submissionSetStatus = base.PrepareForSqlInStatement(GetParameterValue(objStoredQueryRequest.ParameterList, "$XDSSubmissionSetStatus"));
            documentEntryStatus = base.PrepareForSqlInStatement(GetParameterValue(objStoredQueryRequest.ParameterList, "$XDSDocumentEntryStatus"));
            folderStatus        = base.PrepareForSqlInStatement(GetParameterValue(objStoredQueryRequest.ParameterList, "$XDSFolderStatus"));

            //SubmissionSet
            lstSubmissionSet = objStoredQueryDAL.GetSubmissionSets(submissionSetStatus, patientUID);

            //DocumentEntry
            lstDocumentEntry   = objStoredQueryDAL.GetDocumentEntries(documentEntryStatus, patientUID);
            lstDocumentEntry   = GetDocumentEntries(lstDocumentEntry, objStoredQueryRequest);
            documentEntryUUIDs = GetDocumentEntryUUIDs(lstDocumentEntry);

            //Folders
            lstFolder = objStoredQueryDAL.GetFolders(folderStatus, patientUID);

            //Associations
            lstAssociation = objStoredQueryDAL.GetAssociations(documentEntryUUIDs, null);


            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            xmlDocResponse = ConstructRegistryObjectList(xmlDocAdHocQueryResponse, lstSubmissionSet, lstDocumentEntry, lstFolder, lstAssociation);

            return(xmlDocResponse);
        }
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument          xmlDocResponse = null;
            XmlDocument          xmlDocAdHocQueryResponse;
            List <DocumentEntry> lstDocumentEntries = null;

            //Special Validations
            if (base.IsEmptyParametersExists(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "No parameters passed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            if (base.IsBothParametersPassed(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Both entryUUID and uniqueUUID parameters are passed. Only one parameter is allowed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            //Get documents
            lstDocumentEntries = GetDocumentsByEntryUUIDOrUniqueID(objStoredQueryRequest.ParameterList);

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            if (objStoredQueryRequest.ReturnType.ToLower() == "leafclass")
            {
                // Construct LeafClass - RegistryObjectList Element
                xmlDocResponse = ConstructLeafClassRegistryObjectList(xmlDocAdHocQueryResponse, lstDocumentEntries);
            }
            else
            {
                //Default ObjectRef

                // Construct ObjectRef - RegistryObjectList Element
                xmlDocResponse = ConstructObjectRefRegistryObjectList(xmlDocAdHocQueryResponse, lstDocumentEntries);
            }


            return(xmlDocResponse);
        }
예제 #8
0
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument xmlDocResponse = null;
            string      sSqlCode       = string.Empty;
            XmlDocument xmlDocAdHocQueryResponse;
            List <GetSubmissionSetsRequest> lstGetSubmissionSetsRequest = null;
            List <GetSubmissionSetsRequest> lstSubmissionSetXml         = null;
            List <GetSubmissionSetsRequest> lstAssociationXml           = null;

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            lstGetSubmissionSetsRequest = GetSubmissionSetsByTargetObjects(objStoredQueryRequest.ParameterList);

            lstSubmissionSetXml = RemoveDuplicateGetSubmissionSets(lstGetSubmissionSetsRequest);

            lstAssociationXml = RemoveDuplicateAssociations(lstGetSubmissionSetsRequest);

            xmlDocResponse = ConstructRegistryObjectList(xmlDocAdHocQueryResponse, lstSubmissionSetXml, lstAssociationXml);

            return(xmlDocResponse);
        }
예제 #9
0
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument xmlDocResponse = null;
            XmlDocument xmlDocAdHocQueryResponse;
            RegistryStoredQueryDataAccess objStoredQueryDAL           = null;
            SubmissionSetAssociation      objSubmissionSetAssociation = null;
            List <Folder>        lstSubmissionSetFolders          = null;
            List <DocumentEntry> lstSubmissionSetDocumentEntry    = null;
            List <string>        lstSubmissionSetDocumentEntryIDs = null;
            List <string>        lstSubmissionSetFolderIDs        = null;
            List <string>        lstFolderDocumentEntryIds        = null;
            List <DocumentEntry> lstFolderDocumentEntry           = null;
            string documentEntryIDs = null;
            string folderIDs        = null;

            objStoredQueryDAL = new RegistryStoredQueryDataAccess();

            //Validate Parameters (Either EntryUUID or UniqueID has to be passed)
            if (base.IsEmptyParametersExists(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "No parameters passed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            if (base.IsBothParametersPassed(objStoredQueryRequest.ParameterList))
            {
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Both entryUUID and uniqueUUID parameters are passed. Only one parameter is allowed.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                return(xmlDocResponse);
            }

            //SubmissionSet & Association
            objSubmissionSetAssociation = GetSubmissionSetAndAssociation(objStoredQueryRequest);

            lstSubmissionSetDocumentEntryIDs = GetDocumentEntryIDs(objSubmissionSetAssociation.SubmissionSetDocumentFolders);
            lstSubmissionSetFolderIDs        = GetFolderIDs(objSubmissionSetAssociation.SubmissionSetDocumentFolders);

            //Documents directly associated to SubmissionSet
            documentEntryIDs = base.PrepareForSqlInStatement(lstSubmissionSetDocumentEntryIDs);

            if (!string.IsNullOrEmpty(documentEntryIDs))
            {
                lstSubmissionSetDocumentEntry = base.GetDocumentEntriesByIds(documentEntryIDs, objStoredQueryRequest);
            }

            //Folders directly associated to SubmissionSet
            folderIDs = base.PrepareForSqlInStatement(lstSubmissionSetFolderIDs);

            if (!string.IsNullOrEmpty(folderIDs))
            {
                lstSubmissionSetFolders = objStoredQueryDAL.GetFoldersByFolderIDs(folderIDs);

                //=========================================================================
                //Only association of Sub-Doc & Sub-Folder needs to returned
                //Folder-Doc should not be returned
                //Refer: http://groups.google.com/group/ihe-xds-implementors/browse_thread/thread/b9771865e01a674c/d3fef7b63d6a184c?lnk=gst&q=GetSubmissionSetAndContents#d3fef7b63d6a184c
                //List<SubmissionSetDocumentFolder> lstSSTDF = objStoredQueryDAL.GetAssociationsForFolderIDs(folderIDs);

                //if ((lstSSTDF != null) && (lstSSTDF.Count > 0))
                //{
                //    objSubmissionSetAssociation.SubmissionSetDocumentFolders.AddRange(lstSSTDF);

                //    lstFolderDocumentEntryIds = base.GetDocumentEntryIDs(lstSSTDF);
                //    documentEntryIDs = base.PrepareForSqlInStatement(lstFolderDocumentEntryIds);

                //    if (!string.IsNullOrEmpty(documentEntryIDs))
                //    {
                //        lstFolderDocumentEntry = base.GetDocumentEntries(documentEntryIDs, objStoredQueryRequest);

                //        if ((lstFolderDocumentEntry != null) && (lstFolderDocumentEntry.Count > 0))
                //            lstSubmissionSetDocumentEntry.AddRange(lstFolderDocumentEntry);
                //    }
                //}
                //=========================================================================
            }

            //Remove Duplicate Associations
            objSubmissionSetAssociation.SubmissionSetDocumentFolders = base.RemoveDuplicateSubmissionSetDocumentFolder(objSubmissionSetAssociation.SubmissionSetDocumentFolders);

            //Remove Duplicate DocumentEntries
            lstSubmissionSetDocumentEntry = base.RemoveDuplicateDocumentEntry(lstSubmissionSetDocumentEntry);

            //Filter Documents with Association
            objSubmissionSetAssociation.SubmissionSetDocumentFolders = FilterSubmissionSetDocumentFolders(objSubmissionSetAssociation.SubmissionSetDocumentFolders, lstSubmissionSetDocumentEntry);

            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            xmlDocResponse = ConstructRegistryObjectList(xmlDocAdHocQueryResponse, objSubmissionSetAssociation.SubmissionSets, objSubmissionSetAssociation.SubmissionSetDocumentFolders, lstSubmissionSetDocumentEntry, lstSubmissionSetFolders);

            return(xmlDocResponse);
        }
예제 #10
0
        public XmlDocument RegistryStoredQuery(XmlDocument xmlDocRequest, out StringDictionary atnaParameterValues)
        {
            XmlDocument     xmlDocResponse         = null;
            StoredQuery     objStoredQueryRequest  = null;
            StoredQuery     objStoredQueryDB       = null;
            StoredQueryBase objStoredQuery         = null;
            string          parameterName          = null;
            string          dependentParameterName = null;
            string          eventOutcomeIndicator  = "0";

            atnaParameterValues = new StringDictionary();

            try
            {
                //Construct the Request Stored Query Object
                objStoredQueryRequest = StoredQueryBase.ConstructStoredQuery(xmlDocRequest);

                //-------------------------------------------------------------------------------------
                //ATNA
                StoredQueryParameter queryParamPatientID = objStoredQueryRequest.ParameterList.Find(
                    delegate(StoredQueryParameter queryParameter)
                {
                    if (queryParameter != null && queryParameter.ParameterName != null && queryParameter.ParameterName == "$XDSDocumentEntryPatientId")
                    {
                        return(true);
                    }

                    return(false);
                }
                    );
                if (queryParamPatientID != null)
                {
                    atnaParameterValues.Add("$XDSPatient$", queryParamPatientID.ParameterValue);
                }

                XmlNode nodeAdhocQuery = xmlDocRequest.SelectSingleNode(@"//*[local-name()='AdhocQuery']");

                if (nodeAdhocQuery != null)
                {
                    atnaParameterValues.Add("$AdhocQuery$", nodeAdhocQuery.OuterXml);
                }

                //-------------------------------------------------------------------------------------

                objStoredQueryDB = GetStoredQueryDetails(objStoredQueryRequest.StoredQueryUniqueID, objStoredQueryRequest.ReturnType);


                #region "***********Validations****************"

                if (objStoredQueryDB == null)
                {
                    eventOutcomeIndicator = "8";
                    atnaParameterValues.Add("$EventIdentification.EventOutcomeIndicator$", eventOutcomeIndicator);

                    //Invalid Query ID
                    xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Invalid query id.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                    return(xmlDocResponse);
                }

                //Update the Request Parameters with Dependent Parameters
                UpdateDependentParameterName(objStoredQueryRequest.ParameterList, objStoredQueryDB.ParameterList);

                //Validate Repeating Parameter
                if (IsParameterRepeated(objStoredQueryRequest.ParameterList))
                {
                    eventOutcomeIndicator = "8";
                    atnaParameterValues.Add("$EventIdentification.EventOutcomeIndicator$", eventOutcomeIndicator);

                    //Parameter Repeating
                    xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Repeating parameter.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                    return(xmlDocResponse);
                }


                //Parameter Validation
                if (!IsRequiredQueryParameterExists(objStoredQueryRequest.ParameterList, objStoredQueryDB.ParameterList))
                {
                    eventOutcomeIndicator = "8";
                    atnaParameterValues.Add("$EventIdentification.EventOutcomeIndicator$", eventOutcomeIndicator);

                    //Required Parameter Missing
                    xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Required parameter missing.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                    return(xmlDocResponse);
                }

                //Validate Dependent Parameter
                if (!IsValidDependentParameterExists(objStoredQueryRequest.ParameterList, out parameterName, out dependentParameterName))
                {
                    eventOutcomeIndicator = "8";
                    atnaParameterValues.Add("$EventIdentification.EventOutcomeIndicator$", eventOutcomeIndicator);

                    //Required Parameter Missing
                    xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, string.Format("{0} parameter is specified but corresponding {1} parameter is not specified.", parameterName, dependentParameterName), GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                    return(xmlDocResponse);
                }

                //Validate Dependent Parameter Value Count
                if (!IsValidDependentParameterValueCount(objStoredQueryRequest.ParameterList, out parameterName, out dependentParameterName))
                {
                    eventOutcomeIndicator = "8";
                    atnaParameterValues.Add("$EventIdentification.EventOutcomeIndicator$", eventOutcomeIndicator);

                    //Required Parameter Missing
                    xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, string.Format("{0} parameter values does not have equivalent number of values in {1} parameter.", parameterName, dependentParameterName), GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);
                    return(xmlDocResponse);
                }

                #endregion

                //Merge the StoredQuery Request & DB details
                //we are left with only one StoredQuery Object with all the params & it's values
                objStoredQueryRequest = StoredQueryBase.UpdateParameterValues(objStoredQueryRequest, objStoredQueryDB);

                //Create concrete StoredQuery object based on query name
                objStoredQuery = StoredQueryBase.GetStoredQueryObject(objStoredQueryRequest.StoredQueryName);

                //Process Message & Construct Response Accordingly
                xmlDocResponse = objStoredQuery.ProcessQuery(objStoredQueryRequest);
            }
            catch
            {
                //Return Error Response
                xmlDocResponse = StoredQueryBase.ConstructStoredQueryErrorResponse(GlobalValues.CONST_RESPONSE_STATUS_TYPE_FAILURE, string.Empty, "Unexpected Registry Error.", GlobalValues.CONST_REGISTRYERROR_CODE_XDSRegistryError, GlobalValues.CONST_SEVERITY_TYPE_ERROR, string.Empty);

                eventOutcomeIndicator = "8";
            }

            atnaParameterValues.Add("$EventIdentification.EventOutcomeIndicator$", eventOutcomeIndicator);

            return(xmlDocResponse);
        }
예제 #11
0
        public static StoredQueryBase GetStoredQueryObject(string queryName)
        {
            StoredQueryBase objStoredQuery = null;
            string          queryNameLower = queryName.ToLower();

            switch (queryNameLower)
            {
            case "finddocuments":
                objStoredQuery = new FindDocuments();
                break;

            case "findsubmissionsets":
                objStoredQuery = new FindSubmissionSets();
                break;

            case "findfolders":
                objStoredQuery = new FindFolders();
                break;

            case "getall":
                objStoredQuery = new GetAll();
                break;

            case "getdocuments":
                objStoredQuery = new GetDocuments();
                break;

            case "getfolders":
                objStoredQuery = new GetFolders();
                break;

            case "getassociations":
                objStoredQuery = new GetAssociations();
                break;

            case "getdocumentsandassociations":
                objStoredQuery = new GetDocumentsAndAssociations();
                break;

            case "getsubmissionsets":
                objStoredQuery = new GetSubmissionSets();
                break;

            case "getsubmissionsetandcontents":
                objStoredQuery = new GetSubmissionSetAndContents();
                break;

            case "getfolderandcontents":
                objStoredQuery = new GetFolderAndContents();
                break;

            case "getfoldersfordocument":
                objStoredQuery = new GetFoldersForDocument();
                break;

            case "getrelateddocuments":
                objStoredQuery = new GetRelatedDocuments();
                break;
            }

            return(objStoredQuery);
        }
        public override XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument          xmlDocResponse   = null;
            List <SubmissionSet> lstSubmissionSet = null;
            string      patientUID          = null;
            string      submissionSetStatus = null;
            XmlDocument xmlDocAdHocQueryResponse;
            RegistryStoredQueryDataAccess objDAL = new RegistryStoredQueryDataAccess();

            //string sSqlCode = string.Empty;
            //List<string> lstEntryUUIDs = null;


            //Construct SQL Query
            //sSqlCode = base.ConstructDynamicSQLQuery(objStoredQueryRequest);

            patientUID          = base.RemoveSingleQuotes(GetParameterValue(objStoredQueryRequest.ParameterList, "$XDSSubmissionSetPatientId"));
            submissionSetStatus = base.PrepareForSqlInStatement(GetParameterValue(objStoredQueryRequest.ParameterList, "$XDSSubmissionSetStatus"));

            //Get SubmissionSets
            lstSubmissionSet = objDAL.GetSubmissionSets(submissionSetStatus, patientUID);

            //Get & Update SubmissionSet Author
            if (lstSubmissionSet != null && lstSubmissionSet.Count > 0)
            {
                lstSubmissionSet = UpdateSubmissionSetAuthor(lstSubmissionSet);

                //Filter based on SubmissionSet Author
                lstSubmissionSet = FilterByAuthor(lstSubmissionSet, objStoredQueryRequest.ParameterList);

                //Filter by SourceId
                lstSubmissionSet = FilterBySourceId(lstSubmissionSet, objStoredQueryRequest.ParameterList);

                //FilterByContentTypeCode
                lstSubmissionSet = FilterByContentTypeCode(lstSubmissionSet, objStoredQueryRequest.ParameterList);

                //FilterByContentSubmissionTime
                lstSubmissionSet = FilterByContentSubmissionTime(lstSubmissionSet, objStoredQueryRequest.ParameterList);
            }


            //Construct AdHocQueryResponse Element
            xmlDocAdHocQueryResponse = StoredQueryBase.ConstructAdHocQueryResponseElement(GlobalValues.CONST_RESPONSE_STATUS_TYPE_SUCCESS);

            if (objStoredQueryRequest.ReturnType.ToLower() == "leafclass")
            {
                //List<SubmissionSet> lstSubmissionSet = null;

                //lstSubmissionSet = objDAL.FindSubmissionSetLeafClass(sSqlCode);

                // Construct LeafClass - RegistryObjectList Element
                xmlDocResponse = ConstructLeafClassSubmissionSet(xmlDocAdHocQueryResponse, lstSubmissionSet);
            }
            else
            {
                //Default ObjectRef

                //Execute SQL & Get Document IDs
                //lstEntryUUIDs = objDAL.FindSubmissionSetObjectRef(sSqlCode);

                // Construct ObjectRef - RegistryObjectList Element
                xmlDocResponse = ConstructObjectRefSubmissionSet(xmlDocAdHocQueryResponse, lstSubmissionSet);
            }


            return(xmlDocResponse);
        }