ojb.repository.Repository.vm Maven / Gradle / Ivy
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional information
## regarding copyright ownership. The ASF licenses this file
## to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance
## with the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing,
## software distributed under the License is distributed on an
## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
## KIND, either express or implied. See the License for the
## specific language governing permissions and limitations
## under the License.
#set ( $unknownTorqueTypes = [ 'NULL', 'OTHER', 'JAVA_OBJECT', 'DISTINCT', 'STRUCT', 'ARRAY', 'REF', 'BOOLEANINT', 'BOOLEANCHAR' ] )
#set ( $mappedJdbcTypes = ['INTEGER', 'BLOB', 'BLOB', 'BLOB', 'BLOB', 'BLOB', 'BLOB', 'INTEGER', 'CHAR' ] )
#set ( $fieldsWithNoSize = ['INTEGER', 'BLOB', 'CLOB', 'DATE', 'TIME', 'TIMESTAMP', 'BINARY', 'BIGINT', 'SMALLINT', 'TINYINT' ] )
#if ($database.Package)
#set ($package = $database.Package)
#else
#set ($package = $targetPackage)
#end
#foreach ($table in $database.tables)
#set ( $indices = [ "" ] )
#foreach ($index in $table.getIndices())
#set ( $indexColumnListString = $index.getColumnList() )
#set ( $indexColumnList = $indexColumnListString.split(",") )
#foreach ( $indexedColumn in $indexColumnList )
#set ( $result = $indices.add($indexedColumn) )
#end
#end
#foreach ($col in $table.Columns)
#set ( $mappingPos = $unknownTorqueTypes.indexOf($col.TorqueType) )
#set ( $size = "" )
#set ( $precision = "" )
#set ( $colType = $col.getType() )
#set ( $colTypeClass = $colType.getClass() )
#set ( $colTypeClassName = $colTypeClass.getName() )
## === determine the type of the field. OJB recognizes less types than Torque, thus unkown types must be mapped
#if ($mappingPos != -1)
#set ( $jdbcFieldType = $mappedJdbcTypes.get($mappingPos) )
#if ( $mappedJdbcTypes.get($mappingPos) == "CHAR" )
#set ( $size = "1" )
#else
#set ( $size = "" )
#end
#else ## == no mapping is required
#set ( $jdbcFieldType = $col.TorqueType )
## === split the size field into length and precision
#if ($col.size != "")
#set ( $sizeList = $size.split(",") )
#set ( $foundPart = 0 )
## == unfortunatedly $sizeList.get(0) dows not work so I did this hack
#foreach ( $part in $sizeList)
#if ($foundPart == 0)
#set ( $size = $part )
#set ( $foundPart = 1 )
#elseif ($foundPart == 1)
#set ( $precision = $part )
#set ( $foundPart = 2 )
#end
#end
#end
#end
#end
#end
© 2015 - 2024 Weber Informatics LLC | Privacy Policy