Tabnine Logo
IdentifierMap.putSpecialized
Code IndexAdd Tabnine to your IDE (free)

How to use
putSpecialized
method
in
org.apache.sis.xml.IdentifierMap

Best Java code snippets using org.apache.sis.xml.IdentifierMap.putSpecialized (Showing top 19 results out of 315)

origin: org.apache.sis.core/sis-utility

final T previous = map.putSpecialized(authority, value);
if (previous != null && !previous.equals(value)) {
  Context.warningOccured(context, IdentifierMap.class, "putSpecialized",
      Errors.class, Errors.Keys.InconsistentAttribute_2, authority.getName(), value);
  map.putSpecialized(authority, previous);
origin: apache/sis

final T previous = map.putSpecialized(authority, value);
if (previous != null && !previous.equals(value)) {
  Context.warningOccured(context, IdentifierMap.class, "putSpecialized",
      Errors.class, Errors.Keys.InconsistentAttribute_2, authority.getName(), value);
  map.putSpecialized(authority, previous);
origin: org.apache.sis.core/sis-metadata

/**
 * Sets the International Standard Serial Number.
 * In this SIS implementation, invoking this method is equivalent to:
 *
 * {@preformat java
 *   getIdentifierMap().putSpecialized(Citations.ISSN, newValue);
 * }
 *
 * @param  newValue  the new ISSN.
 *
 * @see #setIdentifiers(Collection)
 * @see Citations#ISSN
 */
public void setISSN(final String newValue) {
  checkWritePermission();
  if (newValue != null || !isNullOrEmpty(identifiers)) {
    getIdentifierMap().putSpecialized(Citations.ISSN, newValue);
  }
}
origin: org.apache.sis.core/sis-metadata

  /**
   * Invoked by {@code setID(String)} method implementations for assigning an identifier to an object
   * at unmarshalling time.
   *
   * @param object  the object for which to assign an identifier.
   * @param id      the {@code gco:id} or {@code gml:id} value.
   *
   * @since 0.7
   */
  public static void setObjectID(final IdentifiedObject object, String id) {
    id = CharSequences.trimWhitespaces(id);
    if (id != null && !id.isEmpty()) {
      object.getIdentifierMap().putSpecialized(IdentifierSpace.ID, id);
      final Context context = Context.current();
      if (!Context.setObjectForID(context, object, id)) {
        Context.warningOccured(context, object.getClass(), "setID", Errors.class, Errors.Keys.DuplicatedIdentifier_1, id);
      }
    }
  }
}
origin: org.apache.sis.core/sis-metadata

/**
 * Sets the International Standard Book Number.
 * In this SIS implementation, invoking this method is equivalent to:
 *
 * {@preformat java
 *   getIdentifierMap().putSpecialized(Citations.ISBN, newValue);
 * }
 *
 * @param  newValue  the new ISBN, or {@code null} if none.
 *
 * @see #setIdentifiers(Collection)
 * @see Citations#ISBN
 */
public void setISBN(final String newValue) {
  checkWritePermission();
  if (newValue != null || !isNullOrEmpty(identifiers)) {
    getIdentifierMap().putSpecialized(Citations.ISBN, newValue);
  }
}
origin: apache/sis

  /**
   * Invoked by {@code setID(String)} method implementations for assigning an identifier to an object
   * at unmarshalling time.
   *
   * @param object  the object for which to assign an identifier.
   * @param id      the {@code gco:id} or {@code gml:id} value.
   *
   * @since 0.7
   */
  public static void setObjectID(final IdentifiedObject object, String id) {
    id = CharSequences.trimWhitespaces(id);
    if (id != null && !id.isEmpty()) {
      object.getIdentifierMap().putSpecialized(IdentifierSpace.ID, id);
      final Context context = Context.current();
      if (!Context.setObjectForID(context, object, id)) {
        Context.warningOccured(context, object.getClass(), "setID", Errors.class, Errors.Keys.DuplicatedIdentifier_1, id);
      }
    }
  }
}
origin: apache/sis

  /**
   * Tests with UUIDs.
   */
  @Test
  public void testUUIDs() {
    final List<Identifier> identifiers = new ArrayList<>();
    final IdentifierMap map = new ModifiableIdentifierMap(identifiers);
    final java.util.UUID id1 = fromString("434f3107-c6d2-4c8c-bb25-553f68641c5c");
    final java.util.UUID id2 = fromString("42924124-032a-4dfe-b06e-113e3cb81cf0");

    // Add first UUID.
    assertNull(map.putSpecialized(UUID, id1));

    // Replace UUID by a new one.
    assertSame(id1, map.putSpecialized(UUID, id2));
  }
}
origin: apache/sis

