Examples of XLink


Examples of org.apache.sis.xml.XLink

    /**
     * Creates a dummy XLink.
     */
    private static XLink createXLink() {
        final XLink link = new XLink();
        link.setShow(XLink.Show.REPLACE);
        link.setActuate(XLink.Actuate.ON_LOAD);
        link.setTitle(new SimpleInternationalString("myResult"));
        return link;
    }
View Full Code Here

Examples of org.apache.sis.xml.XLink

     */
    @Test
    @DependsOnMethod({"testWithUUID", "testWithXLink"})
    public void testWithDiscardedReferences() throws Exception {
        final UUID  uuid = UUID.randomUUID();
        final XLink link = createXLink();
        metadata.getIdentifierMap().putSpecialized(IdentifierSpace.UUID,  uuid);
        metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
        final PropertyTypeMock property = marshal();
        assertSame(metadata, property.metadata);
        assertNoReference(property);
View Full Code Here

Examples of org.apache.sis.xml.XLink

     * @throws Exception Should never happen.
     */
    @Test
    @DependsOnMethod("testWithNoReference")
    public void testWithXLink() throws Exception {
        final XLink link = createXLink();
        metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
        context = ReferenceResolverMock.begin(true);
        final PropertyTypeMock property = marshal();
        assertSame  (metadata,              property.metadata);
        assertNull  ("nilReason",           property.getNilReason());
View Full Code Here

Examples of org.apache.sis.xml.XLink

                        href = new URI(code);
                    } catch (URISyntaxException e) {
                        parseFailure(source, e);
                        break;
                    }
                    final XLink xlink = new XLink();
                    xlink.setHRef(href);
                    return new SpecializedIdentifier<XLink>(IdentifierSpace.XLINK, xlink);
                }
            }
        }
        return new IdentifierMapEntry(authority, code);
View Full Code Here

Examples of org.apache.sis.xml.XLink

     * not test if an explicit {@code xlink:href} identifier exists - this check must be done by
     * the caller <strong>before</strong> to invoke this method, by invoking one of the getter
     * methods defined in the {@link IdentifierMapAdapter} super-class.
     */
    private String getHRef() {
        final XLink link = super.getSpecialized(IdentifierSpace.XLINK);
        if (link != null) {
            final URI href = link.getHRef();
            if (href != null) {
                return href.toString();
            }
        }
        return null;
View Full Code Here

Examples of org.apache.sis.xml.XLink

     * identifier exists, it is removed before to set the new {@code href} in the {@link XLink}
     * object.
     */
    private URI setHRef(final URI href) {
        URI old = super.putSpecialized(IdentifierSpace.HREF, null);
        XLink link = super.getSpecialized(IdentifierSpace.XLINK);
        if (link != null) {
            if (old == null) {
                old = link.getHRef();
            }
            link.setHRef(href);
        } else if (href != null) {
            link = new XLink();
            link.setHRef(href);
            super.putSpecialized(IdentifierSpace.XLINK, link);
        }
        return old;
    }
View Full Code Here

Examples of org.apache.sis.xml.XLink

        if (super.containsKey(authority)) {
            return true;
        }
        switch (specialCase(authority)) {
            case NonMarshalledAuthority.HREF: {
                final XLink link = super.getSpecialized(IdentifierSpace.XLINK);
                return (link != null) && (link.getHRef() != null);
            }
        }
        return false;
    }
View Full Code Here

Examples of org.apache.sis.xml.XLink

    public <T> T getSpecialized(final IdentifierSpace<T> authority) {
        T value = super.getSpecialized(authority);
        if (value == null) {
            switch (specialCase(authority)) {
                case NonMarshalledAuthority.HREF: {
                    final XLink link = super.getSpecialized(IdentifierSpace.XLINK);
                    if (link != null) {
                        value = (T) link.getHRef();
                    }
                    break;
                }
            }
        }
View Full Code Here

Examples of org.apache.sis.xml.XLink

        final IdentifierMap map = create(identifiers);
        assertNull(map.put(IdentifierSpace.HREF, "myHREF"));
        assertEquals("Shall contain the entry we added.", "myHREF", map.get(IdentifierSpace.HREF));

        // Check the XLink object
        final XLink link = map.getSpecialized(IdentifierSpace.XLINK);
        assertEquals("Added href shall be stored as XLink attribute.", "myHREF", String.valueOf(link.getHRef()));
        assertEquals("Identifier list shall contain the XLink.", link.toString(), getSingleton(identifiers).getCode());

        // Modidfy the XLink object directly
        link.setHRef(URI.create("myNewHREF"));
        assertEquals("Change in XLink shall be reflected in href.", "myNewHREF", map.get(IdentifierSpace.HREF));
    }
View Full Code Here

Examples of org.apache.sis.xml.XLink

     *       by the XLink because the {@link ReferenceResolverMock#canSubstituteByReference(MarshalContext,
     *       Class, Object, Xlink)} method returns {@code true}.</li>
     * </ul>
     */
    private void testWithXLink(final boolean useReferenceResolverMock) {
        final XLink link = new XLink();
        link.setShow(XLink.Show.REPLACE);
        link.setActuate(XLink.Actuate.ON_LOAD);
        link.setTitle(new SimpleInternationalString("myLinkTitle"));
        metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
        if (useReferenceResolverMock) {
            context = ReferenceResolverMock.begin(true);
            // XMLTestCase.clearContext() will dispose the context.
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.