Source for file FileNamePartStructure.class.php

Documentation is available at FileNamePartStructure.class.php

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

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