models.stores
Class DataBase

java.lang.Object
  extended by models.stores.DataBase

public class DataBase
extends java.lang.Object

class for working with databases


Constructor Summary
DataBase()
          Constructor.
DataBase(java.lang.String host, java.lang.String dataBaseName, java.lang.String user, java.lang.String password)
          Constructor
DataBase(java.lang.String host, java.lang.String port, java.lang.String dataBaseName, java.lang.String user, java.lang.String password)
          Constructor
 
Method Summary
 void closeConnection()
          close connection and statement
 java.sql.Connection getConnection()
           
 java.sql.ResultSet getEisData(java.lang.String objectsTable, java.lang.String objectDataField, java.lang.String objectFileNameField, java.lang.String objectPkField, java.lang.String objectId)
          get data of eis file
 java.sql.ResultSet getEisObjectsSet(java.lang.String objectsTable, java.lang.String objectPkField, java.lang.String objectFkField, java.lang.String objectFileNameField, java.lang.String itemId, java.lang.Boolean asUrl, java.lang.String objectDataField)
          get list of eis data for the layer`s object
 java.sql.ResultSet layerData(java.lang.String schema, java.lang.String table, java.util.List<LayerField> fields)
          data of layer
 java.sql.ResultSet metaDataFromTableOfType(java.lang.String table, java.lang.String layerId)
          metadata for current type
 java.sql.ResultSet metaDataLibrary(java.lang.String table, java.lang.String pkField, java.lang.String dataField)
          get metadata library value
 java.sql.ResultSet metaDataValue(java.lang.String table, java.lang.String pkField, java.lang.String dataField, java.lang.String pkValue)
          get layer`s metadata value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataBase

public DataBase()
Constructor. Get default connection


DataBase

public DataBase(java.lang.String host,
                java.lang.String dataBaseName,
                java.lang.String user,
                java.lang.String password)
         throws java.lang.Exception
Constructor

Parameters:
host - host of database
dataBaseName - database name
user - user of database for authorization
password - password for authorization
Throws:
java.lang.Exception - if it can`t connect to postgre store

DataBase

public DataBase(java.lang.String host,
                java.lang.String port,
                java.lang.String dataBaseName,
                java.lang.String user,
                java.lang.String password)
         throws java.lang.Exception
Constructor

Parameters:
host - host of database
port - port
dataBaseName - database name
user - user of database for authorization
password - password for authorization
Throws:
java.lang.Exception - if it can`t connect to postgre store
Method Detail

getConnection

public java.sql.Connection getConnection()
Returns:
connection

closeConnection

public void closeConnection()
close connection and statement


getEisObjectsSet

public java.sql.ResultSet getEisObjectsSet(java.lang.String objectsTable,
                                           java.lang.String objectPkField,
                                           java.lang.String objectFkField,
                                           java.lang.String objectFileNameField,
                                           java.lang.String itemId,
                                           java.lang.Boolean asUrl,
                                           java.lang.String objectDataField)
get list of eis data for the layer`s object

Parameters:
objectsTable - table name
objectPkField - primary key field
objectFkField - field witch is store for primary key of object
objectFileNameField - field witch is store for file name
itemId - id obf object
asUrl - is file an url
objectDataField - field with file data
Returns:
ResultSet of data
See Also:
ResultSet

getEisData

public java.sql.ResultSet getEisData(java.lang.String objectsTable,
                                     java.lang.String objectDataField,
                                     java.lang.String objectFileNameField,
                                     java.lang.String objectPkField,
                                     java.lang.String objectId)
get data of eis file

Parameters:
objectsTable - table name
objectDataField - field with data of file
objectFileNameField - field with file name
objectPkField - field with primary key
objectId - file id
Returns:
ResultSet of data
See Also:
ResultSet

metaDataValue

public java.sql.ResultSet metaDataValue(java.lang.String table,
                                        java.lang.String pkField,
                                        java.lang.String dataField,
                                        java.lang.String pkValue)
get layer`s metadata value

Parameters:
table - table name
pkField - field with primary key
dataField - field with data
pkValue - primary key value
Returns:
ResultSet of data
See Also:
ResultSet

metaDataLibrary

public java.sql.ResultSet metaDataLibrary(java.lang.String table,
                                          java.lang.String pkField,
                                          java.lang.String dataField)
get metadata library value

Parameters:
table - table name
pkField - field with primary key
dataField - field with data
Returns:
ResultSet of data
See Also:
ResultSet

metaDataFromTableOfType

public java.sql.ResultSet metaDataFromTableOfType(java.lang.String table,
                                                  java.lang.String layerId)
metadata for current type

Parameters:
table - table of type name
layerId - layer id
Returns:
ResultSet of data
See Also:
ResultSet

layerData

public java.sql.ResultSet layerData(java.lang.String schema,
                                    java.lang.String table,
                                    java.util.List<LayerField> fields)
data of layer

Parameters:
schema - schema name
table - table name
fields - list of fields
Returns:
ResultSet of data
See Also:
ResultSet, LayerField