Java Code Examples for mil.nga.geopackage.GeoPackage#createDataColumnConstraintsTable()

The following examples show how to use mil.nga.geopackage.GeoPackage#createDataColumnConstraintsTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUtils.java    From geopackage-android-map with MIT License 4 votes vote down vote up
/**
 * Create Data Column Constraints
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void createConstraints(GeoPackage geoPackage)
        throws SQLException {

    geoPackage.createDataColumnConstraintsTable();

    DataColumnConstraintsDao dao = geoPackage.getDataColumnConstraintsDao();

    DataColumnConstraints sampleRange = new DataColumnConstraints();
    sampleRange.setConstraintName(SAMPLE_RANGE_CONSTRAINT);
    sampleRange.setConstraintType(DataColumnConstraintType.RANGE);
    sampleRange.setMin(BigDecimal.ONE);
    sampleRange.setMinIsInclusive(true);
    sampleRange.setMax(BigDecimal.TEN);
    sampleRange.setMaxIsInclusive(true);
    dao.create(sampleRange);

    DataColumnConstraints sampleEnum1 = new DataColumnConstraints();
    sampleEnum1.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum1.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum1.setValue("1");
    dao.create(sampleEnum1);

    DataColumnConstraints sampleEnum3 = new DataColumnConstraints();
    sampleEnum3.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum3.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum3.setValue("3");
    dao.create(sampleEnum3);

    DataColumnConstraints sampleEnum5 = new DataColumnConstraints();
    sampleEnum5.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum5.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum5.setValue("5");
    dao.create(sampleEnum5);

    DataColumnConstraints sampleEnum7 = new DataColumnConstraints();
    sampleEnum7.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum7.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum7.setValue("7");
    dao.create(sampleEnum7);

    DataColumnConstraints sampleEnum9 = new DataColumnConstraints();
    sampleEnum9.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum9.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum9.setValue("9");
    dao.create(sampleEnum9);

    DataColumnConstraints sampleGlob = new DataColumnConstraints();
    sampleGlob.setConstraintName(SAMPLE_GLOB_CONSTRAINT);
    sampleGlob.setConstraintType(DataColumnConstraintType.GLOB);
    sampleGlob.setValue("[1-2][0-9][0-9][0-9]");
    dao.create(sampleGlob);
}
 
Example 2
Source File: TestUtils.java    From geopackage-android with MIT License 4 votes vote down vote up
/**
 * Create Data Column Constraints
 *
 * @param geoPackage
 * @throws SQLException
 */
public static void createConstraints(GeoPackage geoPackage)
        throws SQLException {

    geoPackage.createDataColumnConstraintsTable();

    DataColumnConstraintsDao dao = geoPackage.getDataColumnConstraintsDao();

    DataColumnConstraints sampleRange = new DataColumnConstraints();
    sampleRange.setConstraintName(SAMPLE_RANGE_CONSTRAINT);
    sampleRange.setConstraintType(DataColumnConstraintType.RANGE);
    sampleRange.setMin(BigDecimal.ONE);
    sampleRange.setMinIsInclusive(true);
    sampleRange.setMax(BigDecimal.TEN);
    sampleRange.setMaxIsInclusive(true);
    dao.create(sampleRange);

    DataColumnConstraints sampleEnum1 = new DataColumnConstraints();
    sampleEnum1.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum1.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum1.setValue("1");
    dao.create(sampleEnum1);

    DataColumnConstraints sampleEnum3 = new DataColumnConstraints();
    sampleEnum3.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum3.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum3.setValue("3");
    dao.create(sampleEnum3);

    DataColumnConstraints sampleEnum5 = new DataColumnConstraints();
    sampleEnum5.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum5.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum5.setValue("5");
    dao.create(sampleEnum5);

    DataColumnConstraints sampleEnum7 = new DataColumnConstraints();
    sampleEnum7.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum7.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum7.setValue("7");
    dao.create(sampleEnum7);

    DataColumnConstraints sampleEnum9 = new DataColumnConstraints();
    sampleEnum9.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
    sampleEnum9.setConstraintType(DataColumnConstraintType.ENUM);
    sampleEnum9.setValue("9");
    dao.create(sampleEnum9);

    DataColumnConstraints sampleGlob = new DataColumnConstraints();
    sampleGlob.setConstraintName(SAMPLE_GLOB_CONSTRAINT);
    sampleGlob.setConstraintType(DataColumnConstraintType.GLOB);
    sampleGlob.setValue("[1-2][0-9][0-9][0-9]");
    dao.create(sampleGlob);
}
 
Example 3
Source File: TestUtils.java    From geopackage-java with MIT License 4 votes vote down vote up
/**
 * Create Data Column Constraints
 * 
 * @param geoPackage
 * @throws SQLException
 */
public static void createConstraints(GeoPackage geoPackage)
		throws SQLException {

	geoPackage.createDataColumnConstraintsTable();

	DataColumnConstraintsDao dao = geoPackage.getDataColumnConstraintsDao();

	DataColumnConstraints sampleRange = new DataColumnConstraints();
	sampleRange.setConstraintName(SAMPLE_RANGE_CONSTRAINT);
	sampleRange.setConstraintType(DataColumnConstraintType.RANGE);
	sampleRange.setMin(BigDecimal.ONE);
	sampleRange.setMinIsInclusive(true);
	sampleRange.setMax(BigDecimal.TEN);
	sampleRange.setMaxIsInclusive(true);
	dao.create(sampleRange);

	DataColumnConstraints sampleEnum1 = new DataColumnConstraints();
	sampleEnum1.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
	sampleEnum1.setConstraintType(DataColumnConstraintType.ENUM);
	sampleEnum1.setValue("1");
	dao.create(sampleEnum1);

	DataColumnConstraints sampleEnum3 = new DataColumnConstraints();
	sampleEnum3.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
	sampleEnum3.setConstraintType(DataColumnConstraintType.ENUM);
	sampleEnum3.setValue("3");
	dao.create(sampleEnum3);

	DataColumnConstraints sampleEnum5 = new DataColumnConstraints();
	sampleEnum5.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
	sampleEnum5.setConstraintType(DataColumnConstraintType.ENUM);
	sampleEnum5.setValue("5");
	dao.create(sampleEnum5);

	DataColumnConstraints sampleEnum7 = new DataColumnConstraints();
	sampleEnum7.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
	sampleEnum7.setConstraintType(DataColumnConstraintType.ENUM);
	sampleEnum7.setValue("7");
	dao.create(sampleEnum7);

	DataColumnConstraints sampleEnum9 = new DataColumnConstraints();
	sampleEnum9.setConstraintName(SAMPLE_ENUM_CONSTRAINT);
	sampleEnum9.setConstraintType(DataColumnConstraintType.ENUM);
	sampleEnum9.setValue("9");
	dao.create(sampleEnum9);

	DataColumnConstraints sampleGlob = new DataColumnConstraints();
	sampleGlob.setConstraintName(SAMPLE_GLOB_CONSTRAINT);
	sampleGlob.setConstraintType(DataColumnConstraintType.GLOB);
	sampleGlob.setValue("[1-2][0-9][0-9][0-9]");
	dao.create(sampleGlob);
}