All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opencms.db.jpa.query.properties Maven / Gradle / Ivy

Go to download

OpenCms is an enterprise-ready, easy to use website content management system based on Java and XML technology. Offering a complete set of features, OpenCms helps content managers worldwide to create and maintain beautiful websites fast and efficiently.

There is a newer version: 18.0
Show newest version
#
# The pattern ${PROJECT} in table names is replaced by the SqlManager with 
# "Online" or "Offline" to choose the right database tables for
# JPQL queries that are project dependent!
# The CmsSqlManager numbers parameters placeholders, so set the parameter placeholders "?"
# whithout number.
#

#
# Project table attributes
#

C_RESOURCES_SELECT_ATTRIBS_HISTORY=\
	T_CmsDAOHistoryStructure , \
	T_CmsDAOHistoryResources 

C_RESOURCES_SELECT_TABLES_HISTORY=CmsDAOHistoryStructure T_CmsDAOHistoryStructure, CmsDAOHistoryResources T_CmsDAOHistoryResources

C_JOIN_STRUCTURE_RESOURCE_HISTORY=T_CmsDAOHistoryStructure.m_resourceId=T_CmsDAOHistoryResources.m_resourceId AND \
	T_CmsDAOHistoryStructure.m_publishTag=T_CmsDAOHistoryResources.m_publishTag

C_STRUCTURE_HISTORY_MAXVER=\
SELECT \
	MAX(T_CmsDAOHistoryStructure.m_version) \
FROM \
	CmsDAOHistoryStructure T_CmsDAOHistoryStructure \
WHERE \
	T_CmsDAOHistoryStructure.m_structureId=?
	

C_STRUCTURE_HISTORY_MAXVER_BYTIME=\
SELECT \
	MAX(T_CmsDAOHistoryStructure.m_version) \
FROM \
	CmsDAOHistoryStructure T_CmsDAOHistoryStructure , \
	CmsDAOHistoryProjects T_CmsDAOHistoryProjects \
WHERE \
	T_CmsDAOHistoryStructure.m_structureId=? \
	AND T_CmsDAOHistoryStructure.m_publishTag = T_CmsDAOHistoryProjects.m_publishTag \
	AND T_CmsDAOHistoryProjects.m_projectPublishDate < ?
	
C_HISTORY_READ_MAXTAG_FOR_VERSION=\
SELECT \
	MAX(T_CmsDAOHistoryStructure.m_publishTag) \
FROM \
	CmsDAOHistoryStructure T_CmsDAOHistoryStructure \
WHERE \
	T_CmsDAOHistoryStructure.m_structureId=? \
	AND T_CmsDAOHistoryStructure.m_version ? \
ORDER BY \
	T_CmsDAOHistoryResources.m_publishTag ASC
	
C_RESOURCES_HISTORY_READ_BTW_VERSIONS=\
SELECT \
    T_CmsDAOHistoryResources \
FROM \
	CmsDAOHistoryResources T_CmsDAOHistoryResources \
WHERE \
	T_CmsDAOHistoryResources.m_resourceId=? \
	AND T_CmsDAOHistoryResources.m_publishTag>? \
	AND T_CmsDAOHistoryResources.m_publishTag= ? \
	AND T_CmsDAOContents.m_publishTagFrom <= ?
	

C_RESOURCES_HISTORY_READ_DELETED=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS_HISTORY} \
FROM \
	${C_RESOURCES_SELECT_TABLES_HISTORY} \
WHERE \
    T_CmsDAOHistoryStructure.m_parentId=? AND \
    (T_CmsDAOHistoryStructure.m_structureState=3 OR T_CmsDAOHistoryResources.m_resourceState=3) AND \
	${C_JOIN_STRUCTURE_RESOURCE_HISTORY} \
ORDER BY \
	T_CmsDAOHistoryStructure.m_version DESC
	

C_RESOURCES_HISTORY_READ_DELETED_RESTRICTED=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS_HISTORY} \
FROM \
	${C_RESOURCES_SELECT_TABLES_HISTORY} \
WHERE \
    T_CmsDAOHistoryStructure.m_parentId=? AND \
    T_CmsDAOHistoryResources.m_userLastModified = ? AND \
    (T_CmsDAOHistoryStructure.m_structureState=3 OR T_CmsDAOHistoryResources.m_resourceState=3) AND \
	${C_JOIN_STRUCTURE_RESOURCE_HISTORY} \
ORDER BY \
	T_CmsDAOHistoryStructure.m_version DESC
	
############
# This query is just used by deprecated methods
# remove it as soon as possible
# see org.m_opencms.db.I_CmsDAOHistoryDriver#readFile(CmsDAODbContext, CmsDAOUUID, int)
############	
C_FILES_READ_HISTORY_BYID=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS_HISTORY} \
FROM \
	${C_RESOURCES_SELECT_TABLES_HISTORY}\
WHERE \
	T_CmsDAOHistoryStructure.m_structureId=? \
	AND T_CmsDAOHistoryStructure.m_publishTag=? \
	AND ${C_JOIN_STRUCTURE_RESOURCE_HISTORY} 

C_RESOURCES_READ_MAX_PUBLISH_TAG=\
SELECT \
	MAX(T_CmsDAOHistoryResources.m_publishTag) \
FROM \
	CmsDAOHistoryResources T_CmsDAOHistoryResources \
WHERE \
	T_CmsDAOHistoryResources.m_resourceId=?
	
C_PROJECTS_HISTORY_MAXTAG=\
SELECT \
	MAX(T_CmsDAOHistoryProjects.m_publishTag) \
FROM \
	CmsDAOHistoryProjects T_CmsDAOHistoryProjects
	
C_RESOURCES_HISTORY_MAXTAG=\
SELECT \
	MAX(T_CmsDAOHistoryStructure.m_publishTag) \
FROM \
	CmsDAOHistoryStructure T_CmsDAOHistoryStructure
	
C_HISTORY_PRINCIPAL_READ=\
SELECT \
	T_CmsDAOHistoryPrincipals \
FROM \
	CmsDAOHistoryPrincipals T_CmsDAOHistoryPrincipals \
WHERE \
	T_CmsDAOHistoryPrincipals.m_principalId=?
	
C_PROJECTS_HISTORY_READ=\
SELECT \
	 T_CmsDAOHistoryProjects \
FROM \
	CmsDAOHistoryProjects T_CmsDAOHistoryProjects \
WHERE \
	T_CmsDAOHistoryProjects.m_publishTag=?
	
C_PROJECTRESOURCES_HISTORY_READ=\
SELECT \
	T_CmsDAOHistoryProjectResources.m_resourcePath \
FROM \
	CmsDAOHistoryProjectResources  T_CmsDAOHistoryProjectResources \
WHERE \
	T_CmsDAOHistoryProjectResources.m_publishTag=?
	
C_PROJECTS_HISTORY_READ_ALL=\
SELECT \
	T_CmsDAOHistoryProjects \
FROM \
	CmsDAOHistoryProjects T_CmsDAOHistoryProjects \
ORDER BY \
	T_CmsDAOHistoryProjects.m_publishTag DESC
	
C_PROPERTIES_HISTORY_READ_PUBTAG=\
SELECT \
	MAX(T_CmsDAOHistoryProperties.m_publishTag) \
FROM \
	CmsDAOHistoryProperties T_CmsDAOHistoryProperties \
