Project

General

Profile

Revision f15eb5ec

IDf15eb5ecd13823a61674845b5c029a011bb4e02e
Parent 2fc20029
Child 9c9fe9df

Added by Andreas Müller almost 3 years ago

fix 8004 add sortindex to DescriptionElementBase

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/DescriptionElementBase.java
135 135
    @OrderColumn(name="sortIndex")
136 136
    @ListIndexBase(value=0)  //not really needed as this is the default
137 137
    @Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE})
138
    private List<Media> media = new ArrayList<Media>();
138
    private List<Media> media = new ArrayList<>();
139 139

  
140 140
    @XmlElement(name = "InDescription")
141 141
    @XmlIDREF
......
155 155
    @Merge(MergeMode.ADD_CLONE)
156 156
    private Set<DescriptionElementSource> sources = new HashSet<>();
157 157

  
158
    //#8004 optional sortIndex
159
    private Integer sortIndex = null;
160

  
158 161

  
159 162

  
160 163
    // ************* CONSTRUCTORS *************/
......
465 468
        this.sources.remove(source);
466 469
    }
467 470

  
471

  
472
    public Integer getSortIndex() {
473
        return sortIndex;
474
    }
475
    public void setSortIndex(Integer sortIndex) {
476
        this.sortIndex = sortIndex;
477
    }
478

  
468 479
// ******************* METHODS *************************************************************/
469 480

  
470 481
    protected Map<TermVocabulary, List<DefinedTerm>> makeModifierMap(){
471
        Map<TermVocabulary, List<DefinedTerm>> result = new HashMap<TermVocabulary, List<DefinedTerm>>();
482
        Map<TermVocabulary, List<DefinedTerm>> result = new HashMap<>();
472 483
        for (DefinedTerm modifier : getModifiers()){
473 484
            TermVocabulary<DefinedTerm> voc = modifier.getVocabulary();
474 485
            if (result.get(voc) == null){
475
                result.put(voc, new ArrayList<DefinedTerm>());
486
                result.put(voc, new ArrayList<>());
476 487
            }
477 488
            result.get(voc).add(modifier);
478 489
        }
......
482 493
    public List<DefinedTerm> getModifiers(TermVocabulary voc){
483 494
        List<DefinedTerm> result = makeModifierMap().get(voc);
484 495
        if (result == null){
485
            result = new ArrayList<DefinedTerm>();
496
            result = new ArrayList<>();
486 497
        }
487 498
        return result;
488 499
    }
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v50_51/SchemaUpdater_50_55.java
14 14

  
15 15
import org.apache.log4j.Logger;
16 16

  
17
import eu.etaxonomy.cdm.database.update.ColumnAdder;
17 18
import eu.etaxonomy.cdm.database.update.ColumnRemover;
18 19
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
19 20
import eu.etaxonomy.cdm.database.update.ISchemaUpdaterStep;
......
76 77

  
77 78
        //TODO remove proparte and partial columns
78 79

  
80
        //#8004 add sortindex to description element
81
        stepName = "Add sortindex to description element";
82
        tableName = "DescriptionElementBase";
83
        newColumnName = "sortIndex";
84
        step = ColumnAdder.NewIntegerInstance(stepName, tableName, newColumnName, INCLUDE_AUDIT, null, !NOT_NULL);
85
        stepList.add(step);
86

  
79 87
        return stepList;
80 88

  
81 89
	}
cdmlib-test/src/main/resources/dbscripts/001-cdm.h2.sql
1459 1459
--	SINGLEVALUE DOUBLE,
1460 1460
--	SAMPLESIZE INTEGER,
1461 1461
	UNKNOWNDATA BOOLEAN,
1462
	SORTINDEX INTEGER,
1462 1463
    CREATEDBY_ID INTEGER,
1463 1464
    UPDATEDBY_ID INTEGER,
1464 1465
    FEATURE_ID INTEGER,
......
1495 1496
--	SINGLEVALUE DOUBLE,
1496 1497
--	SAMPLESIZE INTEGER,
1497 1498
    ORDERRELEVANT BOOLEAN,
1498
    UNKNOWNDATA BOOLEAN,
1499
    CREATEDBY_ID INTEGER,
1499
	UNKNOWNDATA BOOLEAN,
1500
    SORTINDEX INTEGER,
1501
	CREATEDBY_ID INTEGER,
1500 1502
    UPDATEDBY_ID INTEGER,
1501 1503
    FEATURE_ID INTEGER,
1502 1504
    INDESCRIPTION_ID INTEGER,

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)