cz.hdf.cdnavigator.db
Class DataManagement

java.lang.Object
  extended by cz.hdf.db.model.DBModel
      extended by cz.hdf.cdnavigator.db.DBModel_0_5
          extended by cz.hdf.cdnavigator.db.DBModel_0_6
              extended by cz.hdf.cdnavigator.db.DataManagement

public class DataManagement
extends DBModel_0_6

DOCUMENT ME!

Author:
hunter

Field Summary
static java.lang.String APP_CD
          Application name for table CD
static java.lang.String APP_CD_COLUMN_BOX
          Application column name
static java.lang.String APP_CD_COLUMN_COVER
          Application column name
static java.lang.String APP_CD_COLUMN_HASHCODE
          Application column name
static java.lang.String APP_CD_COLUMN_INFO
          Application column name
static java.lang.String APP_CD_COLUMN_NUMBER
          Application column name
static java.lang.String APP_CD_COLUMN_TYPE
          Application column name
static java.lang.String APP_CD_COLUMN_VOLUME
          Application column name
static int APP_COLUMN_TYPE_BOOLEAN
          Application column type
static int APP_COLUMN_TYPE_BOXES
          Application column type
static int APP_COLUMN_TYPE_CD_TYPE
          Application column type
static int APP_COLUMN_TYPE_DATE
          Application column type
static int APP_COLUMN_TYPE_GENRE
          Application column type
static int APP_COLUMN_TYPE_NUMBER
          Application column type
static int APP_COLUMN_TYPE_RATE
          Application column type
static int APP_COLUMN_TYPE_TEXT
          Application column type
static java.lang.String APP_MUSIC
          Application name for tables music_album, interpret, song, album_interpret
static java.lang.String APP_MUSIC_COLUMN_ALBUM_GENRE
          Application column name
static java.lang.String APP_MUSIC_COLUMN_ALBUM_NAME
          Application column name
static java.lang.String APP_MUSIC_COLUMN_ALBUM_RATING
          Application column name
static java.lang.String APP_MUSIC_COLUMN_ALBUM_YEAR
          Application column name
static java.lang.String APP_MUSIC_COLUMN_INTERPRET_NAME
          Application column name
static java.lang.String APP_MUSIC_COLUMN_SONG_FILE
          Application column name
static java.lang.String APP_MUSIC_COLUMN_SONG_GENRE
          Application column name
static java.lang.String APP_MUSIC_COLUMN_SONG_NAME
          Application column name
static java.lang.String APP_MUSIC_COLUMN_SONG_NUMBER
          Application column name
static java.lang.String APP_MUSIC_COLUMN_SONG_RATING
          Application column name
static java.lang.String APP_PHOTO
          Application name for tables photos, ...
static java.lang.String APP_PHOTO_COLUMN_ALBUM_INFO
          Application column name
static java.lang.String APP_PHOTO_COLUMN_ALBUM_NAME
          Application column name
static java.lang.String APP_PHOTO_COLUMN_ALBUM_RATING
          Application column name
static java.lang.String APP_PHOTO_COLUMN_APPERTURE
          Application column name
static java.lang.String APP_PHOTO_COLUMN_CAMERA
          Application column name
static java.lang.String APP_PHOTO_COLUMN_COLOR
          Application column name
static java.lang.String APP_PHOTO_COLUMN_DATE
          Application column name
static java.lang.String APP_PHOTO_COLUMN_EXPOSURE
          Application column name
static java.lang.String APP_PHOTO_COLUMN_EXPOSURE_BIAS
          Application column name
static java.lang.String APP_PHOTO_COLUMN_FILE
          Application column name
static java.lang.String APP_PHOTO_COLUMN_FLASH
          Application column name
static java.lang.String APP_PHOTO_COLUMN_FOCAL_LENGTH
          Application column name
static java.lang.String APP_PHOTO_COLUMN_HEIGHT
          Application column name
static java.lang.String APP_PHOTO_COLUMN_INFO
          Application column name
static java.lang.String APP_PHOTO_COLUMN_ISO_SENSITIVITY
          Application column name
static java.lang.String APP_PHOTO_COLUMN_METERING_MODE
          Application column name
static java.lang.String APP_PHOTO_COLUMN_NUMBER
          Application column name
static java.lang.String APP_PHOTO_COLUMN_RATING
          Application column name
static java.lang.String APP_PHOTO_COLUMN_SHUTTER_SPEED
          Application column name
static java.lang.String APP_PHOTO_COLUMN_SUBJECT_DISTANCE
          Application column name
static java.lang.String APP_PHOTO_COLUMN_THUMB
          Application column name
static java.lang.String APP_PHOTO_COLUMN_WHITE_BALANCE
          Application column name
static java.lang.String APP_PHOTO_COLUMN_WIDTH
          Application column name
static java.lang.String DATABASE_MODEL_FILE
          Database model file name in config dir
static java.lang.String DATABASE_MODEL_VERSION
          Description ID name for model version
private  cz.hdf.db.DBManager dbManager
          Database manager with real connection
static java.lang.String DISC_TYPE_CD_AUDIO
          type audio CD for device DiskDrive
static int DISC_TYPE_CD_AUDIO_INT
          type audio CD for device DiskDrive
static java.lang.String DISC_TYPE_CD_DATA
          type data CD for device DiskDrive
static int DISC_TYPE_CD_DATA_INT
          type data CD for device DiskDrive
static java.lang.String DISC_TYPE_DVD_DATA
          type data DVD for device DiskDrive
static int DISC_TYPE_DVD_DATA_INT
          type data DVD for device DiskDrive
static java.lang.String DISC_TYPE_DVD_MOVIE
          type DVD for device DiskDrive
static int DISC_TYPE_DVD_MOVIE_INT
          type DVD for device DiskDrive
private  FullTextParse ftParse
          ?
private static DataManagement instance
          Singleton instance.