WHERE \
	T_CmsDAOHistoryProperties.m_structureId=? \
	AND T_CmsDAOHistoryProperties.m_publishTag<=?
	
C_PROPERTIES_HISTORY_READALL_STR=\
SELECT \
	T_CmsDAOHistoryPropertyDef.m_propertyDefName, \
	T_CmsDAOHistoryProperties.m_propertyValue,\
	T_CmsDAOHistoryProperties.m_propertyMappingType \
FROM \
	CmsDAOHistoryProperties T_CmsDAOHistoryProperties , \
	CmsDAOHistoryPropertyDef T_CmsDAOHistoryPropertyDef \
WHERE \
	T_CmsDAOHistoryProperties.m_propertyDefId=T_CmsDAOHistoryPropertyDef.m_propertyDefId \
	AND T_CmsDAOHistoryProperties.m_structureId=? \
	AND T_CmsDAOHistoryProperties.m_publishTag=?
	
C_PROPERTIES_HISTORY_READALL_RES=\
SELECT \
	T_CmsDAOHistoryPropertyDef.m_propertyDefName, \
	T_CmsDAOHistoryProperties.m_propertyValue,\
	T_CmsDAOHistoryProperties.m_propertyMappingType \
FROM \
	CmsDAOHistoryProperties T_CmsDAOHistoryProperties ,\
	CmsDAOHistoryPropertyDef T_CmsDAOHistoryPropertyDef \
WHERE \
	T_CmsDAOHistoryProperties.m_propertyDefId=T_CmsDAOHistoryPropertyDef.m_propertyDefId \
	AND T_CmsDAOHistoryProperties.m_propertyMappingId=? \
	AND T_CmsDAOHistoryProperties.m_publishTag=?
	
C_PROPERTYDEF_READ_HISTORY=\
SELECT \
	T_CmsDAOHistoryPropertyDef \
FROM \
	CmsDAOHistoryPropertyDef T_CmsDAOHistoryPropertyDef \
WHERE \
	T_CmsDAOHistoryPropertyDef.m_propertyDefName=?
	
C_PROJECTS_HISTORY_READ_TAG_FOR_DATE=\
SELECT \
	MAX(T_CmsDAOHistoryProjects.m_publishTag) \
FROM \
	CmsDAOHistoryProjects T_CmsDAOHistoryProjects \
WHERE \
	T_CmsDAOHistoryProjects.m_projectPublishDate=0 \
	AND T_CmsDAOPublishHistory.m_publishTag=? \
	AND T_CmsDAOPublishJobs.m_finishTime<=? \
ORDER BY \
	T_CmsDAOPublishJobs.m_enqueueTime ASC
	
C_PUBLISHJOB_READ_PUBLISHLIST=\
SELECT \
	T_CmsDAOPublishJobs \
FROM \
	CmsDAOPublishJobs T_CmsDAOPublishJobs \
WHERE \
	T_CmsDAOPublishJobs.m_historyId=?
	
C_PUBLISHJOB_READ_REPORT=\
SELECT \
	T_CmsDAOPublishJobs \
FROM \
	CmsDAOPublishJobs T_CmsDAOPublishJobs \
WHERE \
	T_CmsDAOPublishJobs.m_historyId=?
	
C_STATICEXPORT_READ_PUBLISHED_LINK_PARAMETERS=\
SELECT \
	T_CmsDAOStaticExportLinks.m_linkParameter \
FROM \
	CmsDAOStaticExportLinks T_CmsDAOStaticExportLinks \
WHERE \
	T_CmsDAOStaticExportLinks.m_linkRfsPath=?
	
C_STATICEXPORT_READ_ALL_PUBLISHED_LINKS=\
SELECT \
	T_CmsDAOStaticExportLinks.m_linkRfsPath \
FROM \
	CmsDAOStaticExportLinks T_CmsDAOStaticExportLinks \
WHERE \
	T_CmsDAOStaticExportLinks.m_linkType=? \
	AND T_CmsDAOStaticExportLinks.m_linkTimestamp>=?
	
C_RESOURCES_UNMARK=\
SELECT T_CmsDAOOfflineResources \
FROM CmsDAOOfflineResources T_CmsDAOOfflineResources \
WHERE \
	T_CmsDAOOfflineResources.m_projectLastModified=?
	
C_RESOURCE_LOCKS_DELETEALL=\
SELECT T_CmsDAOResourceLocks \
FROM CmsDAOResourceLocks T_CmsDAOResourceLocks 
	
C_PROJECTS_WRITE_6=\
SELECT T_CmsDAOProjects \
FROM CmsDAOProjects T_CmsDAOProjects \
WHERE \
	T_CmsDAOProjects.m_projectId=?
	
C_STATICEXPORT_READ_PUBLISHED_RESOURCES=\
SELECT \
	COUNT(T_CmsDAOStaticExportLinks) \
FROM \
	CmsDAOStaticExportLinks T_CmsDAOStaticExportLinks \
WHERE \
	T_CmsDAOStaticExportLinks.m_linkRfsPath=?
	
C_GROUPS_DELETE_GROUP_2=\
SELECT \
	T_CmsDAOGroups \
FROM \
	CmsDAOGroups T_CmsDAOGroups \
WHERE \
	T_CmsDAOGroups.m_groupName=? AND \
	T_CmsDAOGroups.m_groupOu=?
	
C_USERS_DELETE_2=\
SELECT \
	T_CmsDAOUsers \
FROM \
	CmsDAOUsers T_CmsDAOUsers \
WHERE \
	T_CmsDAOUsers.m_userName = ? AND \
	T_CmsDAOUsers.m_userOu = ?
	
C_GROUPS_CHECK_BY_NAME_2=\
SELECT \
	COUNT(T_CmsDAOGroups) \
FROM \
	CmsDAOGroups T_CmsDAOGroups \
WHERE \
	T_CmsDAOGroups.m_groupName=? AND \
	T_CmsDAOGroups.m_groupOu=?
	
C_USERS_CHECK_BY_NAME_2=\
SELECT \
	COUNT(T_CmsDAOUsers) \
FROM \
	CmsDAOUsers T_CmsDAOUsers \
WHERE \
	T_CmsDAOUsers.m_userName=? \
    AND T_CmsDAOUsers.m_userOu=?
    
C_GROUPS_GET_GROUPS_0=\
SELECT \
	T_CmsDAOGroups \
FROM \
	CmsDAOGroups T_CmsDAOGroups \
WHERE 

C_USERS_GET_WEBUSERS_FOR_ORGUNIT_1=\
SELECT \
	T_CmsDAOUsers \
FROM \
	CmsDAOUsers T_CmsDAOUsers \
WHERE \
    T_CmsDAOUsers.m_userFlags >= 32768 \
    AND T_CmsDAOUsers.m_userFlags < 65536 \
    AND T_CmsDAOUsers.m_userOu LIKE ? \
ORDER BY \
	T_CmsDAOUsers.m_userName
	
C_USERS_GET_USERS_FOR_ORGUNIT_1=\
SELECT \
	T_CmsDAOUsers \
FROM \
	CmsDAOUsers T_CmsDAOUsers \
WHERE \
    (T_CmsDAOUsers.m_userFlags < 32768 \
    OR T_CmsDAOUsers.m_userFlags >= 65536) \
    AND T_CmsDAOUsers.m_userOu LIKE ? \
ORDER BY \
	T_CmsDAOUsers.m_userName
	
C_ACCESS_READ_ENTRIES_1=\
SELECT \
	T_CmsDAO${PROJECT}AccessControl \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl \
WHERE \
	T_CmsDAO${PROJECT}AccessControl.m_resourceId=?
	
C_ACCESS_READ_ENTRIES_0=\
SELECT \
	T_CmsDAO${PROJECT}AccessControl \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl 


	
C_ACCESS_READ_ENTRY_2=\
SELECT \
	T_CmsDAO${PROJECT}AccessControl \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl \
WHERE \
	T_CmsDAO${PROJECT}AccessControl.m_resourceId=? \
	AND T_CmsDAO${PROJECT}AccessControl.m_principalId=?
	
C_GROUPS_GET_CHILD_1=\
SELECT \
	T_CmsDAOGroups \
FROM \
	CmsDAOGroups T_CmsDAOGroups \
WHERE \
	T_CmsDAOGroups.m_parentGroupId=?
	
C_GROUPS_READ_BY_NAME_2=\
SELECT \
	T_CmsDAOGroups \
FROM \
	CmsDAOGroups T_CmsDAOGroups \
WHERE \
	T_CmsDAOGroups.m_groupName=? AND \
	T_CmsDAOGroups.m_groupOu=?
	
# Query is built within the CmsDAOUserDriver class
C_GROUPS_GET_GROUPS_OF_USER_1=\
SELECT \
	T_CmsDAOGroups, T_CmsDAOGroupUsers \
FROM \
	CmsDAOGroups T_CmsDAOGroups, \
	CmsDAOGroupUsers T_CmsDAOGroupUsers \
WHERE \
	T_CmsDAOGroupUsers.m_userId=? \
    AND T_CmsDAOGroups.m_groupId=T_CmsDAOGroupUsers.m_groupId \
    AND

C_USERS_READ_BY_NAME_2=\
SELECT \
	 T_CmsDAOUsers \
FROM \
	CmsDAOUsers T_CmsDAOUsers \
WHERE \
	T_CmsDAOUsers.m_userName=? \
    AND T_CmsDAOUsers.m_userOu=?
    
C_USERS_READ_WITH_PWD_3=\
SELECT \
	 T_CmsDAOUsers \
FROM \
	CmsDAOUsers T_CmsDAOUsers \
WHERE \
	T_CmsDAOUsers.m_userName=? \
    AND T_CmsDAOUsers.m_userOu=? \
    AND T_CmsDAOUsers.m_userPassword=?
    
C_USERDATA_READ_1=\
SELECT \
	T_CmsDAOUserData \
FROM \
    CmsDAOUserData T_CmsDAOUserData \
WHERE \
	T_CmsDAOUserData.m_userId = ?
	
C_GROUPS_GET_USERS_OF_GROUP_2=\
SELECT \
	T_CmsDAOUsers \
FROM \
	CmsDAOGroups T_CmsDAOGroups, \
	CmsDAOUsers T_CmsDAOUsers , \
	CmsDAOGroupUsers T_CmsDAOGroupUsers \
WHERE \
	T_CmsDAOGroups.m_groupName=? \
	AND T_CmsDAOGroups.m_groupOu=? \
	AND T_CmsDAOGroups.m_groupOu=T_CmsDAOUsers.m_userOu \
    AND T_CmsDAOUsers.m_userId=T_CmsDAOGroupUsers.m_userId \
    AND T_CmsDAOGroupUsers.m_groupId=T_CmsDAOGroups.m_groupId \
ORDER BY \
	T_CmsDAOUsers.m_userOu,T_CmsDAOUsers.m_userName
	
C_GROUPS_GET_ALL_USERS_OF_GROUP_2=\
SELECT \
	T_CmsDAOUsers \
FROM \
	CmsDAOGroups T_CmsDAOGroups, \
	CmsDAOUsers T_CmsDAOUsers , \
	CmsDAOGroupUsers T_CmsDAOGroupUsers \
WHERE \
	T_CmsDAOGroups.m_groupName=? \
	AND T_CmsDAOGroups.m_groupOu=? \
    AND T_CmsDAOUsers.m_userId=T_CmsDAOGroupUsers.m_userId \
    AND T_CmsDAOGroupUsers.m_groupId=T_CmsDAOGroups.m_groupId \
ORDER BY \
	T_CmsDAOUsers.m_userOu,T_CmsDAOUsers.m_userName
	
C_ACCESS_REMOVE_ALL_1=\
SELECT \
	T_CmsDAO${PROJECT}AccessControl \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl \
WHERE \
	T_CmsDAO${PROJECT}AccessControl.m_resourceId=?
	
C_ACCESS_REMOVE_ALL_FOR_PRINCIPAL_1=\
SELECT \
	T_CmsDAO${PROJECT}AccessControl \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl \
WHERE \
	T_CmsDAO${PROJECT}AccessControl.m_principalId=? 

C_ACCESS_REMOVE_2=\
SELECT \
	T_CmsDAO${PROJECT}AccessControl \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl \
WHERE \
	T_CmsDAO${PROJECT}AccessControl.m_resourceId=? \
	AND T_CmsDAO${PROJECT}AccessControl.m_principalId =?

C_USERS_SET_ORGUNIT_2=\
SELECT T_CmsDAOUsers \
FROM  CmsDAOUsers T_CmsDAOUsers \
WHERE \
  T_CmsDAOUsers.m_userId = ?
  
C_ACCESS_UPDATE_5=\
SELECT T_CmsDAO${PROJECT}AccessControl \
FROM CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl \
WHERE \
	T_CmsDAO${PROJECT}AccessControl.m_resourceId=? \
	AND T_CmsDAO${PROJECT}AccessControl.m_principalId=?
	
C_GROUPS_WRITE_GROUP_4=\
SELECT T_CmsDAOGroups \
FROM CmsDAOGroups T_CmsDAOGroups \
WHERE \
	T_CmsDAOGroups.m_groupId=?
	
C_USERS_SET_PWD_3=\
SELECT T_CmsDAOUsers \
FROM CmsDAOUsers T_CmsDAOUsers \
WHERE \
	T_CmsDAOUsers.m_userName=? AND \
	T_CmsDAOUsers.m_userOu=?
	
C_USERS_WRITE_6=\
SELECT T_CmsDAOUsers \
FROM CmsDAOUsers T_CmsDAOUsers \
WHERE \
	T_CmsDAOUsers.m_userId=?
	
C_GROUPS_GROUP_OU_EQUALS_1	=T_CmsDAOGroups.m_groupOu = ?
C_GROUPS_GROUP_OU_LIKE_1	=T_CmsDAOGroups.m_groupOu LIKE ?
C_GROUPS_SELECT_GROUPS_1	=T_CmsDAOGroups.m_groupFlags < ?
C_GROUPS_SELECT_ROLES_1		=T_CmsDAOGroups.m_groupFlags >= ?
C_GROUPS_ORDER_0			=ORDER BY T_CmsDAOGroups.m_groupOu, T_CmsDAOGroups.m_groupName

C_GROUPS_USER_IN_GROUP_2=\
SELECT \
	T_CmsDAOGroupUsers \
FROM \
	CmsDAOGroupUsers T_CmsDAOGroupUsers \
WHERE \
	T_CmsDAOGroupUsers.m_groupId=? \
	AND T_CmsDAOGroupUsers.m_userId=?
	
C_RESOURCES_COUNT_SIBLINGS=\
SELECT \
	COUNT(T_CmsDAO${PROJECT}Structure) \
FROM \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_resourceId=?
	
