Documentation is available at HarmoniPart.class.php
- <?php
- require(OKI2."osid/repository/Part.php");
- /**
- * Each Asset has one of the AssetType supported by the Repository. There are
- * also zero or more RecordStructures required by the Repository for each
- * AssetType. RecordStructures provide structural information. The values for
- * a given Asset's RecordStructure are stored in a Record. RecordStructures
- * can contain sub-elements which are referred to as PartStructures. The
- * structure defined in the RecordStructure and its PartStructures is used in
- * for any Records for the Asset. Records have Parts which parallel
- * PartStructures.
- *
- * <p>
- * OSID Version: 2.0
- * </p>
- *
- * @package harmoni.osid_v2.repository
- *
- * @copyright Copyright ©2005, Middlebury College
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
- *
- * @version $Id: HarmoniPart.class.php,v 1.20 2007/09/04 20:25:43 adamfranco Exp $
- */
- class HarmoniPart
- extends Part
- // extends java.io.Serializable
- {
- var $_recordFieldValue;
- var $_partStructure;
- function HarmoniPart( $partStructure, $recordFieldValue, $asset ) {
- $this->_recordFieldValue =$recordFieldValue;
- $this->_partStructure =$partStructure;
- $this->_asset =$asset;
- }
- /**
- * Update the display name for this Part.
- *
- * @param string $displayName
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}, {@link }
- * org.osid.repository.RepositoryException#NULL_ARGUMENT
- * NULL_ARGUMENT}
- *
- * @access public
- */
- function updateDisplayName ( $displayName ) {
- die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
- }
- /**
- * Get the display name for this Part.
- *
- * @return string
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}
- *
- * @access public
- */
- function getDisplayName () {
- die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
- }
- /**
- * Get the PartStructure associated with this Part.
- *
- * @return object PartStructure
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}
- *
- * @access public
- */
- function getPartStructure () {
- return $this->_partStructure;
- }
- /**
- * Get the unique Id for this Part.
- *
- * @return object Id
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}
- *
- * @access public
- */
- function getId () {
- // The unique ID for the part should be the
- // RecordID::RecordFieldLabel::RecordFieldIndex
- return $this->_recordFieldValue->getId();
- }
- /**
- * Create a Part. Records are composed of Parts. Parts can also contain
- * other Parts. Each Record is associated with a specific RecordStructure
- * and each Part is associated with a specific PartStructure.
- *
- * @param object Id $partStructureId
- * @param object mixed $value (original type: java.io.Serializable)
- *
- * @return object Part
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}, {@link }
- * org.osid.repository.RepositoryException#NULL_ARGUMENT
- * NULL_ARGUMENT}, {@link }
- * org.osid.repository.RepositoryException#UNKNOWN_ID UNKNOWN_ID}
- *
- * @access public
- */
- function createPart ( $partStructureId, $value ) {
- throwError(
- new Error(RepositoryException::UNIMPLEMENTED(), "HarmoniPart", true));
- $this->_asset->updateModificationDate();
- }
- /**
- * Delete a Part and all its Parts.
- *
- * @param object Id $partId
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}, {@link }
- * org.osid.repository.RepositoryException#NULL_ARGUMENT
- * NULL_ARGUMENT}, {@link }
- * org.osid.repository.RepositoryException#UNKNOWN_ID UNKNOWN_ID}
- *
- * @access public
- */
- function deletePart ( $partId ) {
- throwError(
- new Error(RepositoryException::UNIMPLEMENTED(), "HarmoniPart", true));
- $this->_asset->updateModificationDate();
- }
- /**
- * Get all the Parts in this Part. Iterators return a set, one at a time.
- *
- * @return object PartIterator
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}
- *
- * @access public
- */
- function getParts () {
- throwError(
- new Error(RepositoryException::UNIMPLEMENTED(), "HarmoniPart", true));
- }
- /**
- * Get the value for this Part.
- *
- * @return object mixed (original type: java.io.Serializable)
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}
- *
- * @access public
- */
- function getValue () {
- // NOTE: if no active versions exist, false will be returned here.
- $actValue =$this->_recordFieldValue->getActiveVersion();
- if ($actValue) return $actValue->getPrimitive();
- return ($null=null);
- }
- /**
- * updates the part with a string
- *
- * WARNING: NOT IN OSID
- *
- * @param string $value this is the string value that needs to get in a part
- * @param Id $id this is the id of the part
- * @return false on failed update
- * @access public
- * @since 7/21/05
- */
- function updateValueFromString ( $value ) {
- $partStructure =$this->getPartStructure();
- $dtm = Services::getService("DataTypeManager");
- $type = $partStructure->getType();
- $class = $dtm->primitiveClassForType($type->getKeyword());
- eval('$object = '.$class.'::fromString($value);');
- if (!is_object($object))
- return false;
- $this->updateValue($object);
- }
- /**
- * Update the value for this Part.
- *
- * @param object mixed $value (original type: java.io.Serializable)
- *
- * @throws object RepositoryException An exception with one of
- * the following messages defined in
- * org.osid.repository.RepositoryException may be thrown: {@link }
- * org.osid.repository.RepositoryException#OPERATION_FAILED
- * OPERATION_FAILED}, {@link }
- * org.osid.repository.RepositoryException#PERMISSION_DENIED
- * PERMISSION_DENIED}, {@link }
- * org.osid.repository.RepositoryException#CONFIGURATION_ERROR
- * CONFIGURATION_ERROR}, {@link }
- * org.osid.repository.RepositoryException#UNIMPLEMENTED
- * UNIMPLEMENTED}, {@link }
- * org.osid.repository.RepositoryException#NULL_ARGUMENT
- * NULL_ARGUMENT}
- *
- * @access public
- */
- function updateValue ( $value ) {
- ArgumentValidator::validate($value,
- ExtendsValidatorRule::getRule("SObject"));
- // Get the type for the field.
- $this->_recordFieldValue->setValueFromPrimitive($value);
- $this->_recordFieldValue->commit();
- $this->_asset->updateModificationDate();
- }
- }
Documentation generated on Wed, 19 Sep 2007 10:24:08 -0400 by phpDocumentor 1.3.0RC3