private void getMetaDataContact(Metadata metadata, DefaultMetadata defaultMetaData){ CheckedArrayList<ResponsibleParty> contactSet= (CheckedArrayList<ResponsibleParty>) defaultMetaData.getContacts(); for(ResponsibleParty rparty:contactSet){ if(rparty.getRole()!=null) metadata.add("ContactRole",rparty.getRole().name()); if(rparty.getOrganisationName()!=null) metadata.add("ContactPartyName-",rparty.getOrganisationName().toString()); } }
if(d!=null && d.getDistributorContact()!=null && d.getDistributorContact().getRole()!=null) metadata.add("Distributor Contact ",d.getDistributorContact().getRole().name()); if(d!=null && d.getDistributorContact()!=null && d.getDistributorContact().getOrganisationName()!=null) metadata.add("Distributor Organization Name ",d.getDistributorContact().getOrganisationName().toString());
xhtmlContentHandler.startElement("h3"); xhtmlContentHandler.newline(); xhtmlContentHandler.characters("CitedResponsiblePartyRole " + r.getRole().toString()); xhtmlContentHandler.characters("CitedResponsiblePartyName " + r.getIndividualName().toString()); xhtmlContentHandler.endElement("h3");
private void getMetaDataContact(Metadata metadata, DefaultMetadata defaultMetaData){ CheckedArrayList<ResponsibleParty> contactSet= (CheckedArrayList<ResponsibleParty>) defaultMetaData.getContacts(); for(ResponsibleParty rparty:contactSet){ if(rparty.getRole()!=null) metadata.add("ContactRole",rparty.getRole().name()); if(rparty.getOrganisationName()!=null) metadata.add("ContactPartyName-",rparty.getOrganisationName().toString()); } }
private void getMetaDataContact(Metadata metadata, DefaultMetadata defaultMetaData){ CheckedArrayList<ResponsibleParty> contactSet= (CheckedArrayList<ResponsibleParty>) defaultMetaData.getContacts(); for(ResponsibleParty rparty:contactSet){ if(rparty.getRole()!=null) metadata.add("ContactRole",rparty.getRole().name()); if(rparty.getOrganisationName()!=null) metadata.add("ContactPartyName-",rparty.getOrganisationName().toString()); } }
/** * Bridge constructor for {@link DefaultResponsibleParty#DefaultResponsibleParty(ResponsibleParty)}. */ DefaultResponsibility(final ResponsibleParty object) { super(object); if (object != null) { this.role = object.getRole(); if (object instanceof DefaultResponsibility) { final DefaultResponsibility c = (DefaultResponsibility) object; this.extents = copyCollection(c.getExtents(), Extent.class); this.parties = copyCollection(c.getParties(), AbstractParty.class); } } }
/** * Bridge constructor for {@link DefaultResponsibleParty#DefaultResponsibleParty(ResponsibleParty)}. */ DefaultResponsibility(final ResponsibleParty object) { super(object); if (object != null) { this.role = object.getRole(); if (object instanceof DefaultResponsibility) { final DefaultResponsibility c = (DefaultResponsibility) object; this.extents = copyCollection(c.getExtents(), Extent.class); this.parties = copyCollection(c.getParties(), AbstractParty.class); } } }
/** * Returns the given ISO 19115 metadata as a {@code Person} instance. * This method copies the data only if needed. * * @param r the ISO 19115 metadata, or {@code null}. * @param locale the locale to use for localized strings. * @return the GPX metadata, or {@code null}. */ public static Person castOrCopy(final ResponsibleParty r, final Locale locale) { if (r == null || r instanceof Person) { return (Person) r; } final Role role = r.getRole(); final boolean isCreator = Role.ORIGINATOR.equals(role); if (isCreator || Role.AUTHOR.equals(role)) { final String name = r.getIndividualName(); if (name != null) { final Person pr = new Person(); pr.name = name; pr.isCreator = isCreator; return pr; } } return null; }
/** * Adds role, name, contact and position information for an individual or organization that is responsible * for the resource. This method can be used as an alternative to {@link #addAuthor(CharSequence)} when the * caller needs to create the responsibly party itself. * * <p>If the given {@code role} is non-null, then this method will ensure that the added party has the given * role. A copy of the given party will be created if needed (the given party will never be modified).</p> * * Storage locations are: * * <ul> * <li>{@code metadata/identificationInfo/citation/citedResponsibleParty}</li> * <li>{@code metadata/identificationInfo/citation/citedResponsibleParty/role}</li> * </ul> * * @param party the individual or organization that is responsible, or {@code null} for no-operation. * @param role the role to set, or {@code null} for leaving it unchanged. */ public final void addCitedResponsibleParty(ResponsibleParty party, final Role role) { if (party != null) { if (role != null && !role.equals(party.getRole())) { party = new DefaultResponsibleParty(party); ((DefaultResponsibility) party).setRole(role); } addIfNotPresent(citation().getCitedResponsibleParties(), party); } }
/** * Adds role, name, contact and position information for an individual or organization that is responsible * for the resource. This method can be used as an alternative to {@link #addAuthor(CharSequence)} when the * caller needs to create the responsibly party itself. * * <p>If the given {@code role} is non-null, then this method will ensure that the added party has the given * role. A copy of the given party will be created if needed (the given party will never be modified).</p> * * Storage locations are: * * <ul> * <li>{@code metadata/identificationInfo/citation/citedResponsibleParty}</li> * <li>{@code metadata/identificationInfo/citation/citedResponsibleParty/role}</li> * </ul> * * @param party the individual or organization that is responsible, or {@code null} for no-operation. * @param role the role to set, or {@code null} for leaving it unchanged. */ public final void addCitedResponsibleParty(ResponsibleParty party, final Role role) { if (party != null) { if (role != null && !role.equals(party.getRole())) { party = new DefaultResponsibleParty(party); ((DefaultResponsibility) party).setRole(role); } addIfNotPresent(citation().getCitedResponsibleParties(), party); } }
return new DefaultResponsibility(metadata.getRole(), null, party);
/** * Tests marshalling using the ISO URL. * * @throws JAXBException if an error occurred while marshalling the XML. */ @Test public void testISO_URL() throws JAXBException { final String expected = getResponsiblePartyXML("http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/"); final ResponsibleParty rp = unmarshal(ResponsibleParty.class, expected); assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole()); final MarshallerPool pool = getMarshallerPool(); final Marshaller marshaller = pool.acquireMarshaller(); marshaller.setProperty(XML.METADATA_VERSION, VERSION_2007); marshaller.setProperty(XML.SCHEMAS, Collections.singletonMap("gmd", "http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas")); // Intentionally omit trailing '/'. final String actual = marshal(marshaller, rp); pool.recycle(marshaller); assertXmlEquals(expected, actual, "xmlns:*"); }
/** * Tests marshalling using the default URL. * * @throws JAXBException if an error occurred while marshalling 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:*"); }
/** * Asserts that the given responsibility has the expected properties, then returns its contact info. */ private static Contact assertResponsibilityEquals(final Role role, final String name, final ResponsibleParty actual) { assertEquals("role", role, actual.getRole()); final AbstractParty p = getSingleton(((DefaultResponsibleParty) actual).getParties()); assertEquals("name", name, p.getName().toString()); return getSingleton(p.getContactInfo()); } }
/** * Tests {@link Store#getMetadata()}. * * @throws DataStoreException if en error occurred while reading the XML. */ @Test public void testMetadata() throws DataStoreException { final Metadata metadata; try (Store store = new Store(null, new StorageConnector(new StringReader(XML)))) { metadata = store.getMetadata(); assertSame("Expected cached value.", metadata, store.getMetadata()); } final ResponsibleParty resp = getSingleton(metadata.getContacts()); final Contact contact = resp.getContactInfo(); final OnlineResource resource = contact.getOnlineResource(); assertEquals(Locale.ENGLISH, metadata.getLanguage()); if (!REGRESSION) assertEquals(CharacterSet.UTF_8, metadata.getCharacterSet()); assertEquals(Role.PRINCIPAL_INVESTIGATOR, resp.getRole()); assertEquals("Apache SIS", String.valueOf(resp.getOrganisationName())); assertEquals("http://sis.apache.org", String.valueOf(resource.getLinkage())); assertEquals(OnLineFunction.INFORMATION, resource.getFunction()); } }
if(d!=null && d.getDistributorContact()!=null && d.getDistributorContact().getRole()!=null) metadata.add("Distributor Contact ",d.getDistributorContact().getRole().name()); if(d!=null && d.getDistributorContact()!=null && d.getDistributorContact().getOrganisationName()!=null) metadata.add("Distributor Organization Name ",d.getDistributorContact().getOrganisationName().toString());
if(d!=null && d.getDistributorContact()!=null && d.getDistributorContact().getRole()!=null) metadata.add("Distributor Contact ",d.getDistributorContact().getRole().name()); if(d!=null && d.getDistributorContact()!=null && d.getDistributorContact().getOrganisationName()!=null) metadata.add("Distributor Organization Name ",d.getDistributorContact().getOrganisationName().toString());