import eu.etaxonomy.cdm.api.service.IDescriptionService;\r
import eu.etaxonomy.cdm.api.service.IReferenceService;\r
import eu.etaxonomy.cdm.api.service.ITaxonService;\r
-import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.common.mediaMetaData.ImageMetaData;\r
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;\r
import eu.etaxonomy.cdm.io.common.CdmImportBase;\r
private Map<String,List<CdmBase>> mediaObject_ListCdmBase = new HashMap<String,List<CdmBase>>();\r
private Map<String,String> mediaObject_Role = new HashMap<String,String>();\r
private Map<String,ReferenceBase> publications = new HashMap<String,ReferenceBase>();\r
- private Map<String,StateData> stateDatas = new HashMap<String,StateData>();\r
private Map<String,State> states = new HashMap<String,State>();\r
private Map<String,TaxonDescription> taxonDescriptions = new HashMap<String,TaxonDescription>();\r
private Map<String,NonViralName> taxonNameBases = new HashMap<String,NonViralName>();\r
private Set<MarkerType> markerTypes = new HashSet<MarkerType>();\r
\r
private Set<Feature> descriptiveConcepts = new HashSet<Feature>();\r
- private Set<TermVocabulary<Modifier>> termVocabularyStates = new HashSet<TermVocabulary<Modifier>>();\r
private Set<AnnotationType> annotationTypes = new HashSet<AnnotationType>();\r
private Set<Feature> featureSet = new HashSet<Feature>();\r
private ReferenceBase sec = ReferenceFactory.newDatabase();\r
}\r
\r
private void saveAnnotationType() {\r
- for (Iterator<AnnotationType> at = annotationTypes.iterator() ; at.hasNext() ;) {\r
- AnnotationType annotationType = at.next();\r
+ for (AnnotationType annotationType: annotationTypes){\r
getTermService().save(annotationType); \r
}\r
}\r
\r
private void saveStatisticalMeasure() {\r
- for (Iterator<StatisticalMeasure> k = statisticalMeasures.iterator() ; k.hasNext() ;) {\r
- StatisticalMeasure sm = k.next();\r
+ for (StatisticalMeasure sm : statisticalMeasures){\r
getTermService().save(sm); \r
}\r
}\r
\r
private void saveUnits() {\r
if (units != null) {\r
- for (Iterator<MeasurementUnit> k = units.values().iterator() ; k.hasNext() ;){\r
- MeasurementUnit unit = k.next();\r
+ for (MeasurementUnit unit : units.values()){\r
if (unit != null) {\r
getTermService().save(unit); \r
}\r
}\r
\r
private void saveAreas(MarkerType geographicAreaMarkerType) {\r
- for (Iterator<NamedArea> k = namedAreas.values().iterator() ; k.hasNext() ;) {\r
+ for (NamedArea area : namedAreas.values() ){\r
Marker marker = Marker.NewInstance();\r
marker.setMarkerType(geographicAreaMarkerType);\r
- NamedArea area = k.next();\r
area.addMarker(marker);\r
- //getTermService().save(area);\r
getTermService().save(area);\r
}\r
}\r
\r
private void saveStates() {\r
- for (Iterator<State> k = states.values().iterator() ; k.hasNext() ;){\r
- State state = k.next();\r
+ for (State state : states.values() ){\r
getTermService().save(state);\r
}\r
}\r
\r
private void saveMarkerType() {\r
- for(Iterator<MarkerType> k = markerTypes.iterator() ; k.hasNext() ;){\r
- MarkerType markerType = k.next();\r
+ for (MarkerType markerType : markerTypes){\r
getTermService().save(markerType);\r
}\r
}\r
\r
private void saveModifiers() {\r
-\r
- for (Iterator<Modifier> k = modifiers.values().iterator() ; k.hasNext() ;){\r
- Modifier modifier = k.next();\r
+ for (Modifier modifier : modifiers.values() ){\r
getTermService().save(modifier);\r
}\r
}\r
\r
private void saveFeatures() {\r
- ITermService termService = getTermService();\r
- \r
- for (Iterator<Feature> k = features.values().iterator() ; k.hasNext() ;){\r
- Feature feature = k.next();\r
- termService.save(feature); \r
+ for (Feature feature : features.values() ){\r
+ getTermService().save(feature);\r
}\r
}\r
\r
if ((++k % modCount) == 0){ logger.info("StateDefinitions handled: " + (k-1));}\r
\r
String idS = elStateDefinition.getAttributeValue("id");\r
- State state = State.NewInstance();\r
+ State state = states.get(idS);\r
+ if (state == null){\r
+ state = State.NewInstance();\r
+ }else{\r
+ logger.debug("State duplicate found");\r
+ }\r
importRepresentation(elStateDefinition, sddNamespace, state, idS, sddConfig);\r
\r
//StateData stateData = StateData.NewInstance();\r
if ((++l % modCount) == 0){ logger.info("States handled: " + (l-1));}\r
ref = elState.getAttributeValue("ref");\r
State state = states.get(ref);\r
- if (state!=null) {\r
+ if (state != null) {\r
StateData stateData = StateData.NewInstance();\r
stateData.setState(state);\r
List<Element> elModifiers = elState.getChildren("Modifier", sddNamespace);\r
for (Element elModifier : elModifiers){\r
ref = elModifier.getAttributeValue("ref");\r
Modifier modifier = modifiers.get(ref);\r
- if (modifier!=null) {\r
+ if (modifier != null) {\r
stateData.addModifier(modifier);\r
}\r
}\r
- categoricalData.addState(stateData);\r
+ categoricalData.addState(stateData);\r
+ }\r
+ taxonDescription.addElement(categoricalData);\r
}\r
- taxonDescription.addElement(categoricalData);\r
- }\r
}\r
// <Quantitative ref="c2">\r
List<Element> elQuantitatives = elSummaryData.getChildren("Quantitative", sddNamespace);\r