Project

General

Profile

« Previous | Next » 

Revision 52abc79a

Added by Andreas Müller over 12 years ago

lasted Markup updates

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupDocumentImport.java
10 10
package eu.etaxonomy.cdm.io.markup;
11 11

  
12 12
import java.net.MalformedURLException;
13
import java.net.URISyntaxException;
14 13
import java.net.URL;
15 14
import java.util.ArrayList;
16 15
import java.util.Arrays;
......
22 21
import java.util.Queue;
23 22
import java.util.Set;
24 23
import java.util.UUID;
24
import java.util.regex.Matcher;
25
import java.util.regex.Pattern;
25 26

  
26 27
import javax.xml.stream.FactoryConfigurationError;
27 28
import javax.xml.stream.Location;
......
44 45
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade.DerivedUnitType;
45 46
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
46 47
import eu.etaxonomy.cdm.common.CdmUtils;
48
import eu.etaxonomy.cdm.ext.geo.GeoServiceArea;
47 49
import eu.etaxonomy.cdm.io.common.ICdmIO;
48 50
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
49 51
import eu.etaxonomy.cdm.io.markup.UnmatchedLeads.UnmatchedLeadsKey;
......
57 59
import eu.etaxonomy.cdm.model.common.CdmBase;
58 60
import eu.etaxonomy.cdm.model.common.Extension;
59 61
import eu.etaxonomy.cdm.model.common.ExtensionType;
60
import eu.etaxonomy.cdm.model.common.Figure;
61 62
import eu.etaxonomy.cdm.model.common.Language;
62 63
import eu.etaxonomy.cdm.model.common.TermVocabulary;
63 64
import eu.etaxonomy.cdm.model.common.TimePeriod;
......
68 69
import eu.etaxonomy.cdm.model.description.PolytomousKey;
69 70
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
70 71
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
72
import eu.etaxonomy.cdm.model.description.PresenceTerm;
71 73
import eu.etaxonomy.cdm.model.description.TaxonDescription;
72 74
import eu.etaxonomy.cdm.model.description.TextData;
73 75
import eu.etaxonomy.cdm.model.location.NamedArea;
74 76
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
77
import eu.etaxonomy.cdm.model.location.NamedAreaType;
75 78
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity;
76 79
import eu.etaxonomy.cdm.model.media.Media;
77 80
import eu.etaxonomy.cdm.model.name.CultivarPlantName;
......
1115 1118

  
1116 1119
	}
1117 1120

  
1118
	private WriterDataHolder handleWriter(MarkupImportState state,
1119
			XMLEventReader reader, XMLEvent parentEvent)
