TableMapUnit.java [src/soils/db/tables] Revision: default Date:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package soils.db.tables;
import java.util.ArrayList;
import java.util.Arrays;
/**
* This implementation of Table represents the MapUnit table in the SDM
* database.
*
* @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
*/
public class TableMapUnit extends Table {
public static final String TABLE_NAME = "mapunit";
//Table Column Names
public static final String AREASYMBOL_NAME = "areasymbol";
public static final String AREA_NAME = "areaname";
public static final String LKEY_NAME = "lkey";
public static final String MUKEY = "mukey";
public static final String MUKIND = "mukind";
public static final String MUNAME = "muname";
public static final String MUSTATUS = "mustatus";
public static final String MUSYM = "musym";
public static final String MUACRES = "muacres";
//Table Column Details
private static final String[] AREASYMBOL = {AREASYMBOL_NAME, "A symbol that uniquely identifies a single occurrence of a particular type of area (e.g. Lancaster Co., Nebraska is NE109)"};
private static final String[] AREA_NAME_DATA = {AREA_NAME, ""};
private static final String[] KEY = {MUKEY, "A non-connotative string of characters used to uniquely identify a record in the Mapunit table"};
private static final String[] KIND = {MUKIND, "Map unit kind"};
private static final String[] LKEY = {LKEY_NAME, "Legend key value"};
private static final String[] NAME = {MUNAME, "Correlated name of the mapunit (recommended name or field name for surveys in progress)"};
private static final String[] STATUS = {MUSTATUS, "Map unit status"};
private static final String[] SYM = {MUSYM, "The symbol used to uniquely identify the soil mapunit in the soil survey"};
private static final String[] MUACRES_DATA = {MUACRES, "The number of acres of a particular mapunit"};
/**
* This ArrayList contains a static list of columns for this table that are
* required regardless of the calling program's preferences. This columns
* typically identify indexes and foreign keys and other relational aspects
* of a table that must be maintained for data integrity.
*
* @see Table#getMandatoryColumns()
* @see #getMandatoryColumns()
*/
protected static ArrayList<String> MANDATORY_COLUMNS = new ArrayList<String>(Arrays.asList(MUKEY, LKEY_NAME));
/**
* Constructor
*/
public TableMapUnit() {
tableName = TABLE_NAME;
addDataColumn(MUKEY, new TableColumnString(KEY));
addDataColumn(MUNAME, new TableColumnString(NAME));
addDataColumn(MUSYM, new TableColumnString(SYM));
addDataColumn(AREASYMBOL_NAME, new TableColumnString(AREASYMBOL));
addDataColumn(LKEY_NAME, new TableColumnString(LKEY));
addDataColumn(MUKIND, new TableColumnString(KIND));
addDataColumn(MUSTATUS, new TableColumnString(STATUS));
addDataColumn(AREA_NAME, new TableColumnString(AREA_NAME_DATA));
addDataColumn(MUACRES, new TableColumnDouble(MUACRES_DATA));
}
// @Override
// public ArrayList<String> getColumnNames() {
// ArrayList<String> ret_val = new ArrayList<>();
//
// for (String key : columns.keySet()) {
// ret_val.add(key);
// }
//
// return ret_val;
// }
@Override
protected ArrayList<String> getMandatoryColumns() {
return MANDATORY_COLUMNS;
}
/**
*
* @return
*/
public String areaname() {
return ((String) columns.get(AREA_NAME).getValue());
}
/**
*
* @param value
*/
public void areaname(String value) {
columns.get(AREA_NAME).setValue(value);
}
/**
*
* @return
*/
public String areasymbol() {
return ((String) columns.get(AREASYMBOL_NAME).getValue());
}
/**
*
* @param areasymbol
*/
public void areasymbol(String areasymbol) {
columns.get(AREASYMBOL_NAME).setValue(areasymbol);
}
/**
*
* @return
*/
public double muacres() {
return (double) columns.get(MUACRES).getValue();
}
/**
*
* @param muacres
*/
public void muacres(double muacres) {
columns.get(MUACRES).setValue(muacres);
}
/**
*
* @return
*/
public String mukey() {
return (String) columns.get(MUKEY).getValue();
}
/**
*
* @param mukey
*/
public void mukey(String mukey) {
columns.get(MUKEY).setValue(mukey);
}
/**
*
* @return
*/
public String muname() {
return (String) columns.get(MUNAME).getValue();
}
/**
*
* @param muname
*/
public void muname(String muname) {
columns.get(MUNAME).setValue(muname);
}
/**
*
* @param musym
*/
public void musym(String musym) {
columns.get(MUSYM).setValue(musym);
}
/**
*
* @return
*/
public String musym() {
return ((String) columns.get(MUSYM).getValue());
}
}