merge-update from trunk
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 21 Oct 2013 11:30:29 +0000 (11:30 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 21 Oct 2013 11:30:29 +0000 (11:30 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java

index a12ebd3bff02dd4eb79fba7479f888adce284649..5ede554fcda2bcd27f45091303e78861f26d986a 100644 (file)
@@ -1,8 +1,8 @@
 /**\r
 * Copyright (C) 2011 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
 * http://www.e-taxonomy.eu\r
-* \r
+*\r
 * The contents of this file are subject to the Mozilla Public License Version 1.1\r
 * See LICENSE.TXT at the top of this package for the full license terms.\r
 */\r
@@ -31,58 +31,58 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 \r
 /**\r
  * The context listener will call this class when the uses view is being loaded.\r
- * It checks if the uses view's necessary terms are present in the database. \r
- * It will persist the terms that aren't present, using the CDMLib's services classes. \r
- * @author a.theys     \r
+ * It checks if the uses view's necessary terms are present in the database.\r
+ * It will persist the terms that aren't present, using the CDMLib's services classes.\r
+ * @author a.theys\r
  * @created mar 13, 2012\r
  * @version 1.0\r
  */\r
 public class UseObjectManager extends ContextListenerAdapter{\r
-       \r
-       \r
+\r
+\r
        @Override\r
        public void contextRefresh(IProgressMonitor monitor) {\r
                monitor.subTask("Refreshing the Uses View");\r
                StoreUtil.warn(getClass(), "Refreshing Uses View warn");\r
                setupNecessaryItems(monitor);\r
        }\r
-       \r
-       \r
+\r
+\r
        @Override\r
        public void contextStart(IMemento memento, IProgressMonitor monitor) {\r
                monitor.subTask("Starting the Uses View");\r
                StoreUtil.warn(getClass(), "Starting Uses View warn");\r
                setupNecessaryItems(monitor);\r
        }\r
-       \r
+\r
        private void setupNecessaryItems(IProgressMonitor monitor) {\r
-               \r
+\r
                //retrieve terms and vocabularies from db\r
                Feature featureUseRecord = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseRecordFeature);\r
                Feature featureUseSummary = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseSummaryFeature);\r
-               \r
+\r
                ConversationHolder conversation = CdmStore.createConversation();\r
-               \r
-               \r
+\r
+\r
                //create use marker type if not exists\r
                createUseMarkerType(conversation);\r
-               \r
+\r
                //create state vocabulary if not exists\r
                createStateVocabulary(monitor, conversation);\r
-                       \r
+\r
                //create state vocabulary if not exists\r
                createCountryVocabulary(monitor, conversation);\r
-               \r
+\r
                //create plant part vocabulary\r
                createPlantVocabulary(monitor, conversation);\r
-               \r
+\r
                //create human group vocabulary\r
                createHumanGroupVocabulary(monitor, conversation);\r
-               \r
+\r
                if(featureUseRecord == null || featureUseSummary == null) {\r
-                       TermVocabulary<Feature> featureVocabulary = (TermVocabulary<Feature>)CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidFeatureVocabulary));\r
+                       TermVocabulary<Feature> featureVocabulary = CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidFeatureVocabulary));\r
                        FeatureTree palmWebFeatureTree = CdmStore.getService(IFeatureTreeService.class).find(UsageTermCollection.uuidPalmWebFeatureTree);\r
-                       \r
+\r
                        if (featureUseRecord == null ) {\r
                                featureUseRecord = Feature.NewInstance(UsageTermCollection.useRecordFeatureLabel, UsageTermCollection.useRecordFeatureLabel, null);\r
                                featureUseRecord.setUuid(UsageTermCollection.uuidUseRecordFeature);\r
@@ -109,20 +109,20 @@ public class UseObjectManager extends ContextListenerAdapter{
                                        StoreUtil.warn(getClass(), "No current feature tree available to add use summary feature");\r
                                }\r
                        }\r
-                       \r
+\r
                        CdmStore.getService(IVocabularyService.class).saveOrUpdate(featureVocabulary);\r
                        if (palmWebFeatureTree != null){\r
                                CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(palmWebFeatureTree);\r
                        }\r
                        conversation.commit(true);\r
-                       \r
+\r
                }\r
