Package org.apache.sis.metadata.iso.constraint

Examples of org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints


    private DataIdentification createIdentificationInfo(final Identifier identifier,
            final Set<InternationalString> publisher) throws IOException
    {
        DefaultDataIdentification identification = null;
        Set<InternationalString>  project        = null;
        DefaultLegalConstraints   constraints    = null;
        boolean hasExtent = false;
        for (final String path : searchPath) {
            decoder.setSearchPath(path);
            final Keywords standard = createKeywords(KeywordType.THEME, true);
            final Keywords keywords = createKeywords(KeywordType.THEME, false);
            final String   topic    = decoder.stringValue(TOPIC_CATEGORY);
            final String   type     = decoder.stringValue(DATA_TYPE);
            final String   credits  = decoder.stringValue(ACKNOWLEDGMENT);
            final String   license  = decoder.stringValue(LICENSE);
            final String   access   = decoder.stringValue(ACCESS_CONSTRAINT);
            final Extent   extent   = hasExtent ? null : createExtent();
            if (standard!=null || keywords!=null || topic != null || type!=null || credits!=null || license!=null || access!= null || extent!=null) {
                if (identification == null) {
                    identification = new DefaultDataIdentification();
                }
                if (topic    != null) addIfAbsent(identification.getTopicCategories(), Types.forCodeName(TopicCategory.class, topic, true));
                if (type     != null) addIfAbsent(identification.getSpatialRepresentationTypes(), Types.forCodeName(SpatialRepresentationType.class, type, true));
                if (standard != null) addIfAbsent(identification.getDescriptiveKeywords(), standard);
                if (keywords != null) addIfAbsent(identification.getDescriptiveKeywords(), keywords);
                if (credits  != null) addIfAbsent(identification.getCredits(), credits);
                if (license  != null) addIfAbsent(identification.getResourceConstraints(), constraints = new DefaultLegalConstraints(license));
                if (access   != null) {
                    for (String keyword : access.split(KEYWORD_SEPARATOR)) {
                        keyword = keyword.trim();
                        if (!keyword.isEmpty()) {
                            if (constraints == null) {
                                identification.getResourceConstraints().add(constraints = new DefaultLegalConstraints());
                            }
                            addIfAbsent(constraints.getAccessConstraints(), Types.forCodeName(Restriction.class, keyword, true));
                        }
                    }
                }
                if (extent != null) {
                    // Takes only ONE extent, because a NetCDF file may declare many time the same
View Full Code Here


        fra = (Constraints) FrenchProfile.toAFNOR(std);
        assertNotSame("Expected a copy.", std, fra);
        assertSame   ("Already an AFNOR instance.", fra, FrenchProfile.toAFNOR(fra));
        assertEquals ("Some constraints.", getSingleton(fra.getUseLimitations()).toString());

        std = new DefaultLegalConstraints("Some legal constraints.");
        fra = (LegalConstraints) FrenchProfile.toAFNOR(std);
        assertNotSame("Expected a copy.", std, fra);
        assertSame   ("Already an AFNOR instance.", fra, FrenchProfile.toAFNOR(fra));
        assertEquals ("Some legal constraints.", getSingleton(fra.getUseLimitations()).toString());
View Full Code Here

    private DataIdentification createIdentificationInfo(final Identifier identifier,
            final Set<InternationalString> publisher) throws IOException
    {
        DefaultDataIdentification identification = null;
        Set<InternationalString>  project        = null;
        DefaultLegalConstraints   constraints    = null;
        boolean hasExtent = false;
        for (final String path : searchPath) {
            decoder.setSearchPath(path);
            final Keywords standard = createKeywords(KeywordType.THEME, true);
            final Keywords keywords = createKeywords(KeywordType.THEME, false);
            final String   topic    = decoder.stringValue(TOPIC_CATEGORY);
            final String   type     = decoder.stringValue(DATA_TYPE);
            final String   credits  = decoder.stringValue(ACKNOWLEDGMENT);
            final String   license  = decoder.stringValue(LICENSE);
            final String   access   = decoder.stringValue(ACCESS_CONSTRAINT);
            final Extent   extent   = hasExtent ? null : createExtent();
            if (standard!=null || keywords!=null || topic != null || type!=null || credits!=null || license!=null || access!= null || extent!=null) {
                if (identification == null) {
                    identification = new DefaultDataIdentification();
                }
                if (topic    != null) addIfAbsent(identification.getTopicCategories(), Types.forCodeName(TopicCategory.class, topic, true));
                if (type     != null) addIfAbsent(identification.getSpatialRepresentationTypes(), Types.forCodeName(SpatialRepresentationType.class, type, true));
                if (standard != null) addIfAbsent(identification.getDescriptiveKeywords(), standard);
                if (keywords != null) addIfAbsent(identification.getDescriptiveKeywords(), keywords);
                if (credits  != null) addIfAbsent(identification.getCredits(), credits);
                if (license  != null) addIfAbsent(identification.getResourceConstraints(), constraints = new DefaultLegalConstraints(license));
                if (access   != null) {
                    for (String keyword : access.split(KEYWORD_SEPARATOR)) {
                        keyword = keyword.trim();
                        if (!keyword.isEmpty()) {
                            if (constraints == null) {
                                identification.getResourceConstraints().add(constraints = new DefaultLegalConstraints());
                            }
                            addIfAbsent(constraints.getAccessConstraints(), Types.forCodeName(Restriction.class, keyword, true));
                        }
                    }
                }
                if (extent != null) {
                    // Takes only ONE extent, because a NetCDF file may declare many time the same
View Full Code Here

TOP

Related Classes of org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints

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.