com.atlassian.confluence.upgrade.upgradetask
Class BodyTypeUpgradeTask

java.lang.Object
  extended by com.atlassian.confluence.upgrade.AbstractUpgradeTask
      extended by com.atlassian.confluence.upgrade.upgradetask.BodyTypeUpgradeTask
All Implemented Interfaces:
DatabaseUpgradeTask, UpgradeTask

public class BodyTypeUpgradeTask
extends AbstractUpgradeTask
implements DatabaseUpgradeTask

Iterates over the content and sets the BodyType to either mail or wiki as per the content type.


Constructor Summary
BodyTypeUpgradeTask(ContentDao contentDao, org.springframework.transaction.PlatformTransactionManager transactionManager, net.sf.hibernate.SessionFactory sessionFactory)
           
 
Method Summary
 void doUpgrade()
          The addition of body types is a two stage operation - Update all content to be wiki - this is done with a single SQL UPDATE for better performance Use Hibernate to iterate over any content that shouldn't be wiki and update.
 String getBuildNumber()
           
 String getShortDescription()
          A short (<50 chars) description of the upgrade action
 
Methods inherited from class com.atlassian.confluence.upgrade.AbstractUpgradeTask
addAllErrors, addError, addError, getConstraint, getErrors, setBuildNumber, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.upgrade.UpgradeTask
getConstraint, getErrors, validate
 

Constructor Detail

BodyTypeUpgradeTask

public BodyTypeUpgradeTask(ContentDao contentDao,
                           org.springframework.transaction.PlatformTransactionManager transactionManager,
                           net.sf.hibernate.SessionFactory sessionFactory)
Method Detail

getBuildNumber

public String getBuildNumber()
Specified by:
getBuildNumber in interface UpgradeTask
Overrides:
getBuildNumber in class AbstractUpgradeTask
Returns:
The build number that this upgrade is applicable to

getShortDescription

public String getShortDescription()
Description copied from interface: UpgradeTask
A short (<50 chars) description of the upgrade action

Specified by:
getShortDescription in interface UpgradeTask
Overrides:
getShortDescription in class AbstractUpgradeTask

doUpgrade

public void doUpgrade()
               throws Exception
The addition of body types is a two stage operation -
  1. Update all content to be wiki - this is done with a single SQL UPDATE for better performance
  2. Use Hibernate to iterate over any content that shouldn't be wiki and update. This is done in batches to prevent the Hibernate session from become too large.
The reasons for breaking it into stages are documented on CONFDEV-990.

Specified by:
doUpgrade in interface UpgradeTask
Throws:
Exception


Copyright © 2003-2013 Atlassian. All Rights Reserved.