Project

General

Profile

Revision 7cfc6254

ID7cfc62547f2b3fe22836994a2484b0f6137b6750
Parent b4e979be
Child f974bf29

Added by Andreas Müller about 4 years ago

Add schema updater for v4.0-v4.1

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/metadata/CdmMetaData.java
48 48
	 * The last number represents the date of change.
49 49
	 */
50 50
//	private static final String dbSchemaVersion = "3.6.0.0.201527040000";
51
	private static final String dbSchemaVersion = "4.0.0.0.201604200000";
52
//	private static final String dbSchemaVersion = "3.5.0.0.201531030000";
51
//	private static final String dbSchemaVersion = "4.0.0.0.201604200000";
52
	private static final String dbSchemaVersion = "4.1.0.0.201607300000";
53 53

  
54 54

  
55 55

  
......
84 84
	 *
85 85
	 * The last number represents the date of change.
86 86
	 */
87
//	private static final String termsVersion = "3.6.0.0.201527040000";
88
	private static final String termsVersion = "4.0.0.0.201604200000";
87
	private static final String termsVersion = "4.1.0.0.201607300000";
88
//	private static final String termsVersion = "4.0.0.0.201604200000";
89 89

  
90 90

  
91 91
	public enum MetaDataPropertyName{
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/CdmUpdater.java
18 18
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
19 19
import eu.etaxonomy.cdm.database.CdmDataSource;
20 20
import eu.etaxonomy.cdm.database.ICdmDataSource;
21
import eu.etaxonomy.cdm.database.update.v36_40.SchemaUpdater_36_40;
22
import eu.etaxonomy.cdm.database.update.v36_40.TermUpdater_36_40;
21
import eu.etaxonomy.cdm.database.update.v40_41.SchemaUpdater_40_41;
22
import eu.etaxonomy.cdm.database.update.v40_41.TermUpdater_40_41;
23 23
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
24 24

  
25 25
/**
......
56 56
 * <BR>5.) Go to the previous schema updater class and adjust {@link ISchemaUpdater#getNextUpdater()}
57 57
 * in a way that it returns an instance of the newly created updater.
58 58
 * <BR>6.) Repeat steps 2.-5. for {@link ITermUpdater}
59
 * <BR>7.) Adjust {@link #getCurrentSchemaUpdater()} and {@link #getCurrentTermUpdater()} to return
59
 * <BR>7.) Adjust {@link CdmUpdater#getCurrentSchemaUpdater()} and {@link CdmUpdater#getCurrentTermUpdater()} to return
60 60
 * instances of the newly created updaters.
61 61
 *
62 62
 * @see ISchemaUpdater
......
77 77

  
78 78

  
79 79
    private ITermUpdater getCurrentTermUpdater() {
80
        return TermUpdater_36_40.NewInstance();
80
        return TermUpdater_40_41.NewInstance();
81 81
    }
82 82

  
83 83
    /**
......
85 85
     * @return
86 86
     */
87 87
    private ISchemaUpdater getCurrentSchemaUpdater() {
88
        return SchemaUpdater_36_40.NewInstance();
88
        return SchemaUpdater_40_41.NewInstance();
89 89
    }
90 90

  
91 91
    /**
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/SchemaUpdater_36_40.java
24 24
import eu.etaxonomy.cdm.database.update.SimpleSchemaUpdaterStep;
25 25
import eu.etaxonomy.cdm.database.update.TableNameChanger;
26 26
import eu.etaxonomy.cdm.database.update.v35_36.SchemaUpdater_35_36;
27
import eu.etaxonomy.cdm.database.update.v40_41.SchemaUpdater_40_41;
27 28

  
28 29
/**
29 30
 * @author a.mueller
......
56 57
		String stepName;
57 58
		String tableName;
58 59
		ISchemaUpdaterStep step;
59
//		String columnName;
60 60
		String query;
61 61
		String newColumnName;
62 62
		String oldColumnName;
63
		String columnNames[];
64
		String referencedTables[];
65
		String columnTypes[];
66
//		boolean includeCdmBaseAttributes = false;
67 63

  
68 64
		List<ISchemaUpdaterStep> stepList = new ArrayList<ISchemaUpdaterStep>();
69 65

  
......
511 507

  
512 508
    @Override
513 509
	public ISchemaUpdater getNextUpdater() {
514
		return null;
510
		return SchemaUpdater_40_41.NewInstance();
515 511
	}
516 512

  
517 513
	@Override
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v36_40/TermUpdater_36_40.java
18 18
import eu.etaxonomy.cdm.database.update.ITermUpdaterStep;
19 19
import eu.etaxonomy.cdm.database.update.TermUpdaterBase;
20 20
import eu.etaxonomy.cdm.database.update.v35_36.TermUpdater_35_36;
21
import eu.etaxonomy.cdm.database.update.v40_41.TermUpdater_40_41;
21 22

  
22 23
/**
23 24
 * @author a.mueller
......
48 49
	protected List<ITermUpdaterStep> getUpdaterList() {
49 50
		List<ITermUpdaterStep> list = new ArrayList<ITermUpdaterStep>();
50 51

  
51
//		// proles, #2793
52
//		UUID uuidTerm = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5");
53
//		String description = "Rank ''Proles''. Note: This rank is not compliant with the current nomenclatural codes";
54
//		String label = "Proles";
55
//		String abbrev = "prol.";
56
//		String dtype = Rank.class.getSimpleName();
57
//		boolean isOrdered = true;
58
//		UUID uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b");
59
//		UUID uuidAfterTerm = UUID.fromString("bff22f84-553a-4429-a4e7-c4b3796c3a18");
60
//		UUID uuidLang = Language.uuidEnglish;
61
//		RankClass rankClass = RankClass.Infraspecific;
62
//		String stepName = "Add 'proles' rank to ranks";
63
//		TermType termType = TermType.Rank;
64
//		list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass));
65

  
66 52
		//there are some more new vocabularies, but we trust that the term initializer will
67 53
		//initialize and persist them correctly
68 54

  
......
71 57

  
72 58
	@Override
73 59
	public ITermUpdater getNextUpdater() {
74
		return null;
60
		return TermUpdater_40_41.NewInstance();
75 61
	}
76 62

  
77 63
	@Override
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v40_41/SchemaUpdater_40_41.java
1
// $Id$
2
/**
3
 * Copyright (C) 2007 EDIT
4
 * European Distributed Institute of Taxonomy
5
 * http://www.e-taxonomy.eu
6
 *
7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8
 * See LICENSE.TXT at the top of this package for the full license terms.
9
 */
10

  
11
package eu.etaxonomy.cdm.database.update.v40_41;
12

  
13
import java.util.ArrayList;
14
import java.util.List;
15

  
16
import org.apache.log4j.Logger;
17

  
18
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
19
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
20
import eu.etaxonomy.cdm.database.update.SchemaUpdaterBase;
21
import eu.etaxonomy.cdm.database.update.v36_40.SchemaUpdater_36_40;
22

  
23
/**
24
 * @author a.mueller
25
 * @created 16.04.2016
26
 */
27
public class SchemaUpdater_40_41 extends SchemaUpdaterBase {
28

  
29
	@SuppressWarnings("unused")
30
	private static final Logger logger = Logger.getLogger(SchemaUpdater_40_41.class);
31
	private static final String endSchemaVersion = "4.1.0.0.201607300000";
32
	private static final String startSchemaVersion = "4.0.0.0.201604200000";
33

  
34
	// ********************** FACTORY METHOD *************************************
35

  
36
	public static SchemaUpdater_40_41 NewInstance() {
37
		return new SchemaUpdater_40_41();
38
	}
39

  
40
	/**
41
	 * @param startSchemaVersion
42
	 * @param endSchemaVersion
43
	 */
44
	protected SchemaUpdater_40_41() {
45
		super(startSchemaVersion, endSchemaVersion);
46
	}
47

  
48
	@Override
49
	protected List<ISchemaUpdaterStep> getUpdaterList() {
50

  
51
		String stepName;
52
		String tableName;
53
		ISchemaUpdaterStep step;
54
//		String columnName;
55
		String query;
56
		String newColumnName;
57
		String oldColumnName;
58
		String columnNames[];
59
		String referencedTables[];
60
		String columnTypes[];
61
//		boolean includeCdmBaseAttributes = false;
62

  
63
		List<ISchemaUpdaterStep> stepList = new ArrayList<ISchemaUpdaterStep>();
64

  
65

  
66
//        //#5717
67
//        //Add sec micro reference
68
//        stepName = "Add secMicroReference to TaxonBase";
69
//        tableName = "TaxonBase";
70
//        newColumnName = "secMicroReference";
71
//        step = ColumnAdder.NewStringInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT);
72
//        stepList.add(step);
73

  
74
        return stepList;
75

  
76
    }
77

  
78
    @Override
79
	public ISchemaUpdater getNextUpdater() {
80
		return null;
81
	}
82

  
83
	@Override
84
	public ISchemaUpdater getPreviousUpdater() {
85
		return SchemaUpdater_36_40.NewInstance();
86
	}
87

  
88
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v40_41/TermUpdater_40_41.java
1
// $Id$
2
/**
3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.database.update.v40_41;
11

  
12
import java.util.ArrayList;
13
import java.util.List;
14

  
15
import org.apache.log4j.Logger;
16

  
17
import eu.etaxonomy.cdm.database.update.ITermUpdater;
18
import eu.etaxonomy.cdm.database.update.ITermUpdaterStep;
19
import eu.etaxonomy.cdm.database.update.TermUpdaterBase;
20
import eu.etaxonomy.cdm.database.update.v36_40.TermUpdater_36_40;
21

  
22
/**
23
 * @author a.mueller
24
 * @date 16.04.2016
25
 *
26
 */
27
public class TermUpdater_40_41 extends TermUpdaterBase {
28
	@SuppressWarnings("unused")
29
	private static final Logger logger = Logger.getLogger(TermUpdater_40_41.class);
30

  
31
	private static final String endTermVersion = "4.1.0.0.201607300000";
32
	private static final String startTermVersion = "4.0.0.0.201604200000";
33

  
34
// *************************** FACTORY **************************************/
35

  
36
	public static TermUpdater_40_41 NewInstance(){
37
		return new TermUpdater_40_41(startTermVersion, endTermVersion);
38
	}
39

  
40
// *************************** CONSTRUCTOR ***********************************/
41

  
42
	protected TermUpdater_40_41(String startTermVersion, String endTermVersion) {
43
		super(startTermVersion, endTermVersion);
44
	}
45

  
46

  
47
	@Override
48
	protected List<ITermUpdaterStep> getUpdaterList() {
49
		List<ITermUpdaterStep> list = new ArrayList<ITermUpdaterStep>();
50

  
51
//		// proles, #2793
52
//		UUID uuidTerm = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5");
53
//		String description = "Rank ''Proles''. Note: This rank is not compliant with the current nomenclatural codes";
54
//		String label = "Proles";
55
//		String abbrev = "prol.";
56
//		String dtype = Rank.class.getSimpleName();
57
//		boolean isOrdered = true;
58
//		UUID uuidVocabulary = UUID.fromString("ef0d1ce1-26e3-4e83-b47b-ca74eed40b1b");
59
//		UUID uuidAfterTerm = UUID.fromString("bff22f84-553a-4429-a4e7-c4b3796c3a18");
60
//		UUID uuidLang = Language.uuidEnglish;
61
//		RankClass rankClass = RankClass.Infraspecific;
62
//		String stepName = "Add 'proles' rank to ranks";
63
//		TermType termType = TermType.Rank;
64
//		list.add( SingleTermUpdater.NewInstance(stepName, termType, uuidTerm, abbrev, description, label, abbrev, dtype, uuidVocabulary, uuidLang, isOrdered, uuidAfterTerm).setRankClass(rankClass));
65

  
66
		//there are some more new vocabularies, but we trust that the term initializer will
67
		//initialize and persist them correctly
68

  
69
		return list;
70
	}
71

  
72
	@Override
73
	public ITermUpdater getNextUpdater() {
74
		return null;
75
	}
76

  
77
	@Override
78
	public ITermUpdater getPreviousUpdater() {
79
		return TermUpdater_36_40.NewInstance();
80
	}
81

  
82
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)