C_ONLINE_CONTENTS_HISTORY=\
SELECT T_CmsDAOContents \
FROM CmsDAOContents T_CmsDAOContents \
WHERE \
	T_CmsDAOContents.m_resourceId = ? \
	AND T_CmsDAOContents.m_onlineFlag = 1
	
C_HISTORY_CONTENTS_UPDATE=\
SELECT T_CmsDAOContents \
FROM CmsDAOContents T_CmsDAOContents \
WHERE \
	T_CmsDAOContents.m_resourceId = ? \
	AND T_CmsDAOContents.m_onlineFlag = 1
	
C_RESOURCES_UPDATE_RESOURCES=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_UPDATE_SIBLING_COUNT=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_UPDATE_FLAGS=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_UPDATE_RESOURCE_PROJECT=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_PROPERTYDEF_DELETE=\
SELECT \
	T_CmsDAO${PROJECT}PropertyDef \
FROM \
	CmsDAO${PROJECT}PropertyDef T_CmsDAO${PROJECT}PropertyDef \
WHERE \
	T_CmsDAO${PROJECT}PropertyDef.m_propertyDefId=?
	
C_PROPERTIES_DELETE_ALL_STRUCTURE_AND_RESOURCE_VALUES=\
SELECT \
	T_CmsDAO${PROJECT}Properties \
FROM \
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties \
WHERE \
	(\
		T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
		AND T_CmsDAO${PROJECT}Properties.m_propertyMappingType=? \
	) \
	OR \
	(\
		T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
		AND T_CmsDAO${PROJECT}Properties.m_propertyMappingType=? \
	)

C_PROPERTIES_DELETE_ALL_VALUES_FOR_MAPPING_TYPE=\
SELECT \
	T_CmsDAO${PROJECT}Properties \
FROM \
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties \
WHERE \
	T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
	AND T_CmsDAO${PROJECT}Properties.m_propertyMappingType=?
	
C_DELETE_RELATIONS=\
SELECT \
	T_CmsDAO${PROJECT}ResourceRelations \
FROM \
    CmsDAO${PROJECT}ResourceRelations T_CmsDAO${PROJECT}ResourceRelations \
WHERE

C_RESOURCES_MOVE=\
SELECT T_CmsDAO${PROJECT}Structure \
FROM CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=?
	
C_RESOURCES_UPDATE_STRUCTURE_VERSION=\
SELECT T_CmsDAO${PROJECT}Structure \
FROM CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId = ?
	
C_RESOURCES_UPDATE_STRUCTURE=\
SELECT T_CmsDAO${PROJECT}Structure \
FROM CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=?

C_RESOURCES_UPDATE_RESOURCE_VERSION=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId = ?
	
C_RESOURCES_GET_SUBRESOURCES_GET_FOLDERS=AND T_CmsDAO${PROJECT}Resources.m_resourceSize < 0
C_RESOURCES_GET_SUBRESOURCES_GET_FILES=AND T_CmsDAO${PROJECT}Resources.m_resourceSize >= 0

C_RESOURCES_SELECT_TABLES=CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources, CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure 
C_RESOURCES_SELECT_ATTRIBS=\
    T_CmsDAO${PROJECT}Resources,\
    T_CmsDAO${PROJECT}Structure,\
	T_CmsDAO${PROJECT}Resources.m_projectLastModified

C_JOIN_STRUCTURE_RESOURCE=T_CmsDAO${PROJECT}Structure.m_resourceId=T_CmsDAO${PROJECT}Resources.m_resourceId 

C_RESOURCES_GET_SUBRESOURCES=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_parentId=? \
	AND ${C_JOIN_STRUCTURE_RESOURCE}
						
C_ONLINE_FILES_CONTENT=\
SELECT \
	T_CmsDAOContents \
FROM \
	CmsDAOContents T_CmsDAOContents, \
	CmsDAOOnlineResources T_CmsDAOOnlineResources \
WHERE \
	T_CmsDAOContents.m_resourceId = ? \
	AND	T_CmsDAOContents.m_onlineFlag=1 \
	AND T_CmsDAOContents.m_resourceId = T_CmsDAOOnlineResources.m_resourceId 
	

C_RESOURCES_READBYID=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=? \
	AND ${C_JOIN_STRUCTURE_RESOURCE}
	
C_RESOURCES_READ=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_resourcePath=? \
	AND ${C_JOIN_STRUCTURE_RESOURCE} \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_structureState ASC
	
C_RESOURCES_READ_PARENT_BY_ID=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES}, \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure2 \
WHERE \
    T_CmsDAO${PROJECT}Structure2.m_structureId=? \
	AND T_CmsDAO${PROJECT}Structure.m_structureId=T_CmsDAO${PROJECT}Structure2.m_parentId \
	AND ${C_JOIN_STRUCTURE_RESOURCE}
	
C_PROPERTYDEF_READ=\
SELECT \
	T_CmsDAO${PROJECT}PropertyDef \
FROM \
	CmsDAO${PROJECT}PropertyDef T_CmsDAO${PROJECT}PropertyDef \
WHERE \
	T_CmsDAO${PROJECT}PropertyDef.m_propertyDefName=?
	
C_PROPERTYDEF_READALL=\
SELECT \
	T_CmsDAO${PROJECT}PropertyDef \
FROM \
	CmsDAO${PROJECT}PropertyDef T_CmsDAO${PROJECT}PropertyDef
	
C_PROPERTIES_READ=\
SELECT \
	T_CmsDAO${PROJECT}Properties \
FROM \
	CmsDAO${PROJECT}PropertyDef T_CmsDAO${PROJECT}PropertyDef,\
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties \
WHERE \
	T_CmsDAO${PROJECT}PropertyDef.m_propertyDefName=? \
    AND T_CmsDAO${PROJECT}Properties.m_propertyDefId=T_CmsDAO${PROJECT}PropertyDef.m_propertyDefId \
	AND \
	(\
		T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
			OR \
		T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
	)	
	
C_PROPERTIES_READALL=\
SELECT \
	T_CmsDAO${PROJECT}PropertyDef, \
	T_CmsDAO${PROJECT}Properties \
FROM \
	CmsDAO${PROJECT}PropertyDef T_CmsDAO${PROJECT}PropertyDef ,\
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties \
WHERE \
	(\
		T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
			OR \
		T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
	) \
	AND \
	(\
		T_CmsDAO${PROJECT}Properties.m_propertyDefId=T_CmsDAO${PROJECT}PropertyDef.m_propertyDefId \
	)  

C_RELATIONS_SELECT_ATTRIBS = T_CmsDAO${PROJECT}ResourceRelations

C_READ_RELATIONS=\
SELECT DISTINCT \
	${C_RELATIONS_SELECT_ATTRIBS} \
FROM \
	CmsDAO${PROJECT}ResourceRelations T_CmsDAO${PROJECT}ResourceRelations \
WHERE
# the conditions are build in the vfs driver

C_RESOURCES_GET_RESOURCE_IN_PROJECT_WITH_STATE=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE (\
	T_CmsDAO${PROJECT}Structure.m_resourceId=T_CmsDAO${PROJECT}Resources.m_resourceId) \
	AND T_CmsDAO${PROJECT}Resources.m_projectLastModified = ? \
	AND \
	(\
		(\
			T_CmsDAO${PROJECT}Resources.m_resourceSate=? \
			AND T_CmsDAO${PROJECT}Structure.m_structureState<=? \
		)\
		OR \
		(\
			T_CmsDAO${PROJECT}Structure.m_structureState=? \
			AND T_CmsDAO${PROJECT}Resources.m_resourceState<=? \
		)\
	) \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_resourcePath ASC

