com.atomizesoftware.spin.data.dao

SpinDataModel

case class SpinDataModel(db: scala.slick.jdbc.JdbcBackend.Database, dbIdiom: DatabaseIdiom) extends DataModel with JodaDateTimeSqlTimestampConverter with BigDecimalConverter with Product with Serializable

Mapping of the Spin database to the applications DataModel structure

Linear Supertypes
Serializable, Serializable, Product, Equals, BigDecimalConverter, JodaDateTimeSqlTimestampConverter, DataModel, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. SpinDataModel
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. BigDecimalConverter
  7. JodaDateTimeSqlTimestampConverter
  8. DataModel
  9. AnyRef
  10. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SpinDataModel(db: scala.slick.jdbc.JdbcBackend.Database, dbIdiom: DatabaseIdiom)

Type Members

  1. class DataModelException extends Exception

    Definition Classes
    DataModel

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. object Tables

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. final def childrenTableInfos(tableInfo: TableInfo, include: String, level: Int, previousTableInfos: List[TableInfo]): List[TableInfo]

    Definition Classes
    DataModel
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def columnsNamesWithReferences(tableInfo: TableInfo): List[String]

    Holds a list of all column names, with the proper placeholder alias ("Container_0_1"), quoted according to the database idiom

    Holds a list of all column names, with the proper placeholder alias ("Container_0_1"), quoted according to the database idiom

    returns

    a list of column names with the right references like such "Container"."Number" or "Container01"."Number"

    Definition Classes
    DataModel
  9. def columnsTypes(table: Table[_]): List[Class[_]]

    List with all the data types of all columns

    List with all the data types of all columns

    Definition Classes
    DataModel
  10. def convertValueToDBIdiom(value: Any): String

    Converts a value to string according to the defined database idiom, so it can be used in queries

    Converts a value to string according to the defined database idiom, so it can be used in queries

    value

    any value

    Definition Classes
    DataModel
  11. val db: scala.slick.jdbc.JdbcBackend.Database

    A slick Database instance

    A slick Database instance

    Definition Classes
    SpinDataModelDataModel
  12. val dbIdiom: DatabaseIdiom

    Holds the idiom used for building the SQL statements

    Holds the idiom used for building the SQL statements

    Definition Classes
    SpinDataModelDataModel
  13. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def findColumn(tableInfos: Seq[TableInfo], columnName: String): Option[(TableInfo, Column)]

    Finds a column in a table and based on a name returning the table and column.

    Finds a column in a table and based on a name returning the table and column.

    tableInfos

    to search the column in

    columnName

    name of the column to search for

    returns

    tuple with the table and column found if any, None otherwise

    Definition Classes
    DataModel
  16. def fromSqlType(d: BigDecimal): BigDecimal

    Definition Classes
    BigDecimalConverter
  17. def fromSqlType(t: Timestamp): github.nscala_time.time.Imports.DateTime

  18. def fullTextSearch(tables: Seq[TableInfo], expression: String): (String, List[String])

    Composes the full text search string to be used in a SELECT statement when a quick search is performed

    Composes the full text search string to be used in a SELECT statement when a quick search is performed

    tables

    all tables in the query

    Definition Classes
    DataModel
  19. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  20. def getColumnInTable(table: Table[_], columnName: String): Option[Column]

    Finds the column with the given name.

    Finds the column with the given name. If not found, returns None

    table

    the table where to find the column

    columnName

    the name of the column we want to find

    Definition Classes
    DataModel
  21. def getInfosAndJoinsForStatement(mainTable: Table[_], include: String): StatementBuilderInfo

    Returns the needed table infos and joins for a select statement.

    Returns the needed table infos and joins for a select statement.

    Definition Classes
    DataModel
  22. def getInfosJoinsAndColumnNamesForStatement(mainTable: Table[_], include: String, timeZoneId: Option[String] = None): StatementBuilderInfo

    Returns the needed table infos, joins and column names for a select statement.

    Returns the needed table infos, joins and column names for a select statement.

    returns

    StatementBuilderInfo with the tableInfos, columnNames and join string.

    Definition Classes
    DataModel
  23. def getJoins(allTableInfos: Seq[TableInfo] = Seq()): String

    Composes the join string to be used in a SELECT statement

    Composes the join string to be used in a SELECT statement

    allTableInfos

    all info of all the tables that will be in the select statement.

    returns

    a string representing the join statements for the select.

    Definition Classes
    DataModel
  24. def getOrderByForStatement(tableInfos: Seq[TableInfo], idColumn: String, orderByFilter: String = ""): String

    Returns the order by statement whether a filter was included or not.

    Returns the order by statement whether a filter was included or not.

    returns

    a string for the orderByFilter or a default order by string for the idColumn.

    Definition Classes
    DataModel
  25. def innerJoin(tableInfos: Seq[TableInfo], joinTable: TableInfo): String

    Build an inner join string to be used when composing SELECT statements.

    Build an inner join string to be used when composing SELECT statements.

    Definition Classes
    DataModel
  26. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  27. def leftJoin(tableInfos: Seq[TableInfo], joinTable: TableInfo): String

    Builds a left join string to be used when composing SELECT statements.

    Builds a left join string to be used when composing SELECT statements.

    Definition Classes
    DataModel
  28. def mkPGobject(typeName: String, value: String): PGobject

    Definition Classes
    DataModel
  29. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  30. final def notify(): Unit

    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  32. def orderBy(tables: Seq[TableInfo], filter: String): String

    Returns a string of the Order By segment to use in the SELECT statement

    Returns a string of the Order By segment to use in the SELECT statement

    tables

    where the column to order by might be

    filter

    column and order to use in the statement

    Definition Classes
    DataModel
  33. def page(offset: Int, size: Int): String

    Builds a string to apply paging to the SELECT statement

    Builds a string to apply paging to the SELECT statement

    Definition Classes
    DataModel
  34. def parameterFor[T](value: T, column: Column, pp: PositionedParameters): Option[Unit]

    Transforms a value in a parameter to be used in an insert or update sql statement.

    Transforms a value in a parameter to be used in an insert or update sql statement.

    In order to convert the values into parameters we need to know the underlying type of the value, in order to go around type erasure we pass the column of the value along with the value to be converted, this way when the value is None we can find out which underlying type None pertains to. This needs to be done because SetParameter sets a type for None values that needs to equal the sql column type.

    value

    of the parameter

    column

    to which pertains the parameter

    pp

    positioned parameters

    Definition Classes
    DataModel
  35. def parameterFor[T](value: T, pp: PositionedParameters): Option[Unit]

    Transforms a value in a parameter to be used in a sql statement according to its type.

    Transforms a value in a parameter to be used in a sql statement according to its type.

    value

    of the parameter

    pp

    positioned parameters

    Definition Classes
    DataModel
  36. def parseFilterParams(operator: String, tables: Seq[TableInfo], filter: String): (String, List[Any])

    Transforms a filter string in a partial sql statement string with the parameters to use.

    Transforms a filter string in a partial sql statement string with the parameters to use.

    operator

    used to join the different filtered statements

    tables

    to search in order to get the names present in the filter

    filter

    that contains the filters to apply in the sql statement

    returns

    a partial sql statement and the parameters to apply in it.

    Definition Classes
    DataModel
  37. def parseSearch(tables: Seq[TableInfo], search: String): (String, List[Any])

    Checks if the search string pertains to an advanced search or a quick search and calls upon parseSearchParams or fullTextSearch respectively

    Checks if the search string pertains to an advanced search or a quick search and calls upon parseSearchParams or fullTextSearch respectively

    returns

    a tuple with the partialSql string and a list of params that apply to it.

    Definition Classes
    DataModel
  38. def parseSearchInput(expression: String): String

    Takes the search expression from user input and parses it according to the current dbIdiom

    Takes the search expression from user input and parses it according to the current dbIdiom

    Replace multiple spaces by a single one then replace a space by an AND operator

    expression

    the search expression input by the user

    Definition Classes
    DataModel
  39. def parseSearchParams(operator: String, tables: Seq[TableInfo], search: String): (String, List[Any])

    Transforms a search string in a partial sql statement string with the parameters to use.

    Transforms a search string in a partial sql statement string with the parameters to use.

    This function is only used when performing an advanced search.

    operator

    used to join the different filtered statements

    tables

    to search in order to get the names present in the search string

    search

    string that contains the conditions to apply in the sql statement.

    returns

    a partial sql statement and the parameters to apply in it.

    Definition Classes
    DataModel
  40. final def parseTables(mainTable: Table[_], include: String, motherTableAlias: String = "", path: String = "", level: Int = 0): List[TableInfo]

    Parses a comma separated string of table names into a list of TableInfo instances.

    Parses a comma separated string of table names into a list of TableInfo instances. Table names are case insensitive.

    In order to parse the table names it searches the main table's reference list and tries to match them with the table names in the include string. The results is then a pair containing the table associated with that reference and the name of the reference.

    Example: for include as "containertype,containerstatus" when mainTable is Container returns List(TableInfo(Table[ContainerType],"ContainerType","Container","_0_1","ContainerType"), TableInfo(Table[ContainerStatus],"ContainerStatus","Container","_0_0","ContainerStatus"))

    Example: for include as "container,container.containerstatus" when mainTable is Movement returns List(TableInfo(Table[Container],"Container","Movement","_0_3","Container"), TableInfo(Table[ContainerStatus],"ContainerStatus","Container_0_3","_13_0","Container.ContainerStatus"))

    Definition Classes
    DataModel
  41. def pathToReference(table: Table[_])(implicit alias: String): String

    Returns the correct alias to be used when reading the query results.

    Returns the correct alias to be used when reading the query results.

    returns

    a string representing the correct alias to read in query results.

    Definition Classes
    DataModel
  42. def pathToReferenceWithCode(code: String)(implicit alias: String): String

    Returns the correct alias to be used when reading the query results.

    Returns the correct alias to be used when reading the query results.

    returns

    a string representig the correct alias to read in query results.

    Definition Classes
    DataModel
  43. def qualifiedColumnsNames(table: Table[_]): List[String]

    Holds a list of all column names, properly quoted for the current dbIdiom value

    Holds a list of all column names, properly quoted for the current dbIdiom value

    Definition Classes
    DataModel
  44. def qualifiedColumnsNamesWithAlias(tableInfo: TableInfo, tables: Option[Seq[TableInfo]] = None, timeZoneId: Option[String] = None): List[String]

    Holds a list of all column names, quoted and with the SQL alias declaration appended

    Holds a list of all column names, quoted and with the SQL alias declaration appended

    These aliases are used in SELECTS and have the goal to prevent duplicated column names where there are inner joins. Example: for a column named Id in the Container table, the corresponding value in this list is "Container"."Id" AS Container0Id given that 0 is the position of the column.

    Example: for a column named Id in a reference named CurrentContainer, the corresponding values in this list is "CurrentContainer"."Id" AS CurrentContainer10Id.

    Definition Classes
    DataModel
  45. def qualifiedPkName(table: Table[_]): String

    Holds Table.pk properly quoted for the database idiom and ready to be used in queries

    Holds Table.pk properly quoted for the database idiom and ready to be used in queries

    Definition Classes
    DataModel
  46. def qualifiedTableName(table: Table[_]): String

    Holds the quoted table name.

    Holds the quoted table name.

    Example: considering a table named Container, this value is "Container" if idiom is PostgreSQL or [Container] if SQLServer

    Definition Classes
    DataModel
  47. def quote(string: String): String

    Quotes a string according to the defined dbIdiom

    Quotes a string according to the defined dbIdiom

    Example: if string is Spin, this returns [Spin] if dbIdiom is SQLServer and "Spin" if PostgreSQL

    string

    the string to be quoted

    Definition Classes
    DataModel
  48. def removeSpecialColumnsAndValues(table: Table[_], values: Seq[Any]): ColumnValues

    Removes special columns and values like Primary Key and SyncTimestamp from a table a list of values, returns ColumnValues with a list of columns and values.

    Removes special columns and values like Primary Key and SyncTimestamp from a table a list of values, returns ColumnValues with a list of columns and values.

    table

    the table where to remove the columns.

    values

    the list of values related to the given table.

    Definition Classes
    DataModel
  49. final def retryOnSQLError[T](error: SQLError, times: Int = 1)(fn: ⇒ T): T

    Executes the thunk (fn) and retries if occurs a SQL error of the type defined in the error parameter

    Executes the thunk (fn) and retries if occurs a SQL error of the type defined in the error parameter

    error

    the error type that causes the retrie

    times

    the number of retries (not the number of runs). Deafault is one retry

    fn

    the function to run and retry, if necessary

    Definition Classes
    DataModel
    Annotations
    @tailrec()
  50. def seqParam[A](implicit pconv: SetParameter[A]): SetParameter[Seq[A]]

    Definition Classes
    DataModel
  51. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  52. def tableFor(tableName: String): Option[Table[_]]

    Retrieves the Table instance with the given name.

    Retrieves the Table instance with the given name. If not found, returns None. The name is case insensitive.

    Definition Classes
    DataModel
  53. def tableFor[T](implicit arg0: ClassTag[T], tag: ClassTag[T]): Table[T]

    Retrieves the Table for the type T

    Retrieves the Table for the type T

    Definition Classes
    DataModel
  54. val tables: List[Table[_]]

    List of all Tables in the database

    List of all Tables in the database

    Definition Classes
    SpinDataModelDataModel
  55. def toNativeValue(table: Table[_], columnName: String, value: String): Option[Any]

    Takes a value in string format and tries to convert it to a quoted string according to the database idiom and column data type

    Takes a value in string format and tries to convert it to a quoted string according to the database idiom and column data type

    Definition Classes
    DataModel
  56. def toSqlType(t: github.nscala_time.time.Imports.DateTime): Timestamp

  57. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from BigDecimalConverter

Inherited from DataModel

Inherited from AnyRef

Inherited from Any

Ungrouped