private  java.util.logging.Logger logger
          Logger.
private  java.sql.PreparedStatement pstmtExistInterpret
           
private  java.sql.PreparedStatement pstmtExistMusicAlbum
           
private  java.sql.PreparedStatement pstmtExistPhotoAlbum
           
private  java.sql.PreparedStatement pstmtInsertAlbumInterpret
           
private  java.sql.PreparedStatement pstmtInsertCD
           
private  java.sql.PreparedStatement pstmtInsertInterpret
           
private  java.sql.PreparedStatement pstmtInsertMusicAlbum
           
private  java.sql.PreparedStatement pstmtInsertPhoto
           
private  java.sql.PreparedStatement pstmtInsertPhotoAlbum
           
private  java.sql.PreparedStatement pstmtInsertSong
           
private  java.sql.PreparedStatement pstmtQueryAllCDs
           
private  java.sql.PreparedStatement pstmtQueryAllInterprets
           
private  java.sql.PreparedStatement pstmtQueryAllMusicAlbums
           
private  java.sql.PreparedStatement pstmtQueryAllPhotoAlbums
           
private  java.sql.PreparedStatement pstmtQueryCDBoxes
           
private  java.sql.PreparedStatement pstmtSelectMaxCDID
           
private  java.sql.PreparedStatement pstmtSelectMaxInterpretID
           
private  java.sql.PreparedStatement pstmtSelectMaxMusicAlbumID
           
private  java.sql.PreparedStatement pstmtSelectMaxPhotoAlbumID
           
private  java.sql.PreparedStatement pstmtSelectMaxPhotoID
           
private  java.sql.PreparedStatement pstmtSelectMaxSongID
           
private  java.sql.PreparedStatement pstmtSelectPhotoThumb
           
private  java.sql.PreparedStatement pstmtUpdateCD
           
private  java.sql.PreparedStatement pstmtUpdateInfo
           
private  java.sql.PreparedStatement pstmtUpdateInterpret
           
private  java.sql.PreparedStatement pstmtUpdateMusicAlbum
           
private  java.sql.PreparedStatement pstmtUpdatePhoto
           
private  java.sql.PreparedStatement pstmtUpdatePhotoAlbum
           
private  java.sql.PreparedStatement pstmtUpdateRating
           
private  java.sql.PreparedStatement pstmtUpdateSong
           
static java.lang.String SELECT_CD_PREFIX
          this is prefix of SQL select command on CD table
static java.lang.String SELECT_INTERPRET_PREFIX
          this is prefix of SQL select command on interpret table
static java.lang.String SELECT_MUSIC_ALBUM_PREFIX
          this is prefix of SQL select command on music album table
static java.lang.String SELECT_PHOTO_ALBUM_PREFIX
          this is prefix of SQL select command on photo album table
static java.lang.String SELECT_PHOTO_PREFIX
          this is prefix of SQL select command on photo table
static java.lang.String SELECT_SONG_PREFIX
          this is prefix of SQL select command on song table
 
Fields inherited from class cz.hdf.cdnavigator.db.DBModel_0_6
DATABASE_MODEL_VERSION_0_6
 
Fields inherited from class cz.hdf.cdnavigator.db.DBModel_0_5
DATABASE_MODEL_VERSION_0_5, TABLE_ALBUMINTERPRET, TABLE_ALBUMINTERPRET_COLUMN_INTERPRETID, TABLE_ALBUMINTERPRET_COLUMN_MUSICALBUMID, TABLE_CD, TABLE_CD_COLUMN_BOX, TABLE_CD_COLUMN_COVER, TABLE_CD_COLUMN_HASHCODE, TABLE_CD_COLUMN_ID, TABLE_CD_COLUMN_INFO, TABLE_CD_COLUMN_NUMBER, TABLE_CD_COLUMN_TYPE, TABLE_CD_COLUMN_VOLUME, TABLE_DESCRIPTION, TABLE_DESCRIPTION_COLUMN_ID, TABLE_DESCRIPTION_COLUMN_VALUE, TABLE_INTERPRET, TABLE_INTERPRET_COLUMN_ID, TABLE_INTERPRET_COLUMN_NAME, TABLE_MUSICALBUM, TABLE_MUSICALBUM_COLUMN_CDID, TABLE_MUSICALBUM_COLUMN_COVER, TABLE_MUSICALBUM_COLUMN_GENRE, TABLE_MUSICALBUM_COLUMN_ID, TABLE_MUSICALBUM_COLUMN_NAME, TABLE_MUSICALBUM_COLUMN_RATING, TABLE_MUSICALBUM_COLUMN_YEAR, TABLE_PHOTO, TABLE_PHOTO_COLUMN_ALBUMID, TABLE_PHOTO_COLUMN_APPERTURE, TABLE_PHOTO_COLUMN_CAMERA, TABLE_PHOTO_COLUMN_COLOR, TABLE_PHOTO_COLUMN_DATE, TABLE_PHOTO_COLUMN_DATETIME, TABLE_PHOTO_COLUMN_EXPOSURE, TABLE_PHOTO_COLUMN_EXPOSURE_BIAS, TABLE_PHOTO_COLUMN_FILE, TABLE_PHOTO_COLUMN_FLASH, TABLE_PHOTO_COLUMN_FOCAL_LENGTH, TABLE_PHOTO_COLUMN_HEIGHT, TABLE_PHOTO_COLUMN_ID, TABLE_PHOTO_COLUMN_INFO, TABLE_PHOTO_COLUMN_ISO_SENSITIVITY, TABLE_PHOTO_COLUMN_METERING_MODE, TABLE_PHOTO_COLUMN_NUMBER, TABLE_PHOTO_COLUMN_RATING, TABLE_PHOTO_COLUMN_SHUTTER_SPEED, TABLE_PHOTO_COLUMN_SUBJECT_DISTANCE, TABLE_PHOTO_COLUMN_THUMB, TABLE_PHOTO_COLUMN_TIME, TABLE_PHOTO_COLUMN_WHITE_BALANCE, TABLE_PHOTO_COLUMN_WIDTH, TABLE_PHOTOALBUM, TABLE_PHOTOALBUM_COLUMN_CDID, TABLE_PHOTOALBUM_COLUMN_ID, TABLE_PHOTOALBUM_COLUMN_INFO, TABLE_PHOTOALBUM_COLUMN_NAME, TABLE_PHOTOALBUM_COLUMN_RATING, TABLE_SONG, TABLE_SONG_COLUMN_FILE, TABLE_SONG_COLUMN_GENRE, TABLE_SONG_COLUMN_ID, TABLE_SONG_COLUMN_MUSICALBUMID, TABLE_SONG_COLUMN_NAME, TABLE_SONG_COLUMN_NUMBER, TABLE_SONG_COLUMN_RATING
 
