ARLO Adapt
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Attributes | List of all members
arlo.NesterAudioFile Class Reference
Inheritance diagram for arlo.NesterAudioFile:
Inheritance graph
[legend]
Collaboration diagram for arlo.NesterAudioFile:
Collaboration graph
[legend]

Classes

enum  MediaFileType
 

Public Member Functions

String toString ()
 
 NesterAudioFile ()
 Default Constructor. More...
 
 NesterAudioFile (AudioFile audioFile, String username, int userID, int libraryID)
 Construct a New NesterAudioFile from an AudioFile. More...
 
String GetMetaData (String name, Connection connection)
 
String GetMetaData (String name, Connection connection, boolean AllowNullValue)
 
String GetAbsoluteFilePath ()
 Get the absoluteFilePath of a NesterAudioFile. More...
 
Boolean saveMD5 (Connection connection)
 Save the MD5 Hash of a file back to the database. More...
 

Static Public Member Functions

static NesterAudioFile getAudioFile (int audioFileID, Connection connection, HashMap< String, Boolean > fieldNames)
 Get a NeterAudioFile from the database, along with the associated MetaData. More...
 
static Vector< NesterAudioFilegetNesterProjectAudioFiles (int projectID, boolean activeOnly, HashMap< String, Boolean > fieldNames, Connection connection)
 Get a list of all MediaFile objects in a Project. More...
 
static String GetMetaData (int mediaFileID, String name, Connection connection)
 
static String GetMetaData (int mediaFileID, String name, Connection connection, boolean AllowNullValue)
 
static Boolean SaveMetaData (int mediaFileID, String name, String value, Boolean userEditable, Connection connection)
 
static int getAudioFileID (int userID, String relativeFilePath, Connection connection)
 
static Boolean AddFilesToProject (Vector< NesterAudioFile > nesterAudioFiles, int projectId, Connection connection)
 Adds the files to the indicated Project in the DB. More...
 
static Boolean DeleteMetaDataFromDB (Vector< NesterAudioFile > nesterAudioFiles, Connection connection)
 Deletes any existing MetaData from the DB from the associated files. More...
 
static Boolean SaveMetaDataToDb (Vector< NesterAudioFile > nesterAudioFiles, Connection connection)
 Saves all MetaData from the files in the list. More...
 
static Boolean saveNewAudioFilesToDb (Vector< NesterAudioFile > nesterAudioFiles, int projectId, Connection connection)
 Saves a list of audioFiles. More...
 
static Boolean importAudioFile (String username, int userID, int projectID, int libraryID, String relativeFilePath, Connection connection)
 Import an individual audio file. More...
 
static Boolean importAudioFile (String username, int userID, int projectID, int libraryID, String relativeFilePath, String alias, Connection connection)
 Import an individual audio file. More...
 
static String ComputeFileMD5Digest (String filepath)
 Compute the MD5 Hash of a File. More...
 
static Vector< Integer > getAllMediaFileIds (Connection connection)
 Get a list of all MediaFile IDs in the Database. More...
 

Public Attributes

int id
 database id; if -1, indicates a new object, not in db More...
 
int user_id
 
boolean active
 
String alias
 
Timestamp uploadDate
 
String relativeFilePath
 
int library_id
 
Timestamp realStartTime
 
NesterWavFileMetaData wavFileMetaData
 
NesterStaticUserMetaData staticUserMetaData
 
String md5
 
MediaFileType mediaFileType = null
 

Static Private Attributes

static final long serialVersionUID = -5787612004200650730L
 

Constructor & Destructor Documentation

arlo.NesterAudioFile.NesterAudioFile ( )

Default Constructor.

arlo.NesterAudioFile.NesterAudioFile ( AudioFile  audioFile,
String  username,
int  userID,
int  libraryID 
)

Construct a New NesterAudioFile from an AudioFile.

Initializes a new NesterAudioFile with default settings/MetaData. Does not save the data to the Database itself, this just initializes it into memory.

Parameters
audioFileAn initialize AudioFile with WAV data
usernameThe username who owns this file, used for generating the paths
userIDThe database ID of the user who owns this file
libraryIDThe database ID of the Library in which this will be stored.
Returns
initialized NesterAudioFile

Member Function Documentation

static Boolean arlo.NesterAudioFile.AddFilesToProject ( Vector< NesterAudioFile nesterAudioFiles,
int  projectId,
Connection  connection 
)
static

Adds the files to the indicated Project in the DB.

Parameters
nesterAudioFilesThe list of NesterAudioFile objects from which to save the metadata
projectIdThe DB id of the Project for which to add these files
connectionThe database connection, already opened and active
Returns
Boolean - true if success, false on error
static String arlo.NesterAudioFile.ComputeFileMD5Digest ( String  filepath)
static

Compute the MD5 Hash of a File.

Parameters
filepathPath to the file to hash.
Returns
The 32 character hexadecimal hash as a String, null upon Error.
static Boolean arlo.NesterAudioFile.DeleteMetaDataFromDB ( Vector< NesterAudioFile nesterAudioFiles,
Connection  connection 
)
static

Deletes any existing MetaData from the DB from the associated files.

Existing data is removed so that we can run straight inserts rather that insert / updates when importing new files.

Note
Expects that the id of the NesterAudioFile is set to the correct id.
Warning
Deletes all existing MetaData for the associated files.
Parameters
nesterAudioFilesThe list of NesterAudioFile objects from which to save the metadata
connectionThe database connection, already opened and active
Returns
Boolean - true if success, false on error
String arlo.NesterAudioFile.GetAbsoluteFilePath ( )

