当前位置: 首页>>代码示例>>PHP>>正文


PHP PersistableFilter类代码示例

本文整理汇总了PHP中PersistableFilter的典型用法代码示例。如果您正苦于以下问题:PHP PersistableFilter类的具体用法?PHP PersistableFilter怎么用?PHP PersistableFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PersistableFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testNlm30CitationSchemaCitationAdapter

 /**
  * @covers Nlm30CitationSchemaCitationAdapter
  */
 public function testNlm30CitationSchemaCitationAdapter()
 {
     // Test constructor.
     $adapter = new Nlm30CitationSchemaCitationAdapter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'class::lib.pkp.classes.citation.Citation'));
     self::assertEquals(ASSOC_TYPE_CITATION, $adapter->getAssocType());
     self::assertType('Nlm30CitationSchema', $adapter->getMetadataSchema());
     self::assertEquals('Citation', $adapter->getDataObjectClass());
     // Instantiate a test description.
     $authorDescription = new MetadataDescription('lib.pkp.plugins.metadata.nlm30.schema.Nlm30NameSchema', ASSOC_TYPE_AUTHOR);
     $authorDescription->addStatement('surname', $surname = 'some surname');
     $citationDescription = new MetadataDescription('lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema', ASSOC_TYPE_CITATION);
     $citationDescription->addStatement('article-title', $articleTitle = 'article title');
     $citationDescription->addStatement('person-group[@person-group-type="author"]', $authorDescription);
     // Instantiate test citation.
     $citation = new Citation();
     // Test metadata injection.
     $resultCitation =& $adapter->injectMetadataIntoDataObject($citationDescription, $citation);
     $expectedResult = array('rawCitation' => '', 'nlm30:person-group[@person-group-type="author"]' => array(array('surname' => 'some surname')), 'nlm30:article-title' => array('en_US' => 'article title'));
     self::assertEquals($expectedResult, $resultCitation->getAllData());
     // Instantiate and inject a second test description.
     $authorDescription = new MetadataDescription('lib.pkp.plugins.metadata.nlm30.schema.Nlm30NameSchema', ASSOC_TYPE_AUTHOR);
     $authorDescription->addStatement('surname', $anotherSurname = 'another surname');
     $secondDescription = new MetadataDescription('lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema', ASSOC_TYPE_CITATION);
     $secondDescription->addStatement('person-group[@person-group-type="author"]', $authorDescription);
     $secondDescription->addStatement('source', $source = 'some source');
     $resultCitation =& $adapter->injectMetadataIntoDataObject($secondDescription, $citation);
     $expectedResult = array('rawCitation' => '', 'nlm30:person-group[@person-group-type="author"]' => array(array('surname' => 'another surname')), 'nlm30:article-title' => array('en_US' => 'article title'), 'nlm30:source' => array('en_US' => 'some source'));
     self::assertEquals($expectedResult, $resultCitation->getAllData());
     // Test meta-data extraction.
     $adapter = new Nlm30CitationSchemaCitationAdapter(PersistableFilter::tempGroup('class::lib.pkp.classes.citation.Citation', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)'));
     $extractedDescription =& $adapter->extractMetadataFromDataObject($resultCitation);
     $secondDescription->addStatement('article-title', $articleTitle = 'article title');
     self::assertEquals($secondDescription, $extractedDescription);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:37,代码来源:Nlm30CitationSchemaCitationAdapterTest.inc.php

示例2: testExecute

 /**
  * @covers PKPSubmissionNlm30XmlFilter
  */
 public function testExecute()
 {
     // Instantiate test meta-data for a citation.
     import('lib.pkp.classes.metadata.MetadataDescription');
     $nameSchemaName = 'lib.pkp.plugins.metadata.nlm30.schema.Nlm30NameSchema';
     $nameDescription = new MetadataDescription($nameSchemaName, ASSOC_TYPE_AUTHOR);
     $nameDescription->addStatement('given-names', $value = 'Peter');
     $nameDescription->addStatement('given-names', $value = 'B');
     $nameDescription->addStatement('surname', $value = 'Bork');
     $nameDescription->addStatement('prefix', $value = 'Mr.');
     $citationSchemaName = 'lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema';
     $citationDescription = new MetadataDescription($citationSchemaName, ASSOC_TYPE_CITATION);
     $citationDescription->addStatement('person-group[@person-group-type="author"]', $nameDescription);
     $citationDescription->addStatement('article-title', $value = 'PHPUnit in a nutshell', 'en_US');
     $citationDescription->addStatement('date', $value = '2009-08-17');
     $citationDescription->addStatement('size', $value = 320);
     $citationDescription->addStatement('uri', $value = 'http://phpunit.org/nutshell');
     $citationDescription->addStatement('[@publication-type]', $value = 'book');
     $citation =& $this->getCitation($citationDescription);
     // Persist a few copies of the citation for testing.
     $citationDao =& $this->getCitationDao();
     for ($seq = 1; $seq <= 10; $seq++) {
         $citation->setSeq($seq);
         $citation->setCitationState(CITATION_APPROVED);
         $citationId = $citationDao->insertObject($citation);
         self::assertTrue(is_numeric($citationId));
         self::assertTrue($citationId > 0);
     }
     // Execute the filter and check the outcome.
     $mockSubmission =& $this->getTestSubmission();
     // FIXME: Add NLM 3.0 tag set schema validation as soon as we implement the full tag set, see #5648.
     $filter = new PKPSubmissionNlm30XmlFilter(PersistableFilter::tempGroup('class::lib.pkp.classes.submission.Submission', 'xml::*'));
     $nlm30Xml = $filter->execute($mockSubmission);
     self::assertXmlStringEqualsXmlFile('./lib/pkp/tests/plugins/metadata/nlm30/filter/sample-nlm30-citation.xml', $nlm30Xml);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:38,代码来源:PKPSubmissionNlm30XmlFilterTest.inc.php

示例3: testMods34SchemaSubmissionAdapter

 /**
  * @covers Mods34SchemaSubmissionAdapter
  */
 public function testMods34SchemaSubmissionAdapter()
 {
     // Test constructor.
     $adapter = new Mods34SchemaSubmissionAdapter(PersistableFilter::tempGroup('metadata::plugins.metadata.mods34.schema.Mods34Schema(CITATION)', 'class::lib.pkp.classes.submission.Submission'));
     self::assertEquals(ASSOC_TYPE_CITATION, $adapter->getAssocType());
     self::assertType('Mods34Schema', $adapter->getMetadataSchema());
     self::assertEquals('Submission', $adapter->getDataObjectClass());
     // Instantiate a test description.
     $submissionDescription =& $this->getMods34Description();
     // Instantiate test submission.
     $submission = new Submission();
     $submission->setTitle('previous submission title', 'en_US');
     $submission->setAbstract('previous abstract', 'en_US');
     // Remove the abstract to test whether the injection into existing data works.
     // (The abstract should not be deleted.)
     $submissionDescription->removeStatement('abstract');
     // Test metadata injection (no replace).
     $resultSubmission =& $adapter->injectMetadataIntoDataObject($submissionDescription, $submission, 'lib.pkp.tests.plugins.metadata.mods34.filter.Author');
     $expectedResult = array('cleanTitle' => array('en_US' => 'new submission title', 'de_DE' => 'neuer Titel'), 'title' => array('en_US' => 'new submission title', 'de_DE' => 'neuer Titel'), 'abstract' => array('en_US' => 'previous abstract'), 'sponsor' => array('en_US' => 'Some Sponsor'), 'dateSubmitted' => '2010-07-07', 'language' => 'en', 'pages' => 215, 'coverageGeo' => array('en_US' => 'some geography'), 'mods34:titleInfo/nonSort' => array('en_US' => 'the', 'de_DE' => 'ein'), 'mods34:titleInfo/subTitle' => array('en_US' => 'subtitle', 'de_DE' => 'Subtitel'), 'mods34:titleInfo/partNumber' => array('en_US' => 'part I', 'de_DE' => 'Teil I'), 'mods34:titleInfo/partName' => array('en_US' => 'introduction', 'de_DE' => 'Einführung'), 'mods34:note' => array('en_US' => array('0' => 'some note', '1' => 'another note'), 'de_DE' => array('0' => 'übersetzte Anmerkung')), 'mods34:subject/temporal[@encoding="w3cdtf" @point="start"]' => '1950', 'mods34:subject/temporal[@encoding="w3cdtf" @point="end"]' => '1954');
     self::assertEquals($expectedResult, $resultSubmission->getAllData());
     // Test meta-data extraction.
     $adapter = new Mods34SchemaSubmissionAdapter(PersistableFilter::tempGroup('class::lib.pkp.classes.submission.Submission', 'metadata::plugins.metadata.mods34.schema.Mods34Schema(CITATION)'));
     $extractedDescription =& $adapter->extractMetadataFromDataObject($submission);
     $submissionDescription->removeStatement('recordInfo/recordCreationDate[@encoding="w3cdtf"]');
     self::assertTrue($submissionDescription->addStatement('recordInfo/recordCreationDate[@encoding="w3cdtf"]', date('Y-m-d')));
     self::assertTrue($submissionDescription->addStatement('abstract', $abstract = 'previous abstract'));
     $missingMappings = array('genre[@authority="marcgt"]', 'originInfo/place/placeTerm[@type="text"]', 'originInfo/place/placeTerm[@type="code" @authority="iso3166"]', 'originInfo/publisher', 'originInfo/dateIssued[@keyDate="yes" @encoding="w3cdtf"]', 'originInfo/edition', 'physicalDescription/form[@authority="marcform"]', 'physicalDescription/internetMediaType', 'identifier[@type="isbn"]', 'identifier[@type="doi"]', 'identifier[@type="uri"]', 'location/url[@usage="primary display"]', 'recordInfo/recordIdentifier[@source="pkp"]', 'subject/topic');
     foreach ($missingMappings as $missingMapping) {
         $submissionDescription->removeStatement($missingMapping);
     }
     self::assertEquals($submissionDescription, $extractedDescription);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:35,代码来源:Mods34SchemaSubmissionAdapterTest.inc.php

示例4: getCitationOutputFilterInstance

 /**
  * Retrieve the citation output filter that will be
  * used to transform citations.
  * @return TemplateBasedFilter
  */
 function getCitationOutputFilterInstance()
 {
     $citationOutputFilterName = $this->getData('citationOutputFilterName');
     assert(!is_null($citationOutputFilterName));
     list($inputTypeDescription, $outputTypeDescription) = $this->getCitationOutputFilterTypeDescriptions();
     $filterGroup = PersistableFilter::tempGroup($inputTypeDescription, $outputTypeDescription);
     return instantiate($citationOutputFilterName, 'TemplateBasedFilter', null, null, $filterGroup);
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:13,代码来源:TemplateBasedReferencesListFilter.inc.php

示例5: testExecuteWithSearch

 /**
  * Test Pubmed lookup without PmID
  * @covers PubmedNlm30CitationSchemaFilter
  */
 public function testExecuteWithSearch()
 {
     // Build the test citations array
     $citationFilterTests = array(array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Scott', 'D'), 'surname' => 'Halpern'), array('given-names' => array('Peter', 'A'), 'surname' => 'Ubel'), array('given-names' => array('Arthur', 'L'), 'surname' => 'Caplan')), 'article-title' => 'Solid-organ transplantation in HIV-infected patients.', 'source' => 'N Engl J Med', 'volume' => '347', 'issue' => '4'), 'testOutput' => $this->getTestOutput()), array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Scott', 'D'), 'surname' => 'Halpern'), array('given-names' => array('Peter', 'A'), 'surname' => 'Ubel'), array('given-names' => array('Arthur', 'L'), 'surname' => 'Caplan'))), 'testOutput' => $this->getTestOutput()));
     // Execute the test
     $filter = new PubmedNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)'));
     $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter);
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:12,代码来源:PubmedNlm30CitationSchemaFilterTest.php