-               conversation.close();   \r
+               conversation.close();\r
        }\r
 \r
 \r
        private void createHumanGroupVocabulary(IProgressMonitor monitor,ConversationHolder conversation) {\r
-               TermVocabulary<DefinedTerm> humanGroupVocabulary =  (TermVocabulary<DefinedTerm>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidHumanGroupVocabulary);\r
+               TermVocabulary<DefinedTerm> humanGroupVocabulary =  CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidHumanGroupVocabulary);\r
                if (humanGroupVocabulary == null){\r
                        monitor.subTask("create human group vocabulary");\r
                        URI termSourceUri = null;\r
@@ -131,27 +131,24 @@ public class UseObjectManager extends ContextListenerAdapter{
                        } catch (URISyntaxException e) {\r
                                e.printStackTrace();\r
                        }\r
-                       \r
+\r
                        //FIXME:3.3MC----\r
                        //humanGroupVocabulary = TermVocabulary.NewInstance(UsageTermCollection.humanGroupLabel, UsageTermCollection.humanGroupLabel, null, termSourceUri);\r
-                       humanGroupVocabulary = null;\r
-                       humanGroupVocabulary.setUuid(UsageTermCollection.uuidHumanGroupVocabulary);\r
+//                     humanGroupVocabulary.setUuid(UsageTermCollection.uuidHumanGroupVocabulary);\r
                        //FIXME:3.3MC----\r
-                       \r
+\r
                        //FIXME:3.3MC----\r
                        //DefinedTerm newDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
-                       DefinedTerm newDummyModifier = null;\r
-                       newDummyModifier.setUuid(UsageTermCollection.uuidHumanGroupDummy);\r
+//                     newDummyModifier.setUuid(UsageTermCollection.uuidHumanGroupDummy);\r
                        //FIXME:3.3MC----\r
-                       \r
+\r
                        //FIXME:3.3MC----\r
                        //DefinedTerm newSubDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
-                       DefinedTerm newSubDummyModifier = null;\r
-                       newSubDummyModifier.setUuid(UsageTermCollection.uuidEthnicGroupDummy);\r
+//                     newSubDummyModifier.setUuid(UsageTermCollection.uuidEthnicGroupDummy);\r
+//                     newDummyModifier.addIncludes(newSubDummyModifier);\r
+//                     humanGroupVocabulary.addTerm(newDummyModifier);\r
                        //FIXME:3.3MC----\r
-                       \r
-                       newDummyModifier.addIncludes(newSubDummyModifier);\r
-                       humanGroupVocabulary.addTerm(newDummyModifier);\r
+\r
                        CdmStore.getService(IVocabularyService.class).saveOrUpdate(humanGroupVocabulary);\r
                        conversation.commit(true);\r
                }\r
@@ -159,7 +156,7 @@ public class UseObjectManager extends ContextListenerAdapter{
 \r
 \r
        private void createPlantVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\r
-               TermVocabulary<DefinedTerm> plantPartVocabulary =  (TermVocabulary<DefinedTerm>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidPlantPartVocabulary);\r
+               TermVocabulary<DefinedTerm> plantPartVocabulary =  CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidPlantPartVocabulary);\r
                if (plantPartVocabulary == null){\r
                        monitor.subTask("create plant part vocabulary");\r
                        URI termSourceUri = null;\r
@@ -170,17 +167,15 @@ public class UseObjectManager extends ContextListenerAdapter{
                        }\r
                        //FIXME:3.3MC----\r
                        //plantPartVocabulary = TermVocabulary.NewInstance(UsageTermCollection.plantPartLabel, UsageTermCollection.plantPartLabel, null, termSourceUri);\r
-                       plantPartVocabulary = null;\r
-                       plantPartVocabulary.setUuid(UsageTermCollection.uuidPlantPartVocabulary);\r
+//                     plantPartVocabulary.setUuid(UsageTermCollection.uuidPlantPartVocabulary);\r
                        //FIXME:3.3MC----\r
-                       \r
+\r
                        //FIXME:3.3MC----\r
                        //DefinedTerm newDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
-                       DefinedTerm newDummyModifier = null;\r
-                       newDummyModifier.setUuid(UsageTermCollection.uuidPlantPartDummy);\r
-                       plantPartVocabulary.addTerm(newDummyModifier);\r
+//                     newDummyModifier.setUuid(UsageTermCollection.uuidPlantPartDummy);\r
+//                     plantPartVocabulary.addTerm(newDummyModifier);\r
                        //FIXME:3.3MC----\r
-                       \r
+\r
                        CdmStore.getService(IVocabularyService.class).saveOrUpdate(plantPartVocabulary);\r
                        conversation.commit(true);\r
                }\r
@@ -188,7 +183,7 @@ public class UseObjectManager extends ContextListenerAdapter{
 \r
 \r
        private void createCountryVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\r
-               TermVocabulary<DefinedTerm> countryVocabulary =  (TermVocabulary<DefinedTerm>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidCountryVocabulary);\r
+               TermVocabulary<DefinedTerm> countryVocabulary =  CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidCountryVocabulary);\r
                if (countryVocabulary == null){\r
                        monitor.subTask("create country vocabulary");\r
                        URI termSourceUri = null;\r
@@ -199,16 +194,14 @@ public class UseObjectManager extends ContextListenerAdapter{
                        }\r
                        //FIXME:3.3MC----\r
                        //countryVocabulary = TermVocabulary.NewInstance(UsageTermCollection.countryLabel, UsageTermCollection.countryLabel, null, termSourceUri);\r
-                       countryVocabulary = null;\r
-                       countryVocabulary.setUuid(UsageTermCollection.uuidCountryVocabulary);\r
+//                     countryVocabulary.setUuid(UsageTermCollection.uuidCountryVocabulary);\r
                        //FIXME:3.3MC----\r
-                       \r
+\r
                        //FIXME:3.3MC----\r
                        //DefinedTerm newDummyModifier = DefinedTerm.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
-                       DefinedTerm newDummyModifier = null;\r
-                       newDummyModifier.setUuid(UsageTermCollection.uuidCountryDummy);\r
+//                     newDummyModifier.setUuid(UsageTermCollection.uuidCountryDummy);\r
+//                     countryVocabulary.addTerm(newDummyModifier);\r
                        //FIXME:3.3MC----\r
-                       countryVocabulary.addTerm(newDummyModifier);\r
                        CdmStore.getService(IVocabularyService.class).saveOrUpdate(countryVocabulary);\r
                        conversation.commit(true);\r
                }\r
@@ -216,7 +209,7 @@ public class UseObjectManager extends ContextListenerAdapter{
 \r
 \r
        private void createStateVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\r
-               TermVocabulary<State> stateVocabulary =  (TermVocabulary<State>) CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidUseCategoryVocabulary);\r
+               TermVocabulary<State> stateVocabulary =  CdmStore.getService(IVocabularyService.class).find(UsageTermCollection.uuidUseCategoryVocabulary);\r
                if (stateVocabulary == null){\r
                        monitor.subTask("create state vocabulary");\r
                        URI termSourceUri = null;\r
@@ -227,15 +220,16 @@ public class UseObjectManager extends ContextListenerAdapter{
                        }\r
                        //FIXME:3.3MC----\r
                        //stateVocabulary = TermVocabulary.NewInstance(UsageTermCollection.useCategoryVocabularyLabel, UsageTermCollection.useCategoryVocabularyLabel, null, termSourceUri);\r
-                       stateVocabulary = null;\r
-                       stateVocabulary.setUuid(UsageTermCollection.uuidUseCategoryVocabulary);\r
+//                     stateVocabulary.setUuid(UsageTermCollection.uuidUseCategoryVocabulary);\r
                        //FIXME:3.3MC----\r
                        State newDummyState = State.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
                        newDummyState.setUuid(UsageTermCollection.uuidUseCategoryDummy);\r
                        State newDummySubCat = State.NewInstance(UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
                        newDummySubCat.setUuid(UsageTermCollection.uuidUseSubCategoryDummy);\r
                        newDummyState.addIncludes(newDummySubCat);\r
-                       stateVocabulary.addTerm(newDummyState);\r
+                       //FIXME:3.3MC----\r
+//                     stateVocabulary.addTerm(newDummyState);\r
+                       //FIXME:3.3MC----\r
                        CdmStore.getService(IVocabularyService.class).saveOrUpdate(stateVocabulary);\r
                        conversation.commit(true);\r
                }\r
@@ -247,7 +241,7 @@ public class UseObjectManager extends ContextListenerAdapter{
                if (useMarkertype == null){\r
                        useMarkertype = MarkerType.NewInstance(UsageTermCollection.useMakerLabel, UsageTermCollection.useMakerLabel, null);\r
                        useMarkertype.setUuid( UsageTermCollection.uuidUseMarkerType);\r
-                       TermVocabulary<MarkerType> markerTypeVocabulary = (TermVocabulary<MarkerType>)CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidMarkersVocabulary));\r
+                       TermVocabulary<MarkerType> markerTypeVocabulary = CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidMarkersVocabulary));\r
                        markerTypeVocabulary.addTerm(useMarkertype);\r
                        CdmStore.getService(IVocabularyService.class).saveOrUpdate(markerTypeVocabulary);\r
                        conversation.commit(true);\r
index 0f4356a0b094ff5845eb88c7dbfabd0b97b855e4..99279ca673424483300ab7b6b82eba28cbc0aae0 100644 (file)
@@ -132,19 +132,19 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
                        case ICZN:
                                createZoologicalNameParts(formElement, nonViralName, style);
                                break;
-                       case ICVCN:
-                           //TODO implement
-                           logger.warn("ICVCN not yet implemented");
-                           break;
-                       case ICNB:
+            case ICVCN:
                 //TODO implement
-                           logger.warn("ICNB not yet implemented");
-                           break;
-                       case ICNCP:
+                logger.warn("ICVCN not yet implemented");
+                break;
+            case ICNB:
                 //TODO implement
-                           logger.warn("ICNCP not yet implemented");
-                           break;
-                       }
+                logger.warn("ICNB not yet implemented");
+                break;
+            case ICNCP:
+                //TODO implement
+                logger.warn("ICNCP not yet implemented");
+                break;
+            }
                }
        }