2.17.2: 2011-06-17

net.sf.basedb.core
Class Update

java.lang.Object
  extended by net.sf.basedb.core.Update

public final class Update
extends Object

This class contains static methods used to update items already in the database.

Schema version Description
1 The original schema as released in RC1.
2
3
4
5
  • Removed the AffyFeatures table and AffyFeatureData item. The table has to be removed manually.
6
7
8
9
  • Added removable property to HardwareTypeData The update of existing data is done before the database is initiated.
10
11
12
  • Fixed incorrect PlateMapping:s. The 96-to-384 and 384-to-1536 were wrong. The fix renames and flags the old ones as removed.
13
14
15
16
17
18
19 The update sets the parameter version for existing jobs and configurations to 1 and copies data from the old table (PluginConfigurationValues) to the new table (VersionedPluginConfigurationValues)
20 The update sets all color information to false and null for existing items. The install may later add coloring to some of the formulas.
21 The update sets the value to false for all existing plugins with a null value. The installation may later change the value to true for some plugins (ie. export plugins).
22 The update sets the isProtocolParameter value to false for all existing annotation types with a null value.
23
24
  • File parameters are stored as item parameters. The update will move existing file parameter into the ItemValues table.
25
  • Added DiskUsageData.getItemType(). The update will first set all null values to the correct item type by checking the diskconsumable items.
26
27
28 The update must query the dynamic database and set this value for all existing data cubes.
29 No changes at all except increasing the schema version number. The veryfication of remaining quantity is moved to next update of schema version.
30 No schema change as such, but we need to verify and possibly update the MeasuredBioMaterialData.getRemainingQuantity() since a bug may have caused it to have an incorrect value.
31 The update sets the isWriteProtected value to false for all existing files with a null value and lastUpdate to the date and time the internal file last was modified for existing files.
32 The update sets the isDefault value to false for all existing groups and roles with a null value.
33 The update sets the removeJobWhenFinished value to false for all existing jobs.
34 The update sets the itemId value to 0 for all existing contexts.
35 Check and update the size of File items, since they may be incorrect due to a bug in the File class. The MD5 value in that case also incorrect and is set to null. See ticket http://base.thep.lu.se/ticket/575
36 The update sets the averageMethod to Formula.AverageMethod.ARITHMETIC_MEAN. See ticket http://base.thep.lu.se/ticket/648
37 Only the schemaVersion number is increased in this class, the real update work is done when the database is re-build.
38 The update sets the experiment for jobs that belong to a single transformation.
39 Remove AnyToAny links created by older versions of the Base1PluginExecuter plug-in.
40 Used to "Change invalid property filter on 'guiContexts.itemType' to '$ctx.itemType'", but since the source problem never was fixed this is now done in 43.
41 The update sets all values on existing items to false.
42 No longer used.
43 Change invalid property filter on 'guiContexts.itemType' to '$ctx.itemType'". Was originally fixed by 40, but since the source problem never was fixed it must be done again.
44 The update will set a platform for all array designs and raw bioassays. For Affymetrix data it will move the CEL and CDF files from AnyToAny links into FileSet:s.
45 The update sets all values on existing items to true (if no job agent has been configured for the plug-in) or false (if a job agent is configured).
46 No special database update is needed. Only increase the schema version.
47 No special database update is needed. Only increase the schema version.
48 No special database update is needed. Only increase the schema version.
49 The update sets the identification method to COORDINATES for all existing array designs, and deletes the unique index on row, column, block on the Features table.
50 No special database update is needed. Only increase the schema version.
51 External plug-in paths should be relative to the plugins.dir setting in base.config. The update loads all PluginDefinitions with a JAR path and convert the path with PluginDefinition.convertToRelative(String).
52
53
54 No special database update is needed. Only increase the schema version.
55 No special database update is needed. Only increase the schema version.
56 The update needs to calculate the number of reporters in existing lists.
57 The update grants Permission.SELECT_JOBAGENT to the administrators, power users and job agent roles.
58 The update sets the value to false for all directories.
59 Added: The update sets the spot/reporter/value count to 0 for all existing bioassay sets and extra values.
60 Not a schema change as such. We need to update incorrect quota values for experiments. See http://base.thep.lu.se/ticket/1056
61 Added: No special database update is needed. Only increase the schema version.
62 Added: No special database update is needed. Only increase the schema version.
63 Added: The update will set the value for all existing jobs to false.
64 Added: No special database update is needed. Only increase the schema version.
65 Added: No special database update is needed. Only increase the schema version.
66 Added: No special database update is needed. Only increase the schema version.
67 Added: No special database update is needed. Only increase the schema version.
68 Added: The update sets the value for all existing project to 31 (=read, use, write, delete).
69 Added: No special database update is needed. Only increase the schema version.
70 Added: The update sets the values for all existing bioassay sets to 0 (=no transform).
71 Deprecated: No special database update is needed. Only increase the schema version.
72 Made Protocol an Annotatable item. No special database update is needed. Only increase the schema version.
73 Added ChangeHistoryData and ChangeHistoryDetailData. No special update is needed. Only increase the schema version.
74 Added AnnotationData.getLastUpdate(). No special update is needed. Only increase the schema version.
75 Added GroupData.getHiddenMembers(). The update sets the value for all existing groups to false.
76 Added AnnotationSetData.getItemId(). The update sets the value for all existing annotation sets.
77 Added FormulaData.getValueType(). The update will set the value for all existing formulas were it is possible to determine the correct type.
78 Added ProtocolData.getExternalId(). No special update is needed. Only increase the schema version.
79 Set database column Contexts.sort_property to null if it contains a literal 'null' string. Fix for #1463.
80 Added BioPlateTypeData, BioWellData.getOriginalBioMaterial(). All existing bio plates are assigned "Storage plate" as their plate type.
81 Added FileData.getUrl() and FileServer. No special update is needed. Only increase the schema version.
82 Added PermissionTemplateData and ProjectData.getPermissionTemplate(). No special update is needed. Only increase the schema version.
83 Added JobData.getExecuteCommand(). No special update is needed. Only increase the schema version.
84 Added JobData.getScheduled(). The update will set the scheduled date to the creation date for all existing jobs that is in WAITING status or higher.
85 Added TimestampParameterValueData. The update will change the DateParameterValueData to a date-only column type.
86 Fixes a bug in the "recently used settings" handling. The update will remove all settings ending with '.recent' that contains at least one colon (:). See http://base.thep.lu.se/ticket/1517 for more information.
87 Adds UserData.getSendMessagesAsEmail(). The update will set the value to FALSE for all existing users.
88 Adds BioPlateData.isDestroyed(). The update will set the value to FALSE for all existing bioplates.
89 Adds BioPlateEventData, BioPlateEventTypeData, BioPlateEventParticipantData and BioMaterialEventData.getBioPlateEventParticipant(). No special update is needed. Only increase the schema version.
90 Adds BioPlateData.getFreeWells(). The update will count the number of free wells on existing bio plates.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2011-02-09 14:49:51 +0100 (Wed, 09 Feb 2011) $