示例6: MetadataDescriptionDummyAdapter

 /**
  * Constructor
  *
  * @param $metadataDescription MetadataDescription
  */
 function MetadataDescriptionDummyAdapter(&$metadataDescription, $mode = null)
 {
     $this->setDisplayName('Inject/Extract Metadata into/from a MetadataDescription');
     // Configure the adapter
     $inputType = $outputType = 'metadata::' . $metadataDescription->getMetadataSchemaName() . '(*)';
     parent::MetadataDataObjectAdapter(PersistableFilter::tempGroup($inputType, $outputType), $mode);
     $this->_assocType = $metadataDescription->getAssocType();
 }
开发者ID:jprk,项目名称:pkp-lib,代码行数:13,代码来源:MetadataDescriptionDummyAdapter.inc.php

示例7: testExecuteWithOpenurl10Search

 /**
  * Test CrossRef lookup without DOI
  * @covers CrossrefNlm30CitationSchemaFilter
  */
 public function testExecuteWithOpenurl10Search()
 {
     // Build the test citations array
     $citationFilterTests = array(array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Hao'), 'surname' => 'Chen')), 'source' => 'BMC Bioinformatics', 'issue' => '1', 'volume' => '5', 'fpage' => 147, '[@publication-type]' => 'journal'), 'testOutput' => array('source' => 'BMC Bioinformatics', 'issue' => '1', 'volume' => '5', 'date' => '2004', 'fpage' => 147, 'uri' => 'http://www.biomedcentral.com/1471-2105/5/147', 'issn[@pub-type="ppub"]' => '14712105', 'person-group[@person-group-type="author"]' => array(array('given-names' => array('Hao'), 'surname' => 'Chen'), array('given-names' => array('Burt', 'M'), 'surname' => 'Sharp')), 'pub-id[@pub-id-type="doi"]' => '10.1186/1471-2105-5-147', '[@publication-type]' => 'journal')));
     // Execute the test
     $filter = new CrossrefNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)'));
     $filter->setEmail(self::ACCESS_EMAIL);
     $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter);
 }
