Search in sources :

Example 26 with ProgrammingErrorException

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

the class VectorTileBuilder method writeVectorLayers.

@Override
public List<Layer> writeVectorLayers(Envelope envelope, Envelope bounds) {
    try (ResultSet resultSet = this.getResultSet()) {
        List<Layer> layers = new LinkedList<Layer>();
        layers.add(this.writeVectorLayer("context", bounds, resultSet));
        return layers;
    } catch (JSONException | IOException | SQLException e) {
        throw new ProgrammingErrorException(e);
    }
}
Also used : PSQLException(org.postgresql.util.PSQLException) SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet) JSONException(org.json.JSONException) IOException(java.io.IOException) Layer(com.wdtinc.mapbox_vector_tile.VectorTile.Tile.Layer) LinkedList(java.util.LinkedList) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException)

Example 27 with ProgrammingErrorException

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

the class XMLImporter method importXMLDefinitions.

@Transaction
public List<ServerElement> importXMLDefinitions(Organization organization, InputStream istream) {
    TransactionState state = TransactionState.getCurrentTransactionState();
    state.putTransactionObject("transaction-state", this.cache);
    LinkedList<ServerElement> list = new LinkedList<ServerElement>();
    try {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = factory.newDocumentBuilder();
        Document doc = dBuilder.parse(istream);
        list.addAll(this.createTypes(organization, doc));
        list.addAll(this.createHierarchies(organization, doc));
        list.addAll(this.createDirectedAcyclicGraphTypes(doc));
        list.addAll(this.createUndirectedGraphTypes(doc));
    } catch (ParserConfigurationException | IOException | SAXException e) {
        throw new ProgrammingErrorException(e);
    }
    return list;
}
Also used : TransactionState(com.runwaysdk.dataaccess.transaction.TransactionState) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) IOException(java.io.IOException) Document(org.w3c.dom.Document) ServerElement(net.geoprism.registry.model.ServerElement) LinkedList(java.util.LinkedList) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) SAXException(org.xml.sax.SAXException) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 28 with ProgrammingErrorException

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

the class TestGeoObjectInfo method getGeometry.

public Geometry getGeometry() {
    if (this.getWkt() == null) {
        return null;
    }
    try {
        final WKTReader reader = new WKTReader(new GeometryFactory());
        Geometry geometry = reader.read(this.getWkt());
        geometry.setSRID(4326);
        return geometry;
    } catch (ParseException e) {
        throw new ProgrammingErrorException(e);
    }
}
Also used : Geometry(com.vividsolutions.jts.geom.Geometry) GeometryFactory(com.vividsolutions.jts.geom.GeometryFactory) ParseException(com.vividsolutions.jts.io.ParseException) WKTReader(com.vividsolutions.jts.io.WKTReader) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException)

Example 29 with ProgrammingErrorException

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

the class GeoRegistryUtil method parseDate.

public static Date parseDate(String date, boolean throwClientException) {
    if (date != null && date.length() > 0) {
        try {
            SimpleDateFormat format = new SimpleDateFormat(GeoObjectImportConfiguration.DATE_FORMAT);
            format.setTimeZone(SYSTEM_TIMEZONE);
            return format.parse(date);
        } catch (ParseException e) {
            if (throwClientException) {
                throw new RuntimeException("Unable to parse the date [" + date + "]. The date format must be [" + GeoObjectImportConfiguration.DATE_FORMAT + "]");
            } else {
                throw new ProgrammingErrorException(e);
            }
        }
    }
    return null;
}
Also used : ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException)

Example 30 with ProgrammingErrorException

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

the class GeoRegistryUtil method exportMasterListExcel.

@Transaction
public static InputStream exportMasterListExcel(String oid, String filterJson) {
    MasterListVersion version = MasterListVersion.get(oid);
    MdBusinessDAOIF mdBusiness = MdBusinessDAO.get(version.getMdBusinessOid());
    List<? extends MdAttributeConcreteDAOIF> mdAttributes = mdBusiness.definesAttributesOrdered().stream().filter(mdAttribute -> version.isValid(mdAttribute)).collect(Collectors.toList());
    if (filterJson.contains("invalid")) {
        mdAttributes = mdAttributes.stream().filter(mdAttribute -> !mdAttribute.definesAttribute().equals("invalid")).collect(Collectors.toList());
    }
    try {
        MasterListExcelExporter exporter = new MasterListExcelExporter(version, mdBusiness, mdAttributes, filterJson, null);
        return exporter.export();
    } catch (IOException e) {
        throw new ProgrammingErrorException(e);
    }
}
Also used : JsonObject(com.google.gson.JsonObject) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) Date(java.util.Date) Transaction(com.runwaysdk.dataaccess.transaction.Transaction) SimpleDateFormat(java.text.SimpleDateFormat) Authenticate(com.runwaysdk.business.rbac.Authenticate) JsonParser(com.google.gson.JsonParser) ClassificationType(net.geoprism.registry.model.ClassificationType) ServiceFactory(net.geoprism.registry.service.ServiceFactory) TemporalAccessor(java.time.temporal.TemporalAccessor) MdAttributeConcreteDAOIF(com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF) MasterListExcelExporter(net.geoprism.registry.excel.MasterListExcelExporter) ListTypeShapefileExporter(net.geoprism.registry.shapefile.ListTypeShapefileExporter) ParseException(java.text.ParseException) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) MdBusinessDAOIF(com.runwaysdk.dataaccess.MdBusinessDAOIF) TimeZone(java.util.TimeZone) IOException(java.io.IOException) ListTypeExcelExporter(net.geoprism.registry.excel.ListTypeExcelExporter) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) List(java.util.List) ServerHierarchyTypeBuilder(net.geoprism.registry.conversion.ServerHierarchyTypeBuilder) MdBusinessDAO(com.runwaysdk.dataaccess.metadata.MdBusinessDAO) DateTimeFormatter(java.time.format.DateTimeFormatter) GeoObjectImportConfiguration(net.geoprism.registry.io.GeoObjectImportConfiguration) MasterListShapefileExporter(net.geoprism.registry.shapefile.MasterListShapefileExporter) XMLImporter(net.geoprism.registry.xml.XMLImporter) RegistryAdapter(org.commongeoregistry.adapter.RegistryAdapter) InputStream(java.io.InputStream) MdBusinessDAOIF(com.runwaysdk.dataaccess.MdBusinessDAOIF) MasterListExcelExporter(net.geoprism.registry.excel.MasterListExcelExporter) IOException(java.io.IOException) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)67 IOException (java.io.IOException)34 SimpleDateFormat (java.text.SimpleDateFormat)21 JsonObject (com.google.gson.JsonObject)18 File (java.io.File)16 ParseException (java.text.ParseException)16 InputStream (java.io.InputStream)13 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)13 MdAttributeConcreteDAOIF (com.runwaysdk.dataaccess.MdAttributeConcreteDAOIF)12 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)12 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)11 JSONException (org.json.JSONException)11 JsonArray (com.google.gson.JsonArray)10 List (java.util.List)10 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)9 ArrayList (java.util.ArrayList)9 Date (java.util.Date)9 HashMap (java.util.HashMap)8 Collectors (java.util.stream.Collectors)8 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)8