use of org.opengis.metadata.citation.ResponsibleParty in project tika by apache.
the class GeographicInformationParser method extractContent.
private void extractContent(XHTMLContentHandler xhtmlContentHandler, DefaultMetadata defaultMetadata) throws SAXException {
xhtmlContentHandler.startDocument();
xhtmlContentHandler.newline();
xhtmlContentHandler.newline();
ArrayList<Identification> identifications = (ArrayList<Identification>) defaultMetadata.getIdentificationInfo();
for (Identification i : identifications) {
xhtmlContentHandler.startElement("h1");
xhtmlContentHandler.characters(i.getCitation().getTitle().toString());
xhtmlContentHandler.endElement("h1");
xhtmlContentHandler.newline();
ArrayList<ResponsibleParty> responsiblePartyArrayList = (ArrayList<ResponsibleParty>) i.getCitation().getCitedResponsibleParties();
for (ResponsibleParty r : responsiblePartyArrayList) {
xhtmlContentHandler.startElement("h3");
xhtmlContentHandler.newline();
xhtmlContentHandler.characters("CitedResponsiblePartyRole " + r.getRole().toString());
xhtmlContentHandler.characters("CitedResponsiblePartyName " + r.getIndividualName().toString());
xhtmlContentHandler.endElement("h3");
xhtmlContentHandler.newline();
}
xhtmlContentHandler.startElement("p");
xhtmlContentHandler.newline();
xhtmlContentHandler.characters("IdentificationInfoAbstract " + i.getAbstract().toString());
xhtmlContentHandler.endElement("p");
xhtmlContentHandler.newline();
Collection<Extent> extentList = ((DefaultDataIdentification) i).getExtents();
for (Extent e : extentList) {
ArrayList<GeographicExtent> geoElements = (ArrayList<GeographicExtent>) e.getGeographicElements();
for (GeographicExtent g : geoElements) {
if (g instanceof DefaultGeographicBoundingBox) {
xhtmlContentHandler.startElement("tr");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters("GeographicElementWestBoundLatitude");
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters(String.valueOf(((DefaultGeographicBoundingBox) g).getWestBoundLongitude()));
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.endElement("tr");
xhtmlContentHandler.startElement("tr");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters("GeographicElementEastBoundLatitude");
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters(String.valueOf(((DefaultGeographicBoundingBox) g).getEastBoundLongitude()));
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.endElement("tr");
xhtmlContentHandler.startElement("tr");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters("GeographicElementNorthBoundLatitude");
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters(String.valueOf(((DefaultGeographicBoundingBox) g).getNorthBoundLatitude()));
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.endElement("tr");
xhtmlContentHandler.startElement("tr");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters("GeographicElementSouthBoundLatitude");
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.startElement("td");
xhtmlContentHandler.characters(String.valueOf(((DefaultGeographicBoundingBox) g).getSouthBoundLatitude()));
xhtmlContentHandler.endElement("td");
xhtmlContentHandler.endElement("tr");
}
}
}
}
xhtmlContentHandler.newline();
xhtmlContentHandler.endDocument();
}
use of org.opengis.metadata.citation.ResponsibleParty in project sis by apache.
the class CustomMetadataTest method testSubtypeAttributes.
/**
* Tests that the attributes defined in subtypes are also marshalled.
*
* @throws JAXBException if an error occurred during (un)marshalling.
*
* @see <a href="http://jira.geotoolkit.org/browse/GEOTK-108">GEOTK-108</a>
*/
@Test
public void testSubtypeAttributes() throws JAXBException {
final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
final DataIdentification identification = new DataIdentification() {
@Override
public InternationalString getAbstract() {
Map<Locale, String> names = new HashMap<>();
names.put(Locale.ENGLISH, "Description");
return factory.createInternationalString(names);
}
@Override
public InternationalString getEnvironmentDescription() {
Map<Locale, String> names = new HashMap<>();
names.put(Locale.ENGLISH, "Environment");
return factory.createInternationalString(names);
}
@Override
public InternationalString getSupplementalInformation() {
return null;
}
@Override
public Citation getCitation() {
return null;
}
@Override
public InternationalString getPurpose() {
return null;
}
@Override
public Collection<SpatialRepresentationType> getSpatialRepresentationTypes() {
return null;
}
@Override
public Collection<Resolution> getSpatialResolutions() {
return null;
}
@Override
public Collection<Locale> getLanguages() {
return null;
}
@Override
public Collection<CharacterSet> getCharacterSets() {
return null;
}
@Override
public Collection<TopicCategory> getTopicCategories() {
return null;
}
@Override
public Collection<Extent> getExtents() {
return null;
}
@Override
public Collection<String> getCredits() {
return null;
}
@Override
public Collection<Progress> getStatus() {
return null;
}
@Override
public Collection<ResponsibleParty> getPointOfContacts() {
return null;
}
@Override
public Collection<MaintenanceInformation> getResourceMaintenances() {
return null;
}
@Override
public Collection<BrowseGraphic> getGraphicOverviews() {
return null;
}
@Override
public Collection<Format> getResourceFormats() {
return null;
}
@Override
public Collection<Keywords> getDescriptiveKeywords() {
return null;
}
@Override
public Collection<Usage> getResourceSpecificUsages() {
return null;
}
@Override
public Collection<Constraints> getResourceConstraints() {
return null;
}
@Deprecated
@Override
public Collection<AggregateInformation> getAggregationInfo() {
return null;
}
};
final DefaultMetadata data = new DefaultMetadata();
data.setIdentificationInfo(singleton(identification));
final String xml = XML.marshal(data);
/*
* A few simple checks.
*/
assertTrue("Missing Identification attribute.", xml.contains("Description"));
assertTrue("Missing DataIdentification attribute.", xml.contains("Environment"));
}
use of org.opengis.metadata.citation.ResponsibleParty in project sis by apache.
the class MetadataWriterTest method read.
/**
* Reads known entries in the database.
* Expected entry is:
*
* {@preformat text
* Citation
* ├─Title………………………………………………………… EPSG Geodetic Parameter Dataset
* ├─Identifier
* │ └─Code………………………………………………… EPSG
* ├─Cited responsible party
* │ ├─Party
* │ │ ├─Name……………………………………… International Association of Oil & Gas Producers
* │ │ └─Contact info
* │ │ └─Online resource
* │ │ ├─Linkage………… http://www.epsg.org
* │ │ └─Function……… Information
* │ └─Role………………………………………………… Principal investigator
* └─Presentation form………………………… Table digital
* }
*
* @throws MetadataStoreException if an error occurred while reading the database.
*/
private void read() throws MetadataStoreException {
final Citation c = source.lookup(Citation.class, "EPSG");
assertEquals("EPSG Geodetic Parameter Dataset", c.getTitle().toString());
assertEquals(PresentationForm.TABLE_DIGITAL, TestUtilities.getSingleton(c.getPresentationForms()));
/*
* Ask for dependencies that are known to exist.
*/
final ResponsibleParty responsible = TestUtilities.getSingleton(c.getCitedResponsibleParties());
assertEquals(Role.PRINCIPAL_INVESTIGATOR, responsible.getRole());
assertEquals("International Association of Oil & Gas Producers", responsible.getOrganisationName().toString());
OnlineResource resource = responsible.getContactInfo().getOnlineResource();
assertEquals("http://www.epsg.org", resource.getLinkage().toString());
assertEquals(OnLineFunction.INFORMATION, resource.getFunction());
/*
* Ask columns that are known to not exist.
*/
assertNull(c.getEditionDate());
assertTrue(c.getDates().isEmpty());
assertEquals(0, c.getAlternateTitles().size());
/*
* Test the cache.
*/
assertSame(c, source.lookup(Citation.class, "EPSG"));
assertNotSame(c, source.lookup(Citation.class, "SIS"));
/*
* Should return the identifier with no search. Actually the real test is the call to "proxy",
* since there is no way to ensure that the call to "search" tooks the short path (except by
* looking at the debugger). But if "proxy" succeed, then "search" should be okay.
*/
assertEquals("EPSG", source.proxy(c));
assertEquals("EPSG", source.search(c));
}
use of org.opengis.metadata.citation.ResponsibleParty in project sis by apache.
the class DefaultCitationTest method testFreeze.
/**
* Tests {@link DefaultCitation#freeze()}, which is needed for the constants defined in {@link Citations}.
*/
@Test
public void testFreeze() {
final DefaultCitation original = create();
// This will invoke 'freeze()'.
final DefaultCitation clone = (DefaultCitation) original.unmodifiable();
assertNotSame(original, clone);
assertTrue("original.isModifiable", original.isModifiable());
assertFalse("clone.isModifiable", clone.isModifiable());
assertSame("original.unmodifiable", clone, original.unmodifiable());
assertSame("clone.unmodifiable", clone, clone.unmodifiable());
assertSame("ISBN", original.getISBN(), clone.getISBN());
assertSame("title", original.getTitle(), clone.getTitle());
assertSame("alternateTitle", getSingleton(original.getAlternateTitles()), getSingleton(clone.getAlternateTitles()));
assertCopy(original.getIdentifiers(), clone.getIdentifiers());
assertCopy(original.getCitedResponsibleParties(), clone.getCitedResponsibleParties());
assertCopy(original.getPresentationForms(), clone.getPresentationForms());
/*
* Verify the unique identifier, which is the ISBN code. ISBN and ISSN codes are handled
* in a special way by DefaultCitation (they are instances of SpecializedIdentifier), but
* the should nevertheless be cloned.
*/
final Identifier ide = getSingleton(original.getIdentifiers());
final Identifier ida = getSingleton(clone.getIdentifiers());
assertNotSame("identifier", ide, ida);
assertSame("code", ide.getCode(), ida.getCode());
assertSame("authority", ide.getAuthority(), ida.getAuthority());
/*
* Verify the author metadata.
*/
final ResponsibleParty re = CollectionsExt.first(original.getCitedResponsibleParties());
final ResponsibleParty ra = CollectionsExt.first(clone.getCitedResponsibleParties());
assertNotSame("citedResponsibleParty", re, ra);
assertSame("role", re.getRole(), ra.getRole());
assertSame("name", re.getIndividualName(), ra.getIndividualName());
}
use of org.opengis.metadata.citation.ResponsibleParty in project sis by apache.
the class CodeListMarshallingTest method testDefaultURL.
/**
* Tests marshaling using the default URL.
*
* @throws JAXBException if an error occurred while marshaling the XML.
*/
@Test
public void testDefaultURL() throws JAXBException {
final String expected = getResponsiblePartyXML(Schemas.METADATA_ROOT_LEGACY);
final ResponsibleParty rp = unmarshal(ResponsibleParty.class, expected);
assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole());
/*
* Use the convenience method in order to avoid the effort of creating
* our own MarshallerPool.
*/
final String actual = marshal(rp, VERSION_2007);
assertXmlEquals(expected, actual, "xmlns:*");
}
Aggregations