Exemplo n.º 1
0
        private List <GetSubmissionSetsRequest> GetSubmissionSetsByTargetObjects(List <StoredQueryParameter> lstStoredQueryParameter)
        {
            List <GetSubmissionSetsRequest> lstGetSubmissionSetsRequest         = null;
            List <GetSubmissionSetsRequest> lstDistinctGetSubmissionSetsRequest = null;
            RegistryStoredQueryDataAccess   objStoredQueryDAL = null;
            string entryUUIDs = null;

            lstDistinctGetSubmissionSetsRequest = new List <GetSubmissionSetsRequest>();

            if (lstStoredQueryParameter[0].ParameterName == "$uuid")
            {
                //Prepare SQL IN Param Value
                entryUUIDs = PrepareForSqlInStatement(lstStoredQueryParameter[0].ParameterValue);
            }


            objStoredQueryDAL           = new RegistryStoredQueryDataAccess();
            lstGetSubmissionSetsRequest = objStoredQueryDAL.GetSubmissionSetsByTargetObjects(entryUUIDs);

            if (lstGetSubmissionSetsRequest == null)
            {
                return(lstGetSubmissionSetsRequest);
            }

            return(lstGetSubmissionSetsRequest);
        }
Exemplo n.º 2
0
        private List <Association> GetAssociations(List <StoredQueryParameter> lstStoredQueryParameter)
        {
            List <Association>            lstAssociations   = null;
            RegistryStoredQueryDataAccess objStoredQueryDAL = null;
            string paramValue = null;
            string entryUUID  = null;
            string uniqueID   = null;

            //Prepare SQL IN Param Value
            paramValue = PrepareForSqlInStatement(lstStoredQueryParameter[0].ParameterValue);

            if (lstStoredQueryParameter[0].ParameterName == "$XDSDocumentEntryEntryUUID")
            {
                entryUUID = paramValue;
            }
            else
            {
                uniqueID = paramValue;
            }

            objStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstAssociations   = objStoredQueryDAL.GetAssociations(entryUUID, uniqueID);

            return(lstAssociations);
        }
Exemplo n.º 3
0
        protected List <Folder> GetFoldersByEntryUUIDOrUniqueID(List <StoredQueryParameter> lstStoredQueryParams)
        {
            List <Folder> lstFolders = null;
            RegistryStoredQueryDataAccess objRegistryStoredQueryDAL = null;
            string entryUUID = null;
            string uniqueID  = null;

            for (int count = 0; count < lstStoredQueryParams.Count; count++)
            {
                if (lstStoredQueryParams[count].ParameterName == "$XDSFolderEntryUUID")
                {
                    entryUUID = PrepareForSqlInStatement(lstStoredQueryParams[count].ParameterValue);
                }
                else if (lstStoredQueryParams[count].ParameterName == "$XDSFolderUniqueId")
                {
                    uniqueID = PrepareForSqlInStatement(lstStoredQueryParams[count].ParameterValue);
                }
            }

            objRegistryStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstFolders = objRegistryStoredQueryDAL.GetFoldersByEntryUUIDOrUniqueID(entryUUID, uniqueID);
            objRegistryStoredQueryDAL = null;

            return(lstFolders);
        }
Exemplo n.º 4
0
        protected List <DocumentEntry> GetDocumentsByEntryUUIDOrUniqueID(List <StoredQueryParameter> lstStoredQueryParams)
        {
            List <DocumentEntry>          lstDocumentEntry          = null;
            RegistryStoredQueryDataAccess objRegistryStoredQueryDAL = null;
            string entryUUIDs = null;
            string uniqueIDs  = null;

            for (int count = 0; count < lstStoredQueryParams.Count; count++)
            {
                if (lstStoredQueryParams[count].ParameterName == "$XDSDocumentEntryEntryUUID")
                {
                    entryUUIDs = PrepareForSqlInStatement(lstStoredQueryParams[count].ParameterValue);
                }
                else if (lstStoredQueryParams[count].ParameterName == "$XDSDocumentEntryUniqueId")
                {
                    uniqueIDs = PrepareForSqlInStatement(lstStoredQueryParams[count].ParameterValue);
                }
            }

            objRegistryStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstDocumentEntry          = objRegistryStoredQueryDAL.GetDocuments(entryUUIDs, uniqueIDs);
            objRegistryStoredQueryDAL = null;

            return(lstDocumentEntry);
        }