Constructor Summary
DataManagement()
          Initialize database connection.
 
Method Summary
static java.lang.String[] appColumnNames(java.lang.String _appTableName)
          Get readable application column names according to application table name (like movie -> movie, genre, director, ...)
static java.lang.String appNames2dbColumnName(java.lang.String _appTableName, java.lang.String _appColumnName)
          Convert readable application table and column names to DB table name.
static java.lang.String appNames2dbTableName(java.lang.String _appTableName, java.lang.String _appColumnName)
          Convert readable application table and column names to DB table name.
static void close()
          Release DB statements and connections.
private  java.lang.String[] convertGenres(java.lang.String _genres)
          DOCUMENT ME!
private  java.lang.String convertGenres(java.lang.String[] _genres)
          DOCUMENT ME!
static java.lang.String dbNames2appColumnName(java.lang.String _dbTableName, java.lang.String _dbColumnName)
          Convert DB table name and column name to readable column name for application.
static java.lang.String dbTableName2appName(java.lang.String _dbTableName)
          Convert DB table name to readable name for application.
static int executeDeleteCD(int _cdid)
          Delete one cd and all his photos, music, movies records from DB.
static int executeDeleteInterpret(int _iid)
          Delete one interpret record from DB and all interpret records from music albums.
static int executeDeleteMusicAlbum(int _maid)
          Delete one music album and all his songs from DB.
static int executeDeletePhoto(int _pid)
          Delete one photo from DB.
static int executeDeletePhotoAlbum(int _paid)
          Delete one photo album and all his photos from DB.
static int executeDeleteSong(int _sid)
          Delete one song from DB.
static int executeInsertCD(CDData _cdData)
          Execute SQL insert for CD table.
static int executeInsertInterpret(java.lang.String _interpretName)
          Execute SQL insert for Interpret table.
static void executeInsertModelVersion()
          Insert model version into DB.
static int executeInsertMusicAlbum(MusicAlbumData _aData)
          Execute SQL insert for MusicAlbum table.
static int executeInsertPhoto(PhotoData _pData)
          Execute SQL insert for PhotoAlbum table.
static int executeInsertPhotoAlbum(PhotoAlbumData _paData)
          Execute SQL insert for PhotoAlbum table.
static int executeInsertSong(SongData _sData)
          Execute SQL insert for Song table.
static java.lang.String[] executeQueryAllCDs()
           
static java.lang.String[] executeQueryAllInterprets()
           
static java.lang.String[] executeQueryAllMusicAlbums()
           
static java.lang.String[] executeQueryAllPhotoAlbums()
           
static CDData[] executeQueryCD(java.lang.String _sql)
          Execute SQL query for CD table.
static java.lang.String[] executeQueryCDBoxes()
           
static CDData[] executeQueryFullTextCD(java.lang.String _fulltext)
          Execute SQL query for CD table.
static PhotoData[] executeQueryFullTextPhoto(java.lang.String _fulltext)
          Execute SQL query for Photo table.
static SongData[] executeQueryFullTextSong(java.lang.String _fulltext)
          Execute SQL query for Song table.
static java.lang.String executeQueryModelVersion()
          Select from DB model version.
static MusicAlbumData[] executeQueryMusicAlbum(java.lang.String _sql)
          Execute SQL query for MusicAlbum table and Interpret table.
static PhotoData[] executeQueryPhoto(java.lang.String _sql)
          Execute SQL query for Photo table.
static PhotoAlbumData[] executeQueryPhotoAlbum(java.lang.String _sql)
          Execute SQL query for PhotoAlbum table.
static java.awt.Image executeQueryPhotoThumb(int _photoID)
           
static SongData[] executeQuerySong(java.lang.String _sql)
          Execute SQL query for Song table.
static int executeUpdateCD(CDData _cdData)
          Execute SQL update for CD table.
static int executeUpdateInterpret(int _interpretID, java.lang.String _interpretName)
          Execute SQL update for interpret table.
static int executeUpdateMusicAlbum(MusicAlbumData _maData)
          Execute SQL update for music album table.
static int executeUpdatePhoto(PhotoData _pd)
          Execute SQL update for photo table.
static int executeUpdatePhotoAlbum(PhotoAlbumData _pad)
          Execute SQL update for photo album table.
static int executeUpdatePhotoInfo(int _photoID, java.lang.String _newInfo)
          Execute SQL update for photo table.
static int executeUpdatePhotoRating(int _photoID, int _newRating)
          Execute SQL update for photo table.
static int executeUpdateSong(SongData _songData)
          Execute SQL update for song table.
static int existInterpret(java.lang.String _interpretName)
          Try to find interpret name in DB.
static int existMusicAlbum(java.lang.String _albumName)
          Try to find music album name in DB.
static int existPhotoAlbum(java.lang.String _albumName)
          Try to find photo album name in DB.
static int getAppColumnType(java.lang.String _appTableName, java.lang.String _appColumnName)
          Get app type (APP_COLUMN_TYPE_) for specified app column.