1120
			throws XMLStreamException {
1121
	private WriterDataHolder handleWriter(MarkupImportState state, XMLEventReader reader, XMLEvent parentEvent) throws XMLStreamException {
1121 1122
		String text = "";
1122 1123
		checkNoAttributes(parentEvent);
1123 1124
		WriterDataHolder dataHolder = new WriterDataHolder();
......
1320 1321
			}
1321 1322
			media = getImageMedia(urlString, READ_MEDIA_DATA, isFigure);
1322 1323
			
1323
			// title
1324
			if (StringUtils.isNotBlank(titleString)) {
1325
				media.putTitle(Language.DEFAULT(), titleString);
1326
			}
1327
			// legend
1328
			if (StringUtils.isNotBlank(legendString)) {
1329
				media.addDescription(legendString, Language.DEFAULT());
1330
			}
1331
			if (StringUtils.isNotBlank(numString)) {
1332
				// TODO use concrete source (e.g. DAPHNIPHYLLACEAE in FM
1333
				// vol.13)
1334
				Reference<?> citation = state.getConfig().getSourceReference();
1335
				media.addSource(numString, "num", citation, null);
1336
				// TODO name used in source if available
1337
			}
1338
			// TODO which citation
1339
			if (StringUtils.isNotBlank(id)) {
1340
				media.addSource(id, null, state.getConfig()
1341
						.getSourceReference(), null);
1342
			} else {
1343
				String message = "Figure id should never be empty or null";
1344
				fireWarningEvent(message, next, 6);
1345
			}
1346
			// text
1347
			// do nothing
1324
			if (media != null){
1325
				// title
1326
				if (StringUtils.isNotBlank(titleString)) {
1327
					media.putTitle(Language.DEFAULT(), titleString);
1328
				}
1329
				// legend
1330
				if (StringUtils.isNotBlank(legendString)) {
1331
					media.addDescription(legendString, Language.DEFAULT());
1332
				}
1333
				if (StringUtils.isNotBlank(numString)) {
1334
					// TODO use concrete source (e.g. DAPHNIPHYLLACEAE in FM
1335
					// vol.13)
1336
					Reference<?> citation = state.getConfig().getSourceReference();
1337
					media.addSource(numString, "num", citation, null);
1338
					// TODO name used in source if available
1339
				}
1340
				// TODO which citation
1341
				if (StringUtils.isNotBlank(id)) {
1342
					media.addSource(id, null, state.getConfig().getSourceReference(), null);
1343
				} else {
1344
					String message = "Figure id should never be empty or null";
1345
					fireWarningEvent(message, next, 6);
1346
				}
1347
				
1348
				// text
1349
				// do nothing
1348 1350

  
1351
			}
1349 1352
		} catch (MalformedURLException e) {
1350 1353
			String message = "Media uri has incorrect syntax: %s";
1351 1354
			message = String.format(message, urlString);
......
1849 1852
			XMLEvent next = readNoWhitespace(reader);
1850 1853
			if (next.isEndElement()) {
1851 1854
				if (isMyEndingElement(next, parentEvent)) {
1852
					checkMandatoryElement(hasCollector,
1853
							parentEvent.asStartElement(), COLLECTOR);
1854
					checkMandatoryElement(hasFieldNum,
1855
							parentEvent.asStartElement(), FIELD_NUM);
1855
					checkMandatoryElement(hasCollector,parentEvent.asStartElement(), COLLECTOR);
1856
					checkMandatoryElement(hasFieldNum,parentEvent.asStartElement(), FIELD_NUM);
1856 1857
					return;
1857 1858
				} else {
1858 1859
					if (isEndingElement(next, ALTERNATIVE_COLLECTOR)) {
......
1935 1936
		while (reader.hasNext()) {
1936 1937
			XMLEvent next = readNoWhitespace(reader);
1937 1938
			if (next.isEndElement()) {
1938
				if (StringUtils.isNotBlank(text)) {
1939
					if (isMyEndingElement(next, parentEvent)) {
1939
				if (isMyEndingElement(next, parentEvent)) {
1940
					if (StringUtils.isNotBlank(text)) {
1941
						text = normalize(text);
1940 1942
						if (isLocality) {
1941 1943
							facade.setLocality(text);
1942 1944
						} else {
1943
							NamedArea area = createArea(text, areaLevel, state);
1945
							text = CdmUtils.removeTrailingDot(text);
1946
							NamedArea area = makeArea(state, text, areaLevel);
1944 1947
							facade.addCollectingArea(area);
1945 1948
						}
1946 1949
					}
......
1978 1981
				handleUnexpectedElement(next);
1979 1982
			}
1980 1983
		}
1981
		// TODO handle missing end element
1982
		throw new IllegalStateException("Specimen type has no closing tag"); // TODO
1983
																				// Auto-generated
1984
																				// method
1985
																				// stub
1986

  
1984
		throw new IllegalStateException("<SpecimenType> has no closing tag"); 
1987 1985
	}
1988 1986

  
1989
	private NamedArea createArea(String text, NamedAreaLevel areaLevel, MarkupImportState state) {
1990
		NamedArea area = NamedArea.NewInstance(text, text, null);
1991
		area.setLevel(areaLevel);
1992
		save(area, state);
1993
		return area;
1994
	}
1987
//	private NamedArea createArea(String text, NamedAreaLevel areaLevel, MarkupImportState state) {
1988
//		NamedArea area = NamedArea.NewInstance(text, text, null);
1989
//		area.setLevel(areaLevel);
1990
//		save(area, state);
1991
//		return area;
1992
//	}
1995 1993

  
1996 1994
	private AgentBase<?> createCollector(String collectorStr) {
1997 1995
		return createAuthor(collectorStr);
......
2955 2953
			}
2956 2954
		}
2957 2955
		throw new IllegalStateException("Some tag has no closing tag");
2958

  
2959 2956
	}
2960 2957

  
2961
	private void handleDistributionLocality(MarkupImportState state,XMLEventReader reader, XMLEvent parentEvent)throws XMLStreamException {
2958
	private String handleDistributionLocality(MarkupImportState state,XMLEventReader reader, XMLEvent parentEvent)throws XMLStreamException {
2962 2959
		Map<String, Attribute> attributes = getAttributes(parentEvent);
2963 2960
		String classValue = getAndRemoveRequiredAttributeValue(parentEvent, attributes, CLASS);
2964 2961
		String statusValue =getAndRemoveAttributeValue(attributes, STATUS);
......
2974 2971
			XMLEvent next = readNoWhitespace(reader);
2975 2972
			if (isMyEndingElement(next, parentEvent)) {
2976 2973
				if (StringUtils.isNotBlank(text)) {
2974
					String label = CdmUtils.removeTrailingDot(normalize(text));
2977 2975
					TaxonDescription description = getTaxonDescription(taxon, ref, false, true);
2978 2976
					NamedAreaLevel level = makeNamedAreaLevel(state,classValue, next);
2979
					NamedArea area = createArea(text, level, state);
2980

  
2977
					
2978
					//status
2981 2979
					PresenceAbsenceTermBase<?> status = null;
2982
					try {
2983
						status = state.getTransformer().getPresenceTermByKey(statusValue);
2984
					} catch (UndefinedTransformerMethodException e) {
2985
						throw new RuntimeException(e);
2980
					if (isNotBlank(statusValue)){
2981
						try {
2982
							status = state.getTransformer().getPresenceTermByKey(statusValue);
2983
							if (status == null){
2984
								//TODO
2985
								String message = "The status '%s' could not be transformed to an CDM status";
2986
								fireWarningEvent(message, next, 4);
2987
							}
2988
						} catch (UndefinedTransformerMethodException e) {
2989
							throw new RuntimeException(e);
2990
						}
2991
					}else{
2992
						status = PresenceTerm.PRESENT();
2986 2993
					}
2987
					Distribution distribution = Distribution.NewInstance(area,status);
2988
					description.addElement(distribution);
2994
					//frequency
2989 2995
					if (isNotBlank(frequencyValue)){
2990 2996
						String message = "The frequency attribute is currently not yet available in CDM";
2991 2997
						fireWarningEvent(message, parentEvent, 6);
2992 2998
					}
2999
					
3000
					NamedArea higherArea = null;
3001
					List<NamedArea> areas = new ArrayList<NamedArea>(); 
3002
					
3003
					String patSingleArea = "([^,\\(]{3,})";
3004
					String patSeparator = "(,|\\sand\\s)";
3005
					String hierarchiePattern = String.format("%s\\((%s(%s%s)*)\\)",patSingleArea, patSingleArea, patSeparator, patSingleArea);
3006
					Pattern patHierarchie = Pattern.compile(hierarchiePattern, Pattern.CASE_INSENSITIVE);
3007
					Matcher matcher = patHierarchie.matcher(label); 
3008
					if (matcher.matches()){
3009
						String higherAreaStr = matcher.group(1).trim();
3010
						higherArea =  makeArea(state, higherAreaStr, level);
3011
						String[] innerAreas = matcher.group(2).split(patSeparator);
3012
						for (String innerArea : innerAreas){
3013
							if (isNotBlank(innerArea)){
3014
								NamedArea singleArea = makeArea(state, innerArea.trim(), level);
3015
								areas.add(singleArea);
3016
								NamedArea partOf = singleArea.getPartOf();
3017
//								if (partOf == null){
3018
//									singleArea.setPartOf(higherArea);
3019
//								}
3020
							}
3021
						}
3022
					}else{
3023
						NamedArea singleArea = makeArea(state, label, level);
3024
						areas.add(singleArea);
3025
					}
3026
					
3027
					for (NamedArea area : areas){
3028
						//create distribution
3029
						Distribution distribution = Distribution.NewInstance(area,status);
3030
						description.addElement(distribution);
3031
					}
2993 3032
				} else {
2994 3033
					String message = "Empty distribution locality";
2995 3034
					fireWarningEvent(message, next, 4);
2996 3035
				}
2997
				return;
3036
				return text;
2998 3037
			} else if (isStartingElement(next, COORDINATES)) {
2999 3038
				//TODO
3000 3039
				handleNotYetImplementedElement(next);
......
3010 3049
		throw new IllegalStateException("<DistributionLocality> has no closing tag");
3011 3050
	}
3012 3051

  
3052
	/**
3053
	 * @param state
3054
	 * @param areaName
3055
	 * @param level
3056
	 * @return 
3057
	 */
3058
	private NamedArea makeArea(MarkupImportState state, String areaName, NamedAreaLevel level) {
3059
		
3060
		
3061
		//TODO FM vocabulary
3062
		TermVocabulary<NamedArea> voc = null; 
3063
		NamedAreaType areaType = null;
3064
		
3065
		NamedArea area = null;
3066
		try {
3067
			area = state.getTransformer().getNamedAreaByKey(areaName);
3068
		} catch (UndefinedTransformerMethodException e) {
3069
			throw new RuntimeException(e);
3070
		}
3071
		if (area == null){
3072
			boolean isNewInState = false;
3073
			UUID uuid = state.getAreaUuid(areaName);
3074
			if (uuid == null){
3075
				isNewInState = true;
3076
				//TODO just for testing -> make generic and move to better place
3077
				if ("Bangka".equals(areaName)){
3078
					String geoServiceLayer="vmap0_as_bnd_political_boundary_a";
3079
					String layerFieldName ="nam";
3080
					//TODO replace #
3081
					String areaValue = "PULAU BANGKA#SUMATERA SELATAN";
3082
					GeoServiceArea geoServiceArea = new GeoServiceArea();
3083
					geoServiceArea.add(geoServiceLayer, layerFieldName, areaValue);
3084
					try {
3085
						String a = geoServiceArea.toXml();
3086
						System.out.println(a);
3087
					} catch (XMLStreamException e) {
3088
						// TODO Auto-generated catch block
3089
						e.printStackTrace();
3090
					}
3091
//					area = createNewArea(areaName,geoServiceLayer, layerFieldName, areaValue);
3092
					
3093
				}
3094
				
3095
				try {
3096
					uuid = state.getTransformer().getNamedAreaUuid(areaName);
3097
				} catch (UndefinedTransformerMethodException e) {
3098
					throw new RuntimeException(e);
3099
				}
3100
			}	
3101
			TermMatchMode matchMode = TermMatchMode.UUID_LABEL;
3102
			area = getNamedArea(state, uuid, areaName, areaName, areaName, areaType, level, voc, matchMode);
3103
			if (isNewInState){
3104
				state.putAreaUuid(areaName, area.getUuid());
3105
			}
3106
		}
3107
		return area;
3108
	}
3109
	
3110

  
3013 3111
	/**
3014 3112
	 * @param state
3015 3113
	 * @param levelString
......
3105 3203
					String message = "Distribution locality only allowed for feature of type 'distribution'";
3106 3204
					fireWarningEvent(message, next, 4);
3107 3205
				}
3108
				handleDistributionLocality(state, reader, next);
3109
			
3206
				text += handleDistributionLocality(state, reader, next);
3110 3207
			} else if (next.isCharacters()) {
3111 3208
				if (!isTextMode) {
3112 3209
					String message = "String is not in text mode";
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupImportBase.java
528 528
	}
529 529
	
530 530

  
531
	/**
532
	 * Trims the text and removes turns all whitespaces into single empty space.
533
	 * @param text
534
	 * @return
535
	 */
531 536
	protected String normalize(String text) {
532 537
		text = StringUtils.trimToEmpty(text);
533 538
		text = text.replaceAll("\\s+", " ");
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupImportState.java
14 14
import java.util.HashSet;
15 15
import java.util.Map;
16 16
import java.util.Set;
17
import java.util.UUID;
17 18

  
18 19
import org.apache.log4j.Logger;
19 20

  
......
63 64
	private Map<String, Set<AnnotatableEntity>> footnoteRefRegister = new HashMap<String, Set<AnnotatableEntity>>();
64 65
	private Map<String, Set<AnnotatableEntity>> figureRefRegister = new HashMap<String, Set<AnnotatableEntity>>();
65 66
	
67
	private Map<String, UUID> areaMap = new HashMap<String, UUID>();
66 68
	
67 69
		
68 70
//**************************** CONSTRUCTOR ******************************************/
......
218 220
		return currentKey;
219 221
	}
220 222

  
223
	/**
224
	 * @param key
225
	 * @return
226
	 * @see java.util.Map#get(java.lang.Object)
227
	 */
228
	public UUID getAreaUuid(Object key) {
229
		return areaMap.get(key);
230
	}
231

  
232
	/**
233
	 * @param key
234
	 * @param value
235
	 * @return
236
	 * @see java.util.Map#put(java.lang.Object, java.lang.Object)
237
	 */
238
	public UUID putAreaUuid(String key, UUID value) {
239
		return areaMap.put(key, value);
240
	}
241
	
242
	
243

  
221 244
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/markup/MarkupTransformer.java
20 20
import eu.etaxonomy.cdm.model.common.MarkerType;
21 21
import eu.etaxonomy.cdm.model.description.Feature;
22 22
import eu.etaxonomy.cdm.model.description.PresenceTerm;
23
import eu.etaxonomy.cdm.model.location.NamedArea;
23 24
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
25
import eu.etaxonomy.cdm.model.location.TdwgArea;
24 26

  
25 27
/**
26 28
 * @author a.mueller
......
31 33
	@SuppressWarnings("unused")
32 34
	private static final Logger logger = Logger.getLogger(MarkupTransformer.class);
33 35
	
36
	//preliminary
37
	public static final UUID uuidKalimantan = UUID.fromString("05c6bce3-2e55-48cb-a414-707e936066d1");
38
	public static final UUID uuidBorneo = UUID.fromString("e615e7e6-5b64-4903-b794-816baab689b3");
39
//	public static final UUID uuidCelebes = UUID.fromString("");
40
	public static final UUID uuidMoluccas = UUID.fromString("0ac8fc74-a081-45e5-b96d-aad367b5f48b");
41
	public static final UUID uuidPeninsularMalaysia = UUID.fromString("9f95af33-ae9e-4031-92f7-9f79d22eecf2");
42
	public static final UUID uuidJava = UUID.fromString("36b93871-0bee-4380-b47e-56a843ce6aa3");
43
	public static final UUID uuidBismarckArchipelago = UUID.fromString("d9a11144-447c-4e72-b75f-9daeb254e7c4");
44
//	public static final UUID uuidNewIreland = UUID.fromString("");
45
	public static final UUID uuidSumatra = UUID.fromString("4395d5e0-64e2-4309-a2ec-b1240919c34d");
46
//	public static final UUID uuidBangka = UUID.fromString("");
47
	public static final UUID uuidSabah = UUID.fromString("8d34b675-7de1-4623-a16a-1e0ca989df0c");
48
	public static final UUID uuidBali = UUID.fromString("3cc15dc7-bc55-4a9b-85af-e1eb733ad845");
49
	
50
	public static final UUID uuidPhilippines  = UUID.fromString("9dee4b0d-d864-4b6f-bd41-39a1ea7c56c3");
51
	
52
	
53
	
34 54
	
35 55
	//extension type uuids
36 56
	public static final UUID uuidTaxonTitle = UUID.fromString("5d9ca987-81f1-4d6c-b06a-eaa8311ca249");
......
56 76
	public static final UUID uuidLocality = UUID.fromString("224a4140-da1f-4046-91bb-fb948916d797");
57 77
	public static final UUID uuidLevelOther = UUID.fromString("4b483cc8-b42d-40ba-9cc7-a656faf629e2");
58 78
	
79
	public static final UUID uuidContinentalRegion = UUID.fromString("06d3a74d-cf2e-4842-8c89-87722b9486a4");
80
	
81
	
82
	
59 83
	//feature uuids
60 84
	
61 85
	public static final UUID uuidFigure = UUID.fromString("5165cd6a-9b31-4a1f-8b30-04ab740c502c");
......
406 430
	public NamedAreaLevel getNamedAreaLevelByKey(String key )throws UndefinedTransformerMethodException {
407 431
		if (CdmUtils.isEmpty(key)){return null;
408 432
		}else if (key.equalsIgnoreCase("country")){return NamedAreaLevel.COUNTRY();
409
//		}else if (key.equalsIgnoreCase("continent")){return NamedAreaLevel.C();
410 433
		}else if (key.equalsIgnoreCase("province")){return NamedAreaLevel.PROVINCE();
411
//		}else if (key.equalsIgnoreCase("region")){return NamedAreaLevel.REGION;
412
//		}else if (key.equalsIgnoreCase("county")){return NamedAreaLevel.COUNTRY();
434
		}else if (key.equalsIgnoreCase("town")){return NamedAreaLevel.TOWN();
413 435
		}else if (key.equalsIgnoreCase("state")){return NamedAreaLevel.STATE();
414

  
415
//		}else if (key.equalsIgnoreCase("habitatecology")){return Feature.ECOLOGY();
436
		}else if (key.equalsIgnoreCase("tdwg1")){return NamedAreaLevel.TDWG_LEVEL1();
437
		}else if (key.equalsIgnoreCase("tdwg2")){return NamedAreaLevel.TDWG_LEVEL2();
438
		}else if (key.equalsIgnoreCase("tdwg3")){return NamedAreaLevel.TDWG_LEVEL3();
439
		}else if (key.equalsIgnoreCase("tdwg4")){return NamedAreaLevel.TDWG_LEVEL4();
416 440
		}else{
417 441
			return null;
418 442
		}
......
425 449
	public UUID getNamedAreaLevelUuid(String key) throws UndefinedTransformerMethodException {
426 450
		if (CdmUtils.isEmpty(key)){return null;
427 451
		}else if (key.equalsIgnoreCase("region")){return uuidRegion;
452
		}else if (key.equalsIgnoreCase("continental region")){return uuidContinentalRegion;
428 453
		}else if (key.equalsIgnoreCase("world")){return uuidWorld;
429 454
		}else if (key.equalsIgnoreCase("county")){return uuidCounty;
430 455
		}else if (key.equalsIgnoreCase("continent")){return uuidContinent;
......
435 460
			return null;
436 461
		}
437 462
	}
463
	
464
	
465

  
466
	/* (non-Javadoc)
467
	 * @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getNamedAreaByKey(java.lang.String)
468
	 */
469
	@Override
470
	public NamedArea getNamedAreaByKey(String key) throws UndefinedTransformerMethodException {
471
		if (CdmUtils.isEmpty(key)){return null;
472
		}else if (key.equalsIgnoreCase("Kalimantan")){return TdwgArea.getAreaByTdwgAbbreviation("BOR-KA");
473
		}else if (key.equalsIgnoreCase("Borneo")){return TdwgArea.getAreaByTdwgAbbreviation("BOR");
474
		}else if (key.equalsIgnoreCase("Peninsular Malaysia")){return TdwgArea.getAreaByTdwgAbbreviation("MLY-PM");
475
			}else if (key.equalsIgnoreCase("Malay Peninsula")){return TdwgArea.getAreaByTdwgAbbreviation("MLY-PM");
476
		}else if (key.equalsIgnoreCase("Java")){return TdwgArea.getAreaByTdwgAbbreviation("JAW-OO");
477
		}else if (key.equalsIgnoreCase("Bismarck Archipelago")){return TdwgArea.getAreaByTdwgAbbreviation("BIS-OO");
478
		}else if (key.equalsIgnoreCase("Sumatra")){return TdwgArea.getAreaByTdwgAbbreviation("SUM-OO");
479
		}else if (key.equalsIgnoreCase("Sabah")){return TdwgArea.getAreaByTdwgAbbreviation("BOR-SB");
480
			}else if (key.equalsIgnoreCase("North Borneo")){return TdwgArea.getAreaByTdwgAbbreviation("BOR-SB");
481
		
482
		}else if (key.equalsIgnoreCase("Bali")){return TdwgArea.getAreaByTdwgAbbreviation("LSI-BA");
483
		}else if (key.equalsIgnoreCase("Moluccas")){return TdwgArea.getAreaByTdwgAbbreviation("MOL-OO");
484
		
485
		}else if (key.equalsIgnoreCase("Indochina")){return TdwgArea.getAreaByTdwgAbbreviation("41");
486
		}else if (key.equalsIgnoreCase("Lesser Sunda Islands")){return TdwgArea.getAreaByTdwgAbbreviation("LSI");
487
		}else if (key.equalsIgnoreCase("Sulawesi")){return TdwgArea.getAreaByTdwgAbbreviation("SUL-OO");
488
			}else if (key.equalsIgnoreCase("Celebes")){return TdwgArea.getAreaByTdwgAbbreviation("SUL-OO");
489
		
490
		}else if (key.equalsIgnoreCase("south-east United States")){return TdwgArea.getAreaByTdwgAbbreviation("78");
491
		}else if (key.equalsIgnoreCase("West Indies")){return TdwgArea.getAreaByTdwgAbbreviation("81");
492
		
493
		}else{
494
			return null;
495
		}
496

  
497
	}
498

  
499
	/* (non-Javadoc)
500
	 * @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getNamedAreaUuid(java.lang.String)
501
	 */
502
	@Override
503
	public UUID getNamedAreaUuid(String key) throws UndefinedTransformerMethodException {
504
		if (CdmUtils.isEmpty(key)){return null;
505
		}else if (key.equalsIgnoreCase("Kalimantan")){return uuidKalimantan;
506
		}else if (key.equalsIgnoreCase("Borneo")){return uuidBorneo;
507
		}else if (key.equalsIgnoreCase("Moluccas")){return uuidMoluccas;
508
		}else if (key.equalsIgnoreCase("Peninsular Malaysia")){return uuidPeninsularMalaysia;
509
		}else if (key.equalsIgnoreCase("Java")){return uuidJava;
510
		}else if (key.equalsIgnoreCase("Bismarck Archipelago")){return uuidBismarckArchipelago;
511
//		}else if (key.equalsIgnoreCase("New Ireland")){return uuidNewIreland;
512
//		}else if (key.equalsIgnoreCase("Celebes")){return uuidSulawesi;
513
		}else if (key.equalsIgnoreCase("Sumatra")){return uuidSumatra;
514
		
515
//		}else if (key.equalsIgnoreCase("Bangka")){return uuidBangka;
516
		}else if (key.equalsIgnoreCase("Sabah")){return uuidSabah;
517
		}else if (key.equalsIgnoreCase("Bali")){return uuidBali;
518
	
519
		//
520
		//Celebes (Sulawesi)
521
		//Moluccas (Ceram, Halmahera, Ambon)
522
		//Peninsular Malaysia (Kedah, Perak, Kelantan, Trengganu, Pahang, Selangor, Negri Sembilan, Malacca, Johore)
523
		//Borneo (Sabah, Sarawak, Kalimantan)
524
		//Sumatra (Aceh, Sumatera Barat, Sumatera Utara)
525
		//Lesser Sunda Islands (Bali, Lombok, Flores, Timor)
526

  
527
		
528
		//countries
529
		}else if (key.equalsIgnoreCase("Philippines")){return uuidPhilippines;
530
		
531

  
532
		
533
		}else{
534
			return null;
535
		}
536
	}
438 537

  
439 538
	/* (non-Javadoc)
440 539
	 * @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getPresenceTermByKey(java.lang.String)

Also available in: Unified diff