Project

General

Profile

Revision 9a9a03a4

ID9a9a03a48de57785983e8d0935982c340e49bac6
Parent 58a29064
Child adfc15ec

Added by Andreas Müller about 4 years ago

#5778 implement first version for PAT symbols update

View differences:

cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/UTF8.java
22 22
	SMALL_A_ACUTE("\u00E1"),
23 23
	RIGHT_SINGLE_QUOT("\u2019"), // Right single quotation mark
24 24
	ENGLISH_QUOT_START("\u201e"),  //Left English quotation mark
25
	ENGLISH_QUOT_END("\u201f")  //Right English quotation mark -‟-
25
	ENGLISH_QUOT_END("\u201f"),  //Right English quotation mark -‟-
26
	BLACK_CIRCLE("\u25CF")       //Black circle, symbol for endemic
26 27

  
27 28
	;
28 29

  
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/database/update/v40_41/SchemaUpdater_40_41.java
15 15

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

  
18
import eu.etaxonomy.cdm.common.UTF8;
18 19
import eu.etaxonomy.cdm.database.update.ColumnAdder;
19 20
import eu.etaxonomy.cdm.database.update.ColumnRemover;
20 21
import eu.etaxonomy.cdm.database.update.ISchemaUpdater;
......
163 164
        step = ColumnRemover.NewInstance(stepName, tableName, oldColumnName, INCLUDE_AUDIT);
164 165
        stepList.add(step);
165 166

  
167
        //5778
168
        //update PresenceAbsenceTerm symbols
169
        updatePresenceAbsenceTermSymbols(stepList);
170

  
166 171
        return stepList;
167 172

  
168 173
    }
169 174

  
175
    /**
176
     * @param stepList
177
     */
178
    private void updatePresenceAbsenceTermSymbols(List<ISchemaUpdaterStep> stepList) {
179
        String enDash = UTF8.EN_DASH.toString();
180

  
181
        //endemic
182
        updateSinglePATsymbol(stepList, "c3ee7048-15b7-4be1-b687-9ce9c1a669d6", "e", "" + UTF8.BLACK_CIRCLE);
183
        //present
184
        updateSinglePATsymbol(stepList, "cef81d25-501c-48d8-bbea-542ec50de2c2", "p", "");
185
        //doubtfully present
186
        updateSinglePATsymbol(stepList, "75a60279-a4c2-4f53-bc57-466028a4b3db", "pd", "?");
187
        //native
188
        updateSinglePATsymbol(stepList, "ddeac4f2-d8fa-43b8-ad7e-ca13abdd32c7", "n", "");
189
        //native: doubtfully native
190
        updateSinglePATsymbol(stepList, "310373bf-7df4-4d02-8cb3-bcc7448805fc", "nd", "d");
191
        //introduced: naturalized
192
        updateSinglePATsymbol(stepList, "e191e89a-a751-4b0c-b883-7f1de70915c9", "in", "n");
193
        //introduced: adventitious (casual)
194
        updateSinglePATsymbol(stepList, "42946bd6-9c22-45ad-a910-7427e8f60bfd", "ia", "a");
195
        //naturalised
196
        updateSinglePATsymbol(stepList, "4e04990a-66fe-4fdf-856c-f40772fbcf0a", "na", "n");
197
        //native: presence questionable
198
        updateSinglePATsymbol(stepList, "925662c1-bb10-459a-8c53-da5a738ac770", "nq", "?");
199
        //introduced: presence questionable
200
        updateSinglePATsymbol(stepList, "83eb0aa0-1a45-495a-a3ca-bf6958b74366", "iq", "?");
201
        //introduced: cultivated
202
        updateSinglePATsymbol(stepList, "fac8c347-8262-44a1-b0a4-db4de451c021", "ic", "c");
203
        //cultivated, presence questionable
204
        updateSinglePATsymbol(stepList, "4f31bfc8-3058-4d83-aea5-3a1fe9773f9f", "cq", "?c");
205
        //absent
206
        updateSinglePATsymbol(stepList, "59709861-f7d9-41f9-bb21-92559cedd598", "a", enDash);
207
        //reported in error
208
        updateSinglePATsymbol(stepList, "38604788-cf05-4607-b155-86db456f7680", "f", enDash);
209
        //native: reported in error
210
        updateSinglePATsymbol(stepList, "aeec2947-2700-4623-8e32-9e3a430569d1", "if", enDash);
211
        //cultivated: reported in error
212
        updateSinglePATsymbol(stepList, "9d4d3431-177a-4abe-8e4b-1558573169d6", "cf", enDash);
213

  
214
    }
215

  
216
    /**
217
     * @param uuid the uuid
218
     * @param oldSymbol
219
     * @param newSybol
220
     */
221
    private void updateSinglePATsymbol(List<ISchemaUpdaterStep> stepList,
222
            String uuid, String oldSymbol, String newSymbol) {
223
        String stepName = "Update single symbol for PresenceAbsenceTerm " + uuid;
224
        String query = "UPDATE @@DefinedTermBase@@ dtb "
225
                + " SET symbol = '" + newSymbol + "'"
226
                + " WHERE uuid = '" + uuid + "' AND symbol = '" + oldSymbol + "'" ;
227
        SimpleSchemaUpdaterStep simpleStep = SimpleSchemaUpdaterStep.NewAuditedInstance(stepName, query, "DefinedTermBase", -99);
228
        stepList.add(simpleStep);
229
    }
230

  
170 231
    @Override
171 232
	public ISchemaUpdater getNextUpdater() {
172 233
		return null;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)