static cz.hdf.db.DBManager getDBManager()
          Get DB manager
static DataManagement getInstance()
          Get singleton instance.
static void initialize()
          Initialize database model and connection to real database.
static void initPreparedStatements()
          Initialize prepared statements.
static boolean isSupportedSQLUnion()
          Is supported SQL union command in DB?
static void upgradeDB(java.lang.String _modelVersion)
          Upgrade/proceed changes from new DB model to DB.
static void upgradeDBFrom03To04()
          Upgrade/proceed changes from new DB model to DB.
static void upgradeDBFrom04To05()
          Upgrade/proceed changes from new DB model to DB.
static void upgradeDBFrom05To06()
          Upgrade/proceed changes from new DB model to DB.
static void upgradeDBFromNullTo03()
          Upgrade/proceed changes from new DB model to DB.
 
Methods inherited from class cz.hdf.cdnavigator.db.DBModel_0_6
getModel, getVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static final DataManagement instance
Singleton instance.


DATABASE_MODEL_FILE

public static final java.lang.String DATABASE_MODEL_FILE
Database model file name in config dir

See Also:
Constant Field Values

DATABASE_MODEL_VERSION

public static final java.lang.String DATABASE_MODEL_VERSION
Description ID name for model version

See Also:
Constant Field Values

DISC_TYPE_CD_DATA

public static final java.lang.String DISC_TYPE_CD_DATA
type data CD for device DiskDrive

See Also:
Constant Field Values

DISC_TYPE_CD_DATA_INT

public static final int DISC_TYPE_CD_DATA_INT
type data CD for device DiskDrive

See Also:
Constant Field Values

DISC_TYPE_CD_AUDIO

public static final java.lang.String DISC_TYPE_CD_AUDIO
type audio CD for device DiskDrive

See Also:
Constant Field Values

DISC_TYPE_CD_AUDIO_INT

public static final int DISC_TYPE_CD_AUDIO_INT
type audio CD for device DiskDrive

See Also:
Constant Field Values

DISC_TYPE_DVD_MOVIE

public static final java.lang.String DISC_TYPE_DVD_MOVIE
type DVD for device DiskDrive

See Also:
Constant Field Values

DISC_TYPE_DVD_MOVIE_INT

public static final int DISC_TYPE_DVD_MOVIE_INT
type DVD for device DiskDrive

See Also:
Constant Field Values

DISC_TYPE_DVD_DATA

public static final java.lang.String DISC_TYPE_DVD_DATA
type data DVD for device DiskDrive

See Also:
Constant Field Values

DISC_TYPE_DVD_DATA_INT

public static final int DISC_TYPE_DVD_DATA_INT
type data DVD for device DiskDrive

See Also:
Constant Field Values

APP_CD

public static final java.lang.String APP_CD
Application name for table CD

See Also:
Constant Field Values

APP_MUSIC

public static final java.lang.String APP_MUSIC
Application name for tables music_album, interpret, song, album_interpret

See Also:
Constant Field Values

APP_PHOTO

public static final java.lang.String APP_PHOTO
Application name for tables photos, ...

See Also:
Constant Field Values

APP_CD_COLUMN_NUMBER

public static final java.lang.String APP_CD_COLUMN_NUMBER
Application column name

See Also:
Constant Field Values

APP_CD_COLUMN_TYPE

public static final java.lang.String APP_CD_COLUMN_TYPE
Application column name

See Also:
Constant Field Values

APP_CD_COLUMN_HASHCODE

public static final java.lang.String APP_CD_COLUMN_HASHCODE
Application column name

See Also:
Constant Field Values

APP_CD_COLUMN_BOX

public static final java.lang.String APP_CD_COLUMN_BOX
Application column name

See Also:
Constant Field Values

APP_CD_COLUMN_VOLUME

public static final java.lang.String APP_CD_COLUMN_VOLUME
Application column name

See Also:
Constant Field Values

APP_CD_COLUMN_INFO

public static final java.lang.String APP_CD_COLUMN_INFO
Application column name

See Also:
Constant Field Values

APP_CD_COLUMN_COVER

public static final java.lang.String APP_CD_COLUMN_COVER
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_ALBUM_NAME

public static final java.lang.String APP_MUSIC_COLUMN_ALBUM_NAME
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_ALBUM_YEAR

public static final java.lang.String APP_MUSIC_COLUMN_ALBUM_YEAR
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_ALBUM_GENRE

public static final java.lang.String APP_MUSIC_COLUMN_ALBUM_GENRE
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_ALBUM_RATING

public static final java.lang.String APP_MUSIC_COLUMN_ALBUM_RATING
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_INTERPRET_NAME

public static final java.lang.String APP_MUSIC_COLUMN_INTERPRET_NAME
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_SONG_NUMBER

public static final java.lang.String APP_MUSIC_COLUMN_SONG_NUMBER
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_SONG_NAME

public static final java.lang.String APP_MUSIC_COLUMN_SONG_NAME
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_SONG_FILE

public static final java.lang.String APP_MUSIC_COLUMN_SONG_FILE
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_SONG_RATING

public static final java.lang.String APP_MUSIC_COLUMN_SONG_RATING
Application column name

See Also:
Constant Field Values

APP_MUSIC_COLUMN_SONG_GENRE

public static final java.lang.String APP_MUSIC_COLUMN_SONG_GENRE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_ALBUM_NAME

public static final java.lang.String APP_PHOTO_COLUMN_ALBUM_NAME
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_ALBUM_INFO

public static final java.lang.String APP_PHOTO_COLUMN_ALBUM_INFO
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_ALBUM_RATING

public static final java.lang.String APP_PHOTO_COLUMN_ALBUM_RATING
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_NUMBER

public static final java.lang.String APP_PHOTO_COLUMN_NUMBER
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_FILE

public static final java.lang.String APP_PHOTO_COLUMN_FILE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_INFO

