Source for file HarmoniEntry.class.php

Documentation is available at HarmoniEntry.class.php

  1. <?php
  2. /**
  3. * @since 3/1/06
  4. * @package harmoni.osid_v2.logging
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: HarmoniEntry.class.php,v 1.4 2007/09/04 20:25:43 adamfranco Exp $
  10. */
  11.  
  12. require_once(OKI2."/osid/logging/Entry.php");
  13. require_once(dirname(__FILE__)."/AgentNodeEntryItem.class.php");
  14.  
  15. /**
  16. * Contains the logged item, its format type, its priority type, and the time
  17. * the item was logged.
  18. *
  19. * <p>
  20. * OSID Version: 2.0
  21. * </p>
  22. *
  23. * <p>
  24. * Licensed under the {@link org.osid.SidImplementationLicenseMIT MIT}
  25. * O.K.I&#46; OSID Definition License}.
  26. * </p>
  27. *
  28. * @package harmoni.osid_v2.logging
  29. */
  30. class HarmoniEntry
  31. extends Entry
  32. {
  33. /**
  34. * Constructor
  35. *
  36. * @param mixed $entryItem
  37. * @param object Type $formatType
  38. * @param object Type $priorityType
  39. * @return object
  40. * @access public
  41. * @since 3/1/06
  42. */
  43. function HarmoniEntry ( $timestamp, $category, $description, $backtrace, $agents, $nodes, $formatType, $priorityType ) {
  44. ArgumentValidator::validate($timestamp, ExtendsValidatorRule::getRule("DateAndTime"));
  45. ArgumentValidator::validate($category, StringValidatorRule::getRule());
  46. ArgumentValidator::validate($description, StringValidatorRule::getRule());
  47. ArgumentValidator::validate($backtrace, StringValidatorRule::getRule());
  48. ArgumentValidator::validate($agents, ArrayValidatorRule::getRule());
  49. ArgumentValidator::validate($nodes, ArrayValidatorRule::getRule());
  50. ArgumentValidator::validate($formatType, ExtendsValidatorRule::getRule("Type"));
  51. ArgumentValidator::validate($priorityType, ExtendsValidatorRule::getRule("type"));
  52. $this->_timestamp =$timestamp;
  53. $this->_formatType =$formatType;
  54. $this->_priorityType =$priorityType;
  55. $this->_entryItem = new AgentNodeEntryItem($category, $description);
  56. $this->_entryItem->setBacktrace($backtrace);
  57. $idManager = Services::getService("Id");
  58. foreach ($agents as $idString) {
  59. if ($idString)
  60. $this->_entryItem->addAgentId($idManager->getId($idString));
  61. }
  62. foreach ($nodes as $idString)
  63. if ($idString)
  64. $this->_entryItem->addNodeId($idManager->getId($idString));
  65. }
  66. /**
  67. * Return the logged item.
  68. *
  69. * @return object mixed (original type: java.io.Serializable)
  70. *
  71. * @throws object LoggingException An exception with one of the
  72. * following messages defined in org.osid.logging.LoggingException
  73. * may be thrown: {@link }
  74. * org.osid.logging.LoggingException#UNIMPLEMENTED UNIMPLEMENTED},
  75. * {@link org.osid.logging.LoggingException#OPERATION_FAILED}
  76. * OPERATION_FAILED}, {@link }
  77. * org.osid.logging.LoggingException#CONFIGURATION_ERROR
  78. * CONFIGURATION_ERROR}, {@link }
  79. * org.osid.logging.LoggingException#PERMISSION_DENIED
  80. * PERMISSION_DENIED}
  81. *
  82. * @access public
  83. */
  84. function getItem () {
  85. return $this->_entryItem;
  86. }
  87.  
  88. /**
  89. * Return the format type of logged item.
  90. *
  91. * @return object Type
  92. *
  93. * @throws object LoggingException An exception with one of the
  94. * following messages defined in org.osid.logging.LoggingException
  95. * may be thrown: {@link }
  96. * org.osid.logging.LoggingException#UNIMPLEMENTED UNIMPLEMENTED},
  97. * {@link org.osid.logging.LoggingException#OPERATION_FAILED}
  98. * OPERATION_FAILED}, {@link }
  99. * org.osid.logging.LoggingException#CONFIGURATION_ERROR
  100. * CONFIGURATION_ERROR}, {@link }
  101. * org.osid.logging.LoggingException#PERMISSION_DENIED
  102. * PERMISSION_DENIED}
  103. *
  104. * @access public
  105. */
  106. function getFormatType () {
  107. return $this->_formatType;
  108. }
  109.  
  110. /**
  111. * Return the format type of logged item.
  112. *
  113. * @return object Type
  114. *
  115. * @throws object LoggingException An exception with one of the
  116. * following messages defined in org.osid.logging.LoggingException
  117. * may be thrown: {@link }
  118. * org.osid.logging.LoggingException#UNIMPLEMENTED UNIMPLEMENTED},
  119. * {@link org.osid.logging.LoggingException#OPERATION_FAILED}
  120. * OPERATION_FAILED}, {@link }
  121. * org.osid.logging.LoggingException#CONFIGURATION_ERROR
  122. * CONFIGURATION_ERROR}, {@link }
  123. * org.osid.logging.LoggingException#PERMISSION_DENIED
  124. * PERMISSION_DENIED}
  125. *
  126. * @access public
  127. */
  128. function getPriorityType () {
  129. return $this->_priorityType;
  130. }
  131.  
  132. /**
  133. * Return the time that the item was logged.
  134. *
  135. * @return object Timestamp OSID specifies returning an int (Unix timestamp)
  136. * but we might as well use our nice primitives.
  137. *
  138. * @throws object LoggingException An exception with one of the
  139. * following messages defined in org.osid.logging.LoggingException
  140. * may be thrown: {@link }
  141. * org.osid.logging.LoggingException#UNIMPLEMENTED UNIMPLEMENTED},
  142. * {@link org.osid.logging.LoggingException#OPERATION_FAILED}
  143. * OPERATION_FAILED}, {@link }
  144. * org.osid.logging.LoggingException#CONFIGURATION_ERROR
  145. * CONFIGURATION_ERROR}, {@link }
  146. * org.osid.logging.LoggingException#PERMISSION_DENIED
  147. * PERMISSION_DENIED}
  148. *
  149. * @access public
  150. */
  151. function getTimestamp () {
  152. return $this->_timestamp;
  153. }
  154. }
  155.  
  156. ?>

Documentation generated on Wed, 19 Sep 2007 10:23:52 -0400 by phpDocumentor 1.3.0RC3