开发者ID:jalperin,项目名称:pkp-lib,代码行数:13,代码来源:CrossrefNlm30CitationSchemaFilterTest.php

示例8: testAllCitationsWithThisParser

 /**
  * @covers ParaciteRawCitationNlm30CitationSchemaFilter
  */
 public function testAllCitationsWithThisParser()
 {
     foreach (ParaciteRawCitationNlm30CitationSchemaFilter::getSupportedCitationModules() as $citationModule) {
         $filter = new ParaciteRawCitationNlm30CitationSchemaFilter(PersistableFilter::tempGroup('primitive::string', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)'));
         $filter->setData('citationModule', $citationModule);
         parent::_testAllCitationsWithThisParser($filter);
         unset($filter);
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:12,代码来源:ParaciteRawCitationNlm30CitationSchemaFilterTest.php

示例9: toXml

 /**
  * @copydoc OAIMetadataFormat::toXML
  */
 function toXml(&$record, $format = null)
 {
     $publicationFormat =& $record->getData('publicationFormat');
     $description = $publicationFormat->extractMetadata(new Xmdp22Schema());
     $xmlFilter = new Xmdp22DescriptionXmlFilter(PersistableFilter::tempGroup('metadata::plugins.metadata.xmdp22.schema.Xmdp22Schema(*)', 'xml::schema(plugins/metadata/xmdp22/filter/xmdp22.xsd)'));
     //FIXME: Hack to remove the duplicate XML document declarations
     $response = substr($xmlFilter->process($description), 39);
     return $response;
 }
开发者ID:kadowa,项目名称:omp-xmdp-oai-plugin,代码行数:12,代码来源:OAIMetadataFormat_XMDP.inc.php

示例10: testMods34DescriptionXmlFilter

 /**
  * @covers Mods34DescriptionXmlFilter
  */
 public function testMods34DescriptionXmlFilter()
 {
     // Get the test description.
     $submissionDescription = $this->getMods34Description();
     // Instantiate filter.
     $filter = new Mods34DescriptionXmlFilter(PersistableFilter::tempGroup('metadata::plugins.metadata.mods34.schema.Mods34Schema(*)', 'xml::schema(lib/pkp/plugins/metadata/mods34/filter/mods34.xsd)'));
     // Transform MODS description to XML.
     $output = $filter->execute($submissionDescription);
     self::assertXmlStringEqualsXmlFile('./lib/pkp/tests/plugins/metadata/mods34/filter/test.xml', $output);
 }
开发者ID:jalperin,项目名称:pkp-lib,代码行数:13,代码来源:Mods34DescriptionXmlFilterTest.php

示例11: testExecute

 /**
  * @covers IsbndbIsbnNlm30CitationSchemaFilter
  * @covers IsbndbNlm30CitationSchemaFilter
  */
 public function testExecute()
 {
     // Test data
     $isbnLookupTest = array('testInput' => '9780820452425', 'testOutput' => array('source' => array('en_US' => 'After literacy: essays'), 'date' => '2001', 'person-group[@person-group-type="author"]' => array(0 => array('given-names' => array('John'), 'surname' => 'Willinsky')), 'publisher-loc' => 'New York', 'publisher-name' => 'P. Lang', 'isbn' => '9780820452425', '[@publication-type]' => 'book'));
     // Build the test array
     $citationFilterTests = array($isbnLookupTest);
     // Test the filter
     $filter = new IsbndbIsbnNlm30CitationSchemaFilter(PersistableFilter::tempGroup('primitive::string', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)'));
     $filter->setData('apiKey', self::ISBNDB_TEST_APIKEY);
     $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:15,代码来源:IsbndbIsbnNlm30CitationSchemaFilterTest.inc.php

示例12: XSLTransformationFilter

 /**
  * Constructor
  *
  * @param $filterGroup FilterGroup
  * @param $displayName string
  *
  * NB: The input side of the transformation must always
  * be an XML format. See the XMLTypeDescription class for
  * more details how to enable XML validation.
  */
 function XSLTransformationFilter(&$filterGroup, $displayName = 'XSL Transformation')
 {
     // Check that we only get xml input, the output type is arbitrary.
     if (!substr($filterGroup->getInputType(), 0, 5) == 'xml::') {
         fatalError('XSL filters need XML as input.');
     }
     // Instantiate the settings of this filter
     import('lib.pkp.classes.filter.FilterSetting');
     $this->addSetting(new FilterSetting('xsl', null, null));
     $this->addSetting(new FilterSetting('xslType', null, null));
     $this->addSetting(new FilterSetting('resultType', null, null, FORM_VALIDATOR_OPTIONAL_VALUE));
     $this->setDisplayName($displayName);
     parent::PersistableFilter($filterGroup);
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:24,代码来源:XSLTransformationFilter.inc.php

示例13: testExecute

 /**
  * @covers IsbndbNlm30CitationSchemaIsbnFilter
  * @covers IsbndbNlm30CitationSchemaFilter
  */
 public function testExecute()
 {
     // Test data
     $isbnSearchTest = array('testInput' => array('person-group[@person-group-type="author"]' => array(0 => array('given-names' => array('John'), 'surname' => 'Willinsky')), 'source' => array('en_US' => 'After literacy')), 'testOutput' => '9780820452425');
     // Build the test array
     $citationFilterTests = array($isbnSearchTest);
     // Test the filter
     $filter = new IsbndbNlm30CitationSchemaIsbnFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'primitive::string'));
     $apiKey = $this->_getIsbndbApiKey();
     if (!$apiKey) {
         $this->markTestSkipped('ISBNDB API key not available.');
     }
     $filter->setData('apiKey', $apiKey);
     $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter);
 }
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:19,代码来源:IsbndbNlm30CitationSchemaIsbnFilterTest.php

示例14: testExecuteWithDoi

 /**
  * Test CrossRef lookup with DOI
  * @covers WorldcatNlm30CitationSchemaFilter
  */
 public function testExecuteWithDoi()
 {
     // Test book lookup
     $testWithApiKey = array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula'), 'surname' => 'Fernandes Lopes')), 'source' => 'A ética platônica: modelo de ética da boa vida'), 'testOutput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula', 'Fernandes'), 'surname' => 'Lopes')), 'source' => 'A ética platônica : modelo de ética da boa vida', 'isbn' => '851503154X', 'publisher-loc' => 'São Paulo', 'publisher-name' => 'Ed. Loyola', 'date' => '2005'));
     // Build the test citations array
     $citationFilterTests = array($testWithApiKey);
     // Execute the tests with API key
     $filter = new WorldcatNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)'));
     $filter->setData('apiKey', self::WORLDCAT_TEST_APIKEY);
     $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter);
     // Try again without API key
     $testWithoutApiKey = array('testInput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula'), 'surname' => 'Fernandes Lopes')), 'source' => 'A ética platônica: modelo de ética da boa vida'), 'testOutput' => array('person-group[@person-group-type="author"]' => array(array('given-names' => array('Paula', 'Fernandes'), 'surname' => 'Lopes')), 'source' => 'A ética platônica : modelo de ética da boa vida', 'isbn' => '9788515031542', 'date' => '2005', 'publisher-name' => 'Ed. Loyola', 'publisher-loc' => 'São Paulo'));
     $citationFilterTests = array($testWithoutApiKey);
     $filter = new WorldcatNlm30CitationSchemaFilter(PersistableFilter::tempGroup('metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)', 'metadata::lib.pkp.plugins.metadata.nlm30.schema.Nlm30CitationSchema(CITATION)'));
     $this->assertNlm30CitationSchemaFilter($citationFilterTests, $filter);
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:20,代码来源:WorldcatNlm30CitationSchemaFilterTest.php

