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); }
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); }