com.opencms.file.mySql
Class CmsDbAccess

java.lang.Object
  |
  +--com.opencms.file.genericSql.CmsDbAccess
        |
        +--com.opencms.file.mySql.CmsDbAccess
All Implemented Interfaces:
I_CmsConstants, I_CmsLogChannels

public class CmsDbAccess
extends CmsDbAccess
implements I_CmsConstants, I_CmsLogChannels

This is the generic access module to load and store resources from and into the database.

Version:
$Revision: 1.86 $ $Date: 2003/03/18 17:48:23 $ *
Author:
Andreas Schouten, Michael Emmerich, Hanjo Riege, Anders Fugmann

Field Summary
 
Fields inherited from class com.opencms.file.genericSql.CmsDbAccess
C_CONFIGURATIONS_DIGEST, C_CONFIGURATIONS_DIGEST_FILE_ENCODING, C_CONFIGURATIONS_POOL, C_MAX_TABLES, C_RESTYPE_LINK_ID, C_SESSION_TIMEOUT, C_TABLE_FILES, C_TABLE_GROUPS, C_TABLE_GROUPUSERS, C_TABLE_PROJECTS, C_TABLE_PROPERTIES, C_TABLE_PROPERTYDEF, C_TABLE_RESOURCES, C_TABLE_SYSTEMPROPERTIES, C_TABLE_TASK, C_TABLE_TASKLOG, C_TABLE_TASKPAR, C_TABLE_TASKTYPE, C_TABLE_USERS, C_USE_TARGET_DATE, m_cq, m_digest, m_digestFileEncoding, m_maxIds, m_poolName, m_poolNameBackup, m_poolNameOnline
 
