Search in sources :

Example 36 with MdAttributeConcreteDAOIF

use of com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF in project geoprism-registry by terraframe.

the class VectorTileBuilder method getResultSet.

private ResultSet getResultSet() {
    MdBusinessDAOIF mdBusiness = MdBusinessDAO.get(this.version.getMdBusinessOid());
    MdAttributeConcreteDAOIF geomAttribute = mdBusiness.definesAttribute(RegistryConstants.GEOMETRY_ATTRIBUTE_NAME);
    MdAttributeConcreteDAOIF labelAttribute = mdBusiness.definesAttribute(DefaultAttribute.DISPLAY_LABEL.getName() + MasterListVersion.DEFAULT_LOCALE);
    String column = geomAttribute.getColumnName();
    String labelColumn = labelAttribute.getColumnName();
    StringBuilder sql = new StringBuilder();
    sql.append("SELECT ge.oid");
    sql.append(", ge.uid");
    sql.append(", ge.code");
    sql.append(", ge." + labelColumn + " AS default_locale");
    for (Locale locale : locales) {
        MdAttributeConcreteDAOIF localeAttribute = mdBusiness.definesAttribute(DefaultAttribute.DISPLAY_LABEL.getName() + locale.toString());
        if (localeAttribute != null) {
            sql.append(", ge." + localeAttribute.getColumnName() + " AS " + locale.toString());
        }
    }
    sql.append(", ST_Transform(ge." + column + ", 3857) AS " + GeoserverFacade.GEOM_COLUMN + "\n ");
    sql.append("FROM " + mdBusiness.getTableName() + " AS ge\n ");
    sql.append("WHERE ge." + column + " IS NOT NULL\n ");
    sql.append("AND ge.invalid=0");
    return Database.query(sql.toString());
}
Also used : Locale(java.util.Locale) MdBusinessDAOIF(com.runwaysdk.dataaccess.MdBusinessDAOIF) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)

Aggregations

MdAttributeConcreteDAOIF (com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)36 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)18 JsonObject (com.google.gson.JsonObject)16 Date (java.util.Date)12 BusinessQuery (com.runwaysdk.business.BusinessQuery)11 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)11 Point (com.vividsolutions.jts.geom.Point)11 SimpleDateFormat (java.text.SimpleDateFormat)11 JsonArray (com.google.gson.JsonArray)10 MdAttributePointDAOIF (com.runwaysdk.gis.dataaccess.MdAttributePointDAOIF)10 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)9 MdAttributeLineString (com.runwaysdk.system.gis.metadata.MdAttributeLineString)9 MdAttributeMultiLineString (com.runwaysdk.system.gis.metadata.MdAttributeMultiLineString)9 IOException (java.io.IOException)9 ParseException (java.text.ParseException)9 Locale (java.util.Locale)9 Business (com.runwaysdk.business.Business)8 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)8 InputStream (java.io.InputStream)8 List (java.util.List)8