C_RESOURCES_GET_RESOURCE_IN_PROJECT_WITHOUT_STATE=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_resourceId=T_CmsDAO${PROJECT}Resources.m_resourceId \
	AND T_CmsDAO${PROJECT}Resources.m_projectLastModified = ? \
	AND \
	(\
		T_CmsDAO${PROJECT}Resources.m_resourceState <> ? \
		OR T_CmsDAO${PROJECT}Structure.m_structureState <> ? \
	)\
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_resourcePath ASC
	
C_RESOURCES_GET_RESOURCE_IN_PROJECT_IGNORE_STATE=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_resourceId=T_CmsDAO${PROJECT}Resources.m_resourceId \
	AND T_CmsDAO${PROJECT}Resources.m_projectLastModified = ? \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_resourcePath ASC	
	
C_SELECT_RESOURCES_FOR_PRINCIPAL_ACE=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl , \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}AccessControl.m_principalId=? \
	AND T_CmsDAO${PROJECT}AccessControl.m_resourceId=T_CmsDAO${PROJECT}Resources.m_resourceId \
	AND ${C_JOIN_STRUCTURE_RESOURCE} \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_resourcePath ASC
	
C_SELECT_RESOURCES_FOR_PRINCIPAL_ATTR1=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_userCreated=? \
	AND ${C_JOIN_STRUCTURE_RESOURCE} 
	

C_SELECT_RESOURCES_FOR_PRINCIPAL_ATTR2=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_userLastModified=? \
	AND ${C_JOIN_STRUCTURE_RESOURCE} 
	
C_RESOURCES_GET_RESOURCE_WITH_PROPERTYDEF=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties , \
	CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources , \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Properties.m_propertyDefId = ? \
	AND T_CmsDAO${PROJECT}Structure.m_resourceId = T_CmsDAO${PROJECT}Resources.m_resourceId \
	AND T_CmsDAO${PROJECT}Structure.m_resourcePath LIKE ?  ESCAPE '|' \
	AND ( \
		T_CmsDAO${PROJECT}Properties.m_propertyMappingId = T_CmsDAO${PROJECT}Resources.m_resourceId \
		OR T_CmsDAO${PROJECT}Properties.m_propertyMappingId = T_CmsDAO${PROJECT}Structure.m_structureId \
	) \
ORDER BY T_CmsDAO${PROJECT}Structure.m_resourcePath DESC

C_RESOURCES_GET_RESOURCE_WITH_PROPERTYDEF_VALUE=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties , \
	CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources , \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Properties.m_propertyDefId=? \
	AND T_CmsDAO${PROJECT}Structure.m_resourceId = T_CmsDAO${PROJECT}Resources.m_resourceId \
	AND ( \
			( \
				T_CmsDAO${PROJECT}Properties.m_propertyMappingId = T_CmsDAO${PROJECT}Resources.m_resourceId \
				AND T_CmsDAO${PROJECT}Structure.m_resourcePath LIKE ? ESCAPE '|' \
				AND T_CmsDAO${PROJECT}Properties.m_propertyValue LIKE ? \
			) \
			OR \
			( \
				T_CmsDAO${PROJECT}Properties.m_propertyMappingId = T_CmsDAO${PROJECT}Structure.m_structureId \
				AND T_CmsDAO${PROJECT}Structure.m_resourcePath LIKE ?  ESCAPE '|' \
				AND T_CmsDAO${PROJECT}Properties.m_propertyValue LIKE ?  \
			) \
		) \
ORDER BY T_CmsDAO${PROJECT}Structure.m_resourcePath DESC
			  
C_JOIN_RESOURCE_STRUCTURE=T_CmsDAO${PROJECT}Resources.m_resourceId=T_CmsDAO${PROJECT}Structure.m_resourceId