Get the absoluteFilePath of a NesterAudioFile.

Returns
The absolute file path for this file.
static Vector<Integer> arlo.NesterAudioFile.getAllMediaFileIds ( Connection  connection)
static

Get a list of all MediaFile IDs in the Database.

Parameters
connectionOpened Database Connection
Returns
List of database IDs of the MediaFiles, null on any error
static NesterAudioFile arlo.NesterAudioFile.getAudioFile ( int  audioFileID,
Connection  connection,
HashMap< String, Boolean >  fieldNames 
)
static

Get a NeterAudioFile from the database, along with the associated MetaData.

Parameters
audioFileIDThe NesterAudioFile to retrieve.
connectionThe initialized connection to the database.
fieldNamesA list of various fields (MetaData) to retrieve.
Returns
initialized NesterAudioFile.
static int arlo.NesterAudioFile.getAudioFileID ( int  userID,
String  relativeFilePath,
Connection  connection 
)
static
String arlo.NesterAudioFile.GetMetaData ( String  name,
Connection  connection 
)
String arlo.NesterAudioFile.GetMetaData ( String  name,
Connection  connection,
boolean  AllowNullValue 
)
static String arlo.NesterAudioFile.GetMetaData ( int  mediaFileID,
String  name,
Connection  connection 
)
static
static String arlo.NesterAudioFile.GetMetaData ( int  mediaFileID,
String  name,
Connection  connection,
boolean  AllowNullValue 
)
static
static Vector<NesterAudioFile> arlo.NesterAudioFile.getNesterProjectAudioFiles ( int  projectID,
boolean  activeOnly,
HashMap< String, Boolean >  fieldNames,
Connection  connection 
)
static

Get a list of all MediaFile objects in a Project.

This is an optimized version of the original NesterProject.getNesterProjectAudioFiles. This version reduces the number of database calls by requesting all files from the database at once.

Parameters
projectIdThe database ID of the Project.
activeOnlyOnly return files set as 'active'
fieldNames
connectionOpened Database Connection
Returns
List of NesterAudioFile objects
static Boolean arlo.NesterAudioFile.importAudioFile ( String  username,
int  userID,
int  projectID,
int  libraryID,
String  relativeFilePath,
Connection  connection 
)
static

Import an individual audio file.

Other versions delete and recreate the 'import' Project, whereas this one includes the Project as an argument.

Note
This version is a wrapper that excludes the 'alias' parameter (for backward compatibility)
Parameters
username
userID
projectId
relativeFilePath
connection
Returns
True on success, False on error
static Boolean arlo.NesterAudioFile.importAudioFile ( String  username,
int  userID,
int  projectID,
int  libraryID,
String  relativeFilePath,
String  alias,
Connection  connection 
)
static

Import an individual audio file.

Other versions delete and recreate the 'import' Project, whereas this one includes the Project as an argument.

Parameters
username
userID
projectID
libraryIDDatabase ID of the Library in which to store this file.
relativeFilePath
aliasIf not null, stores this value as the 'alias' for the mediaFile, else uses the file name.
connection
Returns
True on success, False on error
Boolean arlo.NesterAudioFile.saveMD5 ( Connection  connection)

Save the MD5 Hash of a file back to the database.

Parameters
connectionThe database connection, already opened and active
Returns
true on Success, false on error
static Boolean arlo.NesterAudioFile.SaveMetaData ( int  mediaFileID,
String  name,
String  value,
Boolean  userEditable,
Connection  connection 
)
static
static Boolean arlo.NesterAudioFile.SaveMetaDataToDb ( Vector< NesterAudioFile nesterAudioFiles,
Connection  connection 
)
static

Saves all MetaData from the files in the list.

Batches up all MetaData from the provided nesterAudioFiles, and saves them to the Db at once.

Warning
This deletes any existing MetaData for these files.
Parameters
nesterAudioFilesThe list of NesterAudioFile objects from which to save the metadata
connectionThe database connection, already opened and active
Returns
Boolean - true if success, false on error
static Boolean arlo.NesterAudioFile.saveNewAudioFilesToDb ( Vector< NesterAudioFile nesterAudioFiles,
int  projectId,
Connection  connection 
)
static

Saves a list of audioFiles.

Save a batch of NesterAudioFiles and associated MetaData at once to the database to optimize time accessing the DB. Uses default/empty values for unknown MetaData/values.

Warning
Deletes any existing 'import' Project for userID.
Parameters
nesterAudioFilesThe list of NesterAudioFile objects to save
projectIdThe DB id of the project for which to add these files
connectionThe database connection, already opened and active
Returns
Boolean - true if success, false on error
String arlo.NesterAudioFile.toString ( )

Member Data Documentation

boolean arlo.NesterAudioFile.active
String arlo.NesterAudioFile.alias
int arlo.NesterAudioFile.id

database id; if -1, indicates a new object, not in db

int arlo.NesterAudioFile.library_id
String arlo.NesterAudioFile.md5
MediaFileType arlo.NesterAudioFile.mediaFileType = null
Timestamp arlo.NesterAudioFile.realStartTime
String arlo.NesterAudioFile.relativeFilePath
final long arlo.NesterAudioFile.serialVersionUID = -5787612004200650730L
staticprivate
NesterStaticUserMetaData arlo.NesterAudioFile.staticUserMetaData
Timestamp arlo.NesterAudioFile.uploadDate
int arlo.NesterAudioFile.user_id
NesterWavFileMetaData arlo.NesterAudioFile.wavFileMetaData

The documentation for this class was generated from the following file: