com.opencms.file.genericSql
Class CmsDbAccess

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

public class CmsDbAccess
extends Object
implements I_CmsConstants, I_CmsLogChannels

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

Version:
$Revision: 1.278.2.1 $ $Date: 2003/06/27 14:59:47 $ *
Author:
Andreas Schouten, Michael Emmerich, Hanjo Riege, Anders Fugmann, Finn Nielsen, Mark Foley

Field Summary
protected static String C_CONFIGURATIONS_DIGEST
          Constant to get property from configurations.
protected static String C_CONFIGURATIONS_DIGEST_FILE_ENCODING
          Constant to get property from configurations.
protected static String C_CONFIGURATIONS_POOL
          Constant to get property from configurations.
protected static int C_MAX_TABLES
          The maximum amount of tables.
protected static int C_RESTYPE_LINK_ID
           
static long C_SESSION_TIMEOUT
          The session-timeout value: currently six hours.
protected static String C_TABLE_FILES
          Table-key for max-id
protected static String C_TABLE_GROUPS
          Table-key for max-id
protected static String C_TABLE_GROUPUSERS
          Table-key for max-id
protected static String C_TABLE_PROJECTS
          Table-key for max-id
protected static String C_TABLE_PROPERTIES
          Table-key for max-id
protected static String C_TABLE_PROPERTYDEF
          Table-key for max-id
protected static String C_TABLE_RESOURCES
          Table-key for max-id
protected static String C_TABLE_SYSTEMPROPERTIES
          Table-key for max-id
protected static String C_TABLE_TASK
          Table-key for max-id
protected static String C_TABLE_TASKLOG
          Table-key for max-id
protected static String C_TABLE_TASKPAR
          Table-key for max-id
protected static String C_TABLE_TASKTYPE
          Table-key for max-id
protected static String C_TABLE_USERS
          Table-key for max-id
protected static boolean C_USE_TARGET_DATE
           
protected  CmsQueries m_cq
          'Constants' file.
protected  MessageDigest m_digest
          A digest to encrypt the passwords.
protected  String m_digestFileEncoding
          The file.encoding to code passwords after encryption with digest.
protected  int[] m_maxIds
          A array containing all max-ids for the tables.
protected  String m_poolName
          The name of the pool to use
protected  String m_poolNameBackup
          The name of the backup pool to use
