/** * Get a list of importable issues from the DuraSpace instance. * @return array(contentId => issueIdentification) */ function getImportableIssues() { $dcc =& $this->getDuraCloudConnection(); $duraStore = new DuraStore($dcc); $spaceId = $this->getDuraCloudSpace(); $contents = $duraStore->getSpace($spaceId, $metadata, null, 'issue-'); if (!$contents) { return $contents; } $returner = array(); foreach ($contents as $contentId) { $content = $duraStore->getContent($spaceId, $contentId); if (!$content) { continue; } // Could not fetch content $descriptor =& $content->getDescriptor(); if (!$descriptor) { continue; } // Could not get descriptor $metadata = $descriptor->getMetadata(); if (!$metadata) { continue; } // Could not get metadata if (!isset($metadata['creator']) || $metadata['creator'] != $this->getName()) { continue; } // Not created by this plugin if (!isset($metadata['identification'])) { continue; } // Could not get identification $returner[$contentId] = $metadata; unset($metadata); } return $returner; }
} if (!$metadata) { die("Could not read content metadata part 1!\n"); } if ($metadata['custommetadataname'] != 'CustomMetadataValue') { die("Incorrect metadata part 1!\n"); } // Reset its metadata. $descriptor->setMetadata('custommetadataname', 'CustomMetadataNewValue'); $result = $ds->setContentMetadata($spaceId, $contentId, $descriptor); if (!$result) { die("Unable to set content metadata!\n"); } unset($descriptor, $metadata); // Check the results. $content = $ds->getContent($spaceId, $contentId); if ($content) { $descriptor =& $content->getDescriptor(); } else { $descriptor = null; } if ($descriptor) { $metadata = $descriptor->getMetadata(); } else { $metadata = null; } if (!$metadata) { die("Could not read content metadata part 2!\n"); } if ($metadata['custommetadataname'] != 'CustomMetadataNewValue') { die("Incorrect metadata part 2!\n");