示例15: MetadataDataObjectAdapter

 /**
  * Constructor
  * @param $filterGroup FilterGroup
  */
 function MetadataDataObjectAdapter($filterGroup, $mode = null)
 {
     // Initialize the adapter.
     parent::PersistableFilter($filterGroup);
     // Extract information from the input/output types.
     // Find out whether this filter is injecting or
     // extracting meta-data.
     $metadataTypeDescription = null;
     /* @var $metadataTypeDescription MetadataTypeDescription */
     $dataObjectTypeDescription = null;
     /* @var $dataObjectTypeDescription ClassTypeDescription */
     $inputType =& $this->getInputType();
     $outputType =& $this->getOutputType();
     if (is_null($mode)) {
         if (is_a($inputType, 'MetadataTypeDescription')) {
             $mode = METADATA_DOA_INJECTION_MODE;
         } else {
             $mode = METADATA_DOA_EXTRACTION_MODE;
         }
     }
     $this->_mode = $mode;
     if ($mode == METADATA_DOA_INJECTION_MODE) {
         // We are in meta-data injection mode (or both input and output are meta-data descriptions).
         $metadataTypeDescription =& $inputType;
         /* @var $metadataTypeDescription MetadataTypeDescription */
         assert(is_a($outputType, 'ClassTypeDescription'));
         $dataObjectTypeDescription =& $outputType;
         /* @var $dataObjectTypeDescription ClassTypeDescription */
     } else {
         // We are in meta-data extraction mode.
         assert(is_a($outputType, 'MetadataTypeDescription'));
         $metadataTypeDescription =& $outputType;
         assert(is_a($inputType, 'ClassTypeDescription'));
         $dataObjectTypeDescription =& $inputType;
     }
     // Extract information from the input/output types.
     $this->_metadataSchemaName = $metadataTypeDescription->getMetadataSchemaClass();
     $this->_assocType = $metadataTypeDescription->getAssocType();
     $this->_dataObjectName = $dataObjectTypeDescription->getTypeName();
     // Set the display name.
     if ($mode == METADATA_DOA_INJECTION_MODE) {
         $this->setDisplayName('Inject metadata into a(n) ' . $this->getDataObjectClass());
     } else {
         $this->setDisplayName('Extract metadata from a(n) ' . $this->getDataObjectClass());
     }
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:50,代码来源:MetadataDataObjectAdapter.inc.php


注:本文中的PersistableFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。