Exemplo n.º 5
0
        private SubmissionSetAssociation GetSubmissionSetAndAssociation(StoredQuery objStoredQueryRequest)
        {
            SubmissionSetAssociation      objSubmissionSetAssociation = null;
            RegistryStoredQueryDataAccess objDAL = null;
            string entryUUID = null;
            string uniqueID  = null;

            for (int count = 0; count < objStoredQueryRequest.ParameterList.Count; count++)
            {
                if (objStoredQueryRequest.ParameterList[count].ParameterName == "$XDSSubmissionSetEntryUUID")
                {
                    entryUUID = base.RemoveSingleQuotes(objStoredQueryRequest.ParameterList[count].ParameterValue);
                }
                else if (objStoredQueryRequest.ParameterList[count].ParameterName == "$XDSSubmissionSetUniqueId")
                {
                    uniqueID = base.RemoveSingleQuotes(objStoredQueryRequest.ParameterList[count].ParameterValue);
                }
            }

            objDAL = new RegistryStoredQueryDataAccess();
            objSubmissionSetAssociation = objDAL.GetSubmissionSetAndAssociation(entryUUID, uniqueID);

            if ((objSubmissionSetAssociation != null) && (objSubmissionSetAssociation.SubmissionSets != null))
            {
                objSubmissionSetAssociation.SubmissionSets = base.RemoveDuplicateSubmissionSet(objSubmissionSetAssociation.SubmissionSets);
            }

            return(objSubmissionSetAssociation);
        }
        private List <Folder> GetFolders(List <StoredQueryParameter> lstStoredQueryParameter)
        {
            List <Folder> lstFolder = null;
            RegistryStoredQueryDataAccess objRegistryStoredQueryDAL = null;
            string availabilityStatusList = null;
            string patientUID             = null;

            for (int count = 0; count < lstStoredQueryParameter.Count; count++)
            {
                if (lstStoredQueryParameter[count].ParameterName == "$XDSFolderStatus")
                {
                    availabilityStatusList = PrepareForSqlInStatement(lstStoredQueryParameter[count].ParameterValue);
                }
                else if (lstStoredQueryParameter[count].ParameterName == "$XDSFolderPatientId")
                {
                    patientUID = lstStoredQueryParameter[count].ParameterValue;
                }
            }

            objRegistryStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstFolder = objRegistryStoredQueryDAL.GetFolders(availabilityStatusList, patientUID);
            objRegistryStoredQueryDAL = null;

            return(lstFolder);
        }
Exemplo n.º 7
0
        private List <SubmissionSetDocumentFolder> GetSubmissionSetDocumentFolderDetails(List <StoredQueryParameter> lstStoredQueryParameter)
        {
            List <SubmissionSetDocumentFolder> lstSubmissionSetDocumentFolder = null;
            RegistryStoredQueryDataAccess      objStoredQueryDAL = null;
            string paramValue = null;
            string entryUUID  = null;
            string uniqueID   = null;

            //Prepare SQL IN Param Value
            paramValue = PrepareForSqlInStatement(lstStoredQueryParameter[0].ParameterValue);

            if (lstStoredQueryParameter[0].ParameterName == "$XDSDocumentEntryEntryUUID")
            {
                entryUUID = paramValue;
            }
            else
            {
                uniqueID = paramValue;
            }

            objStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstSubmissionSetDocumentFolder = objStoredQueryDAL.GetSubmissionSetDocumentFolderByEntryUUIDorUniqueID(entryUUID, uniqueID);

            return(lstSubmissionSetDocumentFolder);
        }
Exemplo n.º 8
0
        private List <SubmissionSetDocumentFolder> GetSubmissionSetDocumentFolderDetails(List <StoredQueryParameter> lstStoredQueryParameter)
        {
            List <SubmissionSetDocumentFolder> lstSubmissionSetDocumentFolder = null;
            RegistryStoredQueryDataAccess      objStoredQueryDAL = null;
            string paramValue       = null;
            string entryUUID        = null;
            string uniqueID         = null;
            string associationTypes = null;

            for (int count = 0; count < lstStoredQueryParameter.Count; count++)
            {
                //Prepare SQL IN Param Value
                paramValue = PrepareForSqlInStatement(lstStoredQueryParameter[count].ParameterValue);

                if (lstStoredQueryParameter[count].ParameterName == "$XDSDocumentEntryEntryUUID")
                {
                    entryUUID = paramValue;
                }
                else if (lstStoredQueryParameter[count].ParameterName == "$XDSDocumentEntryUniqueId")
                {
                    uniqueID = paramValue;
                }
                else if (lstStoredQueryParameter[count].ParameterName == "$AssociationTypes")
                {
                    associationTypes = PrepareForSqlInStatement(paramValue);
                }
            }

            objStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstSubmissionSetDocumentFolder = objStoredQueryDAL.GetSubmissionSetDocumentFolderByEntryUUIDorUniqueID(entryUUID, uniqueID, associationTypes);

            return(lstSubmissionSetDocumentFolder);
        }