#
# General subtree selection statement
#
C_RESOURCES_READ_TREE=\
SELECT \
    ${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	${C_JOIN_RESOURCE_STRUCTURE}
	
#
# Resources order
#
C_RESOURCES_ORDER_BY_PATH=\
	ORDER BY T_CmsDAO${PROJECT}Structure.m_resourcePath
	
C_SELECT_VFS_SIBLINGS=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=? \
	AND ${C_JOIN_STRUCTURE_RESOURCE} \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_resourcePath ASC	
	
#
# Warning: Expects C_STATE_DELETED = 3 and all states >= 0 / <= 3
#
C_SELECT_NONDELETED_VFS_SIBLINGS=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=? \
	AND T_CmsDAO${PROJECT}Structure.m_structureState IN(0,1,2) \
	AND ${C_JOIN_STRUCTURE_RESOURCE} \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_resourcePath ASC
	
C_RESOURCES_READ_VERSION_RES=\
SELECT \
    T_CmsDAO${PROJECT}Resources.m_resourceVersion \
FROM \
	CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_READ_VERSION_STR=\
SELECT \
	T_CmsDAO${PROJECT}Structure.m_structureVersion \
FROM \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=?
	
C_STRUCTURE_DELETE_BY_STRUCTUREID=\
SELECT \
	T_CmsDAO${PROJECT}Structure \
FROM \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=?
	
C_RESOURCES_DELETE_BY_RESOURCEID=\
SELECT \
	T_CmsDAO${PROJECT}Resources \
FROM \
	CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCE_REPLACE=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_TRANSFER_RESOURCE=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_READ_RESOURCE_STATE=\
SELECT \
	T_CmsDAO${PROJECT}Resources.m_resourceState \
FROM \
	CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_SELECT_STRUCTURE_ID=\
SELECT \
	COUNT(T_CmsDAO${PROJECT}Structure.m_structureId) \
FROM \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=?
	
C_OFFLINE_CONTENTS_UPDATE=\
SELECT T_CmsDAOOfflineContents \
FROM CmsDAOOfflineContents T_CmsDAOOfflineContents \
WHERE \
	T_CmsDAOOfflineContents.m_resourceId=?
	
C_RESOURCES_UPDATE_PROJECT_LASTMODIFIED=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_PROPERTIES_UPDATE=\
SELECT T_CmsDAO${PROJECT}Properties \
FROM CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties \
WHERE \
	T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
	AND T_CmsDAO${PROJECT}Properties.m_propertyMappingType=? \
	AND T_CmsDAO${PROJECT}Properties.m_propertyDefId=?
	
C_PROPERTIES_DELETE=\
SELECT \
	T_CmsDAO${PROJECT}Properties \
FROM \
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties \
WHERE \
	T_CmsDAO${PROJECT}Properties.m_propertyDefId=?  \
	AND T_CmsDAO${PROJECT}Properties.m_propertyMappingId=? \
	AND T_CmsDAO${PROJECT}Properties.m_propertyMappingType=?
	
C_RESOURCES_UPDATE_RESOURCES_WITHOUT_STATE=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_UPDATE_RESOURCE_STATELASTMODIFIED=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_UPDATE_RESOURCE_STATE=\
SELECT T_CmsDAO${PROJECT}Resources \
FROM CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
	T_CmsDAO${PROJECT}Resources.m_resourceId=?
	
C_RESOURCES_UPDATE_STRUCTURE_STATE=\
SELECT T_CmsDAO${PROJECT}Structure \
FROM CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=?
	
C_RESOURCES_UPDATE_RELEASE_EXPIRED=\
SELECT T_CmsDAO${PROJECT}Structure \
FROM CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_structureId=?
	
C_RESOURCES_READ_WITH_ACE_1=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	CmsDAO${PROJECT}AccessControl T_CmsDAO${PROJECT}AccessControl, ${C_RESOURCES_SELECT_TABLES} \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_resourceId=T_CmsDAO${PROJECT}Resources.m_resourceId \
	AND T_CmsDAO${PROJECT}Structure.m_resourcePath LIKE ?  ESCAPE '|' \
	AND T_CmsDAO${PROJECT}Structure.m_resourceId = T_CmsDAO${PROJECT}AccessControl.m_resourceId \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_resourcePath ASC
	
C_PROPERTIES_READALL_COUNT=\
SELECT \
	COUNT(T_CmsDAO${PROJECT}Properties) \
FROM \
	CmsDAO${PROJECT}Properties T_CmsDAO${PROJECT}Properties \
WHERE \
	T_CmsDAO${PROJECT}Properties.m_propertyDefId=?
	
C_RESOURCES_READ_PARENT_STRUCTURE_ID=\
SELECT \
	T_CmsDAO${PROJECT}Structure.m_structureId \
FROM \
	CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
	T_CmsDAO${PROJECT}Structure.m_resourcePath=?
	
C_READ_RESOURCE_STATE=\
SELECT \
    T_CmsDAO${PROJECT}Resources.m_resourceState \
FROM \
    CmsDAO${PROJECT}Resources T_CmsDAO${PROJECT}Resources \
WHERE \
    T_CmsDAO${PROJECT}Resources.m_resourceId = ?
    
C_READ_STRUCTURE_STATE=\
SELECT \
    T_CmsDAO${PROJECT}Structure.m_structureState \
FROM \
    CmsDAO${PROJECT}Structure T_CmsDAO${PROJECT}Structure \
WHERE \
    T_CmsDAO${PROJECT}Structure.m_structureId = ?
    
C_MOVE_RELATIONS_SOURCE=\
SELECT T_CmsDAO${PROJECT}ResourceRelations \
FROM CmsDAO${PROJECT}ResourceRelations T_CmsDAO${PROJECT}ResourceRelations \
WHERE \
	T_CmsDAO${PROJECT}ResourceRelations.m_relationSourceId=?
	
C_MOVE_RELATIONS_TARGET=\
SELECT T_CmsDAO${PROJECT}ResourceRelations \
FROM CmsDAO${PROJECT}ResourceRelations T_CmsDAO${PROJECT}ResourceRelations \
WHERE \
	T_CmsDAO${PROJECT}ResourceRelations.m_relationTargetId=?
	
C_STRUCTURE_SELECT_BY_DATE_EXPIRED_AFTER=\
	(T_CmsDAO${PROJECT}Structure.m_dateExpired <> 0) AND (T_CmsDAO${PROJECT}Structure.m_dateExpired >= ?)
	
C_STRUCTURE_SELECT_BY_DATE_EXPIRED_BEFORE=\
	(T_CmsDAO${PROJECT}Structure.m_dateExpired <> 0) AND (T_CmsDAO${PROJECT}Structure.m_dateExpired <= ?)
	
C_RESOURCES_SELECT_BY_PARENT_UUID=\
	T_CmsDAO${PROJECT}Structure.m_parentId = ?
	
C_RESOURCES_SELECT_BY_PATH_PREFIX=\
	T_CmsDAO${PROJECT}Structure.m_resourcePath LIKE ? ESCAPE '|'
	
C_RESOURCES_SELECT_BY_PROJECT_LASTMODIFIED=\
	T_CmsDAO${PROJECT}Resources.m_projectLastModified=?
	
C_RELATION_FILTER_TARGET_ID=T_CmsDAO${PROJECT}ResourceRelations.m_relationTargetId = ?

C_RELATION_FILTER_TARGET_PATH=T_CmsDAO${PROJECT}ResourceRelations.m_relationTargetPath LIKE ?

C_RELATION_FILTER_SOURCE_ID=T_CmsDAO${PROJECT}ResourceRelations.m_relationSourceId = ?

C_RELATION_FILTER_SOURCE_PATH=T_CmsDAO${PROJECT}ResourceRelations.m_relationSourcePath LIKE ?

C_RELATION_FILTER_TYPE=T_CmsDAO${PROJECT}ResourceRelations.m_relationType IN 

C_STRUCTURE_SELECT_BY_DATE_RELEASED_AFTER=\
	(T_CmsDAO${PROJECT}Structure.m_dateReleased <> 0) AND (T_CmsDAO${PROJECT}Structure.m_dateReleased >= ?)
	
C_STRUCTURE_SELECT_BY_DATE_RELEASED_BEFORE=\
	(T_CmsDAO${PROJECT}Structure.m_dateReleased <> 0) AND (T_CmsDAO${PROJECT}Structure.m_dateReleased <= ?)
	
C_RESOURCES_SELECT_ONLY_FOLDERS=\
	T_CmsDAO${PROJECT}Resources.m_resourceSize = -1
	
C_RESOURCES_SELECT_ONLY_FILES=\
	T_CmsDAO${PROJECT}Resources.m_resourceSize > -1
	
C_RESOURCES_SELECT_BY_RESOURCE_STATE=\
	((T_CmsDAO${PROJECT}Structure.m_structureState=? AND T_CmsDAO${PROJECT}Structure.m_structureState >= T_CmsDAO${PROJECT}Resources.m_resourceState) OR \
	(T_CmsDAO${PROJECT}Resources.m_resourceState=? AND T_CmsDAO${PROJECT}Resources.m_resourceState >= T_CmsDAO${PROJECT}Structure.m_structureState))
	
C_RESOURCES_SELECT_BY_DATE_LASTMODIFIED_AFTER=\
	T_CmsDAO${PROJECT}Resources.m_dateLastModified >= ?
	
C_RESOURCES_SELECT_BY_DATE_LASTMODIFIED_BEFORE=\
	T_CmsDAO${PROJECT}Resources.m_dateLastModified <= ?
	
C_RESOURCES_SELECT_BY_RESOURCE_TYPE=\
	T_CmsDAO${PROJECT}Resources.m_resourceType=?
	
C_RELATIONS_REPAIR_BROKEN=\
SELECT T_CmsDAO${PROJECT}ResourceRelations \
FROM CmsDAO${PROJECT}ResourceRelations T_CmsDAO${PROJECT}ResourceRelations \
WHERE \
    T_CmsDAO${PROJECT}ResourceRelations.m_relationTargetPath = ? \
    AND T_CmsDAO${PROJECT}ResourceRelations.m_relationTargetId NOT IN (SELECT T1_CmsDAO${PROJECT}Structure.m_structureId FROM CmsDAO${PROJECT}Structure T1_CmsDAO${PROJECT}Structure)
   
C_RELATIONS_UPDATE_BROKEN=\
SELECT T_CmsDAO${PROJECT}ResourceRelations \
FROM CmsDAO${PROJECT}ResourceRelations T_CmsDAO${PROJECT}ResourceRelations \
WHERE \
    T_CmsDAO${PROJECT}ResourceRelations.m_relationTargetPath = ? \
    AND T_CmsDAO${PROJECT}ResourceRelations.m_relationTargetId NOT IN (SELECT T1_CmsDAO${PROJECT}Structure.m_structureId FROM CmsDAO${PROJECT}Structure T1_CmsDAO${PROJECT}Structure )
    
C_RESOURCES_HISTORY_READ_DELETED_NAME=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS_HISTORY} \
FROM \
	${C_RESOURCES_SELECT_TABLES_HISTORY} \