Fields inherited from interface com.opencms.core.I_CmsConstants
C_ACCESS_DEFAULT_FLAGS, C_ACCESS_GROUP, C_ACCESS_GROUP_READ, C_ACCESS_GROUP_VISIBLE, C_ACCESS_GROUP_WRITE, C_ACCESS_INTERNAL_READ, C_ACCESS_OWNER, C_ACCESS_OWNER_READ, C_ACCESS_OWNER_VISIBLE, C_ACCESS_OWNER_WRITE, C_ACCESS_PUBLIC, C_ACCESS_PUBLIC_READ, C_ACCESS_PUBLIC_VISIBLE, C_ACCESS_PUBLIC_WRITE, C_ACCESS_READ, C_ACCESS_VISIBLE, C_ACCESS_WRITE, C_ADDITIONAL_INFO_EXPLORERSETTINGS, C_ADDITIONAL_INFO_PREFERENCES, C_ADDITIONAL_INFO_STARTSETTINGS, C_ADDITIONAL_INFO_TASKSETTINGS, C_ADDITIONAL_INFO_TOWN, C_ADDITIONAL_INFO_ZIPCODE, C_AT_LEAST_ONCE, C_CLUSTERURL, C_CONFIGURATION_CACHE, C_CONFIGURATION_CLASS, C_CONFIGURATION_REGISTRY, C_CONFIGURATION_RESOURCEBROKER, C_COPYRIGHT, C_DEFAULT_SITE, C_DELETE_HISTORY, C_ENABLE_HISTORY, C_ERRPREFIX, C_ERRSPERATOR, C_EXPORT_TAG_ACCESS, C_EXPORT_TAG_ADDRESS, C_EXPORT_TAG_CREATOR, C_EXPORT_TAG_DATE, C_EXPORT_TAG_DEFAULTGROUP, C_EXPORT_TAG_DESCRIPTION, C_EXPORT_TAG_DESTINATION, C_EXPORT_TAG_EMAIL, C_EXPORT_TAG_EXPORT, C_EXPORT_TAG_FILE, C_EXPORT_TAG_FIRSTNAME, C_EXPORT_TAG_FLAGS, C_EXPORT_TAG_GROUP, C_EXPORT_TAG_GROUPDATA, C_EXPORT_TAG_GROUPNAME, C_EXPORT_TAG_INFO, C_EXPORT_TAG_LASTMODIFIED, C_EXPORT_TAG_LASTNAME, C_EXPORT_TAG_LAUNCHER_START_CLASS, C_EXPORT_TAG_MODULEXPORT, C_EXPORT_TAG_NAME, C_EXPORT_TAG_OC_VERSION, C_EXPORT_TAG_PARENTGROUP, C_EXPORT_TAG_PASSWORD, C_EXPORT_TAG_PROJECT, C_EXPORT_TAG_PROPERTIES, C_EXPORT_TAG_PROPERTY, C_EXPORT_TAG_RECOVERYPASSWORD, C_EXPORT_TAG_SECTION, C_EXPORT_TAG_SOURCE, C_EXPORT_TAG_TYPE, C_EXPORT_TAG_USER, C_EXPORT_TAG_USERDATA, C_EXPORT_TAG_USERGROUPDATA, C_EXPORT_TAG_USERGROUPS, C_EXPORT_TAG_USERINFO, C_EXPORT_TAG_VALUE, C_EXPORT_TAG_VERSION, C_EXPORT_VERSION, C_EXPORT_XMLFILENAME, C_EXPORTONLYFILES, C_EXPORTONLYUSERS, C_EXPORTPOINT, C_EXPORTPOINT_PATH, C_EXPORTUSERSFILES, C_FCONTENT, C_FELEMENT, C_FILE, C_FILECONTENT, C_FILES_IMPORTED, C_FLAG_DISABLED, C_FLAG_ENABLED, C_FLAG_GROUP_PROJECTCOWORKER, C_FLAG_GROUP_PROJECTMANAGER, C_FLAG_GROUP_ROLE, C_FOLDER, C_FOLDER_SEPARATOR, C_GROUP, C_GROUP_ADMIN, C_GROUP_GUEST, C_GROUP_PROJECTLEADER, C_GROUP_USERS, C_LINKCHECKTABLE_DATE, C_MAX_LENGTH_RESOURCE_NAME, C_MODULE_PROPERTY_ADDITIONAL_RESOURCES, C_MODULE_PROPERTY_ADDITIONAL_RESOURCES_SEPARATOR, C_MODUS_AUTO, C_MODUS_EXPORT, C_MODUS_EXTERN, C_MODUS_OFFLINE, C_MODUS_ONLINE, C_MOUNTPOINT_FILESYSTEM, C_MOUNTPOINT_MYSQL, C_NEVER, C_NO_FILES_IMPORTED, C_ORDER_AGENTUSER, C_ORDER_ENDTIME, C_ORDER_ID, C_ORDER_INITIATORUSER, C_ORDER_NAME, C_ORDER_ORIGINALUSER, C_ORDER_PERCENTAGE, C_ORDER_PRIORITY, C_ORDER_ROLE, C_ORDER_STARTTIME, C_ORDER_STATE, C_ORDER_TASKTYPE, C_ORDER_TIMEOUT, C_ORDER_WAKEUPTIME, C_PASSWORD_MINIMUMSIZE, C_PROJECT_ONLINE, C_PROJECT_ONLINE_ID, C_PROJECT_STATE_ARCHIVE, C_PROJECT_STATE_INVISIBLE, C_PROJECT_STATE_LOCKED, C_PROJECT_STATE_UNLOCKED, C_PROJECT_TYPE_INVISIBLE, C_PROJECT_TYPE_NORMAL, C_PROJECT_TYPE_TEMPORARY, C_PROPERTY_ACTIV, C_PROPERTY_CHANNELID, C_PROPERTY_CONTENT_ENCODING, C_PROPERTY_DEFAULT_FILE, C_PROPERTY_DESCRIPTION, C_PROPERTY_EXPORT, C_PROPERTY_EXPORTNAME, C_PROPERTY_KEYWORDS, C_PROPERTY_NAVPOS, C_PROPERTY_NAVTEXT, C_PROPERTY_RELATIVEROOT, C_PROPERTY_TEMPLATETYPE, C_PROPERTY_TITLE, C_PROPERTY_VISIBLE, C_PUBLISH_METHOD_LINK, C_REGISTRY_DESTINATION, C_REGISTRY_HISTORY, C_REGISTRY_KNOWNLAUNCHERS, C_REGISTRY_LAUNCHER, C_REGISTRY_SOURCE, C_REQUEST_CONSOLE, C_REQUEST_HTTP, C_RESPONSE_CONSOLE, C_RESPONSE_HTTP, C_ROOT, C_ROOT_TEMPLATE_NAME, C_ROOTNAME_COS, C_ROOTNAME_VFS, C_SESSION_ADMIN_POS, C_SESSION_BROADCASTMESSAGE, C_SESSION_CONTENT_ENCODING, C_SESSION_CURRENTGROUP, C_SESSION_DATA, C_SESSION_IS_DIRTY, C_SESSION_MESSAGEPENDING, C_SESSION_MODULE_VECTOR, C_SESSION_PROJECT, C_SESSION_THREAD_ERROR, C_SESSION_USERNAME, C_SORT_ASC, C_SORT_DESC, C_START_ACCESSFLAGS, C_START_DEFAULTGROUP, C_START_LANGUAGE, C_START_LOCKDIALOG, C_START_PROJECT, C_START_VIEW, C_STATE_CHANGED, C_STATE_DELETED, C_STATE_NEW, C_STATE_UNCHANGED, C_STATICEXPORT_PATH, C_STATICEXPORT_START, C_SYNCHRONISATION_PATH, C_SYNCHRONISATION_PROJECT, C_SYNCHRONISATION_RESOURCE, C_SYNCHRONISATION_RESOURCETAG, C_SYSTEMPROPERTY_CRONTABLE, C_SYSTEMPROPERTY_EXPORTPATH, C_SYSTEMPROPERTY_EXTENSIONS, C_SYSTEMPROPERTY_LINKCHECKTABLE, C_SYSTEMPROPERTY_MIMETYPES, C_SYSTEMPROPERTY_MOUNTPOINT, C_SYSTEMPROPERTY_RESOURCE_TYPE, C_TABLE_CHANNELID, C_TASK_FILTER, C_TASK_MESSAGES, C_TASK_MESSAGES_ACCEPTED, C_TASK_MESSAGES_COMPLETED, C_TASK_MESSAGES_FORWARDED, C_TASK_MESSAGES_MEMBERS, C_TASK_ORDER_BY_DATE, C_TASK_ORDER_BY_NAME, C_TASK_PRIORITY_HIGH, C_TASK_PRIORITY_LOW, C_TASK_PRIORITY_NORMAL, C_TASK_STATE_ENDED, C_TASK_STATE_HALTED, C_TASK_STATE_NOTENDED, C_TASK_STATE_PREPARE, C_TASK_STATE_START, C_TASK_STATE_STARTED, C_TASK_VIEW_ALL, C_TASKLOG_SYSTEM, C_TASKLOG_USER, C_TASKORDER_NONE, C_TASKORDER_STARTDATE, C_TASKORDER_TIMEOUT, C_TASKS_ACTIVE, C_TASKS_ALL, C_TASKS_DONE, C_TASKS_NEW, C_TASKS_OPEN, C_TASKSORDER_TASKNAME, C_TEMP_PREFIX, C_TFACCESS, C_TFGROUP, C_TFILEOBJ, C_TFILES, C_TFNAME, C_TFPROPERTYINFO, C_TFPROPERTYNAME, C_TFPROPERTYTYPE, C_TFPROPERTYVALUE, C_TFTYPE, C_TFTYPENAME, C_TFUSER, C_TGDESC, C_TGFLAG, C_TGNAME, C_TGPARENTGROUP, C_TGROUPOBJ, C_TGROUPS, C_TGROUPUSERS, C_TGUSER, C_TUADDINFO, C_TUDESC, C_TUDGROUP, C_TUDISABLED, C_TUEMAIL, C_TUFIRSTNAME, C_TUFLAG, C_TUGROUP, C_TUINFOKEY, C_TUINFOVALUE, C_TULOGIN, C_TUNAME, C_TUPASSWD, C_TUSERGROUPS, C_TUSEROBJ, C_TUSERS, C_TYPE_BODY_NAME, C_TYPE_COMPATIBLEPLAIN_NAME, C_TYPE_FOLDER, C_TYPE_FOLDER_NAME, C_TYPE_IMAGE_NAME, C_TYPE_LAST_INDEX, C_TYPE_PAGE_NAME, C_TYPE_PLAIN_NAME, C_UNKNOWN_ID, C_UNKNOWN_INT, C_UNKNOWN_LAUNCHER, C_UNKNOWN_LAUNCHER_ID, C_UNKNOWN_LONG, C_URL_PREFIX_EXPORT, C_URL_PREFIX_HTTP, C_URL_PREFIX_HTTPS, C_URL_PREFIX_SERVERNAME, C_USER, C_USER_ADMIN, C_USER_GUEST, C_USER_TYPE_SYSTEMANDWEBUSER, C_USER_TYPE_SYSTEMUSER, C_USER_TYPE_WEBUSER, C_WEB_APP_REPLACE_KEY, C_WEEKS_HISTORY, C_WHATEVER, C_XML_BODY_ELEMENT
 
