Source for file DimensionsPartStructure.class.php

Documentation is available at DimensionsPartStructure.class.php

  1. <?php
  2.  
  3. require_once(OKI2."/osid/repository/PartStructure.php");
  4.  
  5. /**
  6. * Each Asset has one of the AssetType supported by the Repository. There are
  7. * also zero or more RecordStructures required by the Repository for each
  8. * AssetType. RecordStructures provide structural information. The values for
  9. * a given Asset's RecordStructure are stored in a Record. RecordStructures
  10. * can contain sub-elements which are referred to as PartStructures. The
  11. * structure defined in the RecordStructure and its PartStructures is used in
  12. * for any Records for the Asset. Records have Parts which parallel
  13. * PartStructures.
  14. *
  15. * <p>
  16. * OSID Version: 2.0
  17. * </p>
  18. *
  19. * @package harmoni.osid_v2.repository
  20. *
  21. * @copyright Copyright &copy;2005, Middlebury College
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
  23. *
  24. * @version $Id: DimensionsPartStructure.class.php,v 1.7 2007/09/04 20:25:44 adamfranco Exp $
  25. */
  26. class DimensionsPartStructure
  27. extends PartStructure
  28. {
  29.  
  30. var $_partStructure;
  31. var $_idString;
  32. function DimensionsPartStructure($partStructure, $idString) {
  33. $this->_partStructure =$partStructure;
  34. $this->_idString = $idString;
  35. }
  36. /**
  37. * Get the display name for this PartStructure.
  38. *
  39. * @return string
  40. *
  41. * @throws object RepositoryException An exception with one of
  42. * the following messages defined in
  43. * org.osid.repository.RepositoryException may be thrown: {@link }
  44. * org.osid.repository.RepositoryException#OPERATION_FAILED
  45. * OPERATION_FAILED}, {@link }
  46. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  47. * PERMISSION_DENIED}, {@link }
  48. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  49. * CONFIGURATION_ERROR}, {@link }
  50. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  51. * UNIMPLEMENTED}
  52. *
  53. * @access public
  54. */
  55. function getDisplayName() {
  56. return "Dimensions";
  57. }
  58.  
  59. /**
  60. * Get the description for this PartStructure.
  61. *
  62. * @return string
  63. *
  64. * @throws object RepositoryException An exception with one of
  65. * the following messages defined in
  66. * org.osid.repository.RepositoryException may be thrown: {@link }
  67. * org.osid.repository.RepositoryException#OPERATION_FAILED
  68. * OPERATION_FAILED}, {@link }
  69. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  70. * PERMISSION_DENIED}, {@link }
  71. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  72. * CONFIGURATION_ERROR}, {@link }
  73. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  74. * UNIMPLEMENTED}
  75. *
  76. * @access public
  77. */
  78. function getDescription() {
  79. return "The dimensions of the file if it is an image or video.";
  80. }
  81. /**
  82. * Get the Type for this PartStructure.
  83. *
  84. * @return object Type
  85. *
  86. * @throws object RepositoryException An exception with one of
  87. * the following messages defined in
  88. * org.osid.repository.RepositoryException may be thrown: {@link }
  89. * org.osid.repository.RepositoryException#OPERATION_FAILED
  90. * OPERATION_FAILED}, {@link }
  91. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  92. * PERMISSION_DENIED}, {@link }
  93. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  94. * CONFIGURATION_ERROR}, {@link }
  95. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  96. * UNIMPLEMENTED}
  97. *
  98. * @access public
  99. */
  100. function getType() {
  101. if (!isset($this->_type)) {
  102. $this->_type = new HarmoniType("Repository", "edu.middlebury.harmoni", "array");
  103. }
  104. return $this->_type;
  105. }
  106.  
  107. /**
  108. * Get the unique Id for this PartStructure.
  109. *
  110. * @return object Id
  111. *
  112. * @throws object RepositoryException An exception with one of
  113. * the following messages defined in
  114. * org.osid.repository.RepositoryException may be thrown: {@link }
  115. * org.osid.repository.RepositoryException#OPERATION_FAILED
  116. * OPERATION_FAILED}, {@link }
  117. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  118. * PERMISSION_DENIED}, {@link }
  119. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  120. * CONFIGURATION_ERROR}, {@link }
  121. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  122. * UNIMPLEMENTED}
  123. *
  124. * @access public
  125. */
  126. function getId() {
  127. $idManager = Services::getService("Id");
  128. return $idManager->getId($this->_idString);
  129. }
  130.  
  131. /**
  132. * Get all the PartStructures in the PartStructure. Iterators return a
  133. * set, one at a time.
  134. *
  135. * @return object PartStructureIterator
  136. *
  137. * @throws object RepositoryException An exception with one of
  138. * the following messages defined in
  139. * org.osid.repository.RepositoryException may be thrown: {@link }
  140. * org.osid.repository.RepositoryException#OPERATION_FAILED
  141. * OPERATION_FAILED}, {@link }
  142. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  143. * PERMISSION_DENIED}, {@link }
  144. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  145. * CONFIGURATION_ERROR}, {@link }
  146. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  147. * UNIMPLEMENTED}
  148. *
  149. * @access public
  150. */
  151. function getPartStructure() {
  152. $array = array();
  153. $obj = new HarmoniNodeIterator($array);
  154. return $obj; // @todo replace with HarmoniPartStructureIterator
  155. }
  156.  
  157. /**
  158. * Return true if this PartStructure is automatically populated by the
  159. * Repository; false otherwise. Examples of the kind of PartStructures
  160. * that might be populated are a time-stamp or the Agent setting the data.
  161. *
  162. * @return boolean
  163. *
  164. * @throws object RepositoryException An exception with one of
  165. * the following messages defined in
  166. * org.osid.repository.RepositoryException may be thrown: {@link }
  167. * org.osid.repository.RepositoryException#OPERATION_FAILED
  168. * OPERATION_FAILED}, {@link }
  169. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  170. * PERMISSION_DENIED}, {@link }
  171. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  172. * CONFIGURATION_ERROR}, {@link }
  173. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  174. * UNIMPLEMENTED}
  175. *
  176. * @access public
  177. */
  178. function isPopulatedByRepository() {
  179. return TRUE;
  180. }
  181.  
  182. /**
  183. * Return true if this PartStructure is mandatory; false otherwise.
  184. *
  185. * @return boolean
  186. *
  187. * @throws object RepositoryException An exception with one of
  188. * the following messages defined in
  189. * org.osid.repository.RepositoryException may be thrown: {@link }
  190. * org.osid.repository.RepositoryException#OPERATION_FAILED
  191. * OPERATION_FAILED}, {@link }
  192. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  193. * PERMISSION_DENIED}, {@link }
  194. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  195. * CONFIGURATION_ERROR}, {@link }
  196. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  197. * UNIMPLEMENTED}
  198. *
  199. * @access public
  200. */
  201. function isMandatory() {
  202. return TRUE;
  203. }
  204.  
  205. /**
  206. * Return true if this PartStructure is repeatable; false otherwise. This
  207. * is determined by the implementation.
  208. *
  209. * @return boolean
  210. *
  211. * @throws object RepositoryException An exception with one of
  212. * the following messages defined in
  213. * org.osid.repository.RepositoryException may be thrown: {@link }
  214. * org.osid.repository.RepositoryException#OPERATION_FAILED
  215. * OPERATION_FAILED}, {@link }
  216. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  217. * PERMISSION_DENIED}, {@link }
  218. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  219. * CONFIGURATION_ERROR}, {@link }
  220. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  221. * UNIMPLEMENTED}
  222. *
  223. * @access public
  224. */
  225. function isRepeatable() {
  226. return FALSE;
  227. }
  228.  
  229. /**
  230. * Get the RecordStructure associated with this PartStructure.
  231. *
  232. * @return object RecordStructure
  233. *
  234. * @throws object RepositoryException An exception with one of
  235. * the following messages defined in
  236. * org.osid.repository.RepositoryException may be thrown: {@link }
  237. * org.osid.repository.RepositoryException#OPERATION_FAILED
  238. * OPERATION_FAILED}, {@link }
  239. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  240. * PERMISSION_DENIED}, {@link }
  241. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  242. * CONFIGURATION_ERROR}, {@link }
  243. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  244. * UNIMPLEMENTED}
  245. *
  246. * @access public
  247. */
  248. function getRecordStructure() {
  249. return $this->_recordStructure;
  250. }
  251.  
  252. /**
  253. * Validate a Part against its PartStructure. Return true if valid; false
  254. * otherwise. The status of the Asset holding this Record is not changed
  255. * through this method. The implementation may throw an Exception for any
  256. * validation failures and use the Exception's message to identify
  257. * specific causes.
  258. *
  259. * @param object Part $part
  260. *
  261. * @return boolean
  262. *
  263. * @throws object RepositoryException An exception with one of
  264. * the following messages defined in
  265. * org.osid.repository.RepositoryException may be thrown: {@link }
  266. * org.osid.repository.RepositoryException#OPERATION_FAILED
  267. * OPERATION_FAILED}, {@link }
  268. * org.osid.repository.RepositoryException#PERMISSION_DENIED
  269. * PERMISSION_DENIED}, {@link }
  270. * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
  271. * CONFIGURATION_ERROR}, {@link }
  272. * org.osid.repository.RepositoryException#UNIMPLEMENTED
  273. * UNIMPLEMENTED}, {@link }
  274. * org.osid.repository.RepositoryException#NULL_ARGUMENT
  275. * NULL_ARGUMENT}
  276. *
  277. * @access public
  278. */
  279. function validatePart($part) {
  280. // we can check if the Part (ie, ValueVersions) has values of the right type.
  281. // @todo
  282. return true;
  283. }
  284. /*******************************************************
  285. * Authority Lists:
  286. * The OSID does not have any support for authority lists.
  287. * These methods could have been placed in another system,
  288. * but have been placed here for ease of locating them.
  289. * Also involved with Authority Lists is a SearchType:
  290. * Repository::edu.middlebury.harmoni::AuthorityValue
  291. * which takes a PartStructure Id and a Value to search on.
  292. *********************************************************/
  293.  
  294. /**
  295. * Answer the authoritative values for this part.
  296. *
  297. * WARNING: NOT in OSID
  298. *
  299. * @return object ObjectIterator
  300. * @access public
  301. * @since 4/25/06
  302. */
  303. function getAuthoritativeValues () {
  304. $array = array();
  305. $iterator = new HarmoniIterator($array);
  306. return $iterator;
  307. }
  308. /**
  309. * Answer true if the value pass is authoritative.
  310. *
  311. * WARNING: NOT in OSID
  312. *
  313. * @param object $value
  314. * @return boolean
  315. * @access public
  316. * @since 4/25/06
  317. */
  318. function isAuthoritativeValue ( $value ) {
  319. return false;
  320. }
  321. /**
  322. * Remove an authoritative value.
  323. *
  324. * WARNING: NOT in OSID
  325. *
  326. * @param object $value
  327. * @return void
  328. * @access public
  329. * @since 4/25/06
  330. */
  331. function removeAuthoritativeValue ( $value ) {
  332. }
  333. /**
  334. * Add an authoritative value
  335. *
  336. * WARNING: NOT in OSID
  337. *
  338. * @param object $value
  339. * @return void
  340. * @access public
  341. * @since 4/25/06
  342. */
  343. function addAuthoritativeValue ( $value ) {
  344. $false = false;
  345. return $false;
  346. }
  347. /**
  348. * Add an authoritative value
  349. *
  350. * WARNING: NOT in OSID
  351. *
  352. * @param string $valueString
  353. * @return void
  354. * @access public
  355. * @since 4/25/06
  356. */
  357. function addAuthoritativeValueAsString ( $valueString ) {
  358. }
  359. /**
  360. * Answer the Primative object appropriate for this part, whose value is
  361. * represented by the input string.
  362. *
  363. * @param string $valueString
  364. * @return object
  365. * @access public
  366. * @since 4/27/06
  367. */
  368. function createValueObjectFromString ( $valueString ) {
  369. $false = false;
  370. return $false;
  371. }
  372. }

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