/**
 * Sets the International Standard Serial Number.
 * In this SIS implementation, invoking this method is equivalent to:
 *
 * {@preformat java
 *   getIdentifierMap().putSpecialized(Citations.ISSN, newValue);
 * }
 *
 * @param  newValue  the new ISSN.
 *
 * @see #setIdentifiers(Collection)
 * @see Citations#ISSN
 */
public void setISSN(final String newValue) {
  checkWritePermission(getIdentifier(Citations.ISSN));
  if (newValue != null || !isNullOrEmpty(identifiers)) {
    getIdentifierMap().putSpecialized(Citations.ISSN, newValue);
  }
}
origin: apache/sis

/**
 * Sets the International Standard Book Number.
 * In this SIS implementation, invoking this method is equivalent to:
 *
 * {@preformat java
 *   getIdentifierMap().putSpecialized(Citations.ISBN, newValue);
 * }
 *
 * @param  newValue  the new ISBN, or {@code null} if none.
 *
 * @see #setIdentifiers(Collection)
 * @see Citations#ISBN
 */
public void setISBN(final String newValue) {
  checkWritePermission(getIdentifier(Citations.ISBN));
  if (newValue != null || !isNullOrEmpty(identifiers)) {
    getIdentifierMap().putSpecialized(Citations.ISBN, newValue);
  }
}
origin: apache/sis

/**
 * Tests XML marshalling using ISO 19115-3 schema.
 * This XML fragment contains an identifier.
 *
 * @throws JAXBException if an error occurred during marshalling.
 */
@Test
public void testMarshalling() throws JAXBException {
  final DefaultRepresentativeFraction fraction = new DefaultRepresentativeFraction(8);
  fraction.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "scale");
  roundtrip(fraction,
      "<mri:MD_RepresentativeFraction xmlns:mri=\"" + Namespaces.MRI + '"' +
                     " xmlns:gco=\"" + Namespaces.GCO + '"' +
                     " id=\"scale\">\n" +
      "  <mri:denominator>\n" +
      "    <gco:Integer>8</gco:Integer>\n" +
      "  </mri:denominator>\n" +
      "</mri:MD_RepresentativeFraction>");
}
origin: apache/sis

metadata.getIdentifierMap().putSpecialized(IdentifierSpace.UUID, uuid);
if (useReferenceResolverMock) {
  context = ReferenceResolverMock.begin(true);
origin: apache/sis

/**
 * Tests write operations on an {@link IdentifierMap} using specific API.
 */
@Test
public void testPutSpecialized() {
  final List<Identifier> identifiers = new ArrayList<>();
  final IdentifierMap map = new ModifiableIdentifierMap(identifiers);
  final String myID = "myID";
  final java.util.UUID myUUID = fromString("a1eb6e53-93db-4942-84a6-d9e7fb9db2c7");
  final URI myURI = URI.create("http://mylink");
  assertNull(map.putSpecialized(ID,   myID));
  assertNull(map.putSpecialized(UUID, myUUID));
  assertNull(map.putSpecialized(HREF, myURI));
  assertMapEquals("{gml:id=“myID”,"
      + " gco:uuid=“a1eb6e53-93db-4942-84a6-d9e7fb9db2c7”,"
      + " xlink:href=“http://mylink”}", map);
  assertSame(myID,   map.getSpecialized(ID));
  assertSame(myUUID, map.getSpecialized(UUID));
  assertSame(myURI,  map.getSpecialized(HREF));
  assertEquals("myID",                                 map.get(ID));
  assertEquals("a1eb6e53-93db-4942-84a6-d9e7fb9db2c7", map.get(UUID));
  assertEquals("http://mylink",                        map.get(HREF));
}
origin: apache/sis

/**
 * Tests (un)marshalling of an object with a {@code xlink:href} attribute without element definition.
 * The XML fragment is:
 *
 * {@preformat xml
 *   <mdb:MD_Metadata>
 *     <mdb:identificationInfo xlink:href="http://test.net"/>
 *   </mdb:MD_Metadata>
 * }
 *
 * @throws JAXBException if an error occurred during (un)marshalling.
 * @throws URISyntaxException if the URI used in this test is malformed.
 */
@Test
public void testLinkOnly() throws JAXBException, URISyntaxException {
  final XLink xlink = new XLink();
  xlink.setHRef(new URI("http://test.net"));
  final DefaultDataIdentification identification = new DefaultDataIdentification();
  identification.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, xlink);
  final DefaultMetadata metadata = new DefaultMetadata();
  metadata.setIdentificationInfo(Collections.singleton(identification));
  assertXmlEquals(LINK_ONLY_XML, marshal(metadata), "xmlns:*");
  verify(true, unmarshal(DefaultMetadata.class, LINK_ONLY_XML));
}
origin: org.apache.sis.core/sis-metadata