Fields inherited from interface com.opencms.boot.I_CmsLogChannels
C_FLEX_CACHE, C_FLEX_LOADER, C_LOGGING, C_MODULE_CRITICAL, C_MODULE_DEBUG, C_MODULE_INFO, C_OPENCMS_CACHE, C_OPENCMS_CRITICAL, C_OPENCMS_CRONSCHEDULER, C_OPENCMS_DEBUG, C_OPENCMS_ELEMENTCACHE, C_OPENCMS_INFO, C_OPENCMS_INIT, C_OPENCMS_POOL, C_OPENCMS_STATICEXPORT, C_OPENCMS_STREAMING, C_PREPROCESSOR_IS_LOGGING
 
Constructor Summary
CmsDbAccess(source.org.apache.java.util.Configurations config)
          Instanciates the access-module and sets up all required modules and connections.
 
Method Summary
 CmsUser addUser(String name, String password, String description, String firstname, String lastname, String email, long lastlogin, long lastused, int flags, Hashtable additionalInfos, CmsGroup defaultGroup, String address, String section, int type)
          Adds a user to the database.
protected  void clearFilesTable()
          Deletes all files in CMS_FILES without fileHeader in CMS_RESOURCES
 CmsFile createFile(CmsUser user, CmsProject project, CmsProject onlineProject, String filename, int flags, int parentId, byte[] contents, I_CmsResourceType resourceType)
          Creates a new file with the given content and resourcetype.
 CmsGroup createGroup(String name, String description, int flags, String parent)
          Add a new group to the Cms.
 CmsTask createTask(int rootId, int parentId, int tasktype, int ownerId, int agentId, int roleId, String taskname, Timestamp wakeuptime, Timestamp timeout, int priority)
          Creates a new task.
 void deleteProjectProperties(CmsProject project)
          Deletes all properties for a project.
 void destroy()
          Destroys this access-module