Field Summary
private static Logger log
          Log core events.
 
Constructor Summary
Update()
           
 
Method Summary
private static void addPluginPermission(org.hibernate.Session session, int pluginId, Item itemType, int granted, int denied)
           
static void adjustExistingItems(boolean update, ProgressReporter progress, String rootLogin, String rootPassword)
          Adjust the existing items in the database to be compatible with the latest mappings.
private static int getSchemaVersion(org.hibernate.Session session)
          Get the current schema version number as it is stored in the database.
private static void setSchemaVersion(org.hibernate.Session session, int schemaVersion)
          Update the database with a new schema version number.
private static int setSchemaVersionInTransaction(org.hibernate.Session session, int schemaVersion)
          Update the schema version version number using a new transaction.
static void updateDatabase(ProgressReporter progress, String rootLogin, String rootPassword)
          Update the database by modifying existing items to follow new requirements.
private static int updateToSchemaVersion10(SessionControl sc)
          Load all plugins and call PluginDefinition.loadPluginInformation(String, String, boolean) for each one so that the PluginDefinition.supportsConfigurations() and PluginDefinition.requiresConfiguration() return correct values.
private static int updateToSchemaVersion19(org.hibernate.Session session)
          Set JobData.getParameterVersion and PluginConfigurationData.getParameterVersion to 1 if they have null values.
private static int updateToSchemaVersion2(org.hibernate.Session session)
          Set Jobs.project_id to 0 for all old jobs with a null value in this column.
