Search in sources :

Example 1 with DefaultResponsibility

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));
}
Also used : DefaultResponsibility(org.apache.sis.metadata.iso.citation.DefaultResponsibility) InternationalString(org.opengis.util.InternationalString)

Example 2 with DefaultResponsibility

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);
    }
}
Also used : DefaultResponsibility(org.apache.sis.metadata.iso.citation.DefaultResponsibility) DefaultResponsibleParty(org.apache.sis.metadata.iso.citation.DefaultResponsibleParty)

Aggregations

DefaultResponsibility (org.apache.sis.metadata.iso.citation.DefaultResponsibility)2 DefaultResponsibleParty (org.apache.sis.metadata.iso.citation.DefaultResponsibleParty)1 InternationalString (org.opengis.util.InternationalString)1