protected  void fillDefaults()
          Private method to init all default-resources
protected  int findAgent(int roleid)
          Finds an agent for a given role (group).
 Vector getAllBackupProjects()
          Returns all projects from the history.
protected  CmsQueries getQueries()
          retrieve the correct instance of the queries holder.
 CmsFile readFile(int projectId, int onlineProjectId, String filename)
          Reads a file from the Cms.
 CmsFile readFile(int projectId, int onlineProjectId, String filename, boolean includeDeleted)
          Reads a file from the Cms.
 Vector readProjectLogs(int projectid)
          Reads log entries for a project with added unescaping of comment as as MySQL doesn't support Unicode strings.
 HashMap readProperties(int projectId, CmsResource resource, int resourceType)
          Added unescaping of property values as MySQL doesn't support Unicode strings
 String readProperty(String meta, int projectId, CmsResource resource, int resourceType)
          Added unescaping of property values as MySQL doesn't support Unicode strings
 CmsTask readTask(int id)
          Reads a task from the Cms with added escaping of Strings since MySQL dosen't support Unicode strings
 CmsTaskLog readTaskLog(int id)
          Reads a log for a task with added unescaping of comment as as MySQL doesn't support Unicode strings.
 Vector readTaskLogs(int taskId)
          Reads log entries for a task with added unescaping of comment as as MySQL doesn't support Unicode strings.
 Vector readTasks(CmsProject project, CmsUser agent, CmsUser owner, CmsGroup role, int tasktype, String orderBy, String sort)
          Reads all tasks of a user in a project with added escaping of Strings since MySQL dosen't support Unicode strings.
 void writeProperty(String meta, int projectId, String value, CmsResource resource, int resourceType, boolean addDefinition)
          Writes a property for a file or folder with added escaping of property values as MySQL doesn't support Unicode strings
 CmsTask writeTask(CmsTask task)
          Writes a task from the Cms with added escaping of Strings since MySQL dosen't support Unicode strings
 void writeTaskLog(int taskId, int userid, Timestamp starttime, String comment, int type)
          Writes new log for a task with added escaping of comment as as MySQL doesn't support Unicode strings.
 void writeUser(CmsUser user)
          Writes a user to the database.
 