public static final java.lang.String APP_PHOTO_COLUMN_INFO
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_RATING

public static final java.lang.String APP_PHOTO_COLUMN_RATING
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_DATE

public static final java.lang.String APP_PHOTO_COLUMN_DATE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_COLOR

public static final java.lang.String APP_PHOTO_COLUMN_COLOR
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_THUMB

public static final java.lang.String APP_PHOTO_COLUMN_THUMB
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_WIDTH

public static final java.lang.String APP_PHOTO_COLUMN_WIDTH
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_HEIGHT

public static final java.lang.String APP_PHOTO_COLUMN_HEIGHT
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_SHUTTER_SPEED

public static final java.lang.String APP_PHOTO_COLUMN_SHUTTER_SPEED
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_APPERTURE

public static final java.lang.String APP_PHOTO_COLUMN_APPERTURE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_EXPOSURE

public static final java.lang.String APP_PHOTO_COLUMN_EXPOSURE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_EXPOSURE_BIAS

public static final java.lang.String APP_PHOTO_COLUMN_EXPOSURE_BIAS
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_ISO_SENSITIVITY

public static final java.lang.String APP_PHOTO_COLUMN_ISO_SENSITIVITY
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_FOCAL_LENGTH

public static final java.lang.String APP_PHOTO_COLUMN_FOCAL_LENGTH
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_SUBJECT_DISTANCE

public static final java.lang.String APP_PHOTO_COLUMN_SUBJECT_DISTANCE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_METERING_MODE

public static final java.lang.String APP_PHOTO_COLUMN_METERING_MODE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_FLASH

public static final java.lang.String APP_PHOTO_COLUMN_FLASH
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_WHITE_BALANCE

public static final java.lang.String APP_PHOTO_COLUMN_WHITE_BALANCE
Application column name

See Also:
Constant Field Values

APP_PHOTO_COLUMN_CAMERA

public static final java.lang.String APP_PHOTO_COLUMN_CAMERA
Application column name

See Also:
Constant Field Values

SELECT_CD_PREFIX

public static final java.lang.String SELECT_CD_PREFIX
this is prefix of SQL select command on CD table

See Also:
Constant Field Values

SELECT_PHOTO_ALBUM_PREFIX

public static final java.lang.String SELECT_PHOTO_ALBUM_PREFIX
this is prefix of SQL select command on photo album table

See Also:
Constant Field Values

SELECT_PHOTO_PREFIX

public static final java.lang.String SELECT_PHOTO_PREFIX
this is prefix of SQL select command on photo table

See Also:
Constant Field Values

SELECT_MUSIC_ALBUM_PREFIX

public static final java.lang.String SELECT_MUSIC_ALBUM_PREFIX
this is prefix of SQL select command on music album table

See Also:
Constant Field Values

SELECT_SONG_PREFIX

public static final java.lang.String SELECT_SONG_PREFIX
this is prefix of SQL select command on song table

See Also:
Constant Field Values

SELECT_INTERPRET_PREFIX

public static final java.lang.String SELECT_INTERPRET_PREFIX
this is prefix of SQL select command on interpret table

See Also:
Constant Field Values

APP_COLUMN_TYPE_TEXT

public static final int APP_COLUMN_TYPE_TEXT
Application column type

See Also:
Constant Field Values

APP_COLUMN_TYPE_NUMBER

public static final int APP_COLUMN_TYPE_NUMBER
Application column type

See Also:
Constant Field Values

APP_COLUMN_TYPE_BOOLEAN

public static final int APP_COLUMN_TYPE_BOOLEAN
Application column type

See Also:
Constant Field Values

APP_COLUMN_TYPE_DATE

public static final int APP_COLUMN_TYPE_DATE
Application column type

See Also:
Constant Field Values

APP_COLUMN_TYPE_RATE

public static final int APP_COLUMN_TYPE_RATE
Application column type

See Also:
Constant Field Values

APP_COLUMN_TYPE_GENRE

public static final int APP_COLUMN_TYPE_GENRE
Application column type

See Also:
Constant Field Values

APP_COLUMN_TYPE_BOXES

public static final int APP_COLUMN_TYPE_BOXES
Application column type

See Also:
Constant Field Values

APP_COLUMN_TYPE_CD_TYPE

public static final int APP_COLUMN_TYPE_CD_TYPE
Application column type

See Also:
Constant Field Values

pstmtInsertCD

private java.sql.PreparedStatement pstmtInsertCD

pstmtInsertPhoto

private java.sql.PreparedStatement pstmtInsertPhoto

pstmtInsertPhotoAlbum

private java.sql.PreparedStatement pstmtInsertPhotoAlbum

pstmtInsertMusicAlbum

private java.sql.PreparedStatement pstmtInsertMusicAlbum

pstmtInsertAlbumInterpret

private java.sql.PreparedStatement pstmtInsertAlbumInterpret

pstmtInsertSong

private java.sql.PreparedStatement pstmtInsertSong

pstmtInsertInterpret

private java.sql.PreparedStatement pstmtInsertInterpret

pstmtUpdateCD

private java.sql.PreparedStatement pstmtUpdateCD

pstmtUpdatePhotoAlbum

private java.sql.PreparedStatement pstmtUpdatePhotoAlbum

pstmtUpdatePhoto

private java.sql.PreparedStatement pstmtUpdatePhoto

pstmtUpdateRating

private java.sql.PreparedStatement pstmtUpdateRating

pstmtUpdateInfo

private java.sql.PreparedStatement pstmtUpdateInfo

pstmtUpdateMusicAlbum

private java.sql.PreparedStatement pstmtUpdateMusicAlbum

pstmtUpdateSong

private java.sql.PreparedStatement pstmtUpdateSong

pstmtUpdateInterpret

private java.sql.PreparedStatement pstmtUpdateInterpret

pstmtSelectMaxCDID

