Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1682 lines
41 KiB

  1. using System;
  2. using System.Data;
  3. using System.Collections;
  4. using System.Collections.Specialized;
  5. using System.ComponentModel;
  6. using System.Data.SqlClient;
  7. using System.Xml.Serialization;
  8. using UDDI.API;
  9. using UDDI.Replication;
  10. using UDDI;
  11. using UDDI.Diagnostics;
  12. namespace UDDI.API.ServiceType
  13. {
  14. [XmlRootAttribute("tModel", Namespace=UDDI.API.Constants.Namespace)]
  15. public class TModel : EntityBase
  16. {
  17. //
  18. // Attribute: tModelKey
  19. //
  20. [XmlAttribute("tModelKey")]
  21. public string TModelKey = "";
  22. //
  23. // Attribute: operator
  24. //
  25. [XmlAttribute("operator")]
  26. public string Operator;
  27. //
  28. // Attribute: authorizedName
  29. //
  30. [XmlAttribute("authorizedName")]
  31. public string AuthorizedName;
  32. //
  33. // Attribute: name
  34. //
  35. [XmlElement("name")]
  36. public string Name;
  37. //
  38. // Element: description
  39. //
  40. private DescriptionCollection descriptions;
  41. [XmlElement("description")]
  42. public DescriptionCollection Descriptions
  43. {
  44. get
  45. {
  46. if( null == descriptions )
  47. descriptions = new DescriptionCollection();
  48. return descriptions;
  49. }
  50. set { descriptions = value; }
  51. }
  52. //
  53. // Element: overviewDoc
  54. //
  55. private OverviewDoc overviewDoc;
  56. [XmlElement("overviewDoc")]
  57. public OverviewDoc OverviewDocSerialize
  58. {
  59. get
  60. {
  61. if( null != overviewDoc && overviewDoc.ShouldSerialize )
  62. return overviewDoc;
  63. return null;
  64. }
  65. set { overviewDoc = value; }
  66. }
  67. [XmlIgnore]
  68. public OverviewDoc OverviewDoc
  69. {
  70. get
  71. {
  72. if( null == overviewDoc )
  73. overviewDoc = new OverviewDoc();
  74. return overviewDoc;
  75. }
  76. }
  77. //
  78. // Element: identifierBag
  79. //
  80. [ XmlIgnore ]
  81. public KeyedReferenceCollection IdentifierBag = new KeyedReferenceCollection();
  82. [ XmlArray( "identifierBag" ), XmlArrayItem( "keyedReference" ) ]
  83. public KeyedReference[] IdentifierBagSerialize
  84. {
  85. get
  86. {
  87. if( Utility.CollectionEmpty( IdentifierBag ) )
  88. return null;
  89. return IdentifierBag.ToArray();
  90. }
  91. set
  92. {
  93. IdentifierBag.Clear();
  94. IdentifierBag.CopyTo( value );
  95. }
  96. }
  97. //
  98. // Element: categoryBag
  99. //
  100. [ XmlIgnore ]
  101. public KeyedReferenceCollection CategoryBag = new KeyedReferenceCollection();
  102. [ XmlArray( "categoryBag" ), XmlArrayItem( "keyedReference" ) ]
  103. public KeyedReference[] CategoryBagSerialize
  104. {
  105. get
  106. {
  107. if( Utility.CollectionEmpty( CategoryBag ) )
  108. return null;
  109. return CategoryBag.ToArray();
  110. }
  111. set
  112. {
  113. CategoryBag.Clear();
  114. CategoryBag.CopyTo( value );
  115. }
  116. }
  117. [XmlIgnore]
  118. public override UDDI.EntityType EntityType
  119. {
  120. get { return EntityType.TModel; }
  121. }
  122. [XmlIgnore]
  123. public override string EntityKey
  124. {
  125. get { return TModelKey; }
  126. }
  127. public TModel()
  128. {
  129. }
  130. public TModel( string tModelKey )
  131. {
  132. TModelKey = tModelKey;
  133. }
  134. public override void Get()
  135. {
  136. //
  137. // Create a command object to invoke the stored procedure
  138. //
  139. SqlStoredProcedureAccessor cmd = new SqlStoredProcedureAccessor( "net_tModel_get_batch" );
  140. //
  141. // Add parameters
  142. //
  143. cmd.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier, ParameterDirection.Input );
  144. cmd.Parameters.Add( "@operatorName", SqlDbType.NVarChar, UDDI.Constants.Lengths.OperatorName, ParameterDirection.Output );
  145. cmd.Parameters.Add( "@authorizedName", SqlDbType.NVarChar, UDDI.Constants.Lengths.AuthorizedName, ParameterDirection.Output );
  146. cmd.Parameters.Add( "@name", SqlDbType.NVarChar, UDDI.Constants.Lengths.Name, ParameterDirection.Output );
  147. cmd.Parameters.Add( "@overviewURL", SqlDbType.NVarChar, UDDI.Constants.Lengths.OverviewURL, ParameterDirection.Output );
  148. cmd.Parameters.SetGuidFromKey( "@tModelKey", TModelKey );
  149. SqlDataReaderAccessor reader = null;
  150. try
  151. {
  152. //
  153. // net_tModel_get will return the objects contained in a business in the following order:
  154. //
  155. // - descriptions
  156. // - overview descriptions
  157. // - identifier bags
  158. // - category bags
  159. //
  160. reader = cmd.ExecuteReader();
  161. //
  162. // Read the descriptions
  163. //
  164. Descriptions.Read( reader );
  165. //
  166. // Read the overview descriptions
  167. //
  168. if( true == reader.NextResult() )
  169. {
  170. OverviewDoc.Descriptions.Read( reader );
  171. }
  172. //
  173. // Read the identifier bags
  174. //
  175. if( true == reader.NextResult() )
  176. {
  177. IdentifierBag.Read( reader );
  178. }
  179. //
  180. // Read the category bags
  181. //
  182. if( true == reader.NextResult() )
  183. {
  184. CategoryBag.Read( reader );
  185. }
  186. }
  187. finally
  188. {
  189. if( null != reader )
  190. {
  191. reader.Close();
  192. }
  193. }
  194. //
  195. // Output parameters
  196. //
  197. Operator = cmd.Parameters.GetString( "@operatorName" );
  198. AuthorizedName = cmd.Parameters.GetString( "@authorizedName" );
  199. Name = cmd.Parameters.GetString( "@name" );
  200. OverviewDoc.OverviewURL = cmd.Parameters.GetString( "@overviewURL" );
  201. #if never
  202. //
  203. // Create a command object to invoke the stored procedure
  204. //
  205. SqlCommand cmd = new SqlCommand( "net_tModel_get", ConnectionManager.GetConnection() );
  206. cmd.Transaction = ConnectionManager.GetTransaction();
  207. cmd.CommandType = CommandType.StoredProcedure;
  208. //
  209. // Add parameters
  210. //
  211. cmd.Parameters.Add( new SqlParameter( "@tModelKey", SqlDbType.UniqueIdentifier ) ).Direction = ParameterDirection.Input;
  212. cmd.Parameters.Add( new SqlParameter( "@operatorName", SqlDbType.NVarChar, UDDI.Constants.Lengths.OperatorName ) ).Direction = ParameterDirection.Output;
  213. cmd.Parameters.Add( new SqlParameter( "@authorizedName", SqlDbType.NVarChar, UDDI.Constants.Lengths.AuthorizedName ) ).Direction = ParameterDirection.Output;
  214. cmd.Parameters.Add( new SqlParameter( "@name", SqlDbType.NVarChar, UDDI.Constants.Lengths.Name ) ).Direction = ParameterDirection.Output;
  215. cmd.Parameters.Add( new SqlParameter( "@overviewURL", SqlDbType.NVarChar, UDDI.Constants.Lengths.OverviewURL ) ).Direction = ParameterDirection.Output;
  216. //
  217. // Set parameter values and execute query
  218. //
  219. SqlParameterAccessor paramacc = new SqlParameterAccessor( cmd.Parameters );
  220. paramacc.SetGuidFromKey( "@tModelKey", TModelKey );
  221. cmd.ExecuteScalar();
  222. //
  223. // Move query results into member variables
  224. //
  225. Operator = paramacc.GetString( "@operatorName" );
  226. AuthorizedName = paramacc.GetString( "@authorizedName" );
  227. Name = paramacc.GetString( "@name" );
  228. OverviewDoc.OverviewURL = paramacc.GetString( "@overviewURL" );
  229. //
  230. // Retrieve sub-objects
  231. //
  232. Descriptions.Get( TModelKey, EntityType.TModel );
  233. OverviewDoc.Descriptions.Get( TModelKey, EntityType.TModelOverviewDoc );
  234. IdentifierBag.Get( TModelKey, EntityType.TModel, KeyedReferenceType.IdentifierBag );
  235. CategoryBag.Get( TModelKey, EntityType.TModel, KeyedReferenceType.CategoryBag );
  236. #endif
  237. QueryLog.Write( QueryType.Get, EntityType.TModel );
  238. }
  239. internal void Validate()
  240. {
  241. //
  242. // Check to make sure publisher's limit allows save of this
  243. // entity. If this is an update, we won't check since they
  244. // are simply replacing an existing entity. We also won't
  245. // check if the limit is 0, since this indicates unlimited
  246. // publishing rights.
  247. //
  248. int limit = Context.User.TModelLimit;
  249. int count = Context.User.TModelCount;
  250. if( 0 != limit && Utility.StringEmpty( TModelKey ) )
  251. {
  252. //
  253. // Verify that the publisher has not exceeded their limit.
  254. //
  255. if( count >= limit )
  256. {
  257. #if never
  258. throw new UDDIException(
  259. ErrorType.E_accountLimitExceeded,
  260. "Publisher limit for 'tModel' exceeded (limit=" + limit + ", count=" + count + ")" );
  261. #endif
  262. throw new UDDIException( ErrorType.E_accountLimitExceeded, "UDDI_ERROR_PUBLISHER_LIMIT_FOR_TMODELS_EXCEEDED", limit, count );
  263. }
  264. }
  265. //
  266. // Check field lengths and truncate if necessary.
  267. //
  268. Utility.ValidateLength( ref Name, "name", UDDI.Constants.Lengths.Name, 1 );
  269. Utility.ValidateLength( ref AuthorizedName, "authorizedName", UDDI.Constants.Lengths.AuthorizedName );
  270. Utility.ValidateLength( ref Operator, "operator", UDDI.Constants.Lengths.Operator );
  271. //
  272. // SECURITY: The operator field should be validated to ensure it is
  273. // the local operator name or empty. This is not currently being done.
  274. //
  275. //
  276. // If no tModelKey is specified, then it is an add and no
  277. // database validation is necessary here. Otherwise, we do
  278. // need to validate that the specified tModel exists and
  279. // is owned by the user.
  280. //
  281. if( !Utility.StringEmpty( TModelKey ) )
  282. {
  283. //
  284. // call net_tModel_validate
  285. //
  286. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_tModel_validate" );
  287. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  288. sp.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  289. sp.Parameters.Add( "@flag", SqlDbType.Int );
  290. sp.Parameters.SetString( "@PUID", Context.User.ID );
  291. sp.Parameters.SetGuidFromKey( "@tModelKey", TModelKey );
  292. if( Context.User.AllowPreassignedKeys )
  293. sp.Parameters.SetInt( "@flag", 1 );
  294. else
  295. sp.Parameters.SetInt( "@flag", 0 );
  296. sp.ExecuteNonQuery();
  297. }
  298. Descriptions.Validate();
  299. IdentifierBag.Validate( TModelKey, KeyedReferenceType.IdentifierBag );
  300. CategoryBag.Validate( TModelKey, KeyedReferenceType.CategoryBag );
  301. OverviewDoc.Validate();
  302. }
  303. public override void Save()
  304. {
  305. Debug.Enter();
  306. //
  307. // If we're not in replication mode, we'll set the operator
  308. // name (ignoring whatever was specified).
  309. //
  310. if( ContextType.Replication != Context.ContextType )
  311. Operator = Config.GetString( "Operator" );
  312. //
  313. // Validate the tModel
  314. //
  315. Validate();
  316. if( Utility.StringEmpty( TModelKey ) )
  317. {
  318. //
  319. // This is an insert, so generate a tmodelkey
  320. //
  321. TModelKey = "uuid:" + System.Guid.NewGuid().ToString();
  322. }
  323. //
  324. // Create a command object to invoke the stored procedure
  325. //
  326. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_tModel_save" );
  327. //
  328. // Add parameters
  329. //
  330. sp.Parameters.Add( "@contextID", SqlDbType.UniqueIdentifier );
  331. sp.Parameters.Add( "@lastChange", SqlDbType.BigInt );
  332. sp.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  333. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  334. sp.Parameters.Add( "@generic", SqlDbType.NVarChar, UDDI.Constants.Lengths.generic );
  335. sp.Parameters.Add( "@authorizedName", SqlDbType.NVarChar, UDDI.Constants.Lengths.AuthorizedName, ParameterDirection.InputOutput );
  336. sp.Parameters.Add( "@name", SqlDbType.NVarChar, UDDI.Constants.Lengths.Name );
  337. sp.Parameters.Add( "@overviewURL", SqlDbType.NVarChar, UDDI.Constants.Lengths.OverviewURL );
  338. //
  339. // Set parameter values
  340. //
  341. sp.Parameters.SetGuid( "@contextID", Context.ContextID );
  342. sp.Parameters.SetLong( "@lastChange", DateTime.UtcNow.Ticks );
  343. sp.Parameters.SetGuidFromKey( "@tModelKey", TModelKey );
  344. sp.Parameters.SetString( "@PUID", Context.User.ID );
  345. sp.Parameters.SetString( "@generic", Constants.Version );
  346. sp.Parameters.SetString( "@authorizedName", AuthorizedName );
  347. sp.Parameters.SetString( "@name", Name );
  348. if( null == (object)OverviewDoc )
  349. sp.Parameters.SetNull( "@overviewUrl" );
  350. else
  351. sp.Parameters.SetString( "@overviewUrl", OverviewDoc.OverviewURL );
  352. //
  353. // Execute query
  354. //
  355. sp.ExecuteNonQuery();
  356. AuthorizedName = sp.Parameters.GetString( "@authorizedName" );
  357. //
  358. // Save the descriptions, category, identifier and overview doc
  359. // information
  360. //
  361. Descriptions.Save( TModelKey, EntityType.TModel );
  362. IdentifierBag.Save( TModelKey, EntityType.TModel, KeyedReferenceType.IdentifierBag );
  363. CategoryBag.Save( TModelKey, EntityType.TModel, KeyedReferenceType.CategoryBag );
  364. OverviewDoc.Descriptions.Save( TModelKey, EntityType.TModelOverviewDoc );
  365. //
  366. // Save the change log entry.
  367. //
  368. if( Context.LogChangeRecords )
  369. {
  370. ChangeRecord changeRecord = new ChangeRecord();
  371. changeRecord.Payload = new ChangeRecordNewData( this );
  372. changeRecord.Log();
  373. }
  374. Debug.Leave();
  375. }
  376. public void Hide()
  377. {
  378. //
  379. // TODO: We should really have a way of hiding vs. deleting
  380. //
  381. Delete();
  382. }
  383. public override void Delete()
  384. {
  385. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_tModel_delete" );
  386. sp.Parameters.Add( "@contextID", SqlDbType.UniqueIdentifier );
  387. sp.Parameters.Add( "@lastChange", SqlDbType.BigInt );
  388. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  389. sp.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  390. sp.Parameters.SetGuid( "@contextID", Context.ContextID );
  391. sp.Parameters.SetLong( "@lastChange", DateTime.UtcNow.Ticks );
  392. sp.Parameters.SetString( "@PUID", Context.User.ID );
  393. sp.Parameters.SetGuidFromKey( "@tModelKey", TModelKey );
  394. sp.ExecuteNonQuery();
  395. //
  396. // Save the change log entry.
  397. //
  398. if( Context.LogChangeRecords )
  399. {
  400. ChangeRecord changeRecord = new ChangeRecord();
  401. changeRecord.AcknowledgementRequested = true;
  402. changeRecord.Payload = new ChangeRecordHide( TModelKey );
  403. changeRecord.Log();
  404. }
  405. }
  406. }
  407. public class TModelCollection : CollectionBase
  408. {
  409. public TModelCollection()
  410. {
  411. }
  412. public TModel this[int index]
  413. {
  414. get { return (TModel)List[index]; }
  415. set { List[index] = value; }
  416. }
  417. public int Add(TModel value)
  418. {
  419. return List.Add(value);
  420. }
  421. public int Add( string tModelKey )
  422. {
  423. return List.Add( new TModel( tModelKey ) );
  424. }
  425. public int Add()
  426. {
  427. return List.Add( new TModel() );
  428. }
  429. public void Insert(int index, TModel value)
  430. {
  431. List.Insert(index, value);
  432. }
  433. public int IndexOf(TModel value)
  434. {
  435. return List.IndexOf(value);
  436. }
  437. public bool Contains(TModel value)
  438. {
  439. return List.Contains(value);
  440. }
  441. public void Remove(TModel value)
  442. {
  443. List.Remove(value);
  444. }
  445. public void CopyTo(TModel[] array, int index)
  446. {
  447. InnerList.CopyTo(array, index);
  448. }
  449. public void Save()
  450. {
  451. //
  452. // Walk tModels collection and save each tModel
  453. //
  454. foreach( TModel tm in this )
  455. {
  456. tm.Save();
  457. }
  458. }
  459. public void Sort()
  460. {
  461. InnerList.Sort( new TModelComparer() );
  462. }
  463. internal class TModelComparer : IComparer
  464. {
  465. public int Compare( object x, object y )
  466. {
  467. TModel entity1 = (TModel)x;
  468. TModel entity2 = (TModel)y;
  469. return string.Compare( entity1.Name, entity2.Name, true );
  470. }
  471. }
  472. }
  473. public class TModelInfoCollection : CollectionBase
  474. {
  475. public void GetForCurrentPublisher()
  476. {
  477. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  478. sp.ProcedureName = "net_publisher_tModelInfos_get";
  479. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  480. sp.Parameters.SetString( "@PUID", Context.User.ID );
  481. SqlDataReaderAccessor reader = sp.ExecuteReader();
  482. try
  483. {
  484. while( reader.Read() )
  485. {
  486. TModelInfo info = new TModelInfo(
  487. reader.GetKeyFromGuid( "tModelKey" ),
  488. reader.GetString( "name" ) );
  489. info.IsHidden = ( 1 == reader.GetInt( "flag" ) );
  490. this.Add( info );
  491. }
  492. }
  493. finally
  494. {
  495. reader.Close();
  496. }
  497. }
  498. public TModelInfo this[int index]
  499. {
  500. get { return (TModelInfo)List[index]; }
  501. set { List[index] = value; }
  502. }
  503. public int Add()
  504. {
  505. return List.Add( new TModelInfo() );
  506. }
  507. public int Add( string tModelKey )
  508. {
  509. return List.Add( new TModelInfo( tModelKey ) );
  510. }
  511. public int Add( string tModelKey, string name )
  512. {
  513. return List.Add( new TModelInfo( tModelKey, name ) );
  514. }
  515. public int Add(TModelInfo value)
  516. {
  517. return List.Add(value);
  518. }
  519. public void Insert(int index, TModelInfo value)
  520. {
  521. List.Insert(index, value);
  522. }
  523. public int IndexOf(TModelInfo value)
  524. {
  525. return List.IndexOf(value);
  526. }
  527. public bool Contains(TModelInfo value)
  528. {
  529. return List.Contains(value);
  530. }
  531. public void Remove(TModelInfo value)
  532. {
  533. List.Remove(value);
  534. }
  535. public void CopyTo(TModelInfo[] array, int index)
  536. {
  537. List.CopyTo(array, index);
  538. }
  539. public void Sort()
  540. {
  541. InnerList.Sort( new TModelInfoComparer() );
  542. }
  543. internal class TModelInfoComparer : IComparer
  544. {
  545. public int Compare( object x, object y )
  546. {
  547. TModelInfo entity1 = (TModelInfo)x;
  548. TModelInfo entity2 = (TModelInfo)y;
  549. return string.Compare( entity1.Name, entity2.Name, true );
  550. }
  551. }
  552. }
  553. public class TModelInstanceInfoCollection : CollectionBase
  554. {
  555. internal void Validate()
  556. {
  557. foreach( TModelInstanceInfo info in this )
  558. {
  559. info.Validate();
  560. }
  561. }
  562. public void Save( string bindingKey )
  563. {
  564. foreach( TModelInstanceInfo tmii in this )
  565. {
  566. tmii.Save( bindingKey );
  567. }
  568. }
  569. public void Get( string bindingKey )
  570. {
  571. ArrayList instanceIds = new ArrayList();
  572. //
  573. // Create a command object to invoke the stored procedure
  574. //
  575. SqlStoredProcedureAccessor cmd = new SqlStoredProcedureAccessor( "net_bindingTemplate_tModelInstanceInfos_get" );
  576. //
  577. // Parameters
  578. //
  579. cmd.Parameters.Add( "@bindingKey", SqlDbType.UniqueIdentifier, ParameterDirection.Input );
  580. //
  581. // Set parameter values and execute query
  582. //
  583. cmd.Parameters.SetGuidFromString( "@bindingKey", bindingKey );
  584. SqlDataReaderAccessor reader = cmd.ExecuteReader();
  585. try
  586. {
  587. instanceIds = Read( reader );
  588. #if never
  589. //
  590. // The core data for this binding will be contained in the resultset
  591. //
  592. while( reader.Read() )
  593. {
  594. instanceIds.Add( rdracc.GetInt( instanceIdIndex ) );
  595. Add( rdracc.GetKeyFromGuid( tModelKeyIndex ),
  596. rdracc.GetString( overviewURLIndex ),
  597. rdracc.GetString( instanceParmIndex ) );
  598. }
  599. #endif
  600. }
  601. finally
  602. {
  603. reader.Close();
  604. }
  605. Populate( instanceIds );
  606. }
  607. public ArrayList Read( SqlDataReaderAccessor reader )
  608. {
  609. const int instanceIdIndex = 0;
  610. const int tModelKeyIndex = 1;
  611. const int overviewURLIndex = 2;
  612. const int instanceParmIndex = 3;
  613. ArrayList instanceIds = new ArrayList();
  614. //
  615. // The core data for this binding will be contained in the resultset
  616. //
  617. while( reader.Read() )
  618. {
  619. instanceIds.Add( reader.GetInt( instanceIdIndex ) );
  620. Add( reader.GetKeyFromGuid( tModelKeyIndex ),
  621. reader.GetString( overviewURLIndex ),
  622. reader.GetString( instanceParmIndex ) );
  623. }
  624. return instanceIds;
  625. }
  626. public void Populate( ArrayList instanceIds )
  627. {
  628. int i = 0;
  629. foreach( TModelInstanceInfo tmii in this )
  630. {
  631. tmii.Get( (int) instanceIds[ i++ ] );
  632. }
  633. }
  634. public TModelInstanceInfo this[int index]
  635. {
  636. get
  637. { return (TModelInstanceInfo)List[index]; }
  638. set
  639. { List[index] = value; }
  640. }
  641. public int Add()
  642. {
  643. return List.Add( new TModelInstanceInfo() );
  644. }
  645. public int Add(TModelInstanceInfo value)
  646. {
  647. return List.Add(value);
  648. }
  649. public int Add( string tModelKey, string overviewURL, string instanceParm )
  650. {
  651. return List.Add( new TModelInstanceInfo( tModelKey, overviewURL, instanceParm ) );
  652. }
  653. public void Insert(int index, TModelInstanceInfo value)
  654. {
  655. List.Insert(index, value);
  656. }
  657. public int IndexOf(TModelInstanceInfo value)
  658. {
  659. return List.IndexOf(value);
  660. }
  661. public bool Contains(TModelInstanceInfo value)
  662. {
  663. return List.Contains(value);
  664. }
  665. public void Remove(TModelInstanceInfo value)
  666. {
  667. List.Remove(value);
  668. }
  669. public void CopyTo(TModelInstanceInfo[] array, int index)
  670. {
  671. List.CopyTo(array, index);
  672. }
  673. }
  674. public class TModelBag
  675. {
  676. [XmlElement("tModelKey")]
  677. public StringCollection tmodelkeys;
  678. [XmlIgnore]
  679. public StringCollection TModelKeys
  680. {
  681. get
  682. {
  683. if( null == tmodelkeys )
  684. tmodelkeys = new StringCollection();
  685. return tmodelkeys;
  686. }
  687. }
  688. }
  689. public class TModelInstanceInfo
  690. {
  691. // ----[Attribute: tModelKey]---------------------------------------
  692. [XmlAttribute("tModelKey")]
  693. public string TModelKey
  694. {
  695. get
  696. {
  697. return tmodelkey;
  698. }
  699. set
  700. {
  701. if( null == value )
  702. tmodelkey = null;
  703. else
  704. tmodelkey = value.Trim();
  705. }
  706. }
  707. private string tmodelkey;
  708. // ----[Element: description]---------------------------------------
  709. private DescriptionCollection descriptions;
  710. [XmlElement("description")]
  711. public DescriptionCollection Descriptions
  712. {
  713. get
  714. {
  715. if( null == descriptions )
  716. descriptions = new DescriptionCollection();
  717. return descriptions;
  718. }
  719. set { descriptions = value; }
  720. }
  721. // ----[Element: instanceDetails]-----------------------------------
  722. private InstanceDetail instanceDetail;
  723. [XmlElement("instanceDetails")]
  724. public InstanceDetail InstanceDetailSerialize
  725. {
  726. get
  727. {
  728. if( null != instanceDetail && instanceDetail.ShouldSerialize )
  729. return instanceDetail;
  730. return null;
  731. }
  732. set { instanceDetail = value; }
  733. }
  734. [XmlIgnore]
  735. public InstanceDetail InstanceDetail
  736. {
  737. get
  738. {
  739. if( null == instanceDetail )
  740. instanceDetail = new InstanceDetail();
  741. return instanceDetail;
  742. }
  743. }
  744. public TModelInstanceInfo()
  745. {
  746. }
  747. public TModelInstanceInfo( string tModelKey, string overviewURL, string instanceParm )
  748. {
  749. TModelKey = tModelKey.Trim();
  750. InstanceDetail.OverviewDoc.OverviewURL = overviewURL;
  751. InstanceDetail.InstanceParm = instanceParm;
  752. }
  753. public void Get( int instanceId )
  754. {
  755. //
  756. // Create a command object to invoke the stored procedure
  757. //
  758. SqlStoredProcedureAccessor cmd = new SqlStoredProcedureAccessor( "net_bindingTemplate_tModelInstanceInfo_get_batch" );
  759. //
  760. // Add parameters
  761. //
  762. cmd.Parameters.Add( "@instanceID", SqlDbType.BigInt, ParameterDirection.Input );
  763. cmd.Parameters.SetLong( "@instanceID", instanceId );
  764. SqlDataReaderAccessor reader = null;
  765. try
  766. {
  767. //
  768. // net_bindingTemplate_tModelInstanceInfo_get_batch will return the objects contained in a business in the following order:
  769. //
  770. // - descriptions
  771. // - instance detail descriptions
  772. // - instance detail overview descriptions
  773. reader = cmd.ExecuteReader();
  774. //
  775. // Read the descriptions
  776. //
  777. Descriptions.Read( reader );
  778. //
  779. // Read the instance detail descriptions
  780. //
  781. if ( true == reader.NextResult() )
  782. {
  783. InstanceDetail.Descriptions.Read( reader );
  784. }
  785. //
  786. // Read the overview document descriptions
  787. //
  788. if ( true == reader.NextResult() )
  789. {
  790. InstanceDetail.OverviewDoc.Descriptions.Read( reader );
  791. }
  792. }
  793. finally
  794. {
  795. if( null != reader )
  796. {
  797. reader.Close();
  798. }
  799. }
  800. #if never
  801. //
  802. // Get sub-objects, current level stuff is already populated
  803. //
  804. Descriptions.Get( instanceId, EntityType.TModelInstanceInfo );
  805. InstanceDetail.Descriptions.Get( instanceId, EntityType.InstanceDetail );
  806. InstanceDetail.OverviewDoc.Descriptions.Get( instanceId, EntityType.InstanceDetailOverviewDoc );
  807. #endif
  808. }
  809. internal void Validate()
  810. {
  811. Debug.Enter();
  812. Debug.VerifyKey( TModelKey );
  813. //
  814. // Validate that the current TModelKey is valid
  815. // Replication shouldn't get in here
  816. //
  817. SqlCommand cmd = new SqlCommand( "net_bindingTemplate_tModelInstanceInfo_validate", ConnectionManager.GetConnection() );
  818. cmd.Transaction = ConnectionManager.GetTransaction();
  819. cmd.CommandType = CommandType.StoredProcedure;
  820. cmd.Parameters.Add( new SqlParameter( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID ) ).Direction = ParameterDirection.Input;
  821. cmd.Parameters.Add( new SqlParameter( "@tModelKey", SqlDbType.UniqueIdentifier ) ).Direction = ParameterDirection.Input;
  822. SqlParameterAccessor paramacc = new SqlParameterAccessor( cmd.Parameters );
  823. paramacc.SetString( "@PUID", Context.User.ID );
  824. paramacc.SetGuidFromKey( "@tModelKey", TModelKey );
  825. cmd.ExecuteNonQuery();
  826. Descriptions.Validate();
  827. InstanceDetail.Validate();
  828. Debug.Leave();
  829. }
  830. public void Save( string bindingKey )
  831. {
  832. //
  833. // Create a command object to invoke the stored procedure
  834. //
  835. SqlCommand cmd = new SqlCommand( "net_bindingTemplate_tModelInstanceInfo_save", ConnectionManager.GetConnection() );
  836. cmd.Transaction = ConnectionManager.GetTransaction();
  837. cmd.CommandType = CommandType.StoredProcedure;
  838. //
  839. // Input parameters
  840. //
  841. cmd.Parameters.Add( new SqlParameter( "@bindingKey", SqlDbType.UniqueIdentifier ) ).Direction = ParameterDirection.Input;
  842. cmd.Parameters.Add( new SqlParameter( "@tModelKey", SqlDbType.UniqueIdentifier ) ).Direction = ParameterDirection.Input;
  843. cmd.Parameters.Add( new SqlParameter( "@overviewUrl", SqlDbType.NVarChar, UDDI.Constants.Lengths.OverviewURL ) ).Direction = ParameterDirection.Input;
  844. cmd.Parameters.Add( new SqlParameter( "@instanceParms", SqlDbType.NVarChar, UDDI.Constants.Lengths.InstanceParms ) ).Direction = ParameterDirection.Input;
  845. cmd.Parameters.Add( new SqlParameter( "@instanceID", SqlDbType.BigInt ) ).Direction = ParameterDirection.Output;
  846. //
  847. // Set parameter values and execute query
  848. //
  849. SqlParameterAccessor paramacc = new SqlParameterAccessor( cmd.Parameters );
  850. paramacc.SetGuidFromString( "@bindingKey", bindingKey );
  851. paramacc.SetGuidFromKey( "@tModelKey", TModelKey );
  852. //
  853. // TODO: I think OverviewDoc will always be non-null... we should be
  854. // testing for a non empty overviewURL
  855. // Agreed there a bunch of these laying around.
  856. //
  857. if( null == (object) InstanceDetail.OverviewDoc )
  858. paramacc.SetNull( "@overviewUrl" );
  859. else
  860. paramacc.SetString( "@overviewUrl", InstanceDetail.OverviewDoc.OverviewURL );
  861. // TODO: same here
  862. if( null != (object) InstanceDetail )
  863. paramacc.SetString( "@instanceParms", InstanceDetail.InstanceParm );
  864. else
  865. paramacc.SetNull( "@instanceParms" );
  866. cmd.ExecuteScalar();
  867. //
  868. // Move out parameters into local variables
  869. //
  870. long InstanceID = paramacc.GetLong( "@instanceID" );
  871. //
  872. // Save sub-objects
  873. //
  874. Descriptions.Save( InstanceID, EntityType.TModelInstanceInfo );
  875. if( null != (object) InstanceDetail )
  876. {
  877. InstanceDetail.Descriptions.Save( InstanceID, EntityType.InstanceDetail );
  878. if( null != (object) InstanceDetail.OverviewDoc )
  879. {
  880. InstanceDetail.OverviewDoc.Descriptions.Save( InstanceID, EntityType.InstanceDetailOverviewDoc );
  881. }
  882. }
  883. }
  884. }
  885. public class TModelInfo
  886. {
  887. [XmlAttribute("tModelKey")]
  888. public string TModelKey
  889. {
  890. get
  891. {
  892. return tmodelkey;
  893. }
  894. set
  895. {
  896. if( null == value )
  897. tmodelkey = null;
  898. else
  899. tmodelkey = value.Trim();
  900. }
  901. }
  902. private string tmodelkey = "";
  903. [XmlElement("name")]
  904. public string Name = "";
  905. [XmlIgnore]
  906. public bool IsHidden = false;
  907. public TModelInfo()
  908. {
  909. }
  910. public TModelInfo( string tModelKey )
  911. {
  912. TModelKey = tModelKey;
  913. }
  914. public TModelInfo( string tModelKey, string name )
  915. {
  916. TModelKey = tModelKey;
  917. Name = name;
  918. }
  919. public void Get()
  920. {
  921. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_tModel_get" );
  922. sp.Parameters.Add( "@tModelKey", SqlDbType.UniqueIdentifier );
  923. sp.Parameters.Add( "@operatorName", SqlDbType.NVarChar, UDDI.Constants.Lengths.OperatorName, ParameterDirection.Output );
  924. sp.Parameters.Add( "@authorizedName", SqlDbType.NVarChar, UDDI.Constants.Lengths.AuthorizedName, ParameterDirection.Output );
  925. sp.Parameters.Add( "@name", SqlDbType.NVarChar, UDDI.Constants.Lengths.Name, ParameterDirection.Output );
  926. sp.Parameters.Add( "@overviewURL", SqlDbType.NVarChar, UDDI.Constants.Lengths.OverviewURL, ParameterDirection.Output );
  927. sp.Parameters.SetGuidFromKey( "@tModelKey", TModelKey );
  928. sp.ExecuteNonQuery();
  929. Name = sp.Parameters.GetString( "@name" );
  930. }
  931. }
  932. public class InstanceDetail
  933. {
  934. // ----[Element: description]---------------------------------------
  935. private DescriptionCollection descriptions;
  936. [XmlElement("description")]
  937. public DescriptionCollection Descriptions
  938. {
  939. get
  940. {
  941. if( null == descriptions )
  942. descriptions = new DescriptionCollection();
  943. return descriptions;
  944. }
  945. set { descriptions = value; }
  946. }
  947. // ----[Element: overviewDoc]---------------------------------------
  948. private OverviewDoc overviewDoc;
  949. [XmlElement("overviewDoc")]
  950. public OverviewDoc OverviewDocSerialize
  951. {
  952. get
  953. {
  954. if( null != overviewDoc && overviewDoc.ShouldSerialize )
  955. return overviewDoc;
  956. return null;
  957. }
  958. set { overviewDoc = value; }
  959. }
  960. [XmlIgnore]
  961. public OverviewDoc OverviewDoc
  962. {
  963. get
  964. {
  965. if( null == overviewDoc )
  966. overviewDoc = new OverviewDoc();
  967. return overviewDoc;
  968. }
  969. }
  970. // ----[Element: instanceParms]-------------------------------------
  971. private string instanceParm;
  972. [XmlElement("instanceParms")]
  973. public string InstanceParm
  974. {
  975. get { return instanceParm; }
  976. set { instanceParm = value; }
  977. }
  978. public InstanceDetail()
  979. {
  980. }
  981. internal void Validate()
  982. {
  983. //
  984. // Check field lengths and truncate if necessary.
  985. //
  986. Utility.ValidateLength( ref instanceParm, "instanceParms", UDDI.Constants.Lengths.InstanceParms );
  987. Descriptions.Validate();
  988. OverviewDoc.Validate();
  989. }
  990. [XmlIgnore]
  991. public bool ShouldSerialize
  992. {
  993. get
  994. {
  995. if( null != descriptions && descriptions.Count > 0 )
  996. return true;
  997. if( null != overviewDoc && overviewDoc.ShouldSerialize )
  998. return true;
  999. if( null != InstanceParm )
  1000. return true;
  1001. return false;
  1002. }
  1003. }
  1004. }
  1005. public class OverviewDoc
  1006. {
  1007. // --[element: description]-----------------------------------------
  1008. private DescriptionCollection descriptions;
  1009. [XmlElement("description")]
  1010. public DescriptionCollection Descriptions
  1011. {
  1012. get
  1013. {
  1014. if( null == descriptions )
  1015. descriptions = new DescriptionCollection();
  1016. return descriptions;
  1017. }
  1018. set { descriptions = value; }
  1019. }
  1020. // --[element: overviewURL]-----------------------------------------
  1021. private string overviewURL;
  1022. [XmlElement("overviewURL")]
  1023. public string OverviewURL
  1024. {
  1025. get { return overviewURL; }
  1026. set { overviewURL = value; }
  1027. }
  1028. public OverviewDoc()
  1029. {
  1030. }
  1031. [XmlIgnore]
  1032. public bool ShouldSerialize
  1033. {
  1034. get
  1035. {
  1036. if( ( null != descriptions && descriptions.Count > 0 )
  1037. || null != OverviewURL )
  1038. return true;
  1039. return false;
  1040. }
  1041. }
  1042. internal void Validate()
  1043. {
  1044. Utility.ValidateLength( ref overviewURL, "overviewURL", UDDI.Constants.Lengths.OverviewURL );
  1045. Descriptions.Validate();
  1046. }
  1047. }
  1048. /// ****************************************************************
  1049. /// class DeleteTModel
  1050. /// ----------------------------------------------------------------
  1051. /// <summary>
  1052. /// The DeleteTModel class contains data and methods associated
  1053. /// with the delete_tModel message. It is typically populated
  1054. /// via deserialization by the .NET runtime as part of the
  1055. /// message processing interface.
  1056. ///
  1057. /// As part of the publisher API, this message implements
  1058. /// IAuthenticateable. This allows the enclosed authInfo to be
  1059. /// authorized prior to processing
  1060. /// </summary>
  1061. /// ****************************************************************
  1062. ///
  1063. [XmlRootAttribute( "delete_tModel", Namespace=UDDI.API.Constants.Namespace )]
  1064. public class DeleteTModel : IAuthenticateable, IMessage
  1065. {
  1066. //
  1067. // Attribute: generic
  1068. //
  1069. private string generic;
  1070. [XmlAttribute("generic")]
  1071. public string Generic
  1072. {
  1073. get { return generic; }
  1074. set { generic = value; }
  1075. }
  1076. //
  1077. // Element: authInfo
  1078. //
  1079. private string authInfo;
  1080. [XmlElement("authInfo")]
  1081. public string AuthInfo
  1082. {
  1083. get { return authInfo; }
  1084. set { authInfo = value; }
  1085. }
  1086. //
  1087. // Element: tModelKey
  1088. //
  1089. [XmlElement("tModelKey")]
  1090. public StringCollection TModelKeys;
  1091. public void Delete()
  1092. {
  1093. foreach( string key in TModelKeys )
  1094. {
  1095. TModel tm = new TModel( key );
  1096. tm.Delete();
  1097. }
  1098. }
  1099. }
  1100. [XmlRootAttribute("find_tModel", Namespace=UDDI.API.Constants.Namespace)]
  1101. public class FindTModel : IMessage
  1102. {
  1103. //
  1104. // Attribute: generic
  1105. //
  1106. private string generic;
  1107. [XmlAttribute("generic")]
  1108. public string Generic
  1109. {
  1110. get { return generic; }
  1111. set { generic = value; }
  1112. }
  1113. //
  1114. // Attribute: maxRows
  1115. //
  1116. private int maxRows = -1;
  1117. [XmlAttribute( "maxRows" ), DefaultValue( -1 )]
  1118. public int MaxRows
  1119. {
  1120. get { return maxRows; }
  1121. set
  1122. {
  1123. if( value < 0 )
  1124. {
  1125. #if never
  1126. throw new UDDIException(
  1127. ErrorType.E_fatalError,
  1128. "maxRows must not be less than 0" );
  1129. #endif
  1130. throw new UDDIException( ErrorType.E_fatalError, "UDDI_ERROR_MAXROW_CANNOT_BE_LESS_THAN_0" );
  1131. }
  1132. maxRows = value;
  1133. }
  1134. }
  1135. [XmlArray("findQualifiers"), XmlArrayItem("findQualifier")]
  1136. public FindQualifierCollection FindQualifiers;
  1137. [XmlElement("name")]
  1138. public string Name;
  1139. [XmlArray("identifierBag"), XmlArrayItem("keyedReference")]
  1140. public KeyedReferenceCollection IdentifierBag;
  1141. [XmlArray("categoryBag"), XmlArrayItem("keyedReference")]
  1142. public KeyedReferenceCollection CategoryBag;
  1143. public FindTModel()
  1144. {
  1145. Generic = UDDI.API.Constants.Version;
  1146. }
  1147. public TModelList Find()
  1148. {
  1149. TModelList tModelList = new TModelList();
  1150. QueryLog.Write( QueryType.Find, EntityType.TModel );
  1151. //
  1152. // Process each find constraint.
  1153. //
  1154. FindBuilder find = new FindBuilder( EntityType.TModel, FindQualifiers );
  1155. //
  1156. // If no search arguments are specified, return an empty result
  1157. // set.
  1158. //
  1159. if( Utility.StringEmpty( Name ) &&
  1160. Utility.CollectionEmpty( IdentifierBag ) &&
  1161. Utility.CollectionEmpty( CategoryBag ) )
  1162. return tModelList;
  1163. //
  1164. // Validate find parameters.
  1165. //
  1166. if( !Utility.StringEmpty( Name ) )
  1167. {
  1168. if( 1 == Context.ApiVersionMajor )
  1169. {
  1170. Name = Name.Trim();
  1171. if( Name.Length > UDDI.Constants.Lengths.Name )
  1172. {
  1173. // throw new UDDIException( ErrorType.E_nameTooLong, "A name specified in the search exceeds the allowable length" );
  1174. throw new UDDIException( ErrorType.E_nameTooLong, "UDDI_ERROR_NAME_TOO_LONG" );
  1175. }
  1176. }
  1177. else
  1178. {
  1179. Utility.ValidateLength( ref Name, "Name", UDDI.Constants.Lengths.Name );
  1180. }
  1181. }
  1182. //
  1183. // TODO: Override may be better for these calls to KeyedReference.Validate because no parent key is used
  1184. //
  1185. if( !Utility.CollectionEmpty( IdentifierBag ) )
  1186. IdentifierBag.Validate( "", KeyedReferenceType.IdentifierBag );
  1187. if( !Utility.CollectionEmpty( CategoryBag ) )
  1188. CategoryBag.Validate( "", KeyedReferenceType.CategoryBag );
  1189. try
  1190. {
  1191. int rows = 1;
  1192. //
  1193. // Find entities with matching identifier bag items.
  1194. //
  1195. if( !Utility.CollectionEmpty( IdentifierBag ) )
  1196. rows = find.FindByKeyedReferences( KeyedReferenceType.IdentifierBag, IdentifierBag );
  1197. //
  1198. // Find entities with matching category bag items.
  1199. //
  1200. if( rows > 0 && !Utility.CollectionEmpty( CategoryBag ) )
  1201. rows = find.FindByKeyedReferences( KeyedReferenceType.CategoryBag, CategoryBag );
  1202. //
  1203. // Find entities with matching names
  1204. //
  1205. if( rows > 0 && !Utility.StringEmpty( Name ) )
  1206. rows = find.FindByName( Name );
  1207. //
  1208. // Process the find result set.
  1209. //
  1210. if( 0 == rows )
  1211. {
  1212. //
  1213. // Cleanup any temporary tables.
  1214. //
  1215. find.Abort();
  1216. }
  1217. else if( 0 == MaxRows )
  1218. {
  1219. tModelList.Truncated = Truncated.True;
  1220. return tModelList;
  1221. }
  1222. else
  1223. {
  1224. //
  1225. // Read in the find results.
  1226. //
  1227. SqlDataReaderAccessor reader;
  1228. SqlStoredProcedureAccessor sp;
  1229. sp = find.RetrieveResults( MaxRows );
  1230. reader = sp.ExecuteReader();
  1231. try
  1232. {
  1233. while( reader.Read() )
  1234. {
  1235. tModelList.TModelInfos.Add( reader.GetKeyFromGuid( "entityKey" ) );
  1236. }
  1237. }
  1238. finally
  1239. {
  1240. reader.Close();
  1241. }
  1242. if( sp.Parameters.GetBool( "@truncated" ) )
  1243. tModelList.Truncated = Truncated.True;
  1244. else
  1245. tModelList.Truncated = Truncated.False;
  1246. foreach( TModelInfo tModelInfo in tModelList.TModelInfos )
  1247. tModelInfo.Get();
  1248. }
  1249. }
  1250. catch( Exception )
  1251. {
  1252. find.Abort();
  1253. throw;
  1254. }
  1255. return tModelList;
  1256. }
  1257. }
  1258. /// ********************************************************************
  1259. /// public class GetTModelDetail
  1260. /// --------------------------------------------------------------------
  1261. /// <summary>
  1262. /// </summary>
  1263. /// ********************************************************************
  1264. ///
  1265. [XmlRootAttribute("get_tModelDetail", Namespace=UDDI.API.Constants.Namespace)]
  1266. public class GetTModelDetail : IMessage
  1267. {
  1268. //
  1269. // Attribute: generic
  1270. //
  1271. private string generic;
  1272. [XmlAttribute("generic")]
  1273. public string Generic
  1274. {
  1275. get { return generic; }
  1276. set { generic = value; }
  1277. }
  1278. //
  1279. // Element: tModelKey
  1280. //
  1281. [XmlElement("tModelKey")]
  1282. public StringCollection TModelKeys;
  1283. public GetTModelDetail()
  1284. {
  1285. }
  1286. }
  1287. /// ********************************************************************
  1288. /// public class SaveTModel
  1289. /// --------------------------------------------------------------------
  1290. /// <summary>
  1291. /// </summary>
  1292. /// ********************************************************************
  1293. ///
  1294. [XmlRootAttribute("save_tModel", Namespace=UDDI.API.Constants.Namespace)]
  1295. public class SaveTModel : IAuthenticateable, IMessage
  1296. {
  1297. //
  1298. // Attribute: generic
  1299. //
  1300. private string generic;
  1301. [XmlAttribute("generic")]
  1302. public string Generic
  1303. {
  1304. get { return generic; }
  1305. set { generic = value; }
  1306. }
  1307. //
  1308. // Element: authInfo
  1309. //
  1310. private string authInfo;
  1311. [XmlElement("authInfo")]
  1312. public string AuthInfo
  1313. {
  1314. get { return authInfo; }
  1315. set { authInfo = value; }
  1316. }
  1317. //
  1318. // Element: tModel
  1319. //
  1320. [XmlElement("tModel")]
  1321. public TModelCollection TModels;
  1322. //
  1323. // Element: uploadRegister
  1324. //
  1325. [XmlElement("uploadRegister")]
  1326. public StringCollection UploadRegisters = new StringCollection();
  1327. public SaveTModel()
  1328. {
  1329. Generic = UDDI.API.Constants.Version;
  1330. }
  1331. /// ****************************************************************
  1332. /// public Save
  1333. /// ----------------------------------------------------------------
  1334. /// <summary>
  1335. /// </summary>
  1336. /// ****************************************************************
  1337. ///
  1338. public void Save()
  1339. {
  1340. //
  1341. // This is outside of replication so any attempt to specify
  1342. // an upload register URL will force an E_unsupported response
  1343. //
  1344. if( 0 != UploadRegisters.Count )
  1345. {
  1346. // throw new UDDIException( ErrorType.E_unsupported, "This node does not support the upload register facility" );
  1347. throw new UDDIException( ErrorType.E_unsupported, "UDDI_ERROR_NODE_DOES_NOT_SUPPORT_UPLOAD" );
  1348. }
  1349. TModels.Save();
  1350. }
  1351. }
  1352. [XmlRootAttribute("tModelDetail", Namespace=UDDI.API.Constants.Namespace)]
  1353. public class TModelDetail
  1354. {
  1355. [XmlAttribute("generic")]
  1356. public string Generic = UDDI.API.Constants.Version;
  1357. [XmlAttribute("operator")]
  1358. public string Operator = Config.GetString( "Operator" );
  1359. [XmlAttribute("truncated")]
  1360. public Truncated Truncated;
  1361. [XmlElement("tModel")]
  1362. public TModelCollection TModels = new TModelCollection();
  1363. public void Get( StringCollection tModelKeys )
  1364. {
  1365. foreach( string tModelKey in tModelKeys )
  1366. {
  1367. int index = TModels.Add( tModelKey );
  1368. TModels[ index ].Get();
  1369. }
  1370. }
  1371. }
  1372. [XmlRootAttribute("tModelList", Namespace=UDDI.API.Constants.Namespace)]
  1373. public class TModelList
  1374. {
  1375. //
  1376. // Attribute: generic
  1377. //
  1378. [XmlAttribute("generic")]
  1379. public string Generic = UDDI.API.Constants.Version;
  1380. //
  1381. // Attribute: operator
  1382. //
  1383. [XmlAttribute("operator")]
  1384. public string Operator = Config.GetString( "Operator" );
  1385. //
  1386. // Attribute: truncated
  1387. //
  1388. [XmlAttribute("truncated")]
  1389. public Truncated Truncated;
  1390. //
  1391. // Element: tModelInfos
  1392. //
  1393. private TModelInfoCollection tModelInfos;
  1394. [ XmlArray( "tModelInfos" ), XmlArrayItem( "tModelInfo" ) ]
  1395. public TModelInfoCollection TModelInfos
  1396. {
  1397. get
  1398. {
  1399. if( null == tModelInfos )
  1400. tModelInfos = new TModelInfoCollection();
  1401. return tModelInfos;
  1402. }
  1403. set { tModelInfos = value; }
  1404. }
  1405. }
  1406. }