Methods inherited from class com.opencms.file.genericSql.CmsDbAccess
addImportUser, addSystemProperty, addUserToGroup, backupProject, backupResource, changeLockedInProject, changeUserType, checkExport, checkGroupDependence, checkNull, copyFile, countLockedResources, countProperties, createFile, createFileContent, createFolder, createFolder, createLinkEntrys, createOnlineLinkEntrys, createProject, createProjectResource, createPropertydefinition, createResource, createSession, deleteAllProjectResources, deleteAllProperties, deleteAllProperties, deleteBackups, deleteExportLink, deleteExportLink, deleteFile, deleteFolder, deleteGroup, deleteLinkEntrys, deleteOnlineLinkEntrys, deleteProject, deleteProjectResource, deleteProjectResources, deleteProperty, deletePropertydefinition, deleteResource, deleteSessions, deleteSystemProperty, deleteUser, deleteUser, digest, endTask, fetchAllVfsLinks, fetchDateFromResource, fetchResourceFlags, fetchResourceID, fetchVfsLinksForResourceID, forwardTask, getAllAccessibleProjectsByGroup, getAllAccessibleProjectsByManagerGroup, getAllAccessibleProjectsByUser, getAllExportLinks, getAllProjects, getBackupVersionId, getBrokenLinks, getBytesFromResultset, getChild, getConnectionPools, getDependingExportLinks, getFilesInFolder, getFilesWithProperty, getFolderTree, getGroups, getGroupsOfUser, getOnlineBrokenLinks, getOnlineProject, getOnlineResourceNames, getReadingpermittedGroup, getResourcesInFolder, getResourcesWithProperty, getResourcesWithProperty, getSubFolders, getTaskPar, getTaskType, getTaskTypeConditon, getUndeletedResources, getUsers, getUsers, getUsersByLastname, getUsersOfGroup, insertTaskPar, insertTaskType, m_doSetBytes, nextId, publishProject, readAllFileHeaders, readAllFileHeadersForHist, readAllProjectResources, readAllPropertydefinitions, readAllPropertydefinitions, readBackupProject, readBackupProjectResources, readExportLink, readExportLinkHeader, readFileContent, readFileForHist, readFileHeader, readFileHeader, readFileHeader, readFileHeaderForHist, readFileHeaderInProject, readFileInProject, readFiles, readFiles, readFilesByType, readFolder, readFolder, readFolderInProject, readFolders, readFolders, readGroup, readGroup, readLinkEntrys, readOnlineLinkEntrys, readProject, readProject, readProjectResource, readProjectView, readPropertydefinition, readPropertydefinition, readResource, readResources, readResourcesLikeName, readSession, readSystemProperty, readUser, readUser, readUser, recoverPassword, removeFile, removeFolder, removeFolderForPublish, removeTemporaryFile, removeUserFromGroup, renameFile, setPassword, setRecoveryPassword, setTaskPar, SortEntrys, undeleteFile, unlockProject, updateAllResourceFlags, updateLockstate, updateOnlineProjectLinks, updateResourceFlags, updateResourcestate, updateSession, updateTaskPar, updateTaskType, userInGroup, writeExportLink, writeExportLinkProcessedState, writeFile, writeFile, writeFileContent, writeFileHeader, writeFileHeader, writeFolder, writeFolder, writeGroup, writeProject, writeProperties, writeProperties, writePropertydefinition, writeResource, writeSystemProperty, writeSystemTaskLog, writeTaskType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsDbAccess

public CmsDbAccess(source.org.apache.java.util.Configurations config)
            throws CmsException
Instanciates the access-module and sets up all required modules and connections.

Parameters:
config - The OpenCms configuration.
Throws:
CmsException - Throws CmsException if something goes wrong.
Method Detail

addUser

public CmsUser addUser(String name,
                       String password,
                       String description,
                       String firstname,
                       String lastname,
                       String email,
                       long lastlogin,
                       long lastused,
                       int flags,
                       Hashtable additionalInfos,
                       CmsGroup defaultGroup,
                       String address,
                       String section,
                       int type)
                throws CmsException
Adds a user to the database.

Overrides:
addUser in class CmsDbAccess
Parameters:
name - username
password - user-password
description - user-description
firstname - user-firstname
lastname - user-lastname
email - user-email
lastlogin - user-lastlogin
lastused - user-lastused
flags - user-flags
additionalInfos - user-additional-infos
defaultGroup - user-defaultGroup
address - user-defauladdress
section - user-section
type - user-type
Returns:
the created user.
Throws:
thorws - CmsException if something goes wrong.
CmsException

clearFilesTable

protected void clearFilesTable()
                        throws CmsException
Deletes all files in CMS_FILES without fileHeader in CMS_RESOURCES

Overrides:
clearFilesTable in class CmsDbAccess
CmsException

createFile

public CmsFile createFile(CmsUser user,
                          CmsProject project,
                          CmsProject onlineProject,
                          String filename,
                          int flags,
                          int parentId,
                          byte[] contents,
                          I_CmsResourceType resourceType)
                   throws CmsException
Creates a new file with the given content and resourcetype.

Overrides:
createFile in class CmsDbAccess
Parameters:
user - The user who wants to create the file.
project - The project in which the resource will be used.
onlineProject - The online project of the OpenCms.
filename - The complete name of the new file (including pathinformation).
flags - The flags of this resource.
parentId - The parentId of the resource.
contents - The contents of the new file.
resourceType - The resourceType of the new file.
Returns:
file The created file.
Throws:
CmsException - Throws CmsException if operation was not succesful

createGroup

public CmsGroup createGroup(String name,
                            String description,
                            int flags,
                            String parent)
                     throws CmsException
Add a new group to the Cms.
Only the admin can do this.

Overrides:
createGroup in class CmsDbAccess
Parameters:
name - The name of the new group.
description - The description for the new group.
flags - The flags for the new group.
Returns:
Group
Throws:
CmsException - Throws CmsException if operation was not succesfull.

deleteProjectProperties

public void deleteProjectProperties(CmsProject project)
                             throws CmsException
Deletes all properties for a project.