protected  String m_poolNameOnline
          The name of the online pool to use
 
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 addImportUser(String name, String password, String recoveryPassword, 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.
 Serializable addSystemProperty(String name, Serializable object)
          Creates a serializable object in the systempropertys.
 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.
 void addUserToGroup(int userid, int groupid)
          Adds a user to a group.
 void backupProject(CmsProject project, int versionId, long publishDate, CmsUser currentUser)
          Creates a backup of the published project
 void backupResource(int projectId, CmsResource resource, byte[] content, Map properties, int versionId, long publishDate)
          Creates a backup of the published resource
 void changeLockedInProject(int newProjectId, String resourcename)
          Changes the project-id of a resource to the new project for publishing the resource directly
 void changeUserType(int userId, int userType)
          Changes the user type of the user
protected  String checkExport(String filename, Hashtable exportpoints)
          Private helper method for publihing into the filesystem.
 int checkGroupDependence(Vector groups)
          checks a Vector of Groupids for the Group which can read all files
protected  String checkNull(String value)
          Checks, if the String was null or is empty.
protected  void clearFilesTable()
          Deletes all files in CMS_FILES without fileHeader in CMS_RESOURCES
 void copyFile(CmsProject project, CmsProject onlineProject, int userId, String source, int parentId, String destination)
          Copies the file.
 int countLockedResources(CmsProject project)
          Counts the locked resources in this project.
protected  int countProperties(CmsPropertydefinition metadef)
          Returns the amount of properties for a propertydefinition.
 CmsFile createFile(CmsProject project, CmsProject onlineProject, CmsFile file, int userId, int parentId, String filename)
          Creates a new file from an given CmsFile object and a new filename.
 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.
protected  void createFileContent(int fileId, byte[] fileContent, int versionId, String usedPool, String usedStatement)
          Creates the content entry for a file
 CmsFolder createFolder(CmsUser user, CmsProject project, CmsProject onlineProject, CmsFolder folder, int parentId, String foldername)
          Creates a new folder from an existing folder object.
 CmsFolder createFolder(CmsUser user, CmsProject project, int parentId, int fileId, String foldername, int flags)
          Creates a new folder
 CmsGroup createGroup(String name, String description, int flags, String parent)
          Add a new group to the Cms.
 void createLinkEntrys(int pageId, Vector linkTargets)
          creates a link entry for each of the link targets in the linktable.
 void createOnlineLinkEntrys(int pageId, Vector linkTargets)
          creates a link entry for each of the link targets in the online linktable.
 CmsProject createProject(CmsUser owner, CmsGroup group, CmsGroup managergroup, CmsTask task, String name, String description, int flags, int type)
          Creates a project.
 void createProjectResource(int projectId, String resourceName)
          Creates a new projectResource from an given CmsResource object.
 CmsPropertydefinition createPropertydefinition(String name, int resourcetype, int projectId)
          Creates the propertydefinitions for the resource type.
 CmsResource createResource(CmsProject project, CmsProject onlineProject, CmsResource newResource, byte[] filecontent, int userId, boolean isFolder)
          Creates a new resource from an given CmsResource object.
 void createSession(String sessionId, Hashtable data)
          This method creates a new session in the database.
 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 deleteAllProjectResources(int projectId)
          delete all projectResource from an given CmsProject object.
 void deleteAllProperties(int projectId, CmsResource resource)
          Deletes all properties for a file or folder.
 void deleteAllProperties(int projectId, int resourceId)
          Deletes all properties for a file or folder.
 int deleteBackups(long maxdate)
          Deletes the versions from the backup tables that are older then the given date
 void deleteExportLink(CmsExportLink link)
          Deletes an exportlink from the Cms.
 void deleteExportLink(String link)
          Deletes an exportlink from the Cms.
 void deleteFile(CmsProject project, String filename)
          Deletes the file.
 void deleteFolder(CmsProject project, CmsFolder orgFolder)
          Deletes the folder.
 void deleteGroup(String delgroup)
          Delete a group from the Cms.
 void deleteLinkEntrys(int pageId)
          deletes all entrys in the link table that belong to the pageId
 void deleteOnlineLinkEntrys(int pageId)
          deletes all entrys in the online link table that belong to the pageId
 void deleteProject(CmsProject project)
          Deletes a project from the cms.
 void deleteProjectProperties(CmsProject project)
          Deletes all properties for a project.
 void deleteProjectResource(int projectId, String resourceName)
          delete a projectResource from an given CmsResource object.
 void deleteProjectResources(CmsProject project)
          Deletes a specified project
 void deleteProperty(String meta, int projectId, CmsResource resource, int resourceType)
          Deletes a property for a file or folder.
 void deletePropertydefinition(CmsPropertydefinition metadef)
          Delete the propertydefinitions for the resource type.
protected  void deleteResource(CmsResource resource)
          Private helper method to delete a resource.
 void deleteSessions()
          Deletes old sessions.
 void deleteSystemProperty(String name)
          Deletes a serializable object from the systempropertys.
 void deleteUser(int id)
          Deletes a user from the database.
 void deleteUser(String name)
          Deletes a user from the database.
 void destroy()
          Destroys this access-module
protected  String digest(String value)
          Private method to encrypt the passwords.
 void endTask(int taskId)
          Ends a task from the Cms.
 int fetchAllVfsLinks(CmsProject theProject, ArrayList theResourceIDs, ArrayList theLinkContents, ArrayList theLinkResources, int theResourceTypeLinkID)
          Fetch all VFS links pointing to other VFS resources.
protected  long fetchDateFromResource(int theProjectId, int theResourceId, long theDefaultDate)
           
 int fetchResourceFlags(CmsProject theProject, String theResourceName)
          Fetches the RESOURCE_FLAGS attribute for a given resource name.
 int fetchResourceID(CmsProject theProject, String theResourceName, int skipResourceTypeID)
          Fetch the ID for a given VFS link target.
 ArrayList fetchVfsLinksForResourceID(CmsProject theProject, int theResourceID, int theResourceTypeLinkID)
          Fetches all VFS links pointing to a given resource ID.
protected  void fillDefaults()
          Private method to init all default-resources
protected  int findAgent(int roleid)
          Finds an agent for a given role (group).
 void forwardTask(int taskId, int newRoleId, int newUserId)
          Forwards a task to another user.
 Vector getAllAccessibleProjectsByGroup(CmsGroup group)
          Returns all projects, which are accessible by a group.
 Vector getAllAccessibleProjectsByManagerGroup(CmsGroup group)
          Returns all projects, which are manageable by a group.
 Vector getAllAccessibleProjectsByUser(CmsUser user)
          Returns all projects, which are owned by a user.
 Vector getAllBackupProjects()
          Returns all projects from the history.
 Vector getAllExportLinks()
          Reads all export links.
 Vector getAllProjects(int state)
          Returns all projects, with the overgiven state.
 int getBackupVersionId()
          Get the next version id for the published backup resources
 void getBrokenLinks(I_CmsReport report, Vector changed, Vector deleted, Vector newRes)
          checks a project for broken links that would appear if the project is published.
protected  byte[] getBytesFromResultset(ResultSet res, String columnName)
          Returns the bytes from a result set
 Vector getChild(String groupname)
          Returns all child groups of a groups

protected  void getConnectionPools(source.org.apache.java.util.Configurations config, String rbName)
          Gets all necessary connection pools This method can be adjusted for each resourcebroker
 Vector getDependingExportLinks(Vector resources)
          Reads all export links that depend on the resource.
 Vector getFilesInFolder(int projectId, CmsFolder parentFolder)
          Returns a Vector with all file headers of a folder.
 Vector getFilesWithProperty(int projectId, String propertyDefinition, String propertyValue)
          Returns a Vector with all resource-names that have set the given property to the given value.
 Vector getFolderTree(int projectId, String rootName)
          Reads the complete folder-tree for this project.
 Vector getGroups()
          Returns all groups

 Vector getGroupsOfUser(String name)
          Returns a list of groups of a user.
 Vector getOnlineBrokenLinks()
          serches for broken links in the online project.
 CmsProject getOnlineProject()
          Retrieves the online project from the database.
 Vector getOnlineResourceNames()
          This method reads all resource names from the table CmsOnlineResources
protected  CmsQueries getQueries()
          retrieve the correct instance of the queries holder.
 String getReadingpermittedGroup(int projectId, String resource)
          Checks which Group can read the resource and all the parent folders.
 Vector getResourcesInFolder(int projectId, CmsFolder offlineResource)
          Reads all resources (including the folders) residing in a folder
 Vector getResourcesWithProperty(int projectId, String propertyDefinition)
          Returns a Vector with all resources of the given type that have set the given property.
 Vector getResourcesWithProperty(int projectId, String propertyDefinition, String propertyValue, int resourceType)
          Returns a Vector with all resources of the given type that have set the given property to the given value.
 Vector getSubFolders(int projectId, CmsFolder parentFolder)
          Returns a Vector with all subfolders.
 String getTaskPar(int taskId, String parname)
          Get a parameter value for a task.
 int getTaskType(String taskName)
          Get the template task id fo a given taskname.
protected  String getTaskTypeConditon(boolean first, int tasktype)
           
protected  Vector getUndeletedResources(Vector resources)
          Gets all resources that are marked as undeleted.
 Vector getUsers(int type)
          Gets all users of a type.
 Vector getUsers(int type, String namefilter)
          Gets all users of a type and namefilter.
 Vector getUsersByLastname(String lastname, int userType, int userStatus, int wasLoggedIn, int nMax)
          Gets all users with a certain Lastname.
 Vector getUsersOfGroup(String name, int type)
          Returns a list of users of a group.
protected  int insertTaskPar(int taskId, String parname, String parvalue)
           
protected  int insertTaskType(int autofinish, int escalationtyperef, String htmllink, String name, String permission, int priorityref, int roleref)
           
protected  void m_doSetBytes(PreparedStatement statement, int posn, byte[] content)
          TESTFIX (mfoley@iee.org) New Code: Performs an Oracle-safe setBytes() action.
protected  int nextId(String key)
          Private method to get the next id for a table.
 Vector publishProject(CmsUser user, int projectId, CmsProject onlineProject, boolean enableHistory, I_CmsReport report, Hashtable exportpoints)
          Publishes a specified project to the online project.
 Vector readAllFileHeaders(int projectId, String resourceName)
          Reads all file headers of a file in the OpenCms.
 Vector readAllFileHeadersForHist(String resourceName)
          Reads all file headers of a file in the OpenCms.
 Vector readAllProjectResources(int projectId)
          select all projectResources from an given project
 Vector readAllPropertydefinitions(I_CmsResourceType resourcetype, int projectId)
          Reads all propertydefinitions for the given resource type.
 Vector readAllPropertydefinitions(int resourcetype, int projectId)
          Reads all propertydefinitions for the given resource type.
 CmsBackupProject readBackupProject(int versionId)
          Reads a project from the backup tables.
protected  Vector readBackupProjectResources(int versionId)
          select a projectResource from an given project and resourcename
 CmsExportLink readExportLink(String request)
          Reads a exportrequest from the Cms.
 CmsExportLink readExportLinkHeader(String request)
          Reads a exportrequest without the dependencies from the Cms.
 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.
protected  byte[] readFileContent(int projectId, int fileId)
          Private helper method to read the fileContent for publishProject(export).
 CmsBackupResource readFileForHist(int versionId, String filename)
          Reads a file from the history of the Cms.
 CmsFile readFileHeader(int projectId, CmsResource resource)
          Reads a file header from the Cms.
 CmsFile readFileHeader(int projectId, int resourceId)
          Reads a file header from the Cms.
 CmsFile readFileHeader(int projectId, String filename, boolean includeDeleted)
          Reads a file header from the Cms.
 CmsBackupResource readFileHeaderForHist(int versionId, String filename)
          Reads a file header from the backup of the Cms.
 CmsFile readFileHeaderInProject(int projectId, String filename)
          Reads a file header from the Cms.
 CmsFile readFileInProject(int projectId, int onlineProjectId, String filename)
          Reads a file in the project from the Cms.
 Vector readFiles(int projectId)
          Reads all files from the Cms, that are in one project.
 Vector readFiles(int projectId, boolean includeUnchanged, boolean onlyProject)
          Reads all files from the Cms, that are in one project.
 Vector readFilesByType(int projectId, int resourcetype)
          Reads all files from the Cms, that are of the given type.
 CmsFolder readFolder(int projectId, int folderid)
          Reads a folder from the Cms.
 CmsFolder readFolder(int projectId, String foldername)
          Reads a folder from the Cms.
 CmsFolder readFolderInProject(int projectId, String foldername)
          Reads a folder from the Cms that exists in the project.
 Vector readFolders(int projectId)
          Reads all folders from the Cms, that are in one project.
 Vector readFolders(int projectId, boolean includeUnchanged, boolean onlyProject)
          Reads all folders from the Cms, that are in one project.
 CmsGroup readGroup(int id)
          Returns a group object.
 CmsGroup readGroup(String groupname)
          Returns a group object.
 Vector readLinkEntrys(int pageId)
          returns a Vector (Strings) with the link destinations of all links on the page with the pageId.
 Vector readOnlineLinkEntrys(int pageId)
          returns a Vector (Strings) with the link destinations of all links on the page with the pageId.
 CmsProject readProject(CmsTask task)
          Reads a project by task-id.
 CmsProject readProject(int id)
          Reads a project.
 Vector readProjectLogs(int projectid)
          Reads log entries for a project.
 String readProjectResource(int projectId, String resourcename)
          select a projectResource from an given project and resourcename
 Vector readProjectView(int currentProject, int project, String filter)
          Reads all resource from the Cms, that are in one project.
 HashMap readProperties(int projectId, CmsResource resource, int resourceType)
          Returns a list of all properties of a file or folder.
 String readProperty(String meta, int projectId, CmsResource resource, int resourceType)
          Returns a property of a file or folder.
 CmsPropertydefinition readPropertydefinition(String name, I_CmsResourceType type, int projectId)
          Reads a propertydefinition for the given resource type.
 CmsPropertydefinition readPropertydefinition(String name, int type, int projectId)
          Reads a propertydefinition for the given resource type.
protected  CmsResource readResource(CmsProject project, String filename)
          Reads a resource from the Cms.
 Vector readResources(CmsProject project)
          Reads all resource from the Cms, that are in one project.
 Vector readResourcesLikeName(CmsProject project, String resourcename)
          Reads all resources that contains the given string in the resourcename and exists in the current project.
 Hashtable readSession(String sessionId)
          Reads a session from the database.
 Serializable readSystemProperty(String name)
          Reads a serializable object from the systempropertys.
 CmsTask readTask(int id)
          Reads a task from the Cms.
 CmsTaskLog readTaskLog(int id)
          Reads a log for a task.
 Vector readTaskLogs(int taskId)
          Reads log entries for a task.
 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.
 CmsUser readUser(int id)
          Reads a user from the cms, only if the password is correct.
 CmsUser readUser(String name, int type)
          Reads a user from the cms.
 CmsUser readUser(String name, String password, int type)
          Reads a user from the cms, only if the password is correct.
 void recoverPassword(String user, String recoveryPassword, String password)
          Sets the password, only if the user knows the recovery-password.
 void removeFile(int projectId, String filename)
          Deletes a file in the database.
 void removeFolder(int projectId, CmsFolder folder)
          Deletes a folder in the database.
protected  void removeFolderForPublish(int projectId, String foldername)
          Deletes a folder in the database.
protected  void removeTemporaryFile(CmsFile file)
          Removes the temporary files of the given resource
 void removeUserFromGroup(int userid, int groupid)
          Removes a user from a group.
 void renameFile(CmsProject project, CmsProject onlineProject, int userId, int oldfileID, String newname)
          Renames the file to the new name.
 void setPassword(String user, String password)
          Sets a new password for a user.
 void setRecoveryPassword(String user, String password)
          Sets a new password for a user.
 int setTaskPar(int taskId, String parname, String parvalue)
          Set a Parameter for a task.
protected  Vector SortEntrys(Vector list)
          Sorts a vector of files or folders alphabetically.
 void undeleteFile(CmsProject project, String filename)
          Undeletes the file.
 void unlockProject(CmsProject project)
          Unlocks all resources in this project.
 int updateAllResourceFlags(CmsProject theProject, int theValue)
          Update the resources flag attribute of all resources.
 void updateLockstate(CmsResource res, int projectId)
          Updates the LOCKED_BY state of a Resource.
 void updateOnlineProjectLinks(Vector deleted, Vector changed, Vector newRes, int pageType)
          When a project is published this method aktualises the online link table.
 int updateResourceFlags(CmsProject theProject, int theResourceID, int theValue)
          Update the resource flag attribute for a given resource.
 void updateResourcestate(CmsResource res)
          Updates the state of a Resource.
 int updateSession(String sessionId, Hashtable data)
          This method updates a session in the database.
protected  void updateTaskPar(int parid, String parvalue)
           
protected  void updateTaskType(int taskId, int autofinish, int escalationtyperef, String htmllink, String name, String permission, int priorityref, int roleref)
           
 boolean userInGroup(int userid, int groupid)
          Checks if a user is member of a group.
 void writeExportLink(CmsExportLink link)
          Writes an exportlink to the Cms.
 void writeExportLinkProcessedState(CmsExportLink link)
          Sets one exportLink to procecced.
 void writeFile(CmsProject project, CmsProject onlineProject, CmsFile file, boolean changed)
          Writes a file to the Cms.
 void writeFile(CmsProject project, CmsProject onlineProject, CmsFile file, boolean changed, int userId)
          Writes a file to the Cms.
protected  void writeFileContent(int fileId, byte[] fileContent, String usedPool, String usedStatement)
          Writes the file content of an existing file
 void writeFileHeader(CmsProject project, CmsFile file, boolean changed)
          Writes the fileheader to the Cms.
 void writeFileHeader(CmsProject project, CmsFile file, boolean changed, int userId)
          Writes the fileheader to the Cms.
 void writeFolder(CmsProject project, CmsFolder folder, boolean changed)
          Writes a folder to the Cms.
 void writeFolder(CmsProject project, CmsFolder folder, boolean changed, int userId)
          Writes a folder to the Cms.
 void writeGroup(CmsGroup group)
          Writes an already existing group in the Cms.
 void writeProject(CmsProject project)
          Deletes a project from the cms.
 void writeProperties(Map propertyinfos, int projectId, CmsResource resource, int resourceType)
          Writes a couple of Properties for a file or folder.
 void writeProperties(Map propertyinfos, int projectId, CmsResource resource, int resourceType, boolean addDefinition)
          Writes a couple of Properties for a file or folder.
 void writeProperty(String meta, int projectId, String value, CmsResource resource, int resourceType, boolean addDefinition)
          Writes a property for a file or folder.
 CmsPropertydefinition writePropertydefinition(CmsPropertydefinition propertyDef, int projectId)
          Updates the name of the propertydefinition for the resource type.
 void writeResource(CmsProject project, CmsResource resource, byte[] filecontent, boolean changed, int userId)
          Writes a folder to the Cms.
 Serializable writeSystemProperty(String name, Serializable object)
          Writes a serializable object to the systemproperties.
 void writeSystemTaskLog(int taskid, String comment)
           
 CmsTask writeTask(CmsTask task)
          Updates a task.
 void writeTaskLog(int taskId, int userid, Timestamp starttime, String comment, int type)
          Writes new log for a task.
 int writeTaskType(int autofinish, int escalationtyperef, String htmllink, String name, String permission, int priorityref, int roleref)
          Creates a new tasktype set in the database.
 void writeUser(CmsUser user)
          Writes a user to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C_RESTYPE_LINK_ID

protected static int C_RESTYPE_LINK_ID

C_USE_TARGET_DATE

protected static boolean C_USE_TARGET_DATE

m_poolName

protected String m_poolName
The name of the pool to use


m_poolNameOnline

protected String m_poolNameOnline
The name of the online pool to use


m_poolNameBackup

protected String m_poolNameBackup
The name of the backup pool to use


C_SESSION_TIMEOUT

public static long C_SESSION_TIMEOUT
The session-timeout value: currently six hours. After that time the session can't be restored.


C_MAX_TABLES

protected static int C_MAX_TABLES
The maximum amount of tables.


C_TABLE_SYSTEMPROPERTIES

protected static String C_TABLE_SYSTEMPROPERTIES
Table-key for max-id


C_TABLE_GROUPS

protected static String C_TABLE_GROUPS
Table-key for max-id


C_TABLE_GROUPUSERS

protected static String C_TABLE_GROUPUSERS
Table-key for max-id


C_TABLE_USERS

protected static String C_TABLE_USERS
Table-key for max-id


C_TABLE_PROJECTS

protected static String C_TABLE_PROJECTS
Table-key for max-id


C_TABLE_RESOURCES

protected static String C_TABLE_RESOURCES
Table-key for max-id


C_TABLE_FILES

protected static String C_TABLE_FILES
Table-key for max-id


C_TABLE_PROPERTYDEF

protected static String C_TABLE_PROPERTYDEF
Table-key for max-id


C_TABLE_PROPERTIES

protected static String C_TABLE_PROPERTIES
Table-key for max-id


C_TABLE_TASK

protected static String C_TABLE_TASK
Table-key for max-id


C_TABLE_TASKTYPE

protected static String C_TABLE_TASKTYPE
Table-key for max-id


C_TABLE_TASKPAR

protected static String C_TABLE_TASKPAR
Table-key for max-id


C_TABLE_TASKLOG

protected static String C_TABLE_TASKLOG
Table-key for max-id


C_CONFIGURATIONS_DIGEST

protected static String C_CONFIGURATIONS_DIGEST
Constant to get property from configurations.


C_CONFIGURATIONS_DIGEST_FILE_ENCODING

protected static String C_CONFIGURATIONS_DIGEST_FILE_ENCODING
Constant to get property from configurations.


C_CONFIGURATIONS_POOL

protected static String C_CONFIGURATIONS_POOL
Constant to get property from configurations.


m_maxIds

protected int[] m_maxIds
A array containing all max-ids for the tables.


m_digest

protected MessageDigest m_digest
A digest to encrypt the passwords.


m_digestFileEncoding

protected String m_digestFileEncoding
The file.encoding to code passwords after encryption with digest.


m_cq

protected CmsQueries m_cq
'Constants' file.

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

m_doSetBytes

protected void m_doSetBytes(PreparedStatement statement,
                            int posn,
                            byte[] content)
                     throws SQLException
TESTFIX (mfoley@iee.org) New Code: Performs an Oracle-safe setBytes() action.

Parameters:
statement - The PreparedStatement.
posn - The parameter placeholder in the prepared statement.
content - The byte array to be inserted into the prepared statement.
Throws:
SQLException - Throws SQLException if something goes wrong.

getConnectionPools

protected void getConnectionPools(source.org.apache.java.util.Configurations config,
                                  String rbName)
Gets all necessary connection pools This method can be adjusted for each resourcebroker

Parameters:
config - The configuration

addSystemProperty

public Serializable addSystemProperty(String name,
                                      Serializable object)
                               throws CmsException
Creates a serializable object in the systempropertys.

Parameters:
name - The name of the property.
object - The property-object.
Returns:
object The property-object.
Throws:
CmsException - Throws CmsException if something goes wrong.

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.

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

addImportUser

public CmsUser addImportUser(String name,
                             String password,
                             String recoveryPassword,
                             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.

Parameters:
name - username
password - user-password
recoveryPassword - user-recoveryPassword
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

addUserToGroup

public void addUserToGroup(int userid,
                           int groupid)
                    throws CmsException
Adds a user to a group.
Only the admin can do this.

Parameters:
userid - The id of the user that is to be added to the group.
groupid - The id of the group.
Throws:
CmsException - Throws CmsException if operation was not succesfull.

checkExport

protected String checkExport(String filename,
                             Hashtable exportpoints)
Private helper method for publihing into the filesystem. test if resource must be written to the filesystem

Parameters:
filename - Name of a resource in the OpenCms system.
Returns:
key in exportpoint Hashtable or null.

checkNull

protected String checkNull(String value)
Checks, if the String was null or is empty. If this is so it returns " ". This is for oracle-issues, because in oracle an empty string is the same as null.

Parameters:
value - the String to check.
Returns:
the value, or " " if needed.

clearFilesTable

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

CmsException

copyFile

public void copyFile(CmsProject project,
                     CmsProject onlineProject,
                     int userId,
                     String source,
                     int parentId,
                     String destination)
              throws CmsException
Copies the file.

Parameters:
project - The project in which the resource will be used.
onlineProject - The online project of the OpenCms.
userId - The id of the user who wants to copy the file.
source - The complete path of the sourcefile.
parentId - The parentId of the resource.
destination - The complete path of the destinationfile.
Throws:
CmsException - Throws CmsException if operation was not succesful.

countLockedResources

public int countLockedResources(CmsProject project)
                         throws CmsException
Counts the locked resources in this project.

Parameters:
project - The project to be unlocked.
Returns:
the amount of locked resources in this project.
Throws:
CmsException - Throws CmsException if something goes wrong.

countProperties

protected int countProperties(CmsPropertydefinition metadef)
                       throws CmsException
Returns the amount of properties for a propertydefinition.

Parameters:
metadef - The propertydefinition to test.
Returns:
the amount of properties for a propertydefinition.
Throws:
CmsException - Throws CmsException if something goes wrong.

createFile

public CmsFile createFile(CmsProject project,
                          CmsProject onlineProject,
                          CmsFile file,
                          int userId,
                          int parentId,
                          String filename)
                   throws CmsException
Creates a new file from an given CmsFile object and a new filename.

Parameters:
project - The project in which the resource will be used.
onlineProject - The online project of the OpenCms.
file - The file to be written to the Cms.
parentId - The parentId of the resource.
filename - The complete new name of the file (including pathinformation).
Returns:
file The created file.
Throws:
CmsException - Throws CmsException if operation was not succesful

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.

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

createFolder

public CmsFolder createFolder(CmsUser user,
                              CmsProject project,
                              int parentId,
                              int fileId,
                              String foldername,
                              int flags)
                       throws CmsException
Creates a new folder

Parameters:
user - The user who wants to create the folder.
project - The project in which the resource will be used.
parentId - The parentId of the folder.
fileId - The fileId of the folder.
foldername - The complete path to the folder in which the new folder will be created.
flags - The flags of this resource.
Returns:
The created folder.
Throws:
CmsException - Throws CmsException if operation was not succesful.

createFolder

public CmsFolder createFolder(CmsUser user,
                              CmsProject project,
                              CmsProject onlineProject,
                              CmsFolder folder,
                              int parentId,
                              String foldername)
                       throws CmsException
Creates a new folder from an existing folder object.

Parameters:
user - The user who wants to create the folder.
project - The project in which the resource will be used.
onlineProject - The online project of the OpenCms.
folder - The folder to be written to the Cms.
parentId - The parentId of the resource.
foldername - The complete path of the new name of this folder.
Returns:
The created folder.
Throws:
CmsException - Throws CmsException if operation was not succesful.

createResource

public CmsResource createResource(CmsProject project,
                                  CmsProject onlineProject,
                                  CmsResource newResource,
                                  byte[] filecontent,
                                  int userId,
                                  boolean isFolder)
                           throws CmsException
Creates a new resource from an given CmsResource object.

Parameters:
project - The project in which the resource will be used.
onlineProject - The online project of the OpenCms.
newResource - The resource to be written to the Cms.
filecontent - The filecontent if the resource is a file
userId - The ID of the current user.
Returns:
resource The created resource.
Throws:
CmsException - Throws CmsException if operation was not succesful

createProjectResource

public void createProjectResource(int projectId,
                                  String resourceName)
                           throws CmsException
Creates a new projectResource from an given CmsResource object.

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.

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.

createProject

public CmsProject createProject(CmsUser owner,
                                CmsGroup group,
                                CmsGroup managergroup,
                                CmsTask task,
                                String name,
                                String description,
                                int flags,
                                int type)
                         throws CmsException
Creates a project.

Parameters:
owner - The owner of this project.
group - The group for this project.
managergroup - The managergroup for this project.
task - The task.
name - The name of the project to create.
description - The description for the new project.
flags - The flags for the project (e.g. archive).
type - the type for the project (e.g. normal).
Throws:
CmsException - Throws CmsException if something goes wrong.

createPropertydefinition

public CmsPropertydefinition createPropertydefinition(String name,
                                                      int resourcetype,
                                                      int projectId)
                                               throws CmsException
Creates the propertydefinitions for the resource type.
Only the admin can do this.

Parameters:
name - The name of the propertydefinitions to overwrite.
resourcetype - The resource-type for the propertydefinitions.
Throws:
CmsException - Throws CmsException if something goes wrong.

createSession

public void createSession(String sessionId,
                          Hashtable data)
                   throws CmsException
This method creates a new session in the database. It is used for sessionfailover.

Parameters:
sessionId - the id of the session.
Returns:
data the sessionData.
CmsException

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.

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.

deleteAllProperties

public void deleteAllProperties(int projectId,
                                CmsResource resource)
                         throws CmsException
Deletes all properties for a file or folder.

Throws:
CmsException - Throws CmsException if operation was not succesful

deleteAllProperties

public void deleteAllProperties(int projectId,
                                int resourceId)
                         throws CmsException
Deletes all properties for a file or folder.

Parameters:
resourceId - The id of the resource.
Throws:
CmsException - Throws CmsException if operation was not succesful

deleteFile

public void deleteFile(CmsProject project,
                       String filename)
                throws CmsException
Deletes the file.

Parameters:
project - The project in which the resource will be used.
filename - The complete path of the file.
Throws:
CmsException - Throws CmsException if operation was not succesful.

deleteFolder

public void deleteFolder(CmsProject project,
                         CmsFolder orgFolder)
                  throws CmsException
Deletes the folder. Only empty folders can be deleted yet.

Parameters:
project - The project in which the resource will be used.
orgFolder - The folder that will be deleted.
Throws:
CmsException - Throws CmsException if operation was not succesful.

deleteGroup

public void deleteGroup(String delgroup)
                 throws CmsException
Delete a group from the Cms.
Only groups that contain no subgroups can be deleted. Only the admin can do this.

Parameters:
delgroup - The name of the group that is to be deleted.
Throws:
CmsException - Throws CmsException if operation was not succesfull.

deleteProject

public void deleteProject(CmsProject project)
                   throws CmsException
Deletes a project from the cms. Therefore it deletes all files, resources and properties.

Parameters:
project - the project to delete.
Throws:
CmsException - Throws CmsException if something goes wrong.

deleteProjectProperties

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

Parameters:
project - The project to delete.
Throws:
CmsException - Throws CmsException if operation was not succesful

deleteProjectResources

public void deleteProjectResources(CmsProject project)
                            throws CmsException
Deletes a specified project

Parameters:
project - The project to be deleted.
Throws:
CmsException - Throws CmsException if operation was not succesful.

deleteAllProjectResources

public void deleteAllProjectResources(int projectId)
                               throws CmsException
delete all projectResource from an given CmsProject object.

Throws:
CmsException - Throws CmsException if operation was not succesful

deleteProjectResource

public void deleteProjectResource(int projectId,
                                  String resourceName)
                           throws CmsException
delete a projectResource from an given CmsResource object.

Throws:
CmsException - Throws CmsException if operation was not succesful

deleteProperty

public void deleteProperty(String meta,
                           int projectId,
                           CmsResource resource,
                           int resourceType)
                    throws CmsException
Deletes a property for a file or folder.

Parameters:
meta - The property-name of which the property has to be read.
resourceType - The Type of the resource.
Throws:
CmsException - Throws CmsException if operation was not succesful

deletePropertydefinition

public void deletePropertydefinition(CmsPropertydefinition metadef)
                              throws CmsException
Delete the propertydefinitions for the resource type.
Only the admin can do this.

Parameters:
metadef - The propertydefinitions to be deleted.
Throws:
CmsException - Throws CmsException if something goes wrong.

deleteResource

protected void deleteResource(CmsResource resource)
                       throws CmsException
Private helper method to delete a resource.

Throws:
CmsException - Throws CmsException if operation was not succesful.

deleteSessions

public void deleteSessions()
Deletes old sessions.


deleteSystemProperty

public void deleteSystemProperty(String name)
                          throws CmsException
Deletes a serializable object from the systempropertys.

Parameters:
name - The name of the property.
Throws:
CmsException - Throws CmsException if something goes wrong.

deleteUser

public void deleteUser(int id)
                throws CmsException
Deletes a user from the database.

Throws:
thorws - CmsException if something goes wrong.
CmsException

deleteUser

public void deleteUser(String name)
                throws CmsException
Deletes a user from the database.

Throws:
thorws - CmsException if something goes wrong.
CmsException

destroy

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

Throws:
throws - CmsException if something goes wrong.
CmsException

digest

protected String digest(String value)
Private method to encrypt the passwords.

Parameters:
value - The value to encrypt.
Returns:
The encrypted value.

endTask

public void endTask(int taskId)
             throws CmsException
Ends a task from the Cms.

Throws:
CmsException - Throws CmsException if something goes wrong.

fillDefaults

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

CmsException

findAgent

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

Returns:
A vector with the tasks
Throws:
CmsException - Throws CmsException if something goes wrong.

forwardTask

public void forwardTask(int taskId,
                        int newRoleId,
                        int newUserId)
                 throws CmsException
Forwards a task to another user.

Parameters:
taskId - The id of the task that will be fowarded.
newRoleId - The new Group the task belongs to
newUserId - User who gets the task.
Throws:
CmsException - Throws CmsException if something goes wrong.

getAllAccessibleProjectsByGroup

public Vector getAllAccessibleProjectsByGroup(CmsGroup group)
                                       throws CmsException
Returns all projects, which are accessible by a group.

Parameters:
group - The requesting group.
Returns:
a Vector of projects.
CmsException

getAllAccessibleProjectsByManagerGroup

public Vector getAllAccessibleProjectsByManagerGroup(CmsGroup group)
                                              throws CmsException
Returns all projects, which are manageable by a group.

Parameters:
group - The requesting group.
Returns:
a Vector of projects.
CmsException

getAllAccessibleProjectsByUser

public Vector getAllAccessibleProjectsByUser(CmsUser user)
                                      throws CmsException
Returns all projects, which are owned by a user.

Parameters:
user - The requesting user.
Returns:
a Vector of projects.
CmsException

getAllProjects

public Vector getAllProjects(int state)
                      throws CmsException
Returns all projects, with the overgiven state.

Parameters:
state - The state of the projects to read.
Returns:
a Vector of projects.
CmsException

getAllBackupProjects

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

Returns:
a Vector of projects.
CmsException

getChild

public Vector getChild(String groupname)
                throws CmsException
Returns all child groups of a groups

Parameters:
groupname - The name of the group.
Returns:
users A Vector of all child groups or null.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getFilesInFolder

public Vector getFilesInFolder(int projectId,
                               CmsFolder parentFolder)
                        throws CmsException
Returns a Vector with all file headers of a folder.

Parameters:
parentFolder - The folder to be searched.
Returns:
subfiles A Vector with all file headers of the folder.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getFilesWithProperty

public Vector getFilesWithProperty(int projectId,
                                   String propertyDefinition,
                                   String propertyValue)
                            throws CmsException
Returns a Vector with all resource-names that have set the given property to the given value.

Returns:
Vector with all names of resources.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getResourcesWithProperty

public Vector getResourcesWithProperty(int projectId,
                                       String propertyDefinition,
                                       String propertyValue,
                                       int resourceType)
                                throws CmsException
Returns a Vector with all resources of the given type that have set the given property to the given value.

Returns:
Vector with all resources.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getResourcesWithProperty

public Vector getResourcesWithProperty(int projectId,
                                       String propertyDefinition)
                                throws CmsException
Returns a Vector with all resources of the given type that have set the given property. For the start it is only used by the static export so it reads the online project only.

Returns:
Vector with all resources.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getFolderTree

public Vector getFolderTree(int projectId,
                            String rootName)
                     throws CmsException
Reads the complete folder-tree for this project.

Parameters:
rootName - The name of the root, e.g. /default/vfs
Returns:
A Vecor of folders.
Throws:
CmsException - Throws CmsException if operation was not succesful

getGroups

public Vector getGroups()
                 throws CmsException
Returns all groups

Returns:
users A Vector of all existing groups.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getGroupsOfUser

public Vector getGroupsOfUser(String name)
                       throws CmsException
Returns a list of groups of a user.

Parameters:
name - The name of the user.
Returns:
Vector of groups
Throws:
CmsException - Throws CmsException if operation was not succesful

getOnlineProject

public CmsProject getOnlineProject()
                            throws CmsException
Retrieves the online project from the database.

Returns:
com.opencms.file.CmsProject the onlineproject for the given project.
Throws:
CmsException - Throws CmsException if the resource is not found, or the database communication went wrong.

getReadingpermittedGroup

public String getReadingpermittedGroup(int projectId,
                                       String resource)
                                throws CmsException
Checks which Group can read the resource and all the parent folders.

Returns:
The Group Id of the Group which can read the resource. null for all Groups and Admingroup for no Group.
CmsException

checkGroupDependence

public int checkGroupDependence(Vector groups)
                         throws CmsException
checks a Vector of Groupids for the Group which can read all files

Parameters:
groups - A Vector with groupids (Integer).
Returns:
The id of the group that is in any way parent of all other group or -1 for no dependencies between the groups.
CmsException

getResourcesInFolder

public Vector getResourcesInFolder(int projectId,
                                   CmsFolder offlineResource)
                            throws CmsException
Reads all resources (including the folders) residing in a folder

Parameters:
offlineResource - the parent resource id of the offline resoure.
Returns:
A Vecor of resources.
Throws:
CmsException - Throws CmsException if operation was not succesful

getSubFolders

public Vector getSubFolders(int projectId,
                            CmsFolder parentFolder)
                     throws CmsException
Returns a Vector with all subfolders.

Parameters:
parentFolder - The folder to be searched.
Returns:
Vector with all subfolders for the given folder.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getTaskPar

public String getTaskPar(int taskId,
                         String parname)
                  throws CmsException
Get a parameter value for a task.

Parameters:
parname - Name of the parameter.
Throws:
CmsException - Throws CmsException if something goes wrong.

getTaskType

public int getTaskType(String taskName)
                throws CmsException
Get the template task id fo a given taskname.

Parameters:
taskName - Name of the TAsk
Returns:
id from the task template
Throws:
CmsException - Throws CmsException if something goes wrong.

getTaskTypeConditon

protected String getTaskTypeConditon(boolean first,
                                     int tasktype)

getUndeletedResources

protected Vector getUndeletedResources(Vector resources)
Gets all resources that are marked as undeleted.

Parameters:
resources - Vector of resources
Returns:
Returns all resources that are markes as deleted

getUsers

public Vector getUsers(int type)
                throws CmsException
Gets all users of a type.

Parameters:
type - The type of the user.
Throws:
thorws - CmsException if something goes wrong.
CmsException

getUsers

public Vector getUsers(int type,
                       String namefilter)
                throws CmsException
Gets all users of a type and namefilter.

Parameters:
type - The type of the user.
Throws:
thorws - CmsException if something goes wrong.
CmsException

getUsersOfGroup

public Vector getUsersOfGroup(String name,
                              int type)
                       throws CmsException
Returns a list of users of a group.

Parameters:
name - The name of the group.
type - the type of the users to read.
Returns:
Vector of users
Throws:
CmsException - Throws CmsException if operation was not succesful

getUsersByLastname

public Vector getUsersByLastname(String lastname,
                                 int userType,
                                 int userStatus,
                                 int wasLoggedIn,
                                 int nMax)
                          throws CmsException
Gets all users with a certain Lastname.

Parameters:
wasLoggedIn - was the user ever locked in?
nMax - max number of results
Returns:
the users.
Throws:
CmsException - if operation was not successful.

insertTaskPar

protected int insertTaskPar(int taskId,
                            String parname,
                            String parvalue)
                     throws CmsException
CmsException

insertTaskType

protected int insertTaskType(int autofinish,
                             int escalationtyperef,
                             String htmllink,
                             String name,
                             String permission,
                             int priorityref,
                             int roleref)
                      throws CmsException
CmsException

nextId

protected int nextId(String key)
              throws CmsException
Private method to get the next id for a table. This method is synchronized, to generate unique id's.

Parameters:
key - A key for the table to get the max-id from.
Returns:
next-id The next possible id for this table.
CmsException

publishProject

public Vector publishProject(CmsUser user,
                             int projectId,
                             CmsProject onlineProject,
                             boolean enableHistory,
                             I_CmsReport report,
                             Hashtable exportpoints)
                      throws CmsException
Publishes a specified project to the online project.

Parameters:
onlineProject - The online project of the OpenCms.
report - A report object to provide the loggin messages.
Returns:
a vector of changed or deleted resources.
Throws:
CmsException - Throws CmsException if operation was not succesful.

getBackupVersionId

public int getBackupVersionId()
Get the next version id for the published backup resources

Returns:
int The new version id

backupProject

public void backupProject(CmsProject project,
                          int versionId,
                          long publishDate,
                          CmsUser currentUser)
                   throws CmsException
Creates a backup of the published project

Parameters:
project - The project in which the resource was published.
versionId - The version of the backup
publishDate - The date of publishing
Throws:
CmsException - Throws CmsException if operation was not succesful.

backupResource

public void backupResource(int projectId,
                           CmsResource resource,
                           byte[] content,
                           Map properties,
                           int versionId,
                           long publishDate)
                    throws CmsException
Creates a backup of the published resource

Parameters:
projectId - The project in which the resource was published.
resource - The published resource
content - The file content if the resource is a file.
properties - The properties of the resource.
versionId - The version of the backup
publishDate - The date of publishing
Throws:
CmsException - Throws CmsException if operation was not succesful.

readAllProjectResources

public Vector readAllProjectResources(int projectId)
                               throws CmsException
select all projectResources from an given project

Throws:
CmsException - Throws CmsException if operation was not succesful

readAllFileHeaders

public Vector readAllFileHeaders(int projectId,
                                 String resourceName)
                          throws CmsException
Reads all file headers of a file in the OpenCms.
The reading excludes the filecontent.

Returns:
Vector of file headers read from the Cms.
Throws:
CmsException - Throws CmsException if operation was not succesful

readAllFileHeadersForHist

public Vector readAllFileHeadersForHist(String resourceName)
                                 throws CmsException
Reads all file headers of a file in the OpenCms.
The reading excludes the filecontent.

Returns:
Vector of file headers read from the Cms.
Throws:
CmsException - Throws CmsException if operation was not succesful

readProperties

public HashMap readProperties(int projectId,
                              CmsResource resource,
                              int resourceType)
                       throws CmsException
Returns a list of all properties of a file or folder.

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

readAllPropertydefinitions

public Vector readAllPropertydefinitions(int resourcetype,
                                         int projectId)
                                  throws CmsException
Reads all propertydefinitions for the given resource type.

Parameters:
resourcetype - The resource type to read the propertydefinitions for.
Returns:
propertydefinitions A Vector with propertydefefinitions for the resource type. The Vector is maybe empty.
Throws:
CmsException - Throws CmsException if something goes wrong.

readAllPropertydefinitions

public Vector readAllPropertydefinitions(I_CmsResourceType resourcetype,
                                         int projectId)
                                  throws CmsException
Reads all propertydefinitions for the given resource type.

Parameters:
resourcetype - The resource type to read the propertydefinitions for.
Returns:
propertydefinitions A Vector with propertydefefinitions for the resource type. The Vector is maybe empty.
Throws:
CmsException - Throws CmsException if something goes wrong.

readFile

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

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

deleteLinkEntrys

public void deleteLinkEntrys(int pageId)
                      throws CmsException
deletes all entrys in the link table that belong to the pageId

Parameters:
pageId - The resourceId (offline) of the page whose links should be deleted
CmsException

createLinkEntrys

public void createLinkEntrys(int pageId,
                             Vector linkTargets)
                      throws CmsException
creates a link entry for each of the link targets in the linktable.

Parameters:
pageId - The resourceId (offline) of the page whose liks should be traced.
CmsException

readLinkEntrys

public Vector readLinkEntrys(int pageId)
                      throws CmsException
returns a Vector (Strings) with the link destinations of all links on the page with the pageId.

Parameters:
pageId - The resourceId (offline) of the page whose liks should be read.
CmsException

deleteOnlineLinkEntrys

public void deleteOnlineLinkEntrys(int pageId)
                            throws CmsException
deletes all entrys in the online link table that belong to the pageId

Parameters:
pageId - The resourceId (online) of the page whose links should be deleted
CmsException

createOnlineLinkEntrys

public void createOnlineLinkEntrys(int pageId,
                                   Vector linkTargets)
                            throws CmsException
creates a link entry for each of the link targets in the online linktable.

Parameters:
pageId - The resourceId (online) of the page whose liks should be traced.
CmsException

readOnlineLinkEntrys

public Vector readOnlineLinkEntrys(int pageId)
                            throws CmsException
returns a Vector (Strings) with the link destinations of all links on the page with the pageId.

Parameters:
pageId - The resourceId (online) of the page whose liks should be read.
CmsException

getOnlineBrokenLinks

public Vector getOnlineBrokenLinks()
                            throws CmsException
serches for broken links in the online project.

Returns:
A Vector with a CmsPageLinks object for each page containing broken links this CmsPageLinks object contains all links on the page withouth a valid target.
CmsException

getBrokenLinks

public void getBrokenLinks(I_CmsReport report,
                           Vector changed,
                           Vector deleted,
                           Vector newRes)
                    throws CmsException
checks a project for broken links that would appear if the project is published.

Parameters:
report - A cmsReport object for logging while the method is still running.
changed - A vecor (of CmsResources) with the changed resources in the project.
deleted - A vecor (of CmsResources) with the deleted resources in the project.
newRes - A vecor (of CmsResources) with the new resources in the project.
CmsException

getOnlineResourceNames

public Vector getOnlineResourceNames()
                              throws CmsException
This method reads all resource names from the table CmsOnlineResources

Returns:
A Vector (of Strings) with the resource names (like from getAbsolutePath())
CmsException

updateOnlineProjectLinks

public void updateOnlineProjectLinks(Vector deleted,
                                     Vector changed,
                                     Vector newRes,
                                     int pageType)
                              throws CmsException
When a project is published this method aktualises the online link table.

Parameters:
deleted - A Vector (of CmsResources) with the deleted resources of the project.
changed - A Vector (of CmsResources) with the changed resources of the project.
newRes - A Vector (of CmsResources) with the newRes resources of the project.
CmsException

readExportLink

public CmsExportLink readExportLink(String request)
                             throws CmsException
Reads a exportrequest from the Cms.

Parameters:
request - The request to be read.
Returns:
The exportrequest read from the Cms or null if it is not found.
Throws:
CmsException - Throws CmsException if operation was not succesful.

readExportLinkHeader

public CmsExportLink readExportLinkHeader(String request)
                                   throws CmsException
Reads a exportrequest without the dependencies from the Cms.

Parameters:
request - The request to be read.
Returns:
The exportrequest read from the Cms.
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeExportLinkProcessedState

public void writeExportLinkProcessedState(CmsExportLink link)
                                   throws CmsException
Sets one exportLink to procecced.

Parameters:
link - the cmsexportlink.
Throws:
CmsException - if something goes wrong.

deleteExportLink

public void deleteExportLink(String link)
                      throws CmsException
Deletes an exportlink from the Cms.

Parameters:
link - the cmsexportlink to delete.
Throws:
CmsException - if something goes wrong.

deleteExportLink

public void deleteExportLink(CmsExportLink link)
                      throws CmsException
Deletes an exportlink from the Cms.

Parameters:
link - the cmsexportlink object to delete.
Throws:
CmsException - if something goes wrong.

writeExportLink

public void writeExportLink(CmsExportLink link)
                     throws CmsException
Writes an exportlink to the Cms.

Parameters:
link - the cmsexportlink object to write.
Throws:
CmsException - if something goes wrong.

getDependingExportLinks

public Vector getDependingExportLinks(Vector resources)
                               throws CmsException
Reads all export links that depend on the resource.

Returns:
a Vector(of Strings) with the linkrequest names.
CmsException

getAllExportLinks

public Vector getAllExportLinks()
                         throws CmsException
Reads all export links.

Returns:
a Vector(of Strings) with the links.
CmsException

readFile

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

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

readFileInProject

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

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

readFileContent

protected byte[] readFileContent(int projectId,
                                 int fileId)
                          throws CmsException
Private helper method to read the fileContent for publishProject(export).

Parameters:
fileId - the fileId.
Throws:
CmsException - Throws CmsException if operation was not succesful.

readFileHeader

public CmsFile readFileHeader(int projectId,
                              int resourceId)
                       throws CmsException
Reads a file header from the Cms.
The reading excludes the filecontent.

Parameters:
projectId - The Id of the project
resourceId - The Id of the resource.
Returns:
file The read file.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFileHeader

public CmsFile readFileHeader(int projectId,
                              CmsResource resource)
                       throws CmsException
Reads a file header from the Cms.
The reading excludes the filecontent.

Parameters:
projectId - The Id of the project
Returns:
file The read file.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFileHeader

public CmsFile readFileHeader(int projectId,
                              String filename,
                              boolean includeDeleted)
                       throws CmsException
Reads a file header from the Cms.
The reading excludes the filecontent.

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

readFileHeaderForHist

public CmsBackupResource readFileHeaderForHist(int versionId,
                                               String filename)
                                        throws CmsException
Reads a file header from the backup of the Cms.
The reading excludes the filecontent.

Parameters:
versionId - The Id of the version of the resource.
filename - The complete name of the new file (including pathinformation).
Returns:
file The read file.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFileForHist

public CmsBackupResource readFileForHist(int versionId,
                                         String filename)
                                  throws CmsException
Reads a file from the history of the Cms.

Parameters:
versionId - The versionId of the resource.
filename - The complete name of the file (including pathinformation).
Returns:
file The read file.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFileHeaderInProject

public CmsFile readFileHeaderInProject(int projectId,
                                       String filename)
                                throws CmsException
Reads a file header from the Cms.
The reading excludes the filecontent.

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

readFiles

public Vector readFiles(int projectId)
                 throws CmsException
Reads all files from the Cms, that are in one project.

Returns:
A Vecor of files.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFiles

public Vector readFiles(int projectId,
                        boolean includeUnchanged,
                        boolean onlyProject)
                 throws CmsException
Reads all files from the Cms, that are in one project.

Returns:
A Vecor of files.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFolder

public CmsFolder readFolder(int projectId,
                            String foldername)
                     throws CmsException
Reads a folder from the Cms.

Parameters:
foldername - The name of the folder to be read.
Returns:
The read folder.
Throws:
CmsException - Throws CmsException if operation was not succesful.

readFolder

public CmsFolder readFolder(int projectId,
                            int folderid)
                     throws CmsException
Reads a folder from the Cms.

Parameters:
folderid - The id of the folder to be read.
Returns:
The read folder.
Throws:
CmsException - Throws CmsException if operation was not succesful.

readFolderInProject

public CmsFolder readFolderInProject(int projectId,
                                     String foldername)
                              throws CmsException
Reads a folder from the Cms that exists in the project.

Parameters:
foldername - The name of the folder to be read.
Returns:
The read folder.
Throws:
CmsException - Throws CmsException if operation was not succesful.

readFolders

public Vector readFolders(int projectId)
                   throws CmsException
Reads all folders from the Cms, that are in one project.

Returns:
A Vecor of folders.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFolders

public Vector readFolders(int projectId,
                          boolean includeUnchanged,
                          boolean onlyProject)
                   throws CmsException
Reads all folders from the Cms, that are in one project.

Returns:
A Vecor of folders.
Throws:
CmsException - Throws CmsException if operation was not succesful

readGroup

public CmsGroup readGroup(int id)
                   throws CmsException
Returns a group object.

Returns:
Group.
Throws:
CmsException - Throws CmsException if operation was not succesful

readGroup

public CmsGroup readGroup(String groupname)
                   throws CmsException
Returns a group object.

Parameters:
groupname - The name of the group that is to be read.
Returns:
Group.
Throws:
CmsException - Throws CmsException if operation was not succesful

readProject

public CmsProject readProject(int id)
                       throws CmsException
Reads a project.

Parameters:
id - The id of the project.
Throws:
CmsException - Throws CmsException if something goes wrong.

readProject

public CmsProject readProject(CmsTask task)
                       throws CmsException
Reads a project by task-id.

Parameters:
task - The task to read the project for.
Throws:
CmsException - Throws CmsException if something goes wrong.

readProjectView

public Vector readProjectView(int currentProject,
                              int project,
                              String filter)
                       throws CmsException
Reads all resource from the Cms, that are in one project.
A resource is either a file header or a folder.

Parameters:
project - The id of the project in which the resource will be used.
filter - The filter for the resources to be read
Returns:
A Vecor of resources.
Throws:
CmsException - Throws CmsException if operation was not succesful

readBackupProject

public CmsBackupProject readBackupProject(int versionId)
                                   throws CmsException
Reads a project from the backup tables.

Parameters:
versionId - The versionId of the backup project.
Throws:
CmsException - Throws CmsException if something goes wrong.

readProjectLogs

public Vector readProjectLogs(int projectid)
                       throws CmsException
Reads log entries for a project.

Returns:
A Vector of new TaskLog objects
Throws:
CmsException - Throws CmsException if something goes wrong.

readProperty

public String readProperty(String meta,
                           int projectId,
                           CmsResource resource,
                           int resourceType)
                    throws CmsException
Returns a property of a file or folder.

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

readPropertydefinition

public CmsPropertydefinition readPropertydefinition(String name,
                                                    int type,
                                                    int projectId)
                                             throws CmsException
Reads a propertydefinition for the given resource type.

Parameters:
name - The name of the propertydefinition to read.
type - The resource type for which the propertydefinition is valid.
Returns:
propertydefinition The propertydefinition that corresponds to the overgiven arguments - or null if there is no valid propertydefinition.
Throws:
CmsException - Throws CmsException if something goes wrong.

readPropertydefinition

public CmsPropertydefinition readPropertydefinition(String name,
                                                    I_CmsResourceType type,
                                                    int projectId)
                                             throws CmsException
Reads a propertydefinition for the given resource type.

Parameters:
name - The name of the propertydefinition to read.
type - The resource type for which the propertydefinition is valid.
Returns:
propertydefinition The propertydefinition that corresponds to the overgiven arguments - or null if there is no valid propertydefinition.
Throws:
CmsException - Throws CmsException if something goes wrong.

readResource

protected CmsResource readResource(CmsProject project,
                                   String filename)
                            throws CmsException
Reads a resource from the Cms.
A resource is either a file header or a folder.

Parameters:
project - The project in which the resource will be used.
filename - The complete name of the new file (including pathinformation).
Returns:
The resource read.
Throws:
CmsException - Throws CmsException if operation was not succesful

readResources

public Vector readResources(CmsProject project)
                     throws CmsException
Reads all resource from the Cms, that are in one project.
A resource is either a file header or a folder.

Parameters:
project - The project in which the resource will be used.
Returns:
A Vecor of resources.
Throws:
CmsException - Throws CmsException if operation was not succesful

readProjectResource

public String readProjectResource(int projectId,
                                  String resourcename)
                           throws CmsException
select a projectResource from an given project and resourcename

Throws:
CmsException - Throws CmsException if operation was not succesful

readBackupProjectResources

protected Vector readBackupProjectResources(int versionId)
                                     throws CmsException
select a projectResource from an given project and resourcename

Throws:
CmsException - Throws CmsException if operation was not succesful

readSession

public Hashtable readSession(String sessionId)
                      throws CmsException
Reads a session from the database.

Returns:
the read session as Hashtable.
Throws:
thorws - CmsException if something goes wrong.
CmsException

readSystemProperty

public Serializable readSystemProperty(String name)
                                throws CmsException
Reads a serializable object from the systempropertys.

Parameters:
name - The name of the property.
Returns:
object The property-object.
Throws:
CmsException - Throws CmsException if something goes wrong.

readTask

public CmsTask readTask(int id)
                 throws CmsException
Reads a task from the Cms.

Parameters:
id - The id of the task to read.
Returns:
a task object or null if the task is not found.
Throws:
CmsException - Throws CmsException if something goes wrong.

readTaskLog

public CmsTaskLog readTaskLog(int id)
                       throws CmsException
Reads a log for a task.

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.

Returns:
A Vector of new TaskLog objects
Throws:
CmsException - 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.

Parameters:
project - The Project in which the tasks are defined.
agent - The task agent
owner - The task owner .
tasktype - C_TASKS_ALL, C_TASKS_OPEN, C_TASKS_DONE, C_TASKS_NEW
orderBy - Chooses, how to order the tasks.
sort - Sort Ascending or Descending (ASC or DESC)
Returns:
A vector with the tasks
Throws:
CmsException - Throws CmsException if something goes wrong.

readUser

public CmsUser readUser(int id)
                 throws CmsException
Reads a user from the cms, only if the password is correct.

Parameters:
id - the id of the user.
Returns:
the read user.
Throws:
thorws - CmsException if something goes wrong.
CmsException

readUser

public CmsUser readUser(String name,
                        int type)
                 throws CmsException
Reads a user from the cms.

Parameters:
name - the name of the user.
type - the type of the user.
Returns:
the read user.
Throws:
thorws - CmsException if something goes wrong.
CmsException

readUser

public CmsUser readUser(String name,
                        String password,
                        int type)
                 throws CmsException
Reads a user from the cms, only if the password is correct.

Parameters:
name - the name of the user.
password - the password of the user.
type - the type of the user.
Returns:
the read user.
Throws:
thorws - CmsException if something goes wrong.
CmsException

recoverPassword

public void recoverPassword(String user,
                            String recoveryPassword,
                            String password)
                     throws CmsException
Sets the password, only if the user knows the recovery-password.

Parameters:
user - the user to set the password for.
recoveryPassword - the recoveryPassword the user has to know to set the password.
password - the password to set
Throws:
thorws - CmsException if something goes wrong.
CmsException

removeFile

public void removeFile(int projectId,
                       String filename)
                throws CmsException
Deletes a file in the database. This method is used to physically remove a file form the database.

Parameters:
filename - The complete path of the file.
Throws:
CmsException - Throws CmsException if operation was not succesful

removeFolder

public void removeFolder(int projectId,
                         CmsFolder folder)
                  throws CmsException
Deletes a folder in the database. This method is used to physically remove a folder form the database.

Parameters:
folder - The folder.
Throws:
CmsException - Throws CmsException if operation was not succesful

removeFolderForPublish

protected void removeFolderForPublish(int projectId,
                                      String foldername)
                               throws CmsException
Deletes a folder in the database. This method is used to physically remove a folder form the database. It is internally used by the publish project method.

Parameters:
foldername - The complete path of the folder.
Throws:
CmsException - Throws CmsException if operation was not succesful

removeTemporaryFile

protected void removeTemporaryFile(CmsFile file)
                            throws CmsException
Removes the temporary files of the given resource

Parameters:
file - The file of which the remporary files should be deleted
Throws:
CmsException - Throws CmsException if operation was not succesful.

removeUserFromGroup

public void removeUserFromGroup(int userid,
                                int groupid)
                         throws CmsException
Removes a user from a group. Only the admin can do this.

Parameters:
userid - The id of the user that is to be added to the group.
groupid - The id of the group.
Throws:
CmsException - Throws CmsException if operation was not succesful.

renameFile

public void renameFile(CmsProject project,
                       CmsProject onlineProject,
                       int userId,
                       int oldfileID,
                       String newname)
                throws CmsException
Renames the file to the new name.

Parameters:
project - The prect in which the resource will be used.
onlineProject - The online project of the OpenCms.
userId - The user id
oldfileID - The id of the resource which will be renamed.
newname - The new name of the resource.
Throws:
CmsException - Throws CmsException if operation was not succesful.

setPassword

public void setPassword(String user,
                        String password)
                 throws CmsException
Sets a new password for a user.

Parameters:
user - the user to set the password for.
password - the password to set
Throws:
thorws - CmsException if something goes wrong.
CmsException

setRecoveryPassword

public void setRecoveryPassword(String user,
                                String password)
                         throws CmsException
Sets a new password for a user.

Parameters:
user - the user to set the password for.
password - the recoveryPassword to set
Throws:
thorws - CmsException if something goes wrong.
CmsException

setTaskPar

public int setTaskPar(int taskId,
                      String parname,
                      String parvalue)
               throws CmsException
Set a Parameter for a task.

Parameters:
parname - Name of the parameter.
parvalue - Value if the parameter.
Returns:
The id of the inserted parameter or 0 if the parameter exists for this task.
Throws:
CmsException - Throws CmsException if something goes wrong.

SortEntrys

protected Vector SortEntrys(Vector list)
Sorts a vector of files or folders alphabetically. This method uses an insertion sort algorithm. NOT IN USE AT THIS TIME

Returns:
Array of sorted strings.

undeleteFile

public void undeleteFile(CmsProject project,
                         String filename)
                  throws CmsException
Undeletes the file.

Parameters:
project - The project in which the resource will be used.
filename - The complete path of the file.
Throws:
CmsException - Throws CmsException if operation was not succesful.

unlockProject

public void unlockProject(CmsProject project)
                   throws CmsException
Unlocks all resources in this project.

Parameters:
project - The project to be unlocked.
Throws:
CmsException - Throws CmsException if something goes wrong.

updateLockstate

public void updateLockstate(CmsResource res,
                            int projectId)
                     throws CmsException
Updates the LOCKED_BY state of a Resource. Creation date: (29.08.00 15:01:55)

Parameters:
res - com.opencms.file.CmsResource
Throws:
CmsException - The exception description.

updateResourcestate

public void updateResourcestate(CmsResource res)
                         throws CmsException
Updates the state of a Resource.

Parameters:
res - com.opencms.file.CmsResource
Throws:
CmsException - The exception description.

updateSession

public int updateSession(String sessionId,
                         Hashtable data)
                  throws CmsException
This method updates a session in the database. It is used for sessionfailover.

Parameters:
sessionId - the id of the session.
Returns:
data the sessionData.
CmsException

updateTaskPar

protected void updateTaskPar(int parid,
                             String parvalue)
                      throws CmsException
CmsException

updateTaskType

protected void updateTaskType(int taskId,
                              int autofinish,
                              int escalationtyperef,
                              String htmllink,
                              String name,
                              String permission,
                              int priorityref,
                              int roleref)
                       throws CmsException
CmsException

userInGroup

public boolean userInGroup(int userid,
                           int groupid)
                    throws CmsException
Checks if a user is member of a group.

Parameters:
groupid - The id of the group to check.
Returns:
True or False
Throws:
CmsException - Throws CmsException if operation was not succesful

writeFile

public void writeFile(CmsProject project,
                      CmsProject onlineProject,
                      CmsFile file,
                      boolean changed)
               throws CmsException
Writes a file to the Cms.

Parameters:
project - The project in which the resource will be used.
onlineProject - The online project of the OpenCms.
file - The new file.
changed - Flag indicating if the file state must be set to changed.
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeFile

public void writeFile(CmsProject project,
                      CmsProject onlineProject,
                      CmsFile file,
                      boolean changed,
                      int userId)
               throws CmsException
Writes a file to the Cms.

Parameters:
project - The project in which the resource will be used.
onlineProject - The online project of the OpenCms.
file - The new file.
changed - Flag indicating if the file state must be set to changed.
userId - The id of the user who has changed the resource.
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeFileHeader

public void writeFileHeader(CmsProject project,
                            CmsFile file,
                            boolean changed)
                     throws CmsException
Writes the fileheader to the Cms.

Parameters:
project - The project in which the resource will be used.
file - The new file.
changed - Flag indicating if the file state must be set to changed.
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeFileHeader

public void writeFileHeader(CmsProject project,
                            CmsFile file,
                            boolean changed,
                            int userId)
                     throws CmsException
Writes the fileheader to the Cms.

Parameters:
project - The project in which the resource will be used.
file - The new file.
changed - Flag indicating if the file state must be set to changed.
userId - The id of the user who has changed the resource.
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeFolder

public void writeFolder(CmsProject project,
                        CmsFolder folder,
                        boolean changed)
                 throws CmsException
Writes a folder to the Cms.

Parameters:
project - The project in which the resource will be used.
folder - The folder to be written.
changed - Flag indicating if the file state must be set to changed.
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeFolder

public void writeFolder(CmsProject project,
                        CmsFolder folder,
                        boolean changed,
                        int userId)
                 throws CmsException
Writes a folder to the Cms.

Parameters:
project - The project in which the resource will be used.
folder - The folder to be written.
changed - Flag indicating if the file state must be set to changed.
userId - The user who has changed the resource
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeResource

public void writeResource(CmsProject project,
                          CmsResource resource,
                          byte[] filecontent,
                          boolean changed,
                          int userId)
                   throws CmsException
Writes a folder to the Cms.

Parameters:
project - The project in which the resource will be used.
changed - Flag indicating if the file state must be set to changed.
userId - The user who has changed the resource
Throws:
CmsException - Throws CmsException if operation was not succesful.

writeGroup

public void writeGroup(CmsGroup group)
                throws CmsException
Writes an already existing group in the Cms.
Only the admin can do this.

Parameters:
group - The group that should be written to the Cms.
Throws:
CmsException - Throws CmsException if operation was not succesfull.

writeProject

public void writeProject(CmsProject project)
                  throws CmsException
Deletes a project from the cms. Therefore it deletes all files, resources and properties.

Parameters:
project - the project to delete.
Throws:
CmsException - Throws CmsException if something goes wrong.

writeProperties

public void writeProperties(Map propertyinfos,
                            int projectId,
                            CmsResource resource,
                            int resourceType)
                     throws CmsException
Writes a couple of Properties for a file or folder.

Parameters:
propertyinfos - A Hashtable with propertydefinition- property-pairs as strings.
projectId - The id of the current project.
resource - The CmsResource object of the resource that gets the properties.
resourceType - The Type of the resource.
Throws:
CmsException - Throws CmsException if operation was not succesful

writeProperties

public void writeProperties(Map propertyinfos,
                            int projectId,
                            CmsResource resource,
                            int resourceType,
                            boolean addDefinition)
                     throws CmsException
Writes a couple of Properties for a file or folder.

Parameters:
propertyinfos - A Hashtable with propertydefinition- property-pairs as strings.
projectId - The id of the current project.
resource - The CmsResource object of the resource that gets the properties.
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

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.

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

writePropertydefinition

public CmsPropertydefinition writePropertydefinition(CmsPropertydefinition propertyDef,
                                                     int projectId)
                                              throws CmsException
Updates the name of the propertydefinition for the resource type.
Only the admin can do this.

Returns:
The propertydefinition, that was written.
Throws:
CmsException - Throws CmsException if something goes wrong.

writeSystemProperty

public Serializable writeSystemProperty(String name,
                                        Serializable object)
                                 throws CmsException
Writes a serializable object to the systemproperties.

Parameters:
name - The name of the property.
object - The property-object.
Returns:
object The property-object.
Throws:
CmsException - Throws CmsException if something goes wrong.

writeSystemTaskLog

public void writeSystemTaskLog(int taskid,
                               String comment)
                        throws CmsException
CmsException

writeTask

public CmsTask writeTask(CmsTask task)
                  throws CmsException
Updates a task.

Parameters:
task - The task that will be written.
Throws:
CmsException - Throws CmsException if something goes wrong.

writeTaskLog

public void writeTaskLog(int taskId,
                         int userid,
                         Timestamp starttime,
                         String comment,
                         int type)
                  throws CmsException
Writes new log for a task.

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 - Throws CmsException if something goes wrong.

writeTaskType

public int writeTaskType(int autofinish,
                         int escalationtyperef,
                         String htmllink,
                         String name,
                         String permission,
                         int priorityref,
                         int roleref)
                  throws CmsException
Creates a new tasktype set in the database.

Returns:
The id of the inserted parameter or 0 if the parameter exists for this task.
Throws:
CmsException - Throws CmsException if something goes wrong.

writeUser

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

Parameters:
user - the user to write
Throws:
thorws - CmsException if something goes wrong.
CmsException

changeLockedInProject

public void changeLockedInProject(int newProjectId,
                                  String resourcename)
                           throws CmsException
Changes the project-id of a resource to the new project for publishing the resource directly

Parameters:
newProjectId - The new project-id
resourcename - The name of the resource to change
CmsException

changeUserType

public void changeUserType(int userId,
                           int userType)
                    throws CmsException
Changes the user type of the user

Parameters:
userId - The id of the user to change
userType - The new usertype of the user
CmsException

readResourcesLikeName

public Vector readResourcesLikeName(CmsProject project,
                                    String resourcename)
                             throws CmsException
Reads all resources that contains the given string in the resourcename and exists in the current project.
A resource is either a file header or a folder.

Parameters:
project - The project in which the resource will be used.
resourcename - A part of the resourcename
Returns:
A Vecor of resources.
Throws:
CmsException - Throws CmsException if operation was not succesful

readFilesByType

public Vector readFilesByType(int projectId,
                              int resourcetype)
                       throws CmsException
Reads all files from the Cms, that are of the given type.

Parameters:
projectId - A project id for reading online or offline resources
resourcetype - The type of the files.
Returns:
A Vector of files.
Throws:
CmsException - Throws CmsException if operation was not succesful

deleteBackups

public int deleteBackups(long maxdate)
                  throws CmsException
Deletes the versions from the backup tables that are older then the given date

Parameters:
maxdate - The date of the last version that should be remained after deleting
Returns:
int The oldest remaining version
CmsException

getQueries

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


getBytesFromResultset

protected byte[] getBytesFromResultset(ResultSet res,
                                       String columnName)
                                throws SQLException
Returns the bytes from a result set

Parameters:
res - The ResultSet to read from
columnName - The name of the column to read from
Returns:
The byte value from the column
SQLException

createFileContent

protected void createFileContent(int fileId,
                                 byte[] fileContent,
                                 int versionId,
                                 String usedPool,
                                 String usedStatement)
                          throws CmsException
Creates the content entry for a file

Parameters:
fileId - The ID of the new file
fileContent - The content of the new file
versionId - For the content of a backup file you need to insert the versionId of the backup
usedPool - The name of the databasepool to use
usedStatement - Specifies which tables must be used: offline, online or backup
CmsException

writeFileContent

protected void writeFileContent(int fileId,
                                byte[] fileContent,
                                String usedPool,
                                String usedStatement)
                         throws CmsException
Writes the file content of an existing file

Parameters:
fileId - The ID of the file to update
fileContent - The new content of the file
usedPool - The name of the database pool to use
usedStatement - Specifies which tables must be used: offline, online or backup
CmsException

updateAllResourceFlags

public int updateAllResourceFlags(CmsProject theProject,
                                  int theValue)
                           throws CmsException
Update the resources flag attribute of all resources.

Parameters:
theProject - the resources in this project are updated
theValue - the new int value of the resource fags attribute
Returns:
the count of affected rows
CmsException

fetchAllVfsLinks

public int fetchAllVfsLinks(CmsProject theProject,
                            ArrayList theResourceIDs,
                            ArrayList theLinkContents,
                            ArrayList theLinkResources,
                            int theResourceTypeLinkID)
                     throws CmsException
Fetch all VFS links pointing to other VFS resources.

Parameters:
theProject - the resources in this project are updated
theResourceIDs - reference to an ArrayList where the ID's of the fetched links are stored
theLinkContents - reference to an ArrayList where the contents of the fetched links (= VFS resource names of the targets) are stored
theResourceTypeLinkID - reference to an ArrayList where the resource names of the fetched links are stored
Returns:
the count of affected rows
CmsException

fetchResourceID

public int fetchResourceID(CmsProject theProject,
                           String theResourceName,
                           int skipResourceTypeID)
                    throws CmsException
Fetch the ID for a given VFS link target.

Parameters:
theProject - the CmsProject where the resource is fetched
theResourceName - the name of the resource for which we fetch it's ID
skipResourceTypeID - targets of this resource type are ignored
Returns:
the ID of the resource, or -1
CmsException

updateResourceFlags

public int updateResourceFlags(CmsProject theProject,
                               int theResourceID,
                               int theValue)
                        throws CmsException
Update the resource flag attribute for a given resource.

Parameters:
theProject - the CmsProject where the resource is updated
theResourceID - the ID of the resource which is updated
theValue - the new value of the resource flag attribute
Returns:
the count of affected rows (should be 1, unless an error occurred)
CmsException

fetchVfsLinksForResourceID

public ArrayList fetchVfsLinksForResourceID(CmsProject theProject,
                                            int theResourceID,
                                            int theResourceTypeLinkID)
                                     throws CmsException
Fetches all VFS links pointing to a given resource ID.

Parameters:
theProject - the current project
theResourceID - the ID of the resource of which the VFS links are fetched
theResourceTypeLinkID - the resource type ID of VFS links
Returns:
an ArrayList with the resource names of the fetched VFS links
Throws:
CmsException

fetchResourceFlags

public int fetchResourceFlags(CmsProject theProject,
                              String theResourceName)
                       throws CmsException
Fetches the RESOURCE_FLAGS attribute for a given resource name. This method is slighty more efficient that calling readFileHeader().

Parameters:
theProject - the current project to choose the right SQL query
theResourceName - the name of the resource of which the resource flags are fetched
Returns:
the value of the resource flag attribute.
Throws:
CmsException

fetchDateFromResource

protected long fetchDateFromResource(int theProjectId,
                                     int theResourceId,
                                     long theDefaultDate)
                              throws CmsException
CmsException