WHERE \
    T_CmsDAOHistoryStructure.m_resourcePath LIKE ?  ESCAPE '|' AND \
    T_CmsDAOHistoryStructure.m_resourcePath <> ? AND \
    (T_CmsDAOHistoryStructure.m_structureState=3 OR T_CmsDAOHistoryResources.m_resourceState=3) AND \
	${C_JOIN_STRUCTURE_RESOURCE_HISTORY} \
ORDER BY \
	T_CmsDAOHistoryStructure.m_version DESC

C_RESOURCES_HISTORY_READ_DELETED_NAME_RESTRICTED=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS_HISTORY} \
FROM \
	${C_RESOURCES_SELECT_TABLES_HISTORY} \
WHERE \
    T_CmsDAOHistoryStructure.m_resourcePath LIKE ?  ESCAPE '|' AND \
    T_CmsDAOHistoryStructure.m_resourcePath <> ? AND \
    T_CmsDAOHistoryResources.m_userLastModified=? AND \
    (T_CmsDAOHistoryStructure.m_structureState=3 OR T_CmsDAOHistoryResources.m_resourceState=3) AND \
	${C_JOIN_STRUCTURE_RESOURCE_HISTORY} \
ORDER BY \
	T_CmsDAOHistoryStructure.m_version DESC
	
C_CONTENT_PUBLISH_MAXTAG=\
SELECT MAX(T_CmsDAOContents.m_publishTagTo) FROM CmsDAOContents T_CmsDAOContents 

C_PROJECTS_HISTORY_READ_BYID=\
SELECT \
	T_CmsDAOHistoryProjects \
FROM \
	CmsDAOHistoryProjects T_CmsDAOHistoryProjects \
WHERE \
	T_CmsDAOHistoryProjects.m_projectId=? \
ORDER BY \
	T_CmsDAOHistoryProjects.m_publishTag DESC
	
C_READ_RESOURCE_OUS=\
SELECT DISTINCT \
	${C_RELATIONS_SELECT_ATTRIBS} \
FROM \
	CmsDAO${PROJECT}ResourceRelations T_CmsDAO${PROJECT}ResourceRelations \
WHERE \
    T_CmsDAO${PROJECT}ResourceRelations.m_relationType = ?
    
C_PROJECTS_READ_BYRESOURCE_1=\
SELECT \
	T_CmsDAOProjects \
FROM \
	CmsDAOProjects T_CmsDAOProjects, \
	CmsDAOProjectResources T_CmsDAOProjectResources \
WHERE \
	T_CmsDAOProjects.m_projectId = T_CmsDAOProjectResources.m_projectId \
	AND T_CmsDAOProjectResources.m_resourcePath LIKE ?  ESCAPE '|' \
ORDER BY \
	T_CmsDAOProjects.m_projectOu, T_CmsDAOProjects.m_projectName 

# since 7.5.3
	
C_ONLINE_CONTENTS_DELETE=\
DELETE  FROM CmsDAOContents T_CmsDAOContents \
WHERE \
	T_CmsDAOContents.m_resourceId = ? \
	AND T_CmsDAOContents.m_onlineFlag = 1

C_USERS_WRITE_2= \
UPDATE CmsDAOUsers T_CmsDAOUsers \
SET \
	T_CmsDAOUsers.m_userLastLogin= ? \
WHERE \
	T_CmsDAOUsers.m_userId = ?
	
C_USERDATA_UPDATE_4 = \
UPDATE CmsDAOUserData T_CmsDAOUserData \
SET \
	T_CmsDAOUserData.m_dataValue = ?, \
	T_CmsDAOUserData.m_dataType = ? \
WHERE \
	T_CmsDAOUserData.m_userId = ? \
	AND T_CmsDAOUserData.m_dataKey = ?
	
C_USERDATA_DELETE_2 = \
DELETE FROM CmsDAOUserData T_CmsDAOUserData \
WHERE \
	T_CmsDAOUserData.m_userId = ? \
	AND T_CmsDAOUserData.m_dataKey = ?
	
C_OFFLINE_FILE_CONTENT_DELETE=\
DELETE FROM CmsDAOOfflineContents  T_CmsDAOOfflineContents \
WHERE \
	T_CmsDAOOfflineContents.m_resourceId=?
	
# since 8.0

C_LOG_DELETE_ENTRIES=\
DELETE FROM \
    CmsDAOLog  T_CmsDAOLog \
WHERE
# the conditions are build in the project driver


### SQL query
C_LOG_READ_PUBLISH_LIST_2=\
SELECT \
    CMS_${PROJECT}_RESOURCES.RESOURCE_ID, \
	CMS_${PROJECT}_STRUCTURE.STRUCTURE_ID, \
    LOG1.LOG_DATE \
FROM (\
    SELECT \
        MAX(CMS_LOG.LOG_DATE) AS LOG_DATE,\
	    CMS_LOG.STRUCTURE_ID \
    FROM \
        CMS_LOG \
    WHERE \
	    CMS_LOG.USER_ID = ? \
	    AND CMS_LOG.STRUCTURE_ID IS NOT NULL \
    GROUP BY \
        CMS_LOG.STRUCTURE_ID \
    ) LOG1, \
    CMS_${PROJECT}_STRUCTURE,\
    CMS_${PROJECT}_RESOURCES \
WHERE \
	20 < (\
	    SELECT \
	        LOG2.LOG_TYPE \
	    FROM \
	        CMS_LOG LOG2 \
	    WHERE \
	        LOG2.USER_ID = ? \
	        AND LOG2.STRUCTURE_ID = LOG1.STRUCTURE_ID \
	        AND LOG2.LOG_DATE = LOG1.LOG_DATE \
	    ) \
    AND LOG1.STRUCTURE_ID=CMS_${PROJECT}_STRUCTURE.STRUCTURE_ID \
    AND CMS_${PROJECT}_STRUCTURE.RESOURCE_ID=CMS_${PROJECT}_RESOURCES.RESOURCE_ID

C_LOG_READ_ENTRIES=\
SELECT DISTINCT \
	T_CmsDAOLog \
FROM \
	CmsDAOLog T_CmsDAOLog \
WHERE
# the conditions are build in the project driver

C_LOG_FILTER_USER_ID=T_CmsDAOLog.m_userId = ?
C_LOG_FILTER_RESOURCE_ID=T_CmsDAOLog.m_structureId = ?
C_LOG_FILTER_DATE_FROM=T_CmsDAOLog.m_logDate >= ?
C_LOG_FILTER_DATE_TO=CmsDAOLog.m_logDate <= ?
C_LOG_FILTER_INCLUDE_TYPE=T_CmsDAOLog.m_logType IN
C_LOG_FILTER_EXCLUDE_TYPE=T_CmsDAOLog.m_logType NOT IN 

C_VISIT_DELETE_ENTRIES=\
DELETE FROM \
    CmsDAOSubscriptionVisit  T_CmsDAOSubscriptionVisit \
WHERE 
# the conditions are build in the subscription driver