Overrides:
deleteProjectProperties in class CmsDbAccess
Parameters:
project - The project to delete.
Throws:
CmsException - Throws CmsException if operation was not succesful

getAllBackupProjects

public Vector getAllBackupProjects()
                            throws CmsException
Returns all projects from the history.

Overrides:
getAllBackupProjects in class CmsDbAccess
Returns:
a Vector of projects.
CmsException

destroy

public void destroy()
             throws CmsException
Destroys this access-module

Overrides:
destroy in class CmsDbAccess
Throws:
throws - CmsException if something goes wrong.
CmsException

fillDefaults

protected void fillDefaults()
                     throws CmsException
Private method to init all default-resources

Overrides:
fillDefaults in class CmsDbAccess
CmsException

findAgent

protected int findAgent(int roleid)
                 throws CmsException
Finds an agent for a given role (group).

Overrides:
findAgent in class CmsDbAccess
Returns:
A vector with the tasks
Throws:
CmsException - Throws CmsException if something goes wrong.

getQueries

protected CmsQueries getQueries()
retrieve the correct instance of the queries holder. This method should be overloaded if other query strings should be used.

Overrides:
getQueries in class CmsDbAccess

readFile

public CmsFile readFile(int projectId,
                        int onlineProjectId,
                        String filename)
                 throws CmsException
Reads a file from the Cms.

Overrides:
readFile in class CmsDbAccess
Parameters:
projectId - The Id of the project in which the resource will be used.
onlineProjectId - The online projectId of the OpenCms.
filename - The complete name of the new file (including pathinformation).
Returns:
file The read file.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFile

public CmsFile readFile(int projectId,
                        int onlineProjectId,
                        String filename,
                        boolean includeDeleted)
                 throws CmsException
Reads a file from the Cms.

Overrides:
readFile in class CmsDbAccess
Parameters:
projectId - The Id of the project in which the resource will be used.
onlineProjectId - The online projectId of the OpenCms.
filename - The complete name of the new file (including pathinformation).
Returns:
file The read file.
Throws:
CmsException - Throws CmsException if operation was not succesful

createTask

public CmsTask createTask(int rootId,
                          int parentId,
                          int tasktype,
                          int ownerId,
                          int agentId,
                          int roleId,
                          String taskname,
                          Timestamp wakeuptime,
                          Timestamp timeout,
                          int priority)
                   throws CmsException
Creates a new task.

MySQL 4 does not support the SQL from the generic driver, so that's why we have that special implementation here. This was tested with MySQL 4.0.10.

Overrides:
createTask in class CmsDbAccess
Parameters:
rootId - id of the root task project
parentId - id of the parent task
tasktype - type of the task
ownerId - id of the owner
agentId - id of the agent
roleId - id of the role
taskname - name of the task
wakeuptime - time when the task will be wake up
timeout - time when the task times out
priority - priority of the task
Returns:
the Task object of the generated task
Throws:
CmsException - if something goes wrong.

readTask

public CmsTask readTask(int id)
                 throws CmsException
Reads a task from the Cms with added escaping of Strings since MySQL dosen't support Unicode strings

Overrides:
readTask in class CmsDbAccess
Parameters:
id - the id of the task to read
Returns:
a task object or null if the task is not found
Throws:
CmsException - if something goes wrong

readTasks

public Vector readTasks(CmsProject project,
                        CmsUser agent,
                        CmsUser owner,
                        CmsGroup role,
                        int tasktype,
                        String orderBy,
                        String sort)
                 throws CmsException
Reads all tasks of a user in a project with added escaping of Strings since MySQL dosen't support Unicode strings.

Overrides:
readTasks in class CmsDbAccess
Parameters:
project - the Project in which the tasks are defined
agent - the task agent
owner - the task owner .
tasktype - one of C_TASKS_ALL, C_TASKS_OPEN, C_TASKS_DONE, C_TASKS_NEW
orderBy - selects filter how to order the tasks
sort - select to sort ascending or descending ("ASC" or "DESC")
Returns:
a vector with the tasks read
Throws:
CmsException - Throws CmsException if something goes wrong.

