public void Get(long addressID) { SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_address_addressLines_get"; sp.Parameters.Add("@addressID", SqlDbType.BigInt); sp.Parameters.SetLong("@addressID", addressID); SqlDataReaderAccessor reader = sp.ExecuteReader(); try { while (reader.Read()) { Add( reader.GetString("addressLine"), reader.GetString("keyName"), reader.GetString("keyValue")); } } finally { reader.Close(); } }
public void Get() { Debug.Enter(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_operator_get"; sp.Parameters.Add("@operatorKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromString("@operatorKey", OperatorNodeID); SqlDataReaderAccessor reader = sp.ExecuteReader(); try { if (reader.Read()) { OperatorStatus = (OperatorStatus)reader.GetShort("operatorStatusID"); Name = reader.GetString("name"); SoapReplicationURL = reader.GetString("soapReplicationURL"); CertIssuerName = reader.GetString("certIssuer"); CertSubjectName = reader.GetString("certSubject"); Certificate = reader.GetBinary("certificate"); } } finally { reader.Close(); } Debug.Leave(); }
public void Get(string fromKey, string toKey) { SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_businessEntity_assertions_get"; sp.Parameters.Add("@fromKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@toKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@completionStatus", SqlDbType.Int); sp.Parameters.SetGuidFromString("@fromKey", fromKey); sp.Parameters.SetGuidFromString("@toKey", toKey); sp.Parameters.SetInt("@completionStatus", (int)CompletionStatusType.Complete); SqlDataReaderAccessor reader = sp.ExecuteReader(); try { while (reader.Read()) { KeyedReferences.Add( reader.GetString("keyName"), reader.GetString("keyValue"), reader.GetKeyFromGuid("tModelKey")); } } finally { reader.Close(); } }
public void Read(SqlDataReaderAccessor reader) { while (reader.Read()) { Add(reader.GetString("isoLangCode"), reader.GetString("description")); } }
public void Read(SqlDataReaderAccessor reader) { while (reader.Read()) { Add(reader.GetString("keyName"), reader.GetString("keyValue"), reader.GetKeyFromGuid("tModelKey")); } }
public void Read(SqlDataReaderAccessor reader) { const int UseTypeIndex = 0; const int EmailIndex = 1; while (reader.Read()) { // // Construct a new Email from the data in this row // this.Add(reader.GetString(EmailIndex), reader.GetString(UseTypeIndex)); } }
public void Get() { Debug.Enter(); // // Retrieve the taxonomy // SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_taxonomy_get"); sp.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier); sp.Parameters.Add("@flag", SqlDbType.Int, ParameterDirection.InputOutput); sp.Parameters.SetGuidFromKey("@tModelKey", tModelKey); sp.Parameters.SetNull("@flag"); sp.ExecuteScalar(); // // Set the flag value // CategorizationSchemeFlag = sp.Parameters.GetInt("@flag"); // // Retrieve the taxonomy values // CategoryValues.Clear(); SqlStoredProcedureAccessor sp2 = new SqlStoredProcedureAccessor("net_taxonomyValues_get"); sp2.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier); sp2.Parameters.SetGuidFromKey("@tModelKey", tModelKey); SqlDataReaderAccessor reader = sp2.ExecuteReader(); try { while (reader.Read()) { CategoryValues.Add(reader.GetString("keyName"), reader.GetString("keyValue"), reader.GetString("parentKeyValue"), ((reader.GetInt("valid") == 1) ? true : false)); } } finally { reader.Close(); } Debug.Leave(); }
public static string BusinessName(string businessKey) { string name = null; Debug.Enter(); SqlCommand cmd = new SqlCommand("net_businessEntity_names_get", ConnectionManager.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; cmd.Transaction = ConnectionManager.GetTransaction(); cmd.Parameters.Add(new SqlParameter("@businessKey", SqlDbType.UniqueIdentifier)).Direction = ParameterDirection.Input; SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters); paramacc.SetGuidFromString("@businessKey", businessKey); SqlDataReaderAccessor reader = new SqlDataReaderAccessor(cmd.ExecuteReader()); try { if (reader.Read()) { name = reader.GetString("name"); } } finally { reader.Close(); } Debug.Leave(); return(name); }
public HighWaterMarkDetail Get() { HighWaterMarkDetail detail = new HighWaterMarkDetail(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_highWaterMarks_get"; SqlDataReaderAccessor reader = sp.ExecuteReader(); try { while (reader.Read()) { detail.HighWaterMarks.Add( reader.GetString("operatorKey"), reader.GetLong("USN")); } } finally { reader.Close(); } return(detail); }
public void Read(SqlDataReaderAccessor reader) { const int UseTypeIndex = 0; const int PhoneIndex = 1; // // Phones for this contact will be contained in the resultset // while (reader.Read()) { // // construct a new contact from the data in this row, fully populate contact and add to collection // this.Add(reader.GetString(PhoneIndex), reader.GetString(UseTypeIndex)); } }
public void Read(SqlDataReaderAccessor reader) { if (1 == Context.ApiVersionMajor) { if (reader.Read()) { Add(null, reader.GetString("name")); } } else { while (reader.Read()) { Add(reader.GetString("isoLangCode"), reader.GetString("name")); } } }
public void Get(bool activeOperatorsOnly) { SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_operators_get"; SqlDataReaderAccessor reader = sp.ExecuteReader(); try { this.Clear(); while (reader.Read()) { OperatorStatus operatorStatus = (OperatorStatus)reader.GetShort("operatorStatusID"); string name = reader.GetString("name"); if (!activeOperatorsOnly || OperatorStatus.New == operatorStatus || OperatorStatus.Normal == operatorStatus) { this.Add( reader.GetGuidString("operatorKey"), operatorStatus, name, reader.GetString("soapReplicationURL")); } else { Debug.Write( SeverityType.Info, CategoryType.Replication, String.Format( "Removing operator '{0}' with status '{1}' from list of replication operators", name, operatorStatus.ToString())); } } } finally { reader.Close(); } }
public void Read(SqlDataReaderAccessor reader) { const int UseTypeIndex = 0; const int UrlIndex = 1; // // The discoveryUrls will be contained in the result set // while (reader.Read()) { string useType = reader.GetString(UseTypeIndex); if (null == useType) { useType = ""; } Add(reader.GetString(UrlIndex), useType); } }
public ArrayList Read(SqlDataReaderAccessor reader) { const int ContactIdIndex = 0; const int UseTypeIndex = 1; const int PersonNameIndex = 2; ArrayList contactIds = new ArrayList(); // // The contacts will be contained in the result set // while (reader.Read()) { // // construct a new contact from the data in this row, fully populate contact and add to collection // contactIds.Add(reader.GetInt(ContactIdIndex)); Add(new Contact(reader.GetString(PersonNameIndex), reader.GetString(UseTypeIndex))); } return(contactIds); }
public void GetParents() { Parents = new CategoryValueCollection(); SqlDataReader rdr = GetValues(RelationType.Parent); try { SqlDataReaderAccessor dracc = new SqlDataReaderAccessor(rdr); while (rdr.Read()) { Parents.Add(dracc.GetString(KeyNameIndex), dracc.GetString(KeyValueIndex), dracc.GetString(ParentKeyValueIndex), (1 == dracc.GetInt(IsValidIndex))); } } finally { rdr.Close(); } }
public void Get(long addressID) { SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_address_addressLines_get"; sp.Parameters.Add("@addressID", SqlDbType.BigInt); sp.Parameters.SetLong("@addressID", addressID); // // Run the stored procedure // SqlDataReaderAccessor reader = sp.ExecuteReader(); try { if (1 == Context.ApiVersionMajor) { while (reader.Read()) { AddressLines.Add(reader.GetString("addressLine")); } } else { while (reader.Read()) { AddressLines.Add( reader.GetString("addressLine"), reader.GetString("keyName"), reader.GetString("keyValue")); } } } finally { reader.Close(); } }
/// <summary> /// Use this function to populate a ResultsList instance with raw values from the database. /// The results from the database must be returned in the following order: /// /// businessName /// businessKey /// serviceName /// serviceKey /// /// ParseResults will use indexes to read these values from the SqlDataReaderAccessor so this /// order must be maintained from the database. /// </summary> /// <param name="values">Reader returned from the database.</param> /// <returns></returns> public int ParseResults(SqlDataReaderAccessor values) { results = new ArrayList(); string currentBusinessName = null; string lastBusinessName = null; BusinessResultInfo businessInfo = new BusinessResultInfo(); while (values.Read()) { currentBusinessName = values.GetString(0); ServiceResultInfo serviceInfo = new ServiceResultInfo(); serviceInfo.serviceName = values.GetString(2); serviceInfo.serviceKey = values.GetString(3); if (null != lastBusinessName && false == lastBusinessName.Equals(currentBusinessName)) { results.Add(businessInfo); businessInfo = new BusinessResultInfo(); } businessInfo.businessName = currentBusinessName; businessInfo.serviceResultInfos.Add(serviceInfo); lastBusinessName = currentBusinessName; } // // Add our last one. // if (businessInfo.serviceResultInfos.Count > 0) { results.Add(businessInfo); } return(results.Count); }
public void Get(RelationshipQualifier[] relations) { if (null != KeyValue) { // // The request can ask for Root stuff with just the TModelKey // SqlDataReader rdr = GetValues(RelationType.Current); try { SqlDataReaderAccessor dracc = new SqlDataReaderAccessor(rdr); if (rdr.Read()) { this.KeyName = dracc.GetString(KeyNameIndex); this.IsValid = (1 == dracc.GetInt(IsValidIndex)); } else { throw new UDDIException(UDDI.ErrorType.E_invalidValue, "UDDI_ERROR_INVALIDVALUE_VALUENOTFOUND"); } } finally { rdr.Close(); } } if (null != relations) { foreach (RelationshipQualifier rq in relations) { switch (rq) { case RelationshipQualifier.root: GetRoots(); break; case RelationshipQualifier.child: GetChildren(); break; case RelationshipQualifier.parent: GetParents(); break; } } } }
public ArrayList Read(SqlDataReaderAccessor reader) { ArrayList addressIDs = new ArrayList(); if (1 == Context.ApiVersionMajor) { while (reader.Read()) { addressIDs.Add(reader.GetLong("addressID")); Add(reader.GetString("sortCode"), reader.GetString("useType")); } } else { while (reader.Read()) { addressIDs.Add(reader.GetLong("addressID")); Add(reader.GetString("sortCode"), reader.GetString("useType"), reader.GetKeyFromGuid("tModelKey")); } } return(addressIDs); }
protected static OperatorNodeCollection GetOperators(bool filter, int status) { OperatorNodeCollection operators = new OperatorNodeCollection(); SqlStoredProcedureAccessor sp = null; SqlDataReaderAccessor data = null; try { sp = new SqlStoredProcedureAccessor("UI_operatorsList_get"); if (filter && -1 != status) { sp.Parameters.Add("@StatusID", SqlDbType.TinyInt); sp.Parameters.SetInt("@StatusID", status); } data = sp.ExecuteReader(); while (data.Read()) { operators.Add(data.GetString("OperatorKey"), (OperatorStatus)data.GetInt("OperatorStatusID"), data.GetString("Name"), data.GetString("soapReplicationUrl")); } } finally { if (null != data) { data.Close(); } if (null != sp) { sp.Close(); } } return(operators); }
static string GetPUIDForBusinessEntity(string businessKey) { SqlStoredProcedureAccessor puidSP = new SqlStoredProcedureAccessor(); puidSP.ProcedureName = "net_getPUIDForBusinessEntity"; puidSP.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier); puidSP.Parameters.SetGuidFromString("@businessKey", businessKey); SqlDataReaderAccessor reader = puidSP.ExecuteReader(); string puid = ""; try { reader.Read(); puid = reader.GetString(0); } finally { reader.Close(); } return(puid); }
public void Get() { Debug.Enter(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "UI_getPublisher"; sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID); sp.Parameters.SetString("@PUID", Puid); SqlDataReaderAccessor reader = sp.ExecuteReader(); Exists = false; try { if (reader.Read()) { int flag; IsoLangCode = reader.GetString(1); Name = reader.GetString(2); Email = reader.GetString(3); Phone = reader.GetString(4); CompanyName = reader.GetString(5); AltPhone = reader.GetString(6); AddressLine1 = reader.GetString(7); AddressLine2 = reader.GetString(8); City = reader.GetString(9); StateProvince = reader.GetString(10); PostalCode = reader.GetString(11); Country = reader.GetString(12); flag = reader.GetInt(13); SecurityToken = reader.GetGuidString(14); TrackPassport = (0x00 == (flag & 0x02)); Validated = (0x01 == (flag & 0x01)); Exists = true; } } finally { reader.Close(); } Debug.Leave(); }
public void Get(int parentID, EntityType parentType) { Debug.Enter(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); switch (parentType) { case EntityType.Contact: sp.ProcedureName = "net_contact_descriptions_get"; sp.Parameters.Add("@contactID", SqlDbType.BigInt); sp.Parameters.SetLong("@contactID", parentID); break; case EntityType.TModelInstanceInfo: sp.ProcedureName = "net_bindingTemplate_tModelInstanceInfo_descriptions_get"; sp.Parameters.Add("@instanceID", SqlDbType.BigInt); sp.Parameters.SetLong("@instanceID", parentID); break; case EntityType.InstanceDetail: sp.ProcedureName = "net_bindingTemplate_instanceDetails_descriptions_get"; sp.Parameters.Add("@instanceID", SqlDbType.BigInt); sp.Parameters.SetLong("@instanceID", parentID); break; case EntityType.InstanceDetailOverviewDoc: sp.ProcedureName = "net_bindingTemplate_instanceDetails_overviewDoc_descriptions_get"; sp.Parameters.Add("@instanceID", SqlDbType.BigInt); sp.Parameters.SetLong("@instanceID", parentID); break; default: throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_DESCRPTION_INVALIDPARENTTYPE", parentType.ToString()); } SqlDataReaderAccessor reader = sp.ExecuteReader(); try { Read(reader); #if never while (reader.Read()) { Add(reader.GetString("isoLangCode"), reader.GetString("description")); } #endif } finally { reader.Close(); } Debug.Leave(); }
public void Get(string parentKey, EntityType parentType, KeyedReferenceType keyedReferenceType) { Debug.Enter(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); switch (parentType) { case EntityType.BusinessEntity: if (KeyedReferenceType.CategoryBag == keyedReferenceType) { sp.ProcedureName = "net_businessEntity_categoryBag_get"; } else { sp.ProcedureName = "net_businessEntity_identifierBag_get"; } sp.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromString("@businessKey", parentKey); break; case EntityType.BusinessService: Debug.Assert( KeyedReferenceType.CategoryBag == keyedReferenceType, "Unexpected keyed reference type '" + keyedReferenceType.ToString() + "' for parent entity type '" + parentType.ToString() + "'"); sp.ProcedureName = "net_businessService_categoryBag_get"; sp.Parameters.Add("@serviceKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromString("@serviceKey", parentKey); break; case EntityType.TModel: if (KeyedReferenceType.CategoryBag == keyedReferenceType) { sp.ProcedureName = "net_tModel_categoryBag_get"; } else { sp.ProcedureName = "net_tModel_identifierBag_get"; } sp.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromKey("@tModelKey", parentKey); break; default: throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_UNEXPECTED_PARENT_ENTITY_TYPE", parentType.ToString()); } SqlDataReaderAccessor reader = sp.ExecuteReader(); try { Read(reader); #if never while (reader.Read()) { Add( reader.GetString("keyName"), reader.GetString("keyValue"), reader.GetKeyFromGuid("tModelKey")); } #endif } finally { reader.Close(); } Debug.Leave(); }
public void Get(string parentKey, EntityType parentType) { Debug.Enter(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); switch (parentType) { case EntityType.BusinessEntity: sp.ProcedureName = "net_businessEntity_descriptions_get"; sp.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromString("@businessKey", parentKey); break; case EntityType.BusinessService: sp.ProcedureName = "net_businessService_descriptions_get"; sp.Parameters.Add("@serviceKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromString("@serviceKey", parentKey); break; case EntityType.BindingTemplate: sp.ProcedureName = "net_bindingTemplate_descriptions_get"; sp.Parameters.Add("@bindingKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromString("@bindingKey", parentKey); break; case EntityType.TModel: sp.ProcedureName = "net_tModel_descriptions_get"; sp.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromKey("@tModelKey", parentKey); break; case EntityType.TModelOverviewDoc: sp.ProcedureName = "net_tModel_overviewDoc_descriptions_get"; sp.Parameters.Add("@tModelKey", SqlDbType.UniqueIdentifier); sp.Parameters.SetGuidFromKey("@tModelKey", parentKey); break; default: throw new UDDIException(ErrorType.E_fatalError, "UDDI_ERROR_FATALERROR_DESCRPTION_INVALIDPARENTTYPE", parentType.ToString()); } SqlDataReaderAccessor reader = sp.ExecuteReader(); try { Read(reader); #if never while (reader.Read()) { Add(reader.GetString("isoLangCode"), reader.GetString("description")); } #endif } finally { reader.Close(); } Debug.Leave(); }
public void Get(long contactID) { ArrayList addressIDs = new ArrayList(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_contact_addresses_get"); sp.Parameters.Add("@contactID", SqlDbType.BigInt); sp.Parameters.SetLong("@contactID", contactID); SqlDataReaderAccessor reader = sp.ExecuteReader(); try { addressIDs = Read(reader); } finally { reader.Close(); } Populate(addressIDs); #if never ArrayList addressIDs = new ArrayList(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_contact_addresses_get"; sp.Parameters.Add("@contactID", SqlDbType.BigInt); sp.Parameters.SetLong("@contactID", contactID); SqlDataReaderAccessor reader = sp.ExecuteReader(); try { if (1 == Context.ApiVersionMajor) { while (reader.Read()) { addressIDs.Add(reader.GetLong("addressID")); Add(reader.GetString("sortCode"), reader.GetString("useType")); } } else { while (reader.Read()) { addressIDs.Add(reader.GetLong("addressID")); Add(reader.GetString("sortCode"), reader.GetString("useType"), reader.GetKeyFromGuid("tModelKey")); } } } finally { reader.Close(); } // // Retrieve the addressLines for this address // int index = 0; foreach (Address address in this) { address.Get((long)addressIDs[index]); index++; } #endif }
static ChangeRecord CreateChangeRecord(SqlDataReaderAccessor reader) { ChangeRecord changeRecord = null; XmlSerializer serializer = null; switch ((ChangeRecordPayloadType)reader.GetShort("changeTypeID")) { case ChangeRecordPayloadType.ChangeRecordNull: serializer = new XmlSerializer(typeof(ChangeRecordNull)); break; case ChangeRecordPayloadType.ChangeRecordNewData: serializer = new XmlSerializer(typeof(ChangeRecordNewData)); break; case ChangeRecordPayloadType.ChangeRecordDelete: serializer = new XmlSerializer(typeof(ChangeRecordDelete)); break; case ChangeRecordPayloadType.ChangeRecordPublisherAssertion: serializer = new XmlSerializer(typeof(ChangeRecordPublisherAssertion)); break; case ChangeRecordPayloadType.ChangeRecordHide: serializer = new XmlSerializer(typeof(ChangeRecordHide)); break; case ChangeRecordPayloadType.ChangeRecordDeleteAssertion: serializer = new XmlSerializer(typeof(ChangeRecordDeleteAssertion)); break; case ChangeRecordPayloadType.ChangeRecordAcknowledgement: serializer = new XmlSerializer(typeof(ChangeRecordAcknowledgement)); break; case ChangeRecordPayloadType.ChangeRecordCorrection: serializer = new XmlSerializer(typeof(ChangeRecordCorrection)); break; } StringReader stringReader = new StringReader(reader.GetString("changeData")); try { changeRecord = new ChangeRecord(); changeRecord.AcknowledgementRequested = (reader.GetInt("flag") & (int)ChangeRecordFlags.AcknowledgementRequested) > 0; changeRecord.ChangeID.NodeID = reader.GetString("OperatorKey"); changeRecord.ChangeID.OriginatingUSN = reader.GetLong("USN"); ChangeRecordBase changeRecordBase = ( ChangeRecordBase )serializer.Deserialize(stringReader); if (changeRecordBase is ChangeRecordCorrection) { // // The query to find change records will do correction 'fixups'. That is, the changeData of this // change record will be replaced with the changeData from the correction. The problem with this is // that the original change data will now look like a correction. To distinguish these types of // change records, we look to see if the OriginatingUSN's match. If the OriginatingUSN's match, // we want they payload of the change record in this correction. This payload will contain the // corrected data that we want. // ChangeRecordCorrection changeRecordCorrection = ( ChangeRecordCorrection )changeRecordBase; if (changeRecordCorrection.ChangeRecord.ChangeID.OriginatingUSN == changeRecord.ChangeID.OriginatingUSN) { changeRecordBase = changeRecordCorrection.ChangeRecord.Payload; } } changeRecord.Payload = changeRecordBase; } finally { stringReader.Close(); } return(changeRecord); }
/// **************************************************************** /// public Get /// ---------------------------------------------------------------- /// <summary> /// </summary> /// **************************************************************** /// public ChangeRecordDetail Get() { Debug.VerifySetting("OperatorKey"); ChangeRecordDetail detail = new ChangeRecordDetail(); try { // // Get the list of known operators. // StringCollection operators = new StringCollection(); SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor(); sp.ProcedureName = "net_operators_get"; SqlDataReaderAccessor reader = sp.ExecuteReader(); try { while (reader.Read()) { operators.Add(reader.GetGuidString("operatorKey")); } } finally { reader.Close(); } // // Set the search criteria for change records. // foreach (string operatorKey in operators) { long startUSN; long stopUSN; startUSN = 0; foreach (ChangeRecordVector mark in ChangesAlreadySeen) { if (0 == String.Compare(operatorKey, mark.NodeID, true)) { startUSN = mark.OriginatingUSN + 1; break; } } stopUSN = System.Int64.MaxValue; foreach (ChangeRecordVector mark in ResponseLimitVector) { if (0 == String.Compare(operatorKey, mark.NodeID, true)) { stopUSN = mark.OriginatingUSN; break; } } FindChangeRecords.SetRange(operatorKey, startUSN, stopUSN); } // // Retrieve the change records. // int limit = Config.GetInt("Replication.ResponseLimitCountDefault"); if (ResponseLimitCount >= 0 && ResponseLimitCount <= limit) { limit = ResponseLimitCount; } reader = FindChangeRecords.RetrieveResults(limit); try { while (reader.Read()) { XmlSerializer serializer = null; switch ((ChangeRecordPayloadType)reader.GetShort("changeTypeID")) { case ChangeRecordPayloadType.ChangeRecordNull: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordNull)); break; case ChangeRecordPayloadType.ChangeRecordNewData: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordNewData)); break; case ChangeRecordPayloadType.ChangeRecordDelete: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordDelete)); break; case ChangeRecordPayloadType.ChangeRecordPublisherAssertion: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordPublisherAssertion)); break; case ChangeRecordPayloadType.ChangeRecordHide: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordHide)); break; case ChangeRecordPayloadType.ChangeRecordDeleteAssertion: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordDeleteAssertion)); break; case ChangeRecordPayloadType.ChangeRecordAcknowledgement: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordAcknowledgement)); break; case ChangeRecordPayloadType.ChangeRecordCorrection: serializer = XmlSerializerManager.GetSerializer(typeof(ChangeRecordCorrection)); break; } StringReader stringReader = new StringReader(reader.GetString("changeData")); try { ChangeRecord changeRecord = new ChangeRecord(); changeRecord.AcknowledgementRequested = (reader.GetInt("flag") & (int)ChangeRecordFlags.AcknowledgementRequested) > 0; changeRecord.ChangeID.NodeID = reader.GetString("OperatorKey"); changeRecord.ChangeID.OriginatingUSN = reader.GetLong("USN"); ChangeRecordBase changeRecordBase = ( ChangeRecordBase )serializer.Deserialize(stringReader); if (changeRecordBase is ChangeRecordCorrection) { // // The query to find change records will do correction 'fixups'. That is, the changeData of this // change record will be replaced with the changeData from the correction. The problem with this is // that the original change data will now look like a correction. To distinguish these types of // change records, we look to see if the OriginatingUSN's match. If the OriginatingUSN's match, // we want they payload of the change record in this correction. This payload will contain the // corrected data that we want. // ChangeRecordCorrection changeRecordCorrection = ( ChangeRecordCorrection )changeRecordBase; if (changeRecordCorrection.ChangeRecord.ChangeID.OriginatingUSN == changeRecord.ChangeID.OriginatingUSN) { changeRecordBase = changeRecordCorrection.ChangeRecord.Payload; } } changeRecord.Payload = changeRecordBase; detail.ChangeRecords.Add(changeRecord); } finally { stringReader.Close(); } } } finally { reader.Close(); } } catch (Exception e) { Debug.OperatorMessage( SeverityType.Error, CategoryType.Replication, OperatorMessageType.None, "Could not retrieve change records:\r\n" + e.ToString()); FindChangeRecords.CleanUp(); throw; } return(detail); }
public void Get(string businessKey) { // // This procedure add the discoveryURLs that were persisted to the database // this does not include the default discoveryURL, it is added by the the businessEntity.Get() // method since it has the visibility of the operator name who owns the entity. // // // Create a command object to invoke the stored procedure // SqlStoredProcedureAccessor cmd = new SqlStoredProcedureAccessor("net_businessEntity_discoveryURLs_get"); // // Add parameters // cmd.Parameters.Add("@businessKey", SqlDbType.UniqueIdentifier); cmd.Parameters.SetGuidFromString("@businessKey", businessKey); // // Execute query // SqlDataReaderAccessor reader = cmd.ExecuteReader(); try { Read(reader); } finally { reader.Close(); } #if never // // This procedure add the discoveryURLs that were persisted to the database // this does not include the default discoveryURL, it is added by the the businessEntity.Get() // method since it has the visibility of the operator name who owns the entity. // const int UseTypeIndex = 0; const int UrlIndex = 1; // // Create a command object to invoke the stored procedure // SqlCommand cmd = new SqlCommand("net_businessEntity_discoveryURLs_get", ConnectionManager.GetConnection()); cmd.Transaction = ConnectionManager.GetTransaction(); cmd.CommandType = CommandType.StoredProcedure; // // Add parameters // cmd.Parameters.Add(new SqlParameter("@businessKey", SqlDbType.UniqueIdentifier)); SqlParameterAccessor paramacc = new SqlParameterAccessor(cmd.Parameters); paramacc.SetGuidFromString("@businessKey", businessKey); // // Execute query // SqlDataReader rdr = cmd.ExecuteReader(); try { SqlDataReaderAccessor rdracc = new SqlDataReaderAccessor(rdr); // // The discoveryUrls will be contained in the result set // while (rdr.Read()) { string useType = rdracc.GetString(UseTypeIndex); if (null == useType) { useType = ""; } Add(rdracc.GetString(UrlIndex), useType); } } finally { rdr.Close(); } #endif }
public void Get(CompletionStatusType completionStatus) { SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_publisher_assertionStatus_get"); sp.Parameters.Add("@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID); sp.Parameters.SetString("@PUID", Context.User.ID); if (CompletionStatusType.Uninitialized != completionStatus) { // // If the completion status was not specified get all // of the assertions by not specifying a completionStatus value // in the stored procedure. // sp.Parameters.Add("@completionStatus", SqlDbType.Int); sp.Parameters.SetInt("@completionStatus", (int)completionStatus); } SqlDataReaderAccessor reader = sp.ExecuteReader(); try { while (reader.Read()) { KeyedReference keyedReference = new KeyedReference( reader.GetString("keyName"), reader.GetString("keyValue"), reader.GetKeyFromGuid("tModelKey")); CompletionStatusType status = (CompletionStatusType)reader.GetInt("flag"); string fromKey = reader.GetGuidString("fromKey"); string toKey = reader.GetGuidString("toKey"); int ownerFlag = reader.GetInt("ownerFlag"); KeysOwned keysOwned = new KeysOwned(); if (0x02 == (ownerFlag & 0x02)) { keysOwned.FromKey = fromKey; } if (0x01 == (ownerFlag & 0x01)) { keysOwned.ToKey = toKey; } this.Add( new AssertionStatusItem( status, fromKey, toKey, keyedReference, keysOwned)); } } finally { reader.Close(); } }