本文整理汇总了Java中org.gbif.common.parsers.UrlParser类的典型用法代码示例。如果您正苦于以下问题:Java UrlParser类的具体用法?Java UrlParser怎么用?Java UrlParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UrlParser类属于org.gbif.common.parsers包,在下文中一共展示了UrlParser类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractMedia
import org.gbif.common.parsers.UrlParser; //导入依赖的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);
}
}
}
}
示例2: extractMediaCore
import org.gbif.common.parsers.UrlParser; //导入依赖的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);
}
}
}
}
示例3: interpretReferences
import org.gbif.common.parsers.UrlParser; //导入依赖的package包/类
private static void interpretReferences(VerbatimOccurrence verbatim, Occurrence occ) {
if (verbatim.hasVerbatimField(DcTerm.references)) {
String val = verbatim.getVerbatimField(DcTerm.references);
if (!Strings.isNullOrEmpty(val)) {
occ.setReferences(UrlParser.parse(val));
if (occ.getReferences() == null) {
occ.getIssues().add(OccurrenceIssue.REFERENCES_URI_INVALID);
}
}
}
}
示例4: toURI
import org.gbif.common.parsers.UrlParser; //导入依赖的package包/类
private static URI toURI(String val) throws SQLException {
return UrlParser.parse(val);
}