writeTask

public CmsTask writeTask(CmsTask task)
                  throws CmsException
Writes a task from the Cms with added escaping of Strings since MySQL dosen't support Unicode strings

Overrides:
writeTask in class CmsDbAccess
Parameters:
task - The task that will be written.
Returns:
written task object
Throws:
CmsException - if something goes wrong

writeProperty

public void writeProperty(String meta,
                          int projectId,
                          String value,
                          CmsResource resource,
                          int resourceType,
                          boolean addDefinition)
                   throws CmsException
Writes a property for a file or folder with added escaping of property values as MySQL doesn't support Unicode strings

Overrides:
writeProperty in class CmsDbAccess
Parameters:
meta - The property-name of which the property has to be read.
value - The value for the property to be set.
resourceType - The Type of the resource.
addDefinition - If true then the propertydefinition is added if it not exists
Throws:
CmsException - Throws CmsException if operation was not succesful

readProperty

public String readProperty(String meta,
                           int projectId,
                           CmsResource resource,
                           int resourceType)
                    throws CmsException
Added unescaping of property values as MySQL doesn't support Unicode strings

Overrides:
readProperty in class CmsDbAccess
Parameters:
meta - The property-name of which the property has to be read.
resourceType - The Type of the resource.
Returns:
property The property as string or null if the property not exists.
Throws:
CmsException - Throws CmsException if operation was not succesful
See Also:
CmsDbAccess.readProperty(String, int, CmsResource, int)

readProperties

public HashMap readProperties(int projectId,
                              CmsResource resource,
                              int resourceType)
                       throws CmsException
Added unescaping of property values as MySQL doesn't support Unicode strings

Overrides:
readProperties in class CmsDbAccess
Parameters:
resource - the resource to read the properties from
resourceType - the type of the resource
Returns:
a Map of Strings representing the properties of the resource
Throws:
CmsException - Throws CmsException if operation was not succesful
See Also:
CmsDbAccess.readProperties(int, CmsResource, int)

writeTaskLog

public void writeTaskLog(int taskId,
                         int userid,
                         Timestamp starttime,
                         String comment,
                         int type)
                  throws CmsException
Writes new log for a task with added escaping of comment as as MySQL doesn't support Unicode strings.

Overrides:
writeTaskLog in class CmsDbAccess
Parameters:
starttime - Time when the log is created.
comment - Description for the log.
type - Type of the log. 0 = Sytem log, 1 = User Log
Throws:
CmsException - if something goes wrong

readTaskLog

public CmsTaskLog readTaskLog(int id)
                       throws CmsException
Reads a log for a task with added unescaping of comment as as MySQL doesn't support Unicode strings.

Overrides:
readTaskLog in class CmsDbAccess
Parameters:
id - The id for the tasklog .
Returns:
A new TaskLog object
Throws:
CmsException - Throws CmsException if something goes wrong.

readTaskLogs

public Vector readTaskLogs(int taskId)
                    throws CmsException
Reads log entries for a task with added unescaping of comment as as MySQL doesn't support Unicode strings.

Overrides:
readTaskLogs in class CmsDbAccess
Returns:
A Vector of new TaskLog objects
Throws:
CmsException - Throws CmsException if something goes wrong.

readProjectLogs

public Vector readProjectLogs(int projectid)
                       throws CmsException
Reads log entries for a project with added unescaping of comment as as MySQL doesn't support Unicode strings.

Overrides:
readProjectLogs in class CmsDbAccess
Returns:
A Vector of new TaskLog objects
Throws:
CmsException - Throws CmsException if something goes wrong.

writeUser

public void writeUser(CmsUser user)
               throws CmsException
Writes a user to the database.

Overrides:
writeUser in class CmsDbAccess
Parameters:
user - the user to write
Throws:
thorws - CmsException if something goes wrong.
CmsException