private java.sql.PreparedStatement pstmtSelectMaxCDID

pstmtSelectMaxPhotoID

private java.sql.PreparedStatement pstmtSelectMaxPhotoID

pstmtSelectMaxPhotoAlbumID

private java.sql.PreparedStatement pstmtSelectMaxPhotoAlbumID

pstmtSelectMaxMusicAlbumID

private java.sql.PreparedStatement pstmtSelectMaxMusicAlbumID

pstmtSelectMaxSongID

private java.sql.PreparedStatement pstmtSelectMaxSongID

pstmtSelectMaxInterpretID

private java.sql.PreparedStatement pstmtSelectMaxInterpretID

pstmtQueryCDBoxes

private java.sql.PreparedStatement pstmtQueryCDBoxes

pstmtQueryAllCDs

private java.sql.PreparedStatement pstmtQueryAllCDs

pstmtQueryAllPhotoAlbums

private java.sql.PreparedStatement pstmtQueryAllPhotoAlbums

pstmtQueryAllMusicAlbums

private java.sql.PreparedStatement pstmtQueryAllMusicAlbums

pstmtQueryAllInterprets

private java.sql.PreparedStatement pstmtQueryAllInterprets

pstmtExistPhotoAlbum

private java.sql.PreparedStatement pstmtExistPhotoAlbum

pstmtExistMusicAlbum

private java.sql.PreparedStatement pstmtExistMusicAlbum

pstmtExistInterpret

private java.sql.PreparedStatement pstmtExistInterpret

pstmtSelectPhotoThumb

private java.sql.PreparedStatement pstmtSelectPhotoThumb

dbManager

private cz.hdf.db.DBManager dbManager
Database manager with real connection


ftParse

private FullTextParse ftParse
?


logger

private java.util.logging.Logger logger
Logger. Hierarchy is set to name of this class.

Constructor Detail

DataManagement

public DataManagement()
Initialize database connection.

Method Detail

getInstance

public static DataManagement getInstance()
Get singleton instance.

Returns:
singleton instance

initialize

public static void initialize()
                       throws java.sql.SQLException
Initialize database model and connection to real database.

Throws:
java.sql.SQLException - can not connect to DB

initPreparedStatements

public static void initPreparedStatements()
                                   throws java.sql.SQLException
Initialize prepared statements.

Throws:
java.sql.SQLException

getDBManager

public static cz.hdf.db.DBManager getDBManager()
Get DB manager

Returns:
DB manager

convertGenres

private java.lang.String convertGenres(java.lang.String[] _genres)
DOCUMENT ME!

Parameters:
_genres -
Returns:

convertGenres

private java.lang.String[] convertGenres(java.lang.String _genres)
DOCUMENT ME!

Parameters:
_genres -
Returns:

executeQueryModelVersion

public static java.lang.String executeQueryModelVersion()
Select from DB model version. WARN: This may abort DB transaction in PostgreSQL when table not exist.

Returns:
DB model version

executeQueryCD

public static CDData[] executeQueryCD(java.lang.String _sql)
                               throws java.sql.SQLException
Execute SQL query for CD table. This method have to start SQL select with content of SELECT_CD_PREFIX constant.

Parameters:
_sql - SQL select command
Returns:
array of resulted CD data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_CD_PREFIX

executeQueryCDBoxes

public static java.lang.String[] executeQueryCDBoxes()
                                              throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException - when SQL error occurs

executeQueryPhotoAlbum

public static PhotoAlbumData[] executeQueryPhotoAlbum(java.lang.String _sql)
                                               throws java.sql.SQLException
Execute SQL query for PhotoAlbum table. This method have to start SQL select with content of SELECT_PHOTO_ALBUM_PREFIX constant.

Parameters:
_sql - SQL select command
Returns:
array of resulted photo album data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_PHOTO_ALBUM_PREFIX

executeQueryPhoto

public static PhotoData[] executeQueryPhoto(java.lang.String _sql)
                                     throws java.sql.SQLException
Execute SQL query for Photo table. This method have to start SQL select with content of SELECT_PHOTO_PREFIX constant.

Parameters:
_sql - SQL select command
Returns:
array of resulted photo data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_PHOTO_PREFIX

executeQueryMusicAlbum

public static MusicAlbumData[] executeQueryMusicAlbum(java.lang.String _sql)
                                               throws java.sql.SQLException
Execute SQL query for MusicAlbum table and Interpret table. This method have to start SQL select with content of SELECT_MUSIC_ALBUM_PREFIX constant.

Parameters:
_sql - SQL select command
Returns:
array of resulted music album data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_MUSIC_ALBUM_PREFIX

executeQuerySong

public static SongData[] executeQuerySong(java.lang.String _sql)
                                   throws java.sql.SQLException
Execute SQL query for Song table. This method have to start SQL select with content of SELECT_SONG_PREFIX constant.

Parameters:
_sql - SQL select command
Returns:
array of resulted music album data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_SONG_PREFIX

executeQueryAllCDs

public static java.lang.String[] executeQueryAllCDs()
                                             throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException - when SQL error occurs

executeQueryAllPhotoAlbums

public static java.lang.String[] executeQueryAllPhotoAlbums()
                                                     throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException - when SQL error occurs

executeQueryAllMusicAlbums

public static java.lang.String[] executeQueryAllMusicAlbums()
                                                     throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException - when SQL error occurs

executeQueryAllInterprets

public static java.lang.String[] executeQueryAllInterprets()
                                                    throws java.sql.SQLException
Returns:
Throws:
java.sql.SQLException - when SQL error occurs

executeQueryFullTextCD

public static CDData[] executeQueryFullTextCD(java.lang.String _fulltext)
                                       throws java.sql.SQLException
Execute SQL query for CD table. This method have to start SQL select with content of SELECT_CD_PREFIX constant.

