KEDB.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <?php
  2. $oAllowedStatuses = new ValueSetEnum('production,implementation,obsolete');
  3. ////////////////////////////////////////////////////////////////////////////////////
  4. /**
  5. * Description of known error
  6. */
  7. ////////////////////////////////////////////////////////////////////////////////////
  8. class bizKnownError extends cmdbAbstractObject
  9. {
  10. public static function Init()
  11. {
  12. $aParams = array
  13. (
  14. "category" => "bizmodel,searchable",
  15. "name" => "Known Error",
  16. "description" => "Error documented for a known issue",
  17. "key_type" => "autoincrement",
  18. "key_label" => "id",
  19. "name_attcode" => "name",
  20. "state_attcode" => "",
  21. "reconc_keys" => array("cust_id", "name"), // inherited attributes
  22. "db_table" => "known_error",
  23. "db_key_field" => "id",
  24. "db_finalclass_field" => "",
  25. "display_template" => "../business/templates/knownError.html",
  26. );
  27. MetaModel::Init_Params($aParams);
  28. MetaModel::Init_InheritAttributes();
  29. MetaModel::Init_AddAttribute(new AttributeString("name", array("label"=>"Name", "description"=>"Name to identify this error", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
  30. MetaModel::Init_AddAttribute(new AttributeExternalKey("cust_id", array("targetclass"=>"bizOrganization", "label"=>"Organization", "description"=>"Organization for this known error", "allowed_values"=>null, "sql"=>"cust_id", "is_null_allowed"=>false, "depends_on"=>array())));
  31. MetaModel::Init_AddAttribute(new AttributeExternalField("cust_name", array("label"=>"Organization", "description"=>"Company / Department owning this object", "allowed_values"=>null, "extkey_attcode"=> 'cust_id', "target_attcode"=>"name")));
  32. MetaModel::Init_AddAttribute(new AttributeText("symptom", array("label"=>"Symptom", "description"=>"Description of this error", "allowed_values"=>null, "sql"=>"symptom", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  33. MetaModel::Init_AddAttribute(new AttributeText("root_cause", array("label"=>"Root cause", "description"=>"Original cause for this known error", "allowed_values"=>null, "sql"=>"rootcause", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  34. MetaModel::Init_AddAttribute(new AttributeText("workaround", array("label"=>"Work around", "description"=>"Work around to fix this error", "allowed_values"=>null, "sql"=>"workaround", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  35. MetaModel::Init_AddAttribute(new AttributeText("solution", array("label"=>"Solution", "description"=>"Description of this contract", "allowed_values"=>null, "sql"=>"solution", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  36. MetaModel::Init_AddAttribute(new AttributeString("error_code", array("label"=>"Error Code", "description"=>"Key word to identify error", "allowed_values"=>null, "sql"=>"error_code", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  37. MetaModel::Init_AddAttribute(new AttributeEnum("domain", array("label"=>"Domain", "description"=>"Domain for this known error, network, desktop, ...", "allowed_values"=>new ValueSetEnum("Network, Server, Application, Desktop"), "sql"=>"domain", "default_value"=>"Application", "is_null_allowed"=>false, "depends_on"=>array())));
  38. MetaModel::Init_AddAttribute(new AttributeString("vendor", array("label"=>"Vendor", "description"=>"Vendor concerned by this known error", "allowed_values"=>null, "sql"=>"vendor", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  39. MetaModel::Init_AddAttribute(new AttributeString("model", array("label"=>"Model", "description"=>"Model concerned by this known error, it may be an application, a device ...", "allowed_values"=>null, "sql"=>"model", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  40. MetaModel::Init_AddAttribute(new AttributeString("version", array("label"=>"Version", "description"=>"Version related to model impacted by known error", "allowed_values"=>null, "sql"=>"version", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  41. MetaModel::Init_InheritFilters();
  42. MetaModel::Init_AddFilterFromAttribute("name");
  43. MetaModel::Init_AddFilterFromAttribute("cust_id");
  44. MetaModel::Init_AddFilterFromAttribute("cust_name");
  45. MetaModel::Init_AddFilterFromAttribute("error_code");
  46. MetaModel::Init_AddFilterFromAttribute("domain");
  47. MetaModel::Init_SetZListItems('details', array('name', 'cust_id','error_code','domain','vendor','model','version', 'symptom','root_cause','workaround','solution')); // Attributes to be displayed for the complete details
  48. MetaModel::Init_SetZListItems('list', array('name', 'cust_id','error_code', 'symptom')); // Attributes to be displayed for a list
  49. // Search criteria
  50. MetaModel::Init_SetZListItems('standard_search', array('name', 'error_code','domain')); // Criteria of the std search form
  51. MetaModel::Init_SetZListItems('advanced_search', array('name', 'cust_id','error_code', 'error_code','symptom')); // Criteria of the advanced search form
  52. }
  53. // State machine actions
  54. public function IncrementVersion($sStimulusCode)
  55. {
  56. $this->Set('version_number', $this->Get('version_number') + 1);
  57. return true;
  58. }
  59. }
  60. ////////////////////////////////////////////////////////////////////////////////////
  61. /**
  62. * n-n link between any Infra and a Known Error
  63. */
  64. ////////////////////////////////////////////////////////////////////////////////////
  65. class lnkInfraError extends cmdbAbstractObject
  66. {
  67. public static function Init()
  68. {
  69. $aParams = array
  70. (
  71. "category" => "bizmodel,searchable",
  72. "name" => "InfraErrorLinks",
  73. "description" => "Infra related to a known error",
  74. "key_type" => "autoincrement",
  75. "key_label" => "link_id",
  76. "name_attcode" => "", // ????
  77. "state_attcode" => "",
  78. "reconc_keys" => array("infra_id","error_id"), // ????
  79. "db_table" => "infra_error_links",
  80. "db_key_field" => "link_id",
  81. "db_finalclass_field" => "",
  82. "display_template" => "../business/templates/default.html",
  83. );
  84. MetaModel::Init_Params($aParams);
  85. MetaModel::Init_AddAttribute(new AttributeExternalKey("infra_id", array("targetclass"=>"logInfra", "jointype"=> '', "label"=>"Infrastructure", "description"=>"The infrastructure impacted", "allowed_values"=>null, "sql"=>"infra_id", "is_null_allowed"=>false, "depends_on"=>array())));
  86. MetaModel::Init_AddAttribute(new AttributeExternalField("infra_name", array("label"=>"Infrastructure name", "description"=>"Name of the impacted infrastructure", "allowed_values"=>null, "extkey_attcode"=> 'infra_id', "target_attcode"=>"name")));
  87. MetaModel::Init_AddAttribute(new AttributeExternalField("infra_status", array("label"=>"Status", "description"=>"Status of the impacted infrastructure", "allowed_values"=>null, "extkey_attcode"=> 'infra_id', "target_attcode"=>"status")));
  88. MetaModel::Init_AddAttribute(new AttributeExternalKey("error_id", array("targetclass"=>"bizKnownError", "jointype"=> '', "label"=>"Error name", "description"=>"Error id", "allowed_values"=>null, "sql"=>"error_id", "is_null_allowed"=>false, "depends_on"=>array())));
  89. MetaModel::Init_AddAttribute(new AttributeExternalField("error_name", array("label"=>"Error name", "description"=>"Name of the error", "allowed_values"=>null, "extkey_attcode"=> 'error_id', "target_attcode"=>"name")));
  90. MetaModel::Init_AddFilterFromAttribute("infra_id");
  91. MetaModel::Init_AddFilterFromAttribute("error_id");
  92. // Display lists
  93. MetaModel::Init_SetZListItems('details', array('infra_id', 'error_id')); // Attributes to be displayed for a list
  94. MetaModel::Init_SetZListItems('list', array('infra_id', 'infra_status','error_id')); // Attributes to be displayed for a list
  95. // Search criteria
  96. MetaModel::Init_SetZListItems('standard_search', array('infra_id', 'error_id')); // Criteria of the std search form
  97. MetaModel::Init_SetZListItems('advanced_search', array('infra_id', 'error_id')); // Criteria of the advanced search form
  98. }
  99. }
  100. ////////////////////////////////////////////////////////////////////////////////////
  101. /**
  102. * n-n link between any Contract and a Document
  103. */
  104. ////////////////////////////////////////////////////////////////////////////////////
  105. class lnkDocumentError extends cmdbAbstractObject
  106. {
  107. public static function Init()
  108. {
  109. $aParams = array
  110. (
  111. "category" => "bizmodel,searchable",
  112. "name" => "DocumentsErrorLinks",
  113. "description" => "A link between a document and a known error",
  114. "key_type" => "autoincrement",
  115. "key_label" => "link_id",
  116. "name_attcode" => "link_type",
  117. "state_attcode" => "",
  118. "reconc_keys" => array("doc_name", "error_name"),
  119. "db_table" => "documents_error_link",
  120. "db_key_field" => "link_id",
  121. "db_finalclass_field" => "",
  122. "display_template" => "../business/templates/default.html",
  123. );
  124. MetaModel::Init_Params($aParams);
  125. MetaModel::Init_AddAttribute(new AttributeExternalKey("doc_id", array("targetclass"=>"bizDocument", "label"=>"Document Name", "description"=>"id of the Document", "allowed_values"=>null, "sql"=>"doc_id", "is_null_allowed"=>false, "depends_on"=>array())));
  126. MetaModel::Init_AddAttribute(new AttributeExternalField("doc_name", array("label"=>"Document", "description"=>"name of the document", "allowed_values"=>null, "extkey_attcode"=> 'doc_id', "target_attcode"=>"name")));
  127. MetaModel::Init_AddAttribute(new AttributeExternalKey("error_id", array("targetclass"=>"bizKnownError", "label"=>"Error", "description"=>"Error linked to this document", "allowed_values"=>null, "sql"=>"error_id", "is_null_allowed"=>false, "depends_on"=>array())));
  128. MetaModel::Init_AddAttribute(new AttributeExternalField("error_name", array("label"=>"Error name", "description"=>"name of the linked error", "allowed_values"=>null, "extkey_attcode"=> 'error_id', "target_attcode"=>"name")));
  129. MetaModel::Init_AddAttribute(new AttributeString("link_type", array("label"=>"link_type", "description"=>"Type of the link", "allowed_values"=>null, "sql"=>"link_type", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
  130. MetaModel::Init_AddFilterFromAttribute("doc_id");
  131. MetaModel::Init_AddFilterFromAttribute("doc_name");
  132. MetaModel::Init_AddFilterFromAttribute("error_id");
  133. MetaModel::Init_AddFilterFromAttribute("error_name");
  134. MetaModel::Init_AddFilterFromAttribute("link_type");
  135. // Display lists
  136. MetaModel::Init_SetZListItems('details', array('doc_id', 'error_name', 'link_type')); // Attributes to be displayed for the complete details
  137. MetaModel::Init_SetZListItems('list', array('doc_id', 'error_name', 'link_type')); // Attributes to be displayed for a list
  138. }
  139. }
  140. ?>