use of org.apache.sis.metadata.iso.citation.DefaultResponsibility in project sis by apache.
the class MetadataAssert method assertPartyNameEquals.
/**
* Asserts that the given citation has only one responsible party,
* and its English name is equals to the expected string.
*
* @param message the message to report in case of test failure.
* @param expected the expected English responsibly party name.
* @param citation the citation to test.
*
* @since 0.8
*/
public static void assertPartyNameEquals(final String message, final String expected, final DefaultCitation citation) {
assertNotNull(message, citation);
final DefaultResponsibility r = (DefaultResponsibility) TestUtilities.getSingleton(citation.getCitedResponsibleParties());
final InternationalString name = TestUtilities.getSingleton(r.getParties()).getName();
assertNotNull(message, name);
assertEquals(message, expected, name.toString(Locale.US));
}
use of org.apache.sis.metadata.iso.citation.DefaultResponsibility in project sis by apache.
the class MetadataBuilder method addCitedResponsibleParty.
/**
* 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);
}
}
Aggregations