if (id1 != null || id2 != null) {
  final IdentifierMap map = super.getIdentifierMap();
  if (id1 != null) map.putSpecialized(Citations.ISBN, id1);
  if (id2 != null) map.putSpecialized(Citations.ISSN, id2);
origin: apache/sis

if (id1 != null || id2 != null) {
  final IdentifierMap map = super.getIdentifierMap();
  if (id1 != null) map.putSpecialized(Citations.ISBN, id1);
  if (id2 != null) map.putSpecialized(Citations.ISSN, id2);
origin: apache/sis

/**
 * Tests XML marshalling for the given metadata version.
 *
 * @param  file     file containing the expected metadata.
 * @param  version  the metadata version to marshal.
 */
private void testMarshalling(final String file, final Version version) throws JAXBException {
  final DefaultOnlineResource rs = new DefaultOnlineResource(URI.create("https://tools.ietf.org/html/rfc1149"));
  rs.setName("IP over Avian Carriers");
  rs.setDescription(new SimpleInternationalString("High delay, low throughput, and low altitude service."));
  rs.setFunction(OnLineFunction.OFFLINE_ACCESS);
  final DefaultContact contact = new DefaultContact(rs);
  contact.setContactInstructions(new SimpleInternationalString("Send carrier pigeon."));
  contact.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "ip-protocol");
  final DefaultCitation c = new DefaultCitation("Fight against poverty");
  final DefaultResponsibleParty r1 = new DefaultResponsibleParty(Role.ORIGINATOR);
  final DefaultResponsibleParty r2 = new DefaultResponsibleParty(Role.valueOf("funder"));
  r1.setParties(Collections.singleton(new DefaultIndividual("Maid Marian", null, contact)));
  r2.setParties(Collections.singleton(new DefaultIndividual("Robin Hood",  null, contact)));
  c.setCitedResponsibleParties(Arrays.asList(r1, r2));
  c.getDates().add(new DefaultCitationDate(TestUtilities.date("2015-10-17 00:00:00"), DateType.valueOf("adopted")));
  c.getPresentationForms().add(PresentationForm.valueOf("physicalObject"));
  /*
   * Check that XML file built by the marshaller is the same as the example file.
   */
  assertMarshalEqualsFile(file, c, version, "xmlns:*", "xsi:schemaLocation");
}
origin: apache/sis

xlink.setHRef(new URI("http://test.net"));
final DefaultDataIdentification identification = new DefaultDataIdentification();
identification.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, xlink);
identification.setAbstract(new SimpleInternationalString("This is a test."));
final DefaultMetadata metadata = new DefaultMetadata();
origin: apache/sis

online.setProtocol("http");
final DefaultContact contact = new DefaultContact(online);
contact.getIdentifierMap().putSpecialized(IdentifierSpace.ID, "IFREMER");
contact.setPhones(Arrays.asList(
    telephone("+33 (0)2 xx.xx.xx.x6", "VOICE"),
origin: apache/sis

link.setActuate(XLink.Actuate.ON_LOAD);
link.setTitle(new SimpleInternationalString("myLinkTitle"));
metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
if (useReferenceResolverMock) {
  context = ReferenceResolverMock.begin(true);
org.apache.sis.xmlIdentifierMapputSpecialized

Javadoc

Associates the given identifier with the given namespace in this map (optional operation). If the map previously contained a mapping for the namespace, then the old value is replaced by the specified value.

Popular methods of IdentifierMap

  • get
  • getSpecialized
    Returns the identifier associated to the given namespace, or null if this map contains no mapping of
  • put
  • keySet
  • size

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now