Exemplo n.º 9
0
        private StoredQuery GetStoredQueryDetails(string queryUUID, string returnType)
        {
            StoredQuery objStoredQuery = null;

            //Call DAL & get all the query parameters for the given query uuid
            RegistryStoredQueryDataAccess objStoredQueryDAL = new RegistryStoredQueryDataAccess();

            objStoredQuery = objStoredQueryDAL.GetStoredQueryDetails(queryUUID, returnType);

            return(objStoredQuery);
        }
Exemplo n.º 10
0
        private List <Folder> GetFoldersByFolderIDs(List <string> lstFolderIDs)
        {
            string[]      arrFolderIDs = null;
            string        folderIDs    = null;
            List <Folder> lstFolders   = null;
            RegistryStoredQueryDataAccess objRegistryStoredQueryDAL = null;

            arrFolderIDs = lstFolderIDs.ToArray();
            folderIDs    = string.Join(",", arrFolderIDs);

            objRegistryStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstFolders = objRegistryStoredQueryDAL.GetFoldersByFolderIDs(folderIDs);
            objRegistryStoredQueryDAL = null;

            return(lstFolders);
        }
        private List <SubmissionSet> UpdateSubmissionSetAuthor(List <SubmissionSet> lstSubmissionSet)
        {
            RegistryStoredQueryDataAccess storedQueryDAL = null;

            if (lstSubmissionSet == null)
            {
                return(lstSubmissionSet);
            }

            storedQueryDAL = new RegistryStoredQueryDataAccess();

            foreach (SubmissionSet submissionSet in lstSubmissionSet)
            {
                submissionSet.SubmissionAuthor = storedQueryDAL.GetSubmissionSetAuthorDetails(submissionSet.ID);
            }


            return(lstSubmissionSet);
        }
Exemplo n.º 12
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);
        }
        protected List <SubmissionSetDocumentFolder> GetAssociationsBySourceObjectOrTargetObject(List <StoredQueryParameter> lstStoredQueryParams)
        {
            List <SubmissionSetDocumentFolder> lstAssociations           = null;
            RegistryStoredQueryDataAccess      objRegistryStoredQueryDAL = null;
            string uuids = null;

            for (int count = 0; count < lstStoredQueryParams.Count; count++)
            {
                if (lstStoredQueryParams[count].ParameterName == "$uuid")
                {
                    uuids = PrepareForSqlInStatement(lstStoredQueryParams[count].ParameterValue);
                }
            }

            objRegistryStoredQueryDAL = new RegistryStoredQueryDataAccess();
            lstAssociations           = objRegistryStoredQueryDAL.GetAssociations(uuids);
            objRegistryStoredQueryDAL = null;

            return(lstAssociations);
        }
Exemplo n.º 14
0
        public override System.Xml.XmlDocument ProcessQuery(StoredQuery objStoredQueryRequest)
        {
            XmlDocument xmlDocResponse = null;
            XmlDocument xmlDocAdHocQueryResponse;
            List <SubmissionSetDocumentFolder> lstSubmissionSetDocumentFolders = null;
            List <DocumentEntry> lstDocumentEntry    = null;
            List <string>        lstDocumentEntryIDs = null;
            string documentEntryIDs = 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);

            //Document Entry
            lstDocumentEntryIDs = base.GetDocumentEntryIDs(lstSubmissionSetDocumentFolders);
            documentEntryIDs    = base.PrepareForSqlInStatement(lstDocumentEntryIDs);
            RegistryStoredQueryDataAccess objRegistryStoredQueryDAL = new RegistryStoredQueryDataAccess();

            lstDocumentEntry = objRegistryStoredQueryDAL.GetDocumentEntriesByDocumentEntryIDs(documentEntryIDs);


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

            xmlDocResponse = ConstructRegistryObjectList(xmlDocAdHocQueryResponse, lstDocumentEntry, lstSubmissionSetDocumentFolders);

            return(xmlDocResponse);
        }
        private List <SubmissionSetDocumentFolder> GetAssociationsForFolderIDs(List <Folder> lstFolders)
        {
            string folderIDs = null;
            List <SubmissionSetDocumentFolder> lstSubmissionSetDocumentFolders = null;
            RegistryStoredQueryDataAccess      objRegistryStoredQueryDAL       = null;

            for (int count = 0; count < lstFolders.Count; count++)
            {
                if (count > 0)
                {
                    folderIDs += ",";
                }

                folderIDs = lstFolders[count].FolderID.ToString();
            }

            objRegistryStoredQueryDAL       = new RegistryStoredQueryDataAccess();
            lstSubmissionSetDocumentFolders = objRegistryStoredQueryDAL.GetAssociationsForFolderIDs(folderIDs);
            objRegistryStoredQueryDAL       = null;

            return(lstSubmissionSetDocumentFolders);
        }
