Package org.opengis.metadata.citation

Examples of org.opengis.metadata.citation.Citation


    /**
     * Tests the {@code indexOf} and {code name} methods.
     */
    @Test
    public void testName() {
        final Citation citation = Citations.EPSG;
        final PropertyAccessor accessor = createPropertyAccessor(citation);
        assertEquals("Non-existent property",   -1,  accessor.indexOf("dummy"));
        assertEquals("getTitle() property", "title", accessor.name(accessor.indexOf("title")));
        assertEquals("getTitle() property", "title", accessor.name(accessor.indexOf("TITLE")));
        assertEquals("getISBN() property""ISBN",  accessor.name(accessor.indexOf("ISBN")));
View Full Code Here


    /**
     * Tests the get method.
     */
    @Test
    public void testGet() {
        Citation citation = Citations.EPSG;
        final PropertyAccessor accessor = createPropertyAccessor(citation);
        final int index = accessor.indexOf("identifiers");
        assertTrue(index >= 0);
        final Object identifiers = accessor.get(index, citation);
        assertNotNull(identifiers);
View Full Code Here

    /**
     * Tests the set method.
     */
    @Test
    public void testSet() {
        Citation citation = new CitationImpl();
        final PropertyAccessor accessor = createPropertyAccessor(citation);

        // Tries with ISBN, which expect a String.
        Object value = "Random number";
        int index = accessor.indexOf("ISBN");
        assertTrue(index >= 0);
        assertNull(accessor.set(index, citation, value));
        assertSame(value, accessor.get(index, citation));
        assertSame(value, citation.getISBN());

        // Tries with the title. Automatic conversion from String to InternationalString expected.
        index = accessor.indexOf("title");
        assertTrue(index >= 0);
        assertNull(accessor.set(index, citation, "A random title"));
        value = accessor.get(index, citation);
        assertTrue(value instanceof InternationalString);
        assertEquals("A random title", value.toString());
        assertSame(value, citation.getTitle());

        // Tries with an element to be added in a collection.
        index = accessor.indexOf("alternateTitle");
        assertTrue(index >= 0);

View Full Code Here

    /**
     * Tests the shallow equals and copy methods.
     */
    @Test
    public void testEquals() {
        Citation citation = Citations.EPSG;
        final PropertyAccessor accessor = createPropertyAccessor(citation);
        assertFalse(accessor.shallowEquals(citation, Citations.GEOTIFF, true ));
        assertFalse(accessor.shallowEquals(citation, Citations.GEOTIFF, false));
        assertTrue (accessor.shallowEquals(citation, Citations.EPSG,    false));

View Full Code Here

     * Returns the authority for this EPSG database.
     * This authority will contains the database version in the {@linkplain Citation#getEdition
     * edition} attribute, together with the {@linkplain Citation#getEditionDate edition date}.
     */
    public Citation getAuthority() {
        final Citation authority = super.getAuthority();
        return (authority!=null) ? authority : Citations.EPSG;
    }
View Full Code Here

     * This authority will contains the database version in the {@linkplain Citation#getEdition
     * edition} attribute, together with the {@linkplain Citation#getEditionDate edition date}.
     */
    @Override
    public Citation getAuthority() {
        final Citation authority = super.getAuthority();
        return (authority!=null) ? authority : Citations.EPSG;
    }
View Full Code Here

     *
     * @throws FactoryException if the database's metadata can't be fetched.
     */
    @Override
    public synchronized String getBackingStoreDescription() throws FactoryException {
        final Citation   authority = getAuthority();
        final TableWriter    table = new TableWriter(null, " ");
        final Vocabulary resources = Vocabulary.getResources(null);
        CharSequence cs;
        if ((cs=authority.getEdition()) != null) {
            table.write(resources.getString(VocabularyKeys.VERSION_OF_$1, "EPSG"));
            table.write(':');
            table.nextColumn();
            table.write(cs.toString());
            table.nextLine();
View Full Code Here

     */
    private Map<String,Object> generateProperties(final String name, final String code, String remarks)
            throws SQLException, FactoryException
    {
        properties.clear();
        final Citation authority = getAuthority();
        if (name != null) {
            properties.put(IdentifiedObject.NAME_KEY,
                           new NamedIdentifier(authority, name.trim()));
        }
        if (code != null) {
            final InternationalString edition = authority.getEdition();
            final String version = (edition!=null) ? edition.toString() : null;
            properties.put(IdentifiedObject.IDENTIFIERS_KEY,
                           new NamedIdentifier(authority, code.trim(), version));
        }
        if (remarks!=null && (remarks=remarks.trim()).length()!=0) {
View Full Code Here

    private List<Expression> list( Expression expr ){
        return Collections.singletonList(expr);
    }
    @Test
    public void testEvaluatePojo() {
        Citation pojo = new CitationImpl();

        f.setParameters( list(ff.property("edition")));
        Assert.assertEquals(Boolean.TRUE, f.evaluate(pojo));

        f.setParameters(list(ff.property("alternateTitles")));
View Full Code Here

     * @param object The original object.
     * @return The properties to be given to the object created as a substitute
     *         of {@code object}.
     */
    private Map<String,?> getProperties(final IdentifiedObject object) {
        final Citation authority = getAuthority();
        if (!Utilities.equals(authority, object.getName().getAuthority())) {
            return AbstractIdentifiedObject.getProperties(object, authority);
        } else {
            return AbstractIdentifiedObject.getProperties(object);
        }
View Full Code Here

TOP

Related Classes of org.opengis.metadata.citation.Citation

Copyright © 2018 www.massapicom. 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.