private static int updateToSchemaVersion24(org.hibernate.Session session)
          Move FileValues to ItemValues.
private static int updateToSchemaVersion25(org.hibernate.Session session)
          Set the itemType property on all DiskUsageData items.
private static int updateToSchemaVersion28(SessionControl sc)
          Find the number of raw mappings for the spot with the maximum number for each data cube
private static int updateToSchemaVersion30(org.hibernate.Session session)
          Vefify and update the remaining quantity of all biomaterials.
private static int updateToSchemaVersion31(org.hibernate.Session session)
          Set the writeProtected flag on all files with a null value to false.
private static int updateToSchemaVersion35(org.hibernate.Session session)
          Check and update the file size and MD5 on existing file items since they may be incorrect
private static int updateToSchemaVersion38(org.hibernate.Session session)
          Set the experiment for jobs that belong to a single transformation.
private static int updateToSchemaVersion39(org.hibernate.Session session)
          Remove AnyToAny links created by older versions of Base1PluginExecuter
private static int updateToSchemaVersion4(org.hibernate.Session session)
          Find the unique index on HelpTextData.externalId and remove it.
private static int updateToSchemaVersion42(org.hibernate.Session session)
          Has been replaced with updateToSchemaVersion44(SessionControl)
private static int updateToSchemaVersion43(org.hibernate.Session session)
          Update property filter on 'guiContexts.itemType' to '$ctx.itemType'
private static int updateToSchemaVersion44(SessionControl sc)
           Set a platform for array designs and raw bioassays Change experiment raw data type if it is "affymetrix" to "platform.affymetrix" Change project default raw data type if it is "affymetrix" to "platform.affymetrix" Move CEL and CDF files into FileSet:s Remove filters on ArrayDesign.isAffyChip property Add READ permission to PLATFORM and DATAFILETYPE for all plug-ins working with ARRAYDESIGN or RAWBIOASSAY
private static int updateToSchemaVersion45(org.hibernate.Session session)
          Update useInternalJobQueue for plug-ins.
private static int updateToSchemaVersion49(org.hibernate.Session session)
          Find the unique index on Feature (row, column and block) and remove it.
private static int updateToSchemaVersion51(org.hibernate.Session session)
          Change all plug-ins with an absolute JAR path to relative paths.
private static int updateToSchemaVersion56(org.hibernate.Session session)
          Count the number of reporters in existing reporter lists.
private static int updateToSchemaVersion57(org.hibernate.Session session)
          Grant Permission.SELECT_JOBAGENT permission to administrators, power users and job agent roles.
private static int updateToSchemaVersion60(org.hibernate.Session session)
          Update incorrect quota values for experiments.
private static int updateToSchemaVersion7(org.hibernate.Session session)
          Set RawBioAssays.has_data to true or false depending on the number of spots.
private static int updateToSchemaVersion76(org.hibernate.Session session, ProgressReporter progress)
          Sets the AnnotationSetData.getItemId() for all annotation sets with a null value.
private static int updateToSchemaVersion77(org.hibernate.Session session)
          Try to set the value type for as many formulas as possible.
private static int updateToSchemaVersion79(org.hibernate.Session session)
          Set sort_property in Contexts table to null if it contains a literal string 'null'.
private static int updateToSchemaVersion80(org.hibernate.Session session)
          Set the plate type for all existing bio plates to "Storage plate".
private static int updateToSchemaVersion84(org.hibernate.Session session)
          Set the scheduled data for existing jobs.
private static int updateToSchemaVersion85(org.hibernate.Session session)
          Change the date type for the DateValues.values column,.
private static int updateToSchemaVersion86(org.hibernate.Session session)
          Remove all context settings with a name ending with '.recent' that has at least one colon (:) in the value.
private static int updateToSchemaVersion90(org.hibernate.Session session)
          Calculate the value for BioPlateData.getFreeWells() for all existing bioplates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final Logger log
Log core events.

Constructor Detail

Update

public Update()
Method Detail

updateDatabase

public static void updateDatabase(ProgressReporter progress,
                                  String rootLogin,
                                  String rootPassword)
                           throws BaseException
Update the database by modifying existing items to follow new requirements.

Parameters:
progress - An object implementing the ProgressReporter interface
rootLogin - The root user login
rootPassword - The root user password
Throws:
BaseException

getSchemaVersion

