|
3.2.1: 2012-12-13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.Update
public final class Update
This class contains static methods used to update items already in the database.
Schema version | Description |
---|---|
90 | The schema as released in BASE 2.17. For information about schema changes before this check the BASE 2.17 code. |
100 | The schema as released in BASE 3.0. We don't list all changes here. |
101 and 102 |
Fixes an issue with duplicate FileSetMemberData entries
due to a bug in the upgrade program. Make sure that the unique
constraint that should prevent duplicates exists.
|
103 |
Added ReporterCloneTemplateData and related classes. No
special update is required.
|
104 |
Make ExperimentData AnnotatableData . No
special update is required.
|
105 |
Added ItemSubtypeData.getPushAnnotations() . All existing subtypes
are set to 'false'.
|
106 |
Added BioPlateData.getEntryDate() and BioPlateData.getEventDate() .
All existing bioplates get a null value.
|
107 |
Added BioPlateTypeData#getStorageType()
All existing bioplate types get a null value.
|
108 |
Added BioPlateData.getSection() , BioPlateData.getTray()
and BioPlateData.getPosition()
All existing bioplates get null values.
|
109 and 110 |
Added DerivedBioAssayData.getPhysicalBioAssays() and DerivedBioAssayData.getParents()
and removed DerivedBioAssayData.getPhysicalBioAssay() and
DerivedBioAssayData.getParent() . Existing derived bioassays are updated in a two-step
procedure. The first step is to copy existing information to the new tables and the second step is
to drop columns that are no longer needed.
|
111 | Not an actual database schema change, but we need to remove annotation sets that have been created without any annotations by the annotation importer and BASE 1->2 migration. |
Field Summary | |
---|---|
private static int |
FILETYPE
|
private static int |
HARDWARETYPE
|
private static int |
HYBRIDIZATION
|
private static int |
IMAGE
|
private static int |
LABELEDEXTRACT
|
private static org.apache.log4j.Logger |
log
Log core events. |
private static int |
PROTOCOLTYPE
|
private static int |
SCAN
|
private static int |
SOFTWARETYPE
|
private static int |
TICK_INTERVAL
|
Constructor Summary | |
---|---|
Update()
|
Method Summary | ||
---|---|---|
static void |
adjustExistingItems(ProgressReporter progress,
String rootLogin,
String rootPassword)
Adjust the existing items in the database to be compatible with the latest mappings. |
|
private static void |
cleanContextFromProperty(Session session,
Item itemType,
String propertyName,
String replacementPropertyName,
boolean forceRemoveFilter)
|
|
private static Map<Integer,Integer> |
copyFileTypes(Session session,
ProgressReporter progress)
Copy from 'FileTypes' table to 'ItemSubtypes' table. |
|
private static Map<Integer,Integer> |
copyHardwareTypes(Session session,
ProgressReporter progress)
Copy from 'HardwareTypes' table to 'ItemSubtypes' table. |
|
private static Map<Integer,Integer> |
copyHybridizations(Session session,
ProgressReporter progress)
Copy from 'Hybridizations' table to 'PhysicalBioAssays' table. |
|
private static void |
copyJarPathToJarFile(Session session,
String tableName)
|
|
private static Map<Integer,Integer> |
copyProtocolTypes(Session session,
ProgressReporter progress)
Copy from 'ProtocolTypes' table to 'ItemSubtypes' table. |
|
private static Map<Integer,Integer> |
copyScans(Session session,
Map<Integer,Integer> hybMap,
ProgressReporter progress)
Copy from 'Scans' table to 'DerivedBioAssays' table. |
|
private static Map<Integer,Integer> |
copySoftwareTypes(Session session,
ProgressReporter progress)
Copy from 'SoftwareTypes' table to 'ItemSubtypes' table. |
|
private static void |
createIndex(Session session,
boolean unique,
String indexName,
String tableName,
String... columnNames)
|
|
private static void |
disablePlugins(Session session)
|
|
private static void |
dropColumn(Session session,
String tableName,
String columnName,
ProgressReporter progress)
|
|
private static void |
dropIndex(Session session,
boolean unique,
String tableName,
String... columnNames)
|
|
private static void |
dropTable(Session session,
String tableName,
ProgressReporter progress)
|
|
private static void |
encryptPasswords(Session session,
ProgressReporter progress)
|
|
private static String |
ensureUnique(String name,
Set<String> names)
Ensure that the given name is unique among the set of names. |
|
private static void |
fixBioMaterialParents(Session session,
ProgressReporter progress)
Copy from 'BioMaterialEventSources' to 'BioMaterialEventSources2' table. |
|
private static void |
fixLabeledExtracts(Session session,
ProgressReporter progress)
|
|
private static void |
fixPlatformFileTypes(Session session)
Set PlatformFileTypes.allow_multiple to false for all with a null value |
|
private static void |
fixProjectDefaultItems(Session session,
ProgressReporter progress)
Copy project default items from 'AnyToAny' to 'ItemParameterValues'. |
|
private static void |
fixRawBioAssays(Session session,
Map<Integer,Integer> scanMap,
ProgressReporter progress)
Find the correct parent derived bioassay and extract for each raw bioassay using the old scan_id column. |
|
private static void |
fixSoftLinks(Session session,
int oldType,
int newType,
String oldDataClass,
String newDataClass,
Map<Integer,Integer> idMap,
Map<Integer,Integer> annotationSetMap,
ProgressReporter progress)
Fix all "soft links" in the BASE database. |
|
private static int |
getSchemaVersion(Session session)
Get the current schema version number as it is stored in the database. |
|
private static TableInfo |
getTableInfo(Session session,
String tableName)
|
|
private static
|
load(Session session,
Class<T> clazz,
Object id)
|
|
private static void |
removeContext(Session session,
int itemType)
Remove context-related information for the given item type. |
|
private static String |
replaceInCommaSeparatedList(String list,
String find,
String replacement)
|
|
private static void |
setSchemaVersion(Session session,
int schemaVersion)
Update the database with a new schema version number. |
|
private static int |
setSchemaVersionInTransaction(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. |
|
static void |
updateToBase3(ProgressReporter progress,
String rootLogin,
String rootPassword)
|
|
private static int |
updateToSchemaVersion100(Session session)
Set subtypes for hybridizations, scans, labeled extracts and labels moved from BASE 2.17 |
|
private static int |
updateToSchemaVersion101(Session session)
Remove duplicate file set members. |
|
private static int |
updateToSchemaVersion102(Session session)
Add unique index on FileSetMembers(fileset_id,datafiletype_id,file_id) |
|
private static int |
updateToSchemaVersion110(Session session,
int currentSchemaVersion,
boolean startedAtBase217)
Move derived bioassay parent items to different tables. |
|
private static int |
updateToSchemaVersion111(Session session,
ProgressReporter progress)
Remove annotation sets that have no annotation values and no inherited annotations. |
|
(package private) static void |
verifyRootLoginAndPassword(String login,
String password)
Verify the root user login and password. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.log4j.Logger log
private static final int LABELEDEXTRACT
private static final int HYBRIDIZATION
private static final int SCAN
private static final int IMAGE
private static final int PROTOCOLTYPE
private static final int HARDWARETYPE
private static final int SOFTWARETYPE
private static final int FILETYPE
private static final int TICK_INTERVAL
Constructor Detail |
---|
public Update()
Method Detail |
---|
public static void updateDatabase(ProgressReporter progress, String rootLogin, String rootPassword) throws BaseException
progress
- An object implementing the ProgressReporter
interfacerootLogin
- The root user loginrootPassword
- The root user password
BaseException
static void verifyRootLoginAndPassword(String login, String password)
private static int getSchemaVersion(Session session) throws BaseException
BaseException
private static void setSchemaVersion(Session session, int schemaVersion) throws BaseException
schemaVersion
- The new schema version number
BaseException
private static int setSchemaVersionInTransaction(Session session, int schemaVersion)
schemaVersion
- The new schema version numberpublic static void adjustExistingItems(ProgressReporter progress, String rootLogin, String rootPassword) throws BaseException
progress
- An object implementing the ProgressReporter
interfacerootLogin
- The root user loginrootPassword
- The root user password
BaseException
private static int updateToSchemaVersion100(Session session) throws BaseException
BaseException
private static int updateToSchemaVersion101(Session session) throws BaseException
BaseException
private static int updateToSchemaVersion102(Session session) throws BaseException
BaseException
private static int updateToSchemaVersion110(Session session, int currentSchemaVersion, boolean startedAtBase217) throws BaseException
BaseException
private static int updateToSchemaVersion111(Session session, ProgressReporter progress) throws BaseException
BaseException
public static void updateToBase3(ProgressReporter progress, String rootLogin, String rootPassword) throws Exception
Exception
private static void encryptPasswords(Session session, ProgressReporter progress)
private static void copyJarPathToJarFile(Session session, String tableName)
private static TableInfo getTableInfo(Session session, String tableName) throws SQLException
SQLException
private static void dropColumn(Session session, String tableName, String columnName, ProgressReporter progress) throws SQLException
SQLException
private static void dropIndex(Session session, boolean unique, String tableName, String... columnNames) throws SQLException
SQLException
private static void createIndex(Session session, boolean unique, String indexName, String tableName, String... columnNames) throws SQLException
SQLException
private static void dropTable(Session session, String tableName, ProgressReporter progress)
private static void disablePlugins(Session session)
private static void removeContext(Session session, int itemType)
private static void cleanContextFromProperty(Session session, Item itemType, String propertyName, String replacementPropertyName, boolean forceRemoveFilter)
private static String replaceInCommaSeparatedList(String list, String find, String replacement)
private static <T> T load(Session session, Class<T> clazz, Object id)
private static void fixLabeledExtracts(Session session, ProgressReporter progress)
private static Map<Integer,Integer> copyHybridizations(Session session, ProgressReporter progress)
private static Map<Integer,Integer> copyScans(Session session, Map<Integer,Integer> hybMap, ProgressReporter progress)
hybMap
- A Map with oldId -> newId for hybridizations
private static void fixRawBioAssays(Session session, Map<Integer,Integer> scanMap, ProgressReporter progress)
scanMap
- A Map with oldId -> newId for scansprivate static Map<Integer,Integer> copyProtocolTypes(Session session, ProgressReporter progress)
private static Map<Integer,Integer> copyHardwareTypes(Session session, ProgressReporter progress)
private static Map<Integer,Integer> copyFileTypes(Session session, ProgressReporter progress)
private static Map<Integer,Integer> copySoftwareTypes(Session session, ProgressReporter progress)
private static void fixPlatformFileTypes(Session session)
private static void fixBioMaterialParents(Session session, ProgressReporter progress)
private static void fixProjectDefaultItems(Session session, ProgressReporter progress)
private static void fixSoftLinks(Session session, int oldType, int newType, String oldDataClass, String newDataClass, Map<Integer,Integer> idMap, Map<Integer,Integer> annotationSetMap, ProgressReporter progress)
oldType
- The old item type codenewType
- The new item type code (must be different from the old or the update may
be incorrect)idMap
- Map with old -> new id values (null or empty is accepted)annotationSetMap
- Map with new item id -> annotation set id (null or empty is accepted)private static String ensureUnique(String name, Set<String> names)
name
- The original namenames
- The set of already used names
|
3.2.1: 2012-12-13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |