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


Java NameUsageMediaObject.setIdentifier方法代码示例

本文整理汇总了Java中org.gbif.api.model.checklistbank.NameUsageMediaObject.setIdentifier方法的典型用法代码示例。如果您正苦于以下问题:Java NameUsageMediaObject.setIdentifier方法的具体用法?Java NameUsageMediaObject.setIdentifier怎么用?Java NameUsageMediaObject.setIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.gbif.api.model.checklistbank.NameUsageMediaObject的用法示例。


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

示例1: getMedia

import org.gbif.api.model.checklistbank.NameUsageMediaObject; //导入方法依赖的package包/类
@Test
   public void getMedia() {
PagingResponse<NameUsageMediaObject> expected = new PagingResponse<NameUsageMediaObject>(0,20);
expected.setEndOfRecords(true);
List<NameUsageMediaObject> results = new ArrayList<NameUsageMediaObject>();
expected.setResults(results);
NameUsageMediaObject medium = new NameUsageMediaObject();
medium.setType(MediaType.StillImage);
medium.setFormat("image/jpeg");
try {
    medium.setIdentifier(new URI("http://upload.wikimedia.org/wikipedia/commons/d/d9/House_sparrowII.jpg"));
    medium.setReferences(new URI("http://commons.wikimedia.org/wiki/File:House_sparrowII.jpg"));
}
catch (URISyntaxException e) {
}
medium.setTitle("Haussperling (Männchen)");
medium.setLicense("GFDL-1.2");
results.add(medium);
SpeciesAPIClient sut = new SpeciesAPIClient();

PagingResponse<NameUsageMediaObject> actual = sut.getMedia(5231190, null);

printCollections("getMedia", actual.getResults(), expected.getResults());

assertThat(actual, is(expected));
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:27,代码来源:SpeciesAPIClientTest.java

示例2: extractMedia

import org.gbif.api.model.checklistbank.NameUsageMediaObject; //导入方法依赖的package包/类
private void extractMedia(NameUsage u, UsageExtensions e, VerbatimNameUsage v, Extension ext, boolean requireType) {
  if (v.hasExtension(ext)) {
    for (Map<Term, String> rec : v.getExtensions().get(ext)) {
      URI uri = UrlParser.parse(value(rec, AcTerm.accessURI, DcTerm.identifier, DcElement.identifier));
      URI link = UrlParser.parse(value(rec, AcTerm.furtherInformationURL, DcTerm.references, AcTerm.attributionLinkURL));
      // EOL media extension is also used to publish text descriptions - avoid those
      MediaType type = enumify(rec, null, mediaTypeParser, u, DcTerm.type, DcElement.type);
      if (requireType && type == null) {
        continue;
      }
      // link or media uri must exist
      if (uri == null && link == null) {
        u.addIssue(NameUsageIssue.MULTIMEDIA_INVALID);
      } else {
        NameUsageMediaObject m = new NameUsageMediaObject();
        m.setType(type);
        m.setIdentifier(uri);
        m.setReferences(link);
        m.setTitle(value(rec, DcTerm.title, AcTerm.caption));
        m.setDescription(value(rec, DcTerm.description));
        m.setLicense(value(rec, DcTerm.license, XmpRightsTerm.UsageTerms, DcTerm.rights));
        m.setPublisher(value(rec, DcTerm.publisher));
        m.setContributor(value(rec, DcTerm.contributor));
        m.setSource(value(rec, AcTerm.derivedFrom, DcTerm.source));
        m.setAudience(value(rec, DcTerm.audience));
        m.setRightsHolder(value(rec, XmpRightsTerm.Owner, DcTerm.rightsHolder));
        m.setCreator(value(rec, DcTerm.creator));
        m.setFormat(mediaParser.parseMimeType(value(rec, DcTerm.format)));
        String created = value(rec, XmpTerm.CreateDate, DcTerm.created, DcTerm.date);
        if (created != null) {
          m.setCreated(DateParseUtils.parse(created).getPayload());
        }
        mediaParser.detectType(m);
        e.media.add(m);
      }
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:39,代码来源:ExtensionInterpreter.java

示例3: extractMediaCore

import org.gbif.api.model.checklistbank.NameUsageMediaObject; //导入方法依赖的package包/类
private void extractMediaCore(NameUsage u, UsageExtensions e, VerbatimNameUsage v) {
  if (v.hasCoreField(DwcTerm.associatedMedia)) {
    for (URI uri : UrlParser.parseUriList(v.getCoreField(DwcTerm.associatedMedia))) {
      if (uri != null) {
        NameUsageMediaObject m = new NameUsageMediaObject();
        m.setIdentifier(uri);
        mediaParser.detectType(m);
        e.media.add(m);
      }
    }
  }
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:13,代码来源:ExtensionInterpreter.java

示例4: testMapper

import org.gbif.api.model.checklistbank.NameUsageMediaObject; //导入方法依赖的package包/类
@Test
public void testMapper() throws Exception {
    assertTrue(mapper.listByChecklistUsage(usageKey, new PagingRequest()).isEmpty());
    assertTrue(mapper.listByNubUsage(usageKey, new PagingRequest()).isEmpty());

    NameUsageMediaObject obj = new NameUsageMediaObject();
    obj.setAudience("audience");
    obj.setContributor("contrib");
    obj.setCreated(new Date());
    obj.setCreator("creator");
    obj.setDescription("descr");
    obj.setFormat("format");
    obj.setIdentifier(URI.create("https://my.id/sharks"));
    obj.setLicense("license");
    obj.setPublisher("publisher");
    obj.setReferences(URI.create("https://my.tv/sharks"));
    obj.setRightsHolder("rights holder");
    obj.setTitle("title");
    obj.setType(MediaType.Sound);
    // these should get ignored
    obj.setSource("sourcy s");
    obj.setSourceTaxonKey(123);

    mapper.insert(usageKey, obj, citationKey1);

    NameUsageMediaObject obj2 = mapper.listByChecklistUsage(usageKey, new PagingRequest()).get(0);
    assertObject(obj, obj2, citation1, null);


    obj2 = mapper.listByNubUsage(nubKey, new PagingRequest()).get(0);
    // these are now nub source usage values
    assertObject(obj, obj2, datasetTitle, usageKey);
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:34,代码来源:MultimediaMapperTest.java

示例5: getMockObject

import org.gbif.api.model.checklistbank.NameUsageMediaObject; //导入方法依赖的package包/类
@Override
NameUsageMediaObject getMockObject() {
  NameUsageMediaObject image = new NameUsageMediaObject();
  image.setIdentifier(URI.create("http://imageurl.jpg"));
  return image;
}
 
开发者ID:gbif,项目名称:checklistbank,代码行数:7,代码来源:MultimediaWsClientTest.java


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