private static int getSchemaVersion(org.hibernate.Session session)
                             throws BaseException
Get the current schema version number as it is stored in the database.

Returns:
The schema version number, or 0 if no schem version is found
Throws:
BaseException

setSchemaVersion

private static void setSchemaVersion(org.hibernate.Session session,
                                     int schemaVersion)
                              throws BaseException
Update the database with a new schema version number. This method should be called from an open transaction.

Parameters:
schemaVersion - The new schema version number
Throws:
BaseException

setSchemaVersionInTransaction

private static int setSchemaVersionInTransaction(org.hibernate.Session session,
                                                 int schemaVersion)
Update the schema version version number using a new transaction.

Parameters:
schemaVersion - The new schema version number

updateToSchemaVersion2

private static int updateToSchemaVersion2(org.hibernate.Session session)
                                   throws BaseException
Set Jobs.project_id to 0 for all old jobs with a null value in this column.

Returns:
The new schema version (=2)
Throws:
BaseException

updateToSchemaVersion4

private static int updateToSchemaVersion4(org.hibernate.Session session)
                                   throws BaseException
Find the unique index on HelpTextData.externalId and remove it.

Returns:
The new schema version (=4)
Throws:
BaseException

updateToSchemaVersion7

private static int updateToSchemaVersion7(org.hibernate.Session session)
                                   throws BaseException
Set RawBioAssays.has_data to true or false depending on the number of spots. Delete all Formulas with affymetrix raw data type

Returns:
The new schema version (=7)
Throws:
BaseException

updateToSchemaVersion10

private static int updateToSchemaVersion10(SessionControl sc)
                                    throws BaseException
Load all plugins and call PluginDefinition.loadPluginInformation(String, String, boolean) for each one so that the PluginDefinition.supportsConfigurations() and PluginDefinition.requiresConfiguration() return correct values.

Returns:
The new schema version (=10)
Throws:
BaseException

updateToSchemaVersion19

private static int updateToSchemaVersion19(org.hibernate.Session session)
                                    throws BaseException
Set JobData.getParameterVersion and PluginConfigurationData.getParameterVersion to 1 if they have null values. Copy existing info from PluginConfigurationValues to VersionedPluginConfigurationValues.

Returns:
The new schema version (=19)
Throws:
BaseException

updateToSchemaVersion24

private static int updateToSchemaVersion24(org.hibernate.Session session)
                                    throws BaseException
Move FileValues to ItemValues. Requires setting the ParameterValues.discrimitator to 10 for all parameter with a value of 9 and copying the contents of the FileValues table.

Returns:
The new schema version (=24)
Throws:
BaseException

updateToSchemaVersion25

private static int updateToSchemaVersion25(org.hibernate.Session session)
                                    throws BaseException
Set the itemType property on all DiskUsageData items.

Returns:
The new schema version (=25)
Throws:
BaseException

updateToSchemaVersion28

private static int updateToSchemaVersion28(SessionControl sc)
                                    throws BaseException
Find the number of raw mappings for the spot with the maximum number for each data cube

Returns:
The new schema version (=28)
Throws:
BaseException

updateToSchemaVersion30

private static int updateToSchemaVersion30(org.hibernate.Session session)
                                    throws BaseException
Vefify and update the remaining quantity of all biomaterials.

Returns:
The new schema version (=30)
Throws:
BaseException

updateToSchemaVersion31

private static int updateToSchemaVersion31(org.hibernate.Session session)
Set the writeProtected flag on all files with a null value to false. Set the lastUpdated property on all files with a null value to the last modified time of the internal file.

Returns:
The new schema version (=31)

updateToSchemaVersion35

private static int updateToSchemaVersion35(org.hibernate.Session session)
Check and update the file size and MD5 on existing file items since they may be incorrect

Returns:
The new schema version (=35)

updateToSchemaVersion38

private static int updateToSchemaVersion38(org.hibernate.Session session)
Set the experiment for jobs that belong to a single transformation.

Returns:
The new schema version (=38)

updateToSchemaVersion39

private static int updateToSchemaVersion39(org.hibernate.Session session)
Remove AnyToAny links created by older versions of Base1PluginExecuter

Returns:
The new schema version (=39)

updateToSchemaVersion42

private static int updateToSchemaVersion42(org.hibernate.Session session)
Has been replaced with updateToSchemaVersion44(SessionControl)

