本文整理匯總了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);
}