Merged V3.2 to HEAD

17271: Merged DEV/BELARUS/V3.2-2009_10_27 to V3.2
      17224: ETHREEOH-2321: Upgrade scripts for Ent DBs (V3.2 branch)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18042 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-01-14 16:41:29 +00:00
parent 58dd1c6228
commit 354faccbc3
10 changed files with 847 additions and 808 deletions

View File

@@ -82,6 +82,7 @@
<value>classpath:alfresco/dbscripts/create/3.2/${db.script.dialect}/AlfrescoPostCreate-3.2-AuditTables.sql</value>
<value>classpath:alfresco/dbscripts/create/3.2/${db.script.dialect}/AlfrescoPostCreate-3.2-AvmTables.sql</value>
<value>classpath:alfresco/dbscripts/create/3.2/${db.script.dialect}/AlfrescoPostCreate-3.2-Indexes.sql</value>
<value>classpath:alfresco/dbscripts/create/3.2/${db.script.dialect}/AlfrescoPostCreate-3.2-JBPM-Extra.sql</value>
</list>
</property>
<property name="validateUpdateScriptPatches">

View File

@@ -0,0 +1,22 @@
--
-- Title: Fix jbpm tables
-- Database: Generic
-- Since: V3.2 schema 2013
-- Author: Pavel Yurkevich
--
-- Please contact support@alfresco.com if you need assistance with the upgrade.
--
-- This patch is only required to fix the 'configuration_' column in JBPM on DB2.
--
--
-- Record script finish
--
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.2-JBPM-Extra';
INSERT INTO alf_applied_patch
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
VALUES
(
'patch.db-V3.2-JBPM-Extra', 'Manually executed script upgrade V3.2 fix problems in jbpm tables.',
0, 2012, -1, 2013, null, 'UNKOWN', ${TRUE}, ${TRUE}, 'Script completed'
);

View File

