/** * Create a new PrimitiveIO object that allows for selection from an authority * list * * @param <##> * @return <##> * @access public * @since 5/1/06 */ static function createComponentForPartStructure($partStruct) { ArgumentValidator::validate($partStruct, ExtendsValidatorRule::getRule("PartStructure")); $partStructType = $partStruct->getType(); // get the datamanager data type $dataType = $partStructType->getKeyword(); // printpre($dataType); $authoritativeValues = $partStruct->getAuthoritativeValues(); if ($authoritativeValues->hasNext()) { $authZManager = Services::getService("AuthZ"); $idManager = Services::getService("Id"); if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_authority_list"), $partStruct->getRepositoryId())) { $component = new PrimitiveIO_AuthoritativeContainer(); $component->setSelectComponent(PrimitiveIOManager::createAuthoritativeComponent($dataType)); $component->setNewComponent(PrimitiveIOManager::createComponent($dataType)); } else { $component = PrimitiveIOManager::createAuthoritativeComponent($dataType); } while ($authoritativeValues->hasNext()) { $component->addOptionFromSObject($authoritativeValues->next()); } } else { // get the simple component for this data type $component = PrimitiveIOManager::createComponent($dataType); } return $component; }