C_VISITED_USER_COUNT_1=\
SELECT COUNT(T_CmsDAOSubscriptionVisit) \
FROM CmsDAOSubscriptionVisit  T_CmsDAOSubscriptionVisit \
WHERE \
	T_CmsDAOSubscriptionVisit.m_userId=? 
	
C_VISITED_USER_DELETE_GETDATE_2= \
SELECT T_CmsDAOSubscriptionVisit.m_visitDate \
FROM CmsDAOSubscriptionVisit T_CmsDAOSubscriptionVisit \
WHERE \
	T_CmsDAOSubscriptionVisit.m_userId=? \
ORDER BY T_CmsDAOSubscriptionVisit.m_visitDate ASC 

C_SUBSCRIPTION_READ_ALL_1=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES}, \
	CmsDAOSubscription T_CmsDAOSubscription \
WHERE \
	T_CmsDAOSubscription.m_principalId=? \
	AND T_CmsDAOSubscription.m_dateDeleted=0 \
	AND T_CmsDAO${PROJECT}Structure.m_structureId=T_CmsDAOSubscription.m_structureId \
	AND ${C_JOIN_STRUCTURE_RESOURCE} \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_structureState ASC
	
C_VISITED_USER_READ_4=\
SELECT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES}, \
	CmsDAOSubscriptionVisit T_CmsDAOSubscriptionVisit \
WHERE \
	T_CmsDAOSubscriptionVisit.m_userId=? \
	AND T_CmsDAOSubscriptionVisit.m_visitDate > ? \
	AND T_CmsDAOSubscriptionVisit.m_visitDate < ? \
	AND T_CmsDAO${PROJECT}Structure.m_structureId = T_CmsDAOSubscriptionVisit.m_structureId \
	%(CONDITIONS) \
	AND ${C_JOIN_STRUCTURE_RESOURCE} \ 
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_structureState ASC

C_SUBSCRIPTION_DELETED=\
SELECT T_CmsDAOSubscription.m_structureId \
FROM \
	CmsDAOSubscription T_CmsDAOSubscription \
WHERE \
	T_CmsDAOSubscription.m_dateDeleted > ? 
	
C_SUBSCRIPTION_FILTER_READ=\
SELECT DISTINCT \
	${C_RESOURCES_SELECT_ATTRIBS} \
FROM \
	${C_RESOURCES_SELECT_TABLES}, \
	CmsDAOSubscription T_CmsDAOSubscription \
WHERE \
	%(CONDITIONS) \
	AND ${C_JOIN_STRUCTURE_RESOURCE} \
ORDER BY \
	T_CmsDAO${PROJECT}Structure.m_structureState ASC	

C_SUBSCRIPTION_DELETED_FILTER_PRINCIPAL_SINGLE=T_CmsDAOSubscription.m_principalId = ? 

C_SUBSCRIPTION_DELETED_FILTER_PRINCIPALS=T_CmsDAOSubscription.m_principalId IN 

C_SUBSCRIPTION_FILTER_PRINCIPAL_SINGLE=T_CmsDAOSubscription.m_principalId = ? \
			AND T_CmsDAOSubscription.m_dateDeleted=0 \
			AND T_CmsDAO${PROJECT}Structure.m_structureId=T_CmsDAOSubscription.m_structureId
			

C_SUBSCRIPTION_FILTER_PRINCIPALS=T_CmsDAOSubscription.m_principalId IN

C_SUBSCRIPTION_FILTER_PRINCIPALS_END=AND T_CmsDAOSubscription.m_dateDeleted=0 \
									AND T_CmsDAO${PROJECT}Structure.m_structureId=T_CmsDAOSubscription.m_structureId
									
C_SUBSCRIPTION_FILTER_RESOURCES_DATE_MODIFIED=T_CmsDAO${PROJECT}Resources.m_dateLastModified > ? AND T_CmsDAO${PROJECT}Resources.m_dateLastModified < ? 

C_VISIT_SELECT_ATTRIBS=T_CmsDAOSubscriptionVisit 

C_VISIT_READ_ENTRIES=\
SELECT DISTINCT \
	${C_VISIT_SELECT_ATTRIBS} \
FROM \
	CmsDAOSubscriptionVisit T_CmsDAOSubscriptionVisit \
WHERE
# the conditions are build in the subscription driver

C_SUBSCRIPTION_UPDATE_DATE_2=\
SELECT T_CmsDAOSubscription  \
FROM  CmsDAOSubscription T_CmsDAOSubscription \
WHERE \
	T_CmsDAOSubscription.m_structureId = ?
	
C_SUBSCRIPTION_CHECK_2=\
SELECT \
	T_CmsDAOSubscription \
FROM \
	CmsDAOSubscription T_CmsDAOSubscription \
WHERE \
	T_CmsDAOSubscription.m_principalId = ? \
	AND T_CmsDAOSubscription.m_structureId = ?
	
C_SUBSCRIPTION_DELETE=\
SELECT T_CmsDAOSubscription \
FROM \
	CmsDAOSubscription T_CmsDAOSubscription \
WHERE
# the conditions are build in the user driver

C_SUBSCRIPTION_DELETE_FILTER_DATE=T_CmsDAOSubscription.m_dateDeleted>0 AND T_CmsDAOSubscription.m_dateDeleted= ?
C_VISIT_FILTER_DATE_TO=T_CmsDAOSubscriptionVisit.m_visitDate <= ?
C_VISIT_FILTER_STRUCTURE_ID=T_CmsDAOSubscriptionVisit.m_structureId = ?

C_DELETE_URLNAME_MAPPINGS=\
SELECT T_CmsDAO%(PROJECT)UrlNameMappings \
FROM \
	CmsDAO%(PROJECT)UrlNameMappings T_CmsDAO%(PROJECT)UrlNameMappings
	
C_READ_URLNAME_MAPPINGS=\
SELECT T_CmsDAO%(PROJECT)UrlNameMappings \
FROM \
	CmsDAO%(PROJECT)UrlNameMappings T_CmsDAO%(PROJECT)UrlNameMappings
	
	
C_ALIAS_GET_BY_PATH_2= \
	SELECT alias \
	FROM CmsDAOAlias alias \
	WHERE alias.m_siteRoot = ? AND alias.m_aliasPath = ?  
	
C_ALIAS_GET_BY_ID_1= \
	SELECT alias \
	FROM CmsDAOAlias alias \
	WHERE alias.m_structureId = ?


C_ALIAS_DELETE_BY_ID_1= \
	DELETE FROM CmsDAOAlias alias \
	WHERE alias.m_structureId = ? 


C_USER_PUBLISH_LIST_READ_1=\
	SELECT listEntry, s, r \
	FROM CmsDAOUserPublishListEntry listEntry, CmsDAOOfflineStructure s, CmsDAOOfflineResources r \
	WHERE listEntry.m_userId = ? AND listEntry.m_structureId = s.m_structureId AND s.m_resourceId = r.m_resourceId
	
C_USER_PUBLISH_LIST_DELETE_2=\
	DELETE FROM CmsDAOUserPublishListEntry listEntry \
	WHERE listEntry.m_userId = ? AND listEntry.m_structureId = ? 

C_DELETE_REWRITES=\
	DELETE FROM CmsDAORewriteAlias rewriteAlias \
	WHERE 
	
C_READ_REWRITES=\
	SELECT rewriteAlias \
	FROM CmsDAORewriteAlias rewriteAlias \
	WHERE 
				




© 2015 - 2024 Weber Informatics LLC | Privacy Policy