@@ -65,18 +65,26 @@
<parameter property="qnameId" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<parameterMap id="parameter_ContentData" class="ContentData">
<parameter property="version" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="contentUrlId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="mimetypeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="encodingId" jdbcType="BIGINT" javaType="java.lang.Long"/>
<parameter property="localeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
</parameterMap>
<!-- -->
<!-- SQL Snippets -->
<!-- -->
<sql id="insert_Mimetype_AutoIncrement">
insert into alf_mimetype (version, mimetype_str)
values (#version#, lower(#mimetype#))
values (#version#, #mimetype#)
</sql>
<sql id="insert_Encoding_AutoIncrement">
insert into alf_encoding (version, encoding_str)
values (#version#, lower(#encoding#))
values (#version#, #encoding#)
</sql>
<sql id="insert_ContentUrl_AutoIncrement">
@@ -86,7 +94,7 @@
<sql id="insert_ContentData_AutoIncrement">
insert into alf_content_data (version, content_url_id, content_mimetype_id, content_encoding_id, content_locale_id)
values (#version#, #contentUrlId#, #mimetypeId#, #encodingId#, #localeId#)
values (?, ?, ?, ?, ?)
</sql>
<!-- -->
@@ -100,7 +108,7 @@
from
alf_mimetype
where
mimetype_str = lower(#mimetype#)
mimetype_str = #mimetype#
</select>
<!-- Get a mimetype based on the ID -->
@@ -120,7 +128,7 @@
from
alf_encoding
where
encoding_str = lower(#encoding#)
encoding_str = #encoding#
</select>
<!-- Get a encoding based on the ID -->
@@ -150,7 +158,7 @@
from
alf_content_url
where
content_url_short = lower(#contentUrlShort#) and
content_url_short = #contentUrlShort# and
content_url_crc = #contentUrlCrc#
</select>
@@ -162,7 +170,7 @@
alf_content_url cu
left outer join alf_content_data cd on (cd.content_url_id = cu.id)
where
content_url_short = lower(#contentUrlShort#) and
content_url_short = #contentUrlShort# and
content_url_crc = #contentUrlCrc# and
cd.id is null
</select>
@@ -226,7 +234,7 @@
<!-- Insert a Content Clean URL -->
<insert id="insert_ContentCleanUrl" parameterClass="ContentClean" >
insert into alf_content_clean (content_url) values (lower(#contentUrl#))
insert into alf_content_clean (content_url) values (#contentUrl#)
</insert>
<!-- Select all content clean URLs -->
@@ -243,7 +251,7 @@
from
alf_content_clean
where
content_url = lower(#contentUrl#)
content_url = #contentUrl#
</delete>
<!-- Remove all Content Clean URLs -->

View File

@@ -52,12 +52,12 @@
<sql id="insert_LockResource_AutoIncrement">
insert into alf_lock_resource (version, qname_ns_id, qname_localname)
values (#version#, #qnameNamespaceId#, lower(#qnameLocalName#))
values (#version#, #qnameNamespaceId#, #qnameLocalName#)
</sql>
<sql id="insert_Lock_AutoIncrement">
insert into alf_lock (version, shared_resource_id, excl_resource_id, lock_token, start_time, expiry_time)
values (#version#, #sharedResourceId#, #exclusiveResourceId#, lower(#lockToken#), #startTime#, #expiryTime#)
values (#version#, #sharedResourceId#, #exclusiveResourceId#, #lockToken#, #startTime#, #expiryTime#)
</sql>
<!-- -->
@@ -72,7 +72,7 @@
alf_lock_resource
where
qname_ns_id = #qnameNamespaceId# and
qname_localname = lower(#qnameLocalName#)
qname_localname = #qnameLocalName#
</select>
<!-- Get a lock based on the ID -->
@@ -117,7 +117,7 @@
alf_lock
set
version = #version#,
lock_token = lower(#lockToken#),
lock_token = #lockToken#,
start_time = #startTime#,
expiry_time = #expiryTime#
where
@@ -131,7 +131,7 @@
alf_lock
set
version = version + 1,
lock_token = lower(?),
lock_token = ?,
start_time = ?,
expiry_time = ?
where

View File

@@ -27,7 +27,7 @@
</selectKey>
</insert>
<insert id="insert_ContentData" parameterClass="ContentData" >
<insert id="insert_ContentData" parameterMap="parameter_ContentData" >
<include refid="alfresco.content.insert_ContentData_AutoIncrement"/>
<selectKey resultClass="long" keyProperty="id" type="post">
KEY_COLUMN:GENERATED_KEY

View File

@@ -87,7 +87,7 @@ public class ContentCleanDAOImpl implements ContentCleanDAO
public void processContentUrl(String contentUrl)
{
ContentCleanEntity contentCleanEntity = new ContentCleanEntity();
contentCleanEntity.setContentUrl(contentUrl);
contentCleanEntity.setContentUrl(contentUrl == null ? null : contentUrl.toLowerCase());
template.insert(INSERT_CONTENT_CLEAN, contentCleanEntity);
// Write the batch
executeBatch();

View File

@@ -92,6 +92,10 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
{
ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
contentUrlEntity.setContentUrl(contentUrl);
if (contentUrlEntity.getContentUrlShort() != null)
{
contentUrlEntity.setContentUrlShort(contentUrlEntity.getContentUrlShort().toLowerCase());
}
contentUrlEntity = (ContentUrlEntity) template.queryForObject(SELECT_CONTENT_URL_BY_KEY, contentUrlEntity);
// Done
return contentUrlEntity;
@@ -110,6 +114,10 @@ public class ContentDataDAOImpl extends AbstractContentDataDAOImpl
{
ContentUrlEntity contentUrlEntity = new ContentUrlEntity();
contentUrlEntity.setContentUrl(contentUrl);
if (contentUrlEntity.getContentUrlShort() != null)
{
contentUrlEntity.setContentUrlShort(contentUrlEntity.getContentUrlShort().toLowerCase());
}
contentUrlEntity = (ContentUrlEntity) template.queryForObject(SELECT_CONTENT_URL_BY_KEY_UNREFERENCED, contentUrlEntity);
// Done
return contentUrlEntity;

View File

@@ -62,7 +62,7 @@ public class EncodingDAOImpl extends AbstractEncodingDAOImpl
protected EncodingEntity getEncodingEntity(String encoding)
{
EncodingEntity encodingEntity = new EncodingEntity();
encodingEntity.setEncoding(encoding);
encodingEntity.setEncoding(encoding == null ? null : encoding.toLowerCase());
encodingEntity = (EncodingEntity) template.queryForObject(SELECT_ENCODING_BY_KEY, encodingEntity);
// Could be null
return encodingEntity;
@@ -73,7 +73,7 @@ public class EncodingDAOImpl extends AbstractEncodingDAOImpl
{
EncodingEntity encodingEntity = new EncodingEntity();
encodingEntity.setVersion(MimetypeEntity.CONST_LONG_ZERO);
encodingEntity.setEncoding(encoding);
encodingEntity.setEncoding(encoding == null ? null : encoding.toLowerCase());
Long id = (Long) template.insert(INSERT_ENCODING, encodingEntity);
encodingEntity.setId(id);
// Done

View File

@@ -62,7 +62,7 @@ public class LockDAOImpl extends AbstractLockDAOImpl
{
LockResourceEntity lockResource = new LockResourceEntity();
lockResource.setQnameNamespaceId(qnameNamespaceId);
lockResource.setQnameLocalName(qnameLocalName);
lockResource.setQnameLocalName(qnameLocalName == null ? null : qnameLocalName.toLowerCase());
lockResource = (LockResourceEntity) template.queryForObject(SELECT_LOCKRESOURCE_BY_QNAME, lockResource);
// Could be null
return lockResource;
@@ -74,7 +74,7 @@ public class LockDAOImpl extends AbstractLockDAOImpl
LockResourceEntity lockResource = new LockResourceEntity();
lockResource.setVersion(LockEntity.CONST_LONG_ZERO);
lockResource.setQnameNamespaceId(qnameNamespaceId);
lockResource.setQnameLocalName(qnameLocalName);
lockResource.setQnameLocalName(qnameLocalName == null ? null : qnameLocalName.toLowerCase());
Long id = (Long) template.insert(INSERT_LOCKRESOURCE, lockResource);
lockResource.setId(id);
// Done
@@ -122,7 +122,7 @@ public class LockDAOImpl extends AbstractLockDAOImpl
lock.setVersion(LockEntity.CONST_LONG_ZERO);
lock.setSharedResourceId(sharedResourceId);
lock.setExclusiveResourceId(exclusiveResourceId);
lock.setLockToken(lockToken);
lock.setLockToken(lockToken == null ? null : lockToken.toLowerCase());
long now = System.currentTimeMillis();
long exp = now + timeToLive;
lock.setStartTime(now);
@@ -142,7 +142,7 @@ public class LockDAOImpl extends AbstractLockDAOImpl
updateLockEntity.incrementVersion(); // Increment the version number
updateLockEntity.setSharedResourceId(lockEntity.getSharedResourceId());
updateLockEntity.setExclusiveResourceId(lockEntity.getExclusiveResourceId());
updateLockEntity.setLockToken(lockToken);
updateLockEntity.setLockToken(lockToken == null ? null : lockToken.toLowerCase());
long now = (timeToLive > 0) ? System.currentTimeMillis() : 0L;
long exp = (timeToLive > 0) ? (now + timeToLive) : 0L;
updateLockEntity.setStartTime(new Long(now));
@@ -162,7 +162,7 @@ public class LockDAOImpl extends AbstractLockDAOImpl
Map<String, Object> params = new HashMap<String, Object>(11);
params.put("exclusiveLockResourceId", exclusiveLockResourceId);
params.put("oldLockToken", oldLockToken);
params.put("newLockToken", newLockToken);
params.put("newLockToken", newLockToken == null ? null : newLockToken.toLowerCase());
long now = (timeToLive > 0) ? System.currentTimeMillis() : 0L;
long exp = (timeToLive > 0) ? (now + timeToLive) : 0L;
params.put("newStartTime", new Long(now));

View File

@@ -61,7 +61,7 @@ public class MimetypeDAOImpl extends AbstractMimetypeDAOImpl
protected MimetypeEntity getMimetypeEntity(String mimetype)
{
MimetypeEntity mimetypeEntity = new MimetypeEntity();
mimetypeEntity.setMimetype(mimetype);
mimetypeEntity.setMimetype(mimetype == null ? null : mimetype.toLowerCase());
mimetypeEntity = (MimetypeEntity) template.queryForObject(SELECT_MIMETYPE_BY_KEY, mimetypeEntity);
// Could be null
return mimetypeEntity;
@@ -72,7 +72,7 @@ public class MimetypeDAOImpl extends AbstractMimetypeDAOImpl
{
MimetypeEntity mimetypeEntity = new MimetypeEntity();
mimetypeEntity.setVersion(MimetypeEntity.CONST_LONG_ZERO);
mimetypeEntity.setMimetype(mimetype);
mimetypeEntity.setMimetype(mimetype == null ? null : mimetype.toLowerCase());
Long id = (Long) template.insert(INSERT_MIMETYPE, mimetypeEntity);
mimetypeEntity.setId(id);
// Done