Exemplo n.º 16
0
        protected List <DocumentEntry> GetDocumentEntries(string patientUID, List <string> lstAvailabilityStatus)
        {
            List <DocumentEntry>          lstDocumentEntry = null;
            RegistryStoredQueryDataAccess storedQueryDAL   = null;
            string availabilityStatus = null;

            storedQueryDAL = new RegistryStoredQueryDataAccess();

            availabilityStatus = PrepareForSqlInStatement(lstAvailabilityStatus);
            lstDocumentEntry   = storedQueryDAL.GetDocumentEntries(availabilityStatus, patientUID);

            if ((lstDocumentEntry == null) || (lstDocumentEntry.Count == 0))
            {
                return(lstDocumentEntry);
            }

            foreach (DocumentEntry documentEntry in lstDocumentEntry)
            {
                documentEntry.EventCodeList = storedQueryDAL.GetDocumentEntryEventCodeList(documentEntry.ID);
            }

            return(lstDocumentEntry);
        }
        private List <Folder> FilterResults(List <StoredQueryParameter> lstStoredQueryParameter, List <Folder> lstFolder)
        {
            RegistryStoredQueryDataAccess registryStoredQueryDAL = new RegistryStoredQueryDataAccess();
            List <Folder> lstFolderFiltered    = new List <Folder>();
            string        lastUpdateTimeFrom   = null;
            string        lastUpdateTimeTo     = null;
            string        folderCodeList       = null;
            string        folderCodeListScheme = null;

            //If no filter is passed
            lstFolderFiltered = lstFolder;

            lastUpdateTimeFrom   = GetParameterValue(lstStoredQueryParameter, "$XDSFolderLastUpdateTimeFrom");
            lastUpdateTimeTo     = GetParameterValue(lstStoredQueryParameter, "$XDSFolderLastUpdateTimeTo");
            folderCodeList       = GetParameterValue(lstStoredQueryParameter, "$XDSFolderCodeList");
            folderCodeListScheme = GetParameterValue(lstStoredQueryParameter, "$XDSFolderCodeListScheme");



            if ((folderCodeList != null) && (folderCodeListScheme != null))
            {
                List <FolderCodeList> lstFolderCodeList = null;
                List <string>         lstFolderIDs      = null;
                string folderIDs = null;

                folderCodeList       = PrepareForSqlInStatement(folderCodeList);
                folderCodeListScheme = PrepareForSqlInStatement(folderCodeListScheme);

                lstFolderIDs = GetFolderIDs(lstFolderFiltered);
                folderIDs    = PrepareForSqlInStatement(lstFolderIDs);

                lstFolderCodeList = registryStoredQueryDAL.GetFolderCodeListByFolderIDs(folderIDs, folderCodeList, folderCodeListScheme);

                lstFolderIDs = GetFolderIDs(lstFolderCodeList);
                folderIDs    = PrepareForSqlInStatement(lstFolderIDs);

                //Find & Assign matching codelist's
                if (lstFolderCodeList != null)
                {
                    lstFolderFiltered = lstFolderFiltered.FindAll(
                        delegate(Folder folder)
                    {
                        if (folderIDs.Contains(folder.FolderID.ToString()))
                        {
                            return(true);
                        }

                        return(false);
                    }
                        );
                }
            }


            if ((lastUpdateTimeFrom != null) && (lastUpdateTimeTo != null))
            {
                lstFolderFiltered = lstFolderFiltered.FindAll(
                    delegate(Folder folder)
                {
                    if ((folder.LastUpdateTime >= DateTime.Parse(lastUpdateTimeFrom)) &&
                        (folder.LastUpdateTime < DateTime.Parse(lastUpdateTimeTo)))
                    {
                        return(true);
                    }

                    return(false);
                }
                    );
            }
            else if ((lastUpdateTimeFrom != null) && (lastUpdateTimeTo == null))
            {
                lstFolderFiltered = lstFolderFiltered.FindAll(
                    delegate(Folder folder)
                {
                    if (folder.LastUpdateTime >= DateTime.Parse(lastUpdateTimeFrom))
                    {
                        return(true);
                    }

                    return(false);
                }
                    );
            }
            else if ((lastUpdateTimeFrom == null) && (lastUpdateTimeTo != null))
            {
                lstFolderFiltered = lstFolderFiltered.FindAll(
                    delegate(Folder folder)
                {
                    if (folder.LastUpdateTime < DateTime.Parse(lastUpdateTimeTo))
                    {
                        return(true);
                    }

                    return(false);
                }
                    );
            }


            return(lstFolderFiltered);
        }