Returns:
The new schema version (=42)

updateToSchemaVersion43

private static int updateToSchemaVersion43(org.hibernate.Session session)
Update property filter on 'guiContexts.itemType' to '$ctx.itemType'

Returns:
The new schema version (=43)

updateToSchemaVersion44

private static int updateToSchemaVersion44(SessionControl sc)


addPluginPermission

private static void addPluginPermission(org.hibernate.Session session,
                                        int pluginId,
                                        Item itemType,
                                        int granted,
                                        int denied)

updateToSchemaVersion45

private static int updateToSchemaVersion45(org.hibernate.Session session)
Update useInternalJobQueue for plug-ins.

Returns:
The new schema version (=45)

updateToSchemaVersion49

private static int updateToSchemaVersion49(org.hibernate.Session session)
                                    throws BaseException
Find the unique index on Feature (row, column and block) and remove it.

Returns:
The new schema version (=49)
Throws:
BaseException

updateToSchemaVersion51

private static int updateToSchemaVersion51(org.hibernate.Session session)
                                    throws BaseException
Change all plug-ins with an absolute JAR path to relative paths.

Returns:
The new schema version (=51)
Throws:
BaseException

updateToSchemaVersion56

private static int updateToSchemaVersion56(org.hibernate.Session session)
                                    throws BaseException
Count the number of reporters in existing reporter lists.

Returns:
The new schema version (=56)
Throws:
BaseException

updateToSchemaVersion57

private static int updateToSchemaVersion57(org.hibernate.Session session)
                                    throws BaseException
Grant Permission.SELECT_JOBAGENT permission to administrators, power users and job agent roles.

Returns:
The new schema version (=57)
Throws:
BaseException

updateToSchemaVersion60

private static int updateToSchemaVersion60(org.hibernate.Session session)
                                    throws BaseException
Update incorrect quota values for experiments.

Returns:
The new schema version (=60)
Throws:
BaseException

updateToSchemaVersion76

private static int updateToSchemaVersion76(org.hibernate.Session session,
                                           ProgressReporter progress)
                                    throws BaseException
Sets the AnnotationSetData.getItemId() for all annotation sets with a null value.

Returns:
The new schema version (=76)
Throws:
BaseException

updateToSchemaVersion77

private static int updateToSchemaVersion77(org.hibernate.Session session)
                                    throws BaseException
Try to set the value type for as many formulas as possible.

Throws:
BaseException

updateToSchemaVersion79

private static int updateToSchemaVersion79(org.hibernate.Session session)
                                    throws BaseException
Set sort_property in Contexts table to null if it contains a literal string 'null'.

Throws:
BaseException

updateToSchemaVersion80

private static int updateToSchemaVersion80(org.hibernate.Session session)
                                    throws BaseException
Set the plate type for all existing bio plates to "Storage plate".

Throws:
BaseException

updateToSchemaVersion84

private static int updateToSchemaVersion84(org.hibernate.Session session)
                                    throws BaseException
Set the scheduled data for existing jobs.

Throws:
BaseException

updateToSchemaVersion85

private static int updateToSchemaVersion85(org.hibernate.Session session)
                                    throws BaseException
Change the date type for the DateValues.values column,.

Throws:
BaseException

updateToSchemaVersion86

private static int updateToSchemaVersion86(org.hibernate.Session session)
                                    throws BaseException
Remove all context settings with a name ending with '.recent' that has at least one colon (:) in the value.

Throws:
BaseException

updateToSchemaVersion90

private static int updateToSchemaVersion90(org.hibernate.Session session)
                                    throws BaseException
Calculate the value for BioPlateData.getFreeWells() for all existing bioplates.

Throws:
BaseException

adjustExistingItems

public static void adjustExistingItems(boolean update,
                                       ProgressReporter progress,
                                       String rootLogin,
                                       String rootPassword)
                                throws BaseException
Adjust the existing items in the database to be compatible with the latest mappings. No update to the schema version should be done here. The code must also consider the case that the update failes at a later stage and that the same update is executed again.

Parameters:
update - FALSE if it is an installation. TRUE if it is an update.
progress - An object implementing the ProgressReporter interface
rootLogin - The root user login
rootPassword - The root user password
Throws:
BaseException

2.17.2: 2011-06-17