Codota Logo
IdentifierMap.putSpecialized
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
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)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • requestLocationUpdates (LocationManager)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now