/**
  * Constructor
  * @param array $configuration	An array of the configuration options 
  * nessisary to load this manager. To use the a specific manager store, a 
  * store data source must be configured as noted in the class of said 
  * manager store.
  * manager.
  * @access public
  */
 function HarmoniRepositoryManager($configuration = NULL)
 {
     // Define the type to use as a key for Identifying repositories
     $this->repositoryKeyType = new HarmoniType("Repository", "edu.middlebury.harmoni", "Repository", "Nodes with this type are by definition Repositories.");
     // Cache any created repositories so that we can pass out references to them.
     $this->_createdRepositories = array();
     $schemaMgr = Services::getService("SchemaManager");
     $ids = Services::getService("Id");
     $recordStructureId = $ids->getId("edu.middlebury.harmoni.repository.asset_content");
     $recordDesc = "A RecordStructure for the generic content of an asset.";
     if (!$schemaMgr->schemaExists($recordStructureId->getIdString())) {
         // Create the Schema
         $schema = new Schema($recordStructureId->getIdString(), "Repository Asset Content", 1, $recordDesc);
         $schema->addField(new SchemaField("Content", "Content", "blob", "The binary content of the Asset"));
         $schemaMgr->synchronize($schema);
         // The SchemaManager only allows you to use Schemas created by it for use with Records.
         $schema = $schemaMgr->getSchemaByID($recordStructureId->getIdString());
         debug::output("RecordStructure is being created from Schema with Id: '" . $schema->getID() . "'");
         $nullRepositoryId = $ids->getId('null');
         $this->_createdRecordStructures[$schema->getID()] = new HarmoniRecordStructure($this, $schema, $nullRepositoryId);
         // Add the parts to the schema
         //			$partStructureType = new Type("Repository", "edu.middlebury.harmoni", "Blob", "");
         //			$this->_createdRecordStructures[$schema->getID()]->createPartStructure(
         //																"Content",
         //																"The binary content of the Asset",
         //																$partStructureType,
         //																FALSE,
         //																FALSE,
         //																FALSE,
         //																$ids->getId("edu.middlebury.harmoni.repository.asset_content.Content")
         //																);
     }
 }
Beispiel #2
0
 /**
  * bla! - deepCopy baby!
  * @return ref object
  * @access public
  */
 function deepCopy()
 {
     $schema = new Schema($this->getID(), $this->getDisplayName(), $this->getRevision(), $this->getDescription(), $this->getOtherParameters());
     foreach (array_keys($this->_fields) as $key) {
         $field = $this->_fields[$key];
         $newField = $field->replicate();
         $schema->addField($newField);
     }
     return $schema;
 }
Beispiel #3
0
 function getSchema($id)
 {
     $id = strtolower($id);
     $type = 'schema';
     $row = $this->database->getSchemaDescription($id);
     $typePage = $row[2];
     $json = new Schema($row[0], $row[1], $row[2]);
     if ($typePage == 'array') {
         $json->addItems('type', 'object');
         $properties = array();
     } else {
         unset($json->items);
     }
     $rows = $this->database->getFormFields($id, $type);
     foreach ($rows as $row) {
         $rowsI = $this->database->getFormFieldsTypes($id, $type, $row[0]);
         if ($typePage == 'array') {
             $properties[$row[0]] = $json->addField($rowsI);
         } else {
             $campo = $json->addField($rowsI);
             $json->addProperties($row[0], $campo);
         }
     }
     if ($typePage == 'array') {
         $json->addItems("properties", $properties);
         unset($json->properties);
     }
     return $json;
 }