Exemplo n.º 18
0
        protected List <DocumentEntry> GetDocumentEntriesByIds(string documentEntryIDs, StoredQuery objStoredQueryRequest)
        {
            List <DocumentEntry> lstFilteredDocumentEntryObjects = new List <DocumentEntry>();
            List <DocumentEntry> lstDocumentEntries = null;
            List <string>        lstEntryUUIDs      = new List <string>();
            DocumentEntry        objDocumentEntry   = null;

            string[] arrConfidentialityCodes = null;
            string[] arrFormatCodes          = null;

            RegistryStoredQueryDataAccess objStoredQueryDAL = new RegistryStoredQueryDataAccess();

            lstDocumentEntries = objStoredQueryDAL.GetDocumentEntriesByDocumentEntryIDs(documentEntryIDs);

            lstDocumentEntries = RemoveDuplicateDocumentEntry(lstDocumentEntries);

            arrConfidentialityCodes = GetSQLINParameterValues(objStoredQueryRequest, "$XDSDocumentEntryConfidentialityCode");
            arrFormatCodes          = GetSQLINParameterValues(objStoredQueryRequest, "$XDSDocumentEntryFormatCode");

            //No filter condition specified - just return all the document entries
            if ((arrConfidentialityCodes == null) && (arrFormatCodes == null))
            {
                return(lstDocumentEntries);
            }

            //Add Matching Confidentiality Codes
            if (arrConfidentialityCodes != null)
            {
                for (int count = 0; count < arrConfidentialityCodes.Length; count++)
                {
                    objDocumentEntry = lstDocumentEntries.Find(
                        delegate(DocumentEntry documentEntry)
                    {
                        if (documentEntry.ConfidentialityCode == null)
                        {
                            return(false);
                        }

                        if (documentEntry.ConfidentialityCode.Value == arrConfidentialityCodes[count])
                        {
                            return(true);
                        }

                        return(false);
                    }
                        );

                    if (objDocumentEntry != null)
                    {
                        lstEntryUUIDs.Add(objDocumentEntry.EntryUUID);
                    }
                }
            }

            //Add Matching Format Codes
            if (arrFormatCodes != null)
            {
                for (int count = 0; count < arrFormatCodes.Length; count++)
                {
                    objDocumentEntry = lstDocumentEntries.Find(
                        delegate(DocumentEntry documentEntry)
                    {
                        if (documentEntry.FormatCode == null)
                        {
                            return(false);
                        }

                        if (documentEntry.FormatCode.Value == arrFormatCodes[count])
                        {
                            return(true);
                        }

                        return(false);
                    }
                        );

                    if ((objDocumentEntry != null) && (!lstEntryUUIDs.Contains(objDocumentEntry.EntryUUID)))
                    {
                        lstEntryUUIDs.Add(objDocumentEntry.EntryUUID);
                    }
                }
            }

            //Merge Filtered DocumentEntry Objects
            for (int count = 0; count < lstEntryUUIDs.Count; count++)
            {
                objDocumentEntry = lstDocumentEntries.Find(
                    delegate(DocumentEntry documentEntry)
                {
                    if (documentEntry.EntryUUID == lstEntryUUIDs[count])
                    {
                        return(true);
                    }

                    return(false);
                }
                    );

                if (objDocumentEntry != null)
                {
                    lstFilteredDocumentEntryObjects.Add(objDocumentEntry);
                }
            }

            return(lstFilteredDocumentEntryObjects);
        }
Exemplo n.º 19
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);
        }
        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);
        }