Parameters:
_fulltext - SQL select command
Returns:
array of resulted photo data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_CD_PREFIX

executeQueryFullTextPhoto

public static PhotoData[] executeQueryFullTextPhoto(java.lang.String _fulltext)
                                             throws java.sql.SQLException
Execute SQL query for Photo table. This method have to start SQL select with content of SELECT_PHOTO_PREFIX constant.

Parameters:
_fulltext - SQL select command
Returns:
array of resulted photo data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_PHOTO_PREFIX

executeQueryFullTextSong

public static SongData[] executeQueryFullTextSong(java.lang.String _fulltext)
                                           throws java.sql.SQLException
Execute SQL query for Song table. This method have to start SQL select with content of SELECT_SONG_PREFIX constant.

Parameters:
_fulltext - SQL select command
Returns:
array of resulted photo data
Throws:
java.sql.SQLException - when SQL error occurs
See Also:
SELECT_SONG_PREFIX

executeQueryPhotoThumb

public static java.awt.Image executeQueryPhotoThumb(int _photoID)
                                             throws java.sql.SQLException
Throws:
java.sql.SQLException - when SQL error occurs

existPhotoAlbum

public static int existPhotoAlbum(java.lang.String _albumName)
                           throws java.sql.SQLException
Try to find photo album name in DB. If album exist return his ID else return -1.

Parameters:
_albumName - name
Returns:
music album ID or -1
Throws:
java.sql.SQLException - when SQL error occurs

existMusicAlbum

public static int existMusicAlbum(java.lang.String _albumName)
                           throws java.sql.SQLException
Try to find music album name in DB. If album exist return his ID else return -1.

Parameters:
_albumName - name
Returns:
music album ID or -1
Throws:
java.sql.SQLException - when SQL error occurs

existInterpret

public static int existInterpret(java.lang.String _interpretName)
                          throws java.sql.SQLException
Try to find interpret name in DB. If interpret exist return his ID else return -1.

Parameters:
_interpretName - name
Returns:
interpret ID or -1
Throws:
java.sql.SQLException - when SQL error occurs

executeInsertModelVersion

public static void executeInsertModelVersion()
                                      throws java.sql.SQLException
Insert model version into DB.

Throws:
java.sql.SQLException - when SQL error occurs

executeInsertCD

public static int executeInsertCD(CDData _cdData)
                           throws java.sql.SQLException
Execute SQL insert for CD table. CDData.id is ignored, id is generated as sequence number.

Parameters:
_cdData - new CD record data
Returns:
new CD id
Throws:
java.sql.SQLException - when SQL error occurs

executeInsertPhotoAlbum

public static int executeInsertPhotoAlbum(PhotoAlbumData _paData)
                                   throws java.sql.SQLException
Execute SQL insert for PhotoAlbum table. PhotoAlbumData.id is ignored, id is generated as sequence number.

Parameters:
_paData - new PhotoAlbum record data
Returns:
new Photo album id
Throws:
java.sql.SQLException - when SQL error occurs

executeInsertPhoto

public static int executeInsertPhoto(PhotoData _pData)
                              throws java.sql.SQLException
Execute SQL insert for PhotoAlbum table. PhotoAlbumData.id is ignored, id is generated as sequence number.

Parameters:
_pData - new PhotoAlbum record data
Returns:
new Photo album id
Throws:
java.sql.SQLException - when SQL error occurs

executeInsertMusicAlbum

public static int executeInsertMusicAlbum(MusicAlbumData _aData)
                                   throws java.sql.SQLException
Execute SQL insert for MusicAlbum table. MusicAlbumData.id is ignored, id is generated as sequence number.

Parameters:
_aData - new MusicAlbum record data
Returns:
new MusicAlbum id
Throws:
java.sql.SQLException - when SQL error occurs

executeInsertSong

public static int executeInsertSong(SongData _sData)
                             throws java.sql.SQLException
Execute SQL insert for Song table. SongData.id is ignored, id is generated as sequence number.

Parameters:
_sData - new Song record data
Returns:
new song id
Throws:
java.sql.SQLException - when SQL error occurs

executeInsertInterpret

public static int executeInsertInterpret(java.lang.String _interpretName)
                                  throws java.sql.SQLException
Execute SQL insert for Interpret table. ID is generated as sequence number.

Parameters:
_interpretName - new interpret name
Returns:
new interpret id
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdateCD

public static int executeUpdateCD(CDData _cdData)
                           throws java.sql.SQLException
Execute SQL update for CD table.

Parameters:
_cdData - new CD record data, data id shows to original record to update
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdatePhotoAlbum

public static int executeUpdatePhotoAlbum(PhotoAlbumData _pad)
                                   throws java.sql.SQLException
Execute SQL update for photo album table.

Parameters:
_pad - new photo album record data, data id shows to original record to update
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdatePhoto

public static int executeUpdatePhoto(PhotoData _pd)
                              throws java.sql.SQLException
Execute SQL update for photo table.

Parameters:
_pd - new photo record data, data id shows to original record to update
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdatePhotoRating

public static int executeUpdatePhotoRating(int _photoID,
                                           int _newRating)
                                    throws java.sql.SQLException
Execute SQL update for photo table.

Parameters:
_photoID - _pd new photo record data, data id shows to original record to update
_newRating -
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdatePhotoInfo

public static int executeUpdatePhotoInfo(int _photoID,
                                         java.lang.String _newInfo)
                                  throws java.sql.SQLException
Execute SQL update for photo table.

Parameters:
_photoID - _pd new photo record data, data id shows to original record to update
_newInfo -
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdateMusicAlbum

public static int executeUpdateMusicAlbum(MusicAlbumData _maData)
                                   throws java.sql.SQLException
Execute SQL update for music album table.

Parameters:
_maData - new music album record data, data id shows to original record to update
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdateSong

public static int executeUpdateSong(SongData _songData)
                             throws java.sql.SQLException
Execute SQL update for song table.

Parameters:
_songData - new song record data, data id shows to original record to update
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeUpdateInterpret

public static int executeUpdateInterpret(int _interpretID,
                                         java.lang.String _interpretName)
                                  throws java.sql.SQLException
Execute SQL update for interpret table.

Parameters:
_interpretID - id shows to original record to update
_interpretName - new name
Returns:
number of changed rows
Throws:
java.sql.SQLException - when SQL error occurs

executeDeleteCD

public static int executeDeleteCD(int _cdid)
                           throws java.sql.SQLException
Delete one cd and all his photos, music, movies records from DB.

Parameters:
_cdid - cd id to delete
Returns:
number of deleted rows
Throws:
java.sql.SQLException - when SQL error occurs

executeDeletePhotoAlbum

public static int executeDeletePhotoAlbum(int _paid)
                                   throws java.sql.SQLException
Delete one photo album and all his photos from DB.

Parameters:
_paid - photo album id to delete
Returns:
number of deleted rows
Throws:
java.sql.SQLException - when SQL error occurs

executeDeletePhoto

public static int executeDeletePhoto(int _pid)
                              throws java.sql.SQLException
Delete one photo from DB.

Parameters:
_pid - photo id to delete
Returns:
number of deleted rows
Throws:
java.sql.SQLException - when SQL error occurs

executeDeleteMusicAlbum

public static int executeDeleteMusicAlbum(int _maid)
                                   throws java.sql.SQLException
Delete one music album and all his songs from DB.

Parameters:
_maid - music album id to delete
Returns:
number of deleted rows
Throws:
java.sql.SQLException - when SQL error occurs

executeDeleteSong

public static int executeDeleteSong(int _sid)
                             throws java.sql.SQLException
Delete one song from DB.

Parameters:
_sid - song id to delete
Returns:
number of deleted rows
Throws:
java.sql.SQLException - when SQL error occurs

executeDeleteInterpret

public static int executeDeleteInterpret(int _iid)
                                  throws java.sql.SQLException
Delete one interpret record from DB and all interpret records from music albums.

Parameters:
_iid - interpret id to delete
Returns:
number of deleted rows
Throws:
java.sql.SQLException - when SQL error occurs

upgradeDB

public static void upgradeDB(java.lang.String _modelVersion)
                      throws java.sql.SQLException
Upgrade/proceed changes from new DB model to DB.

Parameters:
_modelVersion -
Throws:
java.sql.SQLException - when SQL error occurs

upgradeDBFromNullTo03

public static void upgradeDBFromNullTo03()
                                  throws java.sql.SQLException
Upgrade/proceed changes from new DB model to DB. Repair model from version 'null' to '0.3'

Throws:
java.sql.SQLException - when SQL error occurs

upgradeDBFrom03To04

public static void upgradeDBFrom03To04()
                                throws java.sql.SQLException
Upgrade/proceed changes from new DB model to DB. Repair model from version '03' to '0.4'

Throws:
java.sql.SQLException - when SQL error occurs

upgradeDBFrom04To05

public static void upgradeDBFrom04To05()
                                throws java.sql.SQLException
Upgrade/proceed changes from new DB model to DB. Repair model from version '04' to '0.5'

Throws:
java.sql.SQLException - when SQL error occurs

upgradeDBFrom05To06

public static void upgradeDBFrom05To06()
                                throws java.sql.SQLException
Upgrade/proceed changes from new DB model to DB. Repair model from version '04' to '0.5'

Throws:
java.sql.SQLException - when SQL error occurs

isSupportedSQLUnion

public static boolean isSupportedSQLUnion()
Is supported SQL union command in DB?

Create two testing tables and execute query with union command on these tables. Then drop testing tables.

Returns:
true if DB support union command, else false

dbTableName2appName

public static java.lang.String dbTableName2appName(java.lang.String _dbTableName)
Convert DB table name to readable name for application. (like: music_album -> music, interpret -> music, cd -> cd)

Parameters:
_dbTableName - DB table name
Returns:
readable table name or null

dbNames2appColumnName

public static java.lang.String dbNames2appColumnName(java.lang.String _dbTableName,
                                                     java.lang.String _dbColumnName)
Convert DB table name and column name to readable column name for application. (like: music_album, name -> album)

Parameters:
_dbTableName - DB table name
_dbColumnName - DB column name from table name
Returns:
readable column name or null

appNames2dbTableName

public static java.lang.String appNames2dbTableName(java.lang.String _appTableName,
                                                    java.lang.String _appColumnName)
Convert readable application table and column names to DB table name. (like music,album -> music_album)

Parameters:
_appTableName - readable application table name
_appColumnName - readable application column name from table
Returns:
DB table name or null

appNames2dbColumnName

public static java.lang.String appNames2dbColumnName(java.lang.String _appTableName,
                                                     java.lang.String _appColumnName)
Convert readable application table and column names to DB table name. (like music,album -> name)

Parameters:
_appTableName - readable application table name
_appColumnName - readable application column name from table
Returns:
DB column name or null

appColumnNames

public static java.lang.String[] appColumnNames(java.lang.String _appTableName)
Get readable application column names according to application table name (like movie -> movie, genre, director, ...)

Parameters:
_appTableName - readable application table name
Returns:
list of application column names or null

getAppColumnType

public static int getAppColumnType(java.lang.String _appTableName,
                                   java.lang.String _appColumnName)
Get app type (APP_COLUMN_TYPE_) for specified app column.

Parameters:
_appTableName - app column table
_appColumnName - app column
Returns:
app column type
See Also:
APP_COLUMN_TYPE_BOOLEAN, APP_COLUMN_TYPE_DATE, APP_COLUMN_TYPE_NUMBER, APP_COLUMN_TYPE_TEXT

close

public static void close()
Release DB statements and connections.



CDnavigator JavaDoc, HDF company www.hdf.cz