Search in sources :

Example 1 with DefaultConstraints

use of org.apache.sis.metadata.iso.constraint.DefaultConstraints in project sis by apache.

the class DefaultDataIdentificationTest method create.

/**
 * Creates the instance to test.
 */
private static DefaultDataIdentification create() {
    /*
         * Citation
         *   ├─Title……………………………………………………………………………… Sea Surface Temperature Analysis Model
         *   ├─Date
         *   │   ├─Date……………………………………………………………………… Sep 22, 2005 00:00:00 AM
         *   │   └─Date type………………………………………………………… Creation
         *   └─Identifier
         *       └─Code……………………………………………………………………… NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc
         */
    final DefaultCitation citation = new DefaultCitation("Sea Surface Temperature Analysis Model");
    citation.setDates(singleton(new DefaultCitationDate(TestUtilities.date("2005-09-22 00:00:00"), DateType.CREATION)));
    citation.setIdentifiers(singleton(new DefaultIdentifier("SST_Global.nc")));
    /*
         * Descriptive keywords
         *   ├─Keyword………………………………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
         *   ├─Type………………………………………………………………………………… Theme
         *   └─Thesaurus name
         *       └─Title…………………………………………………………………… GCMD Science Keywords
         */
    final DefaultKeywords keywords = new DefaultKeywords("EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature");
    keywords.setType(KeywordType.THEME);
    keywords.setThesaurusName(new DefaultCitation("GCMD Science Keywords"));
    /*
         * Identification info
         *  ├─(above objects)
         *  ├─Abstract………………………………………………………………………………… NCEP SST Global 5.0 x 2.5 degree model data
         *  ├─Descriptive keywords
         *  │   ├─Keyword………………………………………………………………………… EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature
         *  │   ├─Type………………………………………………………………………………… Theme
         *  │   └─Thesaurus name
         *  │       └─Title…………………………………………………………………… GCMD Science Keywords
         *  ├─Resource constraints
         *  │   └─Use limitation……………………………………………………… Freely available
         *  ├─Spatial representation type……………………………… Grid
         *  ├─Language (1 of 2)………………………………………………………… en_US
         *  ├─Language (2 of 2)………………………………………………………… en
         *  ├─Character set…………………………………………………………………… US-ASCII
         *  └─Extent
         *      └─Geographic element
         *          ├─West bound longitude…………………………… 180°W
         *          ├─East bound longitude…………………………… 180°E
         *          ├─South bound latitude…………………………… 90°S
         *          ├─North bound latitude…………………………… 90°N
         *          └─Extent type code……………………………………… true
         */
    final DefaultDataIdentification info = new DefaultDataIdentification(citation, "NCEP SST Global 5.0 x 2.5 degree model data", null, null);
    info.setSpatialRepresentationTypes(singleton(SpatialRepresentationType.GRID));
    info.setDescriptiveKeywords(singleton(keywords));
    info.setResourceConstraints(singleton(new DefaultConstraints("Freely available")));
    info.setExtents(singleton(Extents.WORLD));
    info.setLanguages(asList(LOCALES));
    info.setCharacterSets(singleton(CharacterSet.US_ASCII));
    return info;
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) DefaultIdentifier(org.apache.sis.metadata.iso.DefaultIdentifier) DefaultConstraints(org.apache.sis.metadata.iso.constraint.DefaultConstraints) DefaultCitationDate(org.apache.sis.metadata.iso.citation.DefaultCitationDate)

Example 2 with DefaultConstraints

use of org.apache.sis.metadata.iso.constraint.DefaultConstraints in project sis by apache.

the class FrenchProfileTest method testConstraintsToAFNOR.

/**
 * Tests {@link FrenchProfile#toAFNOR(Object)} with {@link Constraints},
 * {@link LegalConstraints} and  {@link SecurityConstraints} objects.
 */
@Test
public void testConstraintsToAFNOR() {
    Constraints std, fra;
    std = new DefaultConstraints("Some constraints.");
    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());
    std = new DefaultSecurityConstraints("Some security constraints.");
    fra = (SecurityConstraints) FrenchProfile.toAFNOR(std);
    assertNotSame("Expected a copy.", std, fra);
    assertSame("Already an AFNOR instance.", fra, FrenchProfile.toAFNOR(fra));
    assertEquals("Some security constraints.", getSingleton(fra.getUseLimitations()).toString());
}
Also used : DefaultSecurityConstraints(org.apache.sis.metadata.iso.constraint.DefaultSecurityConstraints) DefaultConstraints(org.apache.sis.metadata.iso.constraint.DefaultConstraints) SecurityConstraints(org.opengis.metadata.constraint.SecurityConstraints) DefaultLegalConstraints(org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints) LegalConstraints(org.opengis.metadata.constraint.LegalConstraints) Constraints(org.opengis.metadata.constraint.Constraints) DefaultLegalConstraints(org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints) DefaultSecurityConstraints(org.apache.sis.metadata.iso.constraint.DefaultSecurityConstraints) DefaultConstraints(org.apache.sis.metadata.iso.constraint.DefaultConstraints) Test(org.junit.Test)

Aggregations

DefaultConstraints (org.apache.sis.metadata.iso.constraint.DefaultConstraints)2 DefaultIdentifier (org.apache.sis.metadata.iso.DefaultIdentifier)1 DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)1 DefaultCitationDate (org.apache.sis.metadata.iso.citation.DefaultCitationDate)1 DefaultLegalConstraints (org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints)1 DefaultSecurityConstraints (org.apache.sis.metadata.iso.constraint.DefaultSecurityConstraints)1 Test (org.junit.Test)1 Constraints (org.opengis.metadata.constraint.Constraints)1 LegalConstraints (org.opengis.metadata.constraint.LegalConstraints)1 SecurityConstraints (org.opengis.metadata.constraint.SecurityConstraints)1