eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/CdmAuthorityTableDropTargetListener.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/transfer/TaxonNodeTransfer.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/ISecuredEditor.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/UsageTermCollection.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDragListener.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDropAdapter.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/UsageTermCollection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/UseObjectStore.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/internal/TaxeditorStorePlugin.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java -text
*/\r
package eu.etaxonomy.taxeditor.editor;\r
\r
-import java.net.URI;\r
-import java.net.URISyntaxException;\r
-\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.ui.IMemento;\r
\r
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
-import eu.etaxonomy.cdm.api.service.ITermService;\r
-import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
-import eu.etaxonomy.cdm.model.common.DefinedTerm;\r
-import eu.etaxonomy.cdm.model.common.MarkerType;\r
-import eu.etaxonomy.cdm.model.common.TermType;\r
-import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
-import eu.etaxonomy.cdm.model.description.Feature;\r
-import eu.etaxonomy.cdm.model.description.State;\r
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.store.UseObjectStore;\r
\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
+ * The context listener will call this class when a new context is started.\r
+ * It will reset the UseObjectStore to guarantee the static\r
+ * content of the store will be refreshed each time we load a new context. \r
* @author a.theys\r
+ * @author a.mueller\r
* @created mar 13, 2012\r
*/\r
public class UseObjectManager extends ContextListenerAdapter{\r
\r
@Override\r
public void contextRefresh(IProgressMonitor monitor) {\r
- monitor.subTask("Refreshing the Uses View");\r
- MessagingUtils.warn(getClass(), "Refreshing Uses View warn");\r
- setupNecessaryItems(monitor);\r
+ monitor.subTask("Reset usage data");\r
+ MessagingUtils.warn(getClass(), "Reset usage data");\r
+ UseObjectStore.reset();\r
}\r
\r
\r
@Override\r
public void contextStart(IMemento memento, IProgressMonitor monitor) {\r
- monitor.subTask("Starting the Uses View");\r
- MessagingUtils.warn(getClass(), "Starting Uses View warn");\r
- setupNecessaryItems(monitor);\r
- }\r
-\r
- private void setupNecessaryItems(IProgressMonitor monitor) {\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
- ConversationHolder conversation = CdmStore.createConversation();\r
-\r
-\r
- //create use marker type if not exists\r
- createUseMarkerType(conversation);\r
-\r
- //create state vocabulary if not exists\r
- createStateVocabulary(monitor, conversation);\r
-\r
- //create state vocabulary if not exists\r
- createCountryVocabulary(monitor, conversation);\r
-\r
- //create plant part vocabulary\r
- createPlantVocabulary(monitor, conversation);\r
-\r
- //create human group vocabulary\r
- createHumanGroupVocabulary(monitor, conversation);\r
-\r
- if(featureUseRecord == null || featureUseSummary == null) {\r
- TermVocabulary<Feature> featureVocabulary = CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidFeatureVocabulary));\r
-// FeatureTree palmWebFeatureTree = CdmStore.getService(IFeatureTreeService.class).find(UsageTermCollection.uuidPalmWebFeatureTree);\r
-\r
- if (featureUseRecord == null ) {\r
- featureUseRecord = Feature.NewInstance(UsageTermCollection.useRecordFeatureLabel, UsageTermCollection.useRecordFeatureLabel, null);\r
- featureUseRecord.setUuid(UsageTermCollection.uuidUseRecordFeature);\r
- featureUseRecord.setSupportsCategoricalData(true);\r
- featureVocabulary.addTerm(featureUseRecord);\r
- \r
-// if (palmWebFeatureTree != null){\r
-// FeatureNode useRecFeatureNode = FeatureNode.NewInstance(featureUseRecord);\r
-// palmWebFeatureTree.getRoot().addChild(useRecFeatureNode);\r
-// }else{\r
-// StoreUtil.warn(getClass(), "No current feature tree available to add useRecord feature");\r
-// }\r
- }\r
- if (featureUseSummary == null) {\r
- featureUseSummary = Feature.NewInstance(UsageTermCollection.useSummaryFeatureLabel, UsageTermCollection.useSummaryFeatureLabel, null);\r
- featureUseSummary.setUuid(UsageTermCollection.uuidUseSummaryFeature);\r
- featureUseSummary.setSupportsTextData(true);\r
- featureVocabulary.addTerm(featureUseSummary);\r
-// if (palmWebFeatureTree != null){\r
-// FeatureNode useSumFeatureNode = FeatureNode.NewInstance(featureUseSummary);\r
-// palmWebFeatureTree.getRoot().addChild(useSumFeatureNode);\r
-// }else{\r
-// StoreUtil.warn(getClass(), "No current feature tree available to add use summary feature");\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
- conversation.close();\r
- }\r
-\r
-\r
- private void createHumanGroupVocabulary(IProgressMonitor monitor,ConversationHolder conversation) {\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
- try {\r
- termSourceUri = new URI("eu.etaxonomy.cdm.model.description.DefinedTerm");\r
- } catch (URISyntaxException e) {\r
- e.printStackTrace();\r
- }\r
-\r
- humanGroupVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.humanGroupLabel, UsageTermCollection.humanGroupLabel, null, termSourceUri);\r
- humanGroupVocabulary.setUuid(UsageTermCollection.uuidHumanGroupVocabulary);\r
-\r
- DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
- newDummyModifier.setUuid(UsageTermCollection.uuidHumanGroupDummy);\r
-\r
- DefinedTerm newSubDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
- newSubDummyModifier.setUuid(UsageTermCollection.uuidEthnicGroupDummy);\r
- newDummyModifier.addIncludes(newSubDummyModifier);\r
- humanGroupVocabulary.addTerm(newDummyModifier);\r
-\r
- CdmStore.getService(IVocabularyService.class).saveOrUpdate(humanGroupVocabulary);\r
- conversation.commit(true);\r
- }\r
- }\r
-\r
-\r
- private void createPlantVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\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
- try {\r
- termSourceUri = new URI("eu.etaxonomy.cdm.model.description.DefinedTerm");\r
- } catch (URISyntaxException e) {\r
- e.printStackTrace();\r
- }\r
- plantPartVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.plantPartLabel, UsageTermCollection.plantPartLabel, null, termSourceUri);\r
- plantPartVocabulary.setUuid(UsageTermCollection.uuidPlantPartVocabulary);\r
-\r
- DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
- newDummyModifier.setUuid(UsageTermCollection.uuidPlantPartDummy);\r
- plantPartVocabulary.addTerm(newDummyModifier);\r
-\r
- CdmStore.getService(IVocabularyService.class).saveOrUpdate(plantPartVocabulary);\r
- conversation.commit(true);\r
- }\r
- }\r
-\r
-\r
- private void createCountryVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\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
- try {\r
- termSourceUri = new URI("eu.etaxonomy.cdm.model.description.DefinedTerm");\r
- } catch (URISyntaxException e) {\r
- e.printStackTrace();\r
- }\r
- countryVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.countryLabel, UsageTermCollection.countryLabel, null, termSourceUri);\r
- countryVocabulary.setUuid(UsageTermCollection.uuidCountryVocabulary);\r
-\r
- DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
- newDummyModifier.setUuid(UsageTermCollection.uuidCountryDummy);\r
- countryVocabulary.addTerm(newDummyModifier);\r
-\r
- CdmStore.getService(IVocabularyService.class).saveOrUpdate(countryVocabulary);\r
- conversation.commit(true);\r
- }\r
- }\r
-\r
-\r
- private void createStateVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\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
- try {\r
- termSourceUri = new URI("eu.etaxonomy.cdm.model.description.State");\r
- } catch (URISyntaxException e) {\r
- e.printStackTrace();\r
- }\r
-\r
- stateVocabulary = TermVocabulary.NewInstance(TermType.State, UsageTermCollection.useCategoryVocabularyLabel, UsageTermCollection.useCategoryVocabularyLabel, null, termSourceUri);\r
- stateVocabulary.setUuid(UsageTermCollection.uuidUseCategoryVocabulary);\r
-\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
-\r
- stateVocabulary.addTerm(newDummyState);\r
-\r
- CdmStore.getService(IVocabularyService.class).saveOrUpdate(stateVocabulary);\r
- conversation.commit(true);\r
- }\r
+// monitor.subTask("Starting the Uses View");\r
+// MessagingUtils.warn(getClass(), "Starting Uses View warn");\r
+ UseObjectStore.reset();\r
}\r
\r
\r
- private void createUseMarkerType(ConversationHolder conversation) {\r
- MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);\r
- if (useMarkertype == null){\r
- useMarkertype = MarkerType.NewInstance(UsageTermCollection.useMakerLabel, UsageTermCollection.useMakerLabel, null);\r
- useMarkertype.setUuid( UsageTermCollection.uuidUseMarkerType);\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
- }\r
- }\r
}\r
public TaxeditorEditorPlugin() {
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
/** {@inheritDoc} */
public void start(BundleContext context) throws Exception {
super.start(context);
EditorStateManager stateManager = new EditorStateManager();
CdmStore.getContextManager().addContextListener(stateManager);
+ UseObjectManager useManager = new UseObjectManager();
+ CdmStore.getContextManager().addContextListener(useManager);
+
ValidationContextListener vcl = new ValidationContextListener();
// CdmStore.getContextManager().addContextListener(vcl);
logger.trace("Plugin started: " + this.getBundle().getSymbolicName());
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
+
/** {@inheritDoc} */
public void stop(BundleContext context) throws Exception {
plugin = null;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.common.Marker;
-import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.description.IDescribable;
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.TermStore;
+import eu.etaxonomy.taxeditor.store.UsageTermCollection;
/**
* <p>DescriptiveContentProvider class.</p>
List<DescriptionBase<?>> resultDescriptions = new ArrayList<DescriptionBase<?>>();
for(DescriptionBase<?> description : elementDescriptions){
if(! description.isImageGallery()){
- MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);
Set<Marker> descriptionMarkers = description.getMarkers();
if(descriptionMarkers != null && !descriptionMarkers.isEmpty()) {
for (Marker marker: descriptionMarkers) {
- if(!(marker.getMarkerType().equals(useMarkertype))) {
+ if(marker.getMarkerType() != null && !(marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType))) {
resultDescriptions.add(description);
}
}
return resultDescriptions;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public Object getParent(Object element) {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public Object[] getElements(Object inputElement) {
return getChildren(inputElement);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
/**
* <p>dispose</p>
*/
featureNodeContainerCache.clear();
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
import java.util.Map;\r
import java.util.Set;\r
\r
-import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.model.common.Marker;\r
import eu.etaxonomy.cdm.model.common.MarkerType;\r
import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
import eu.etaxonomy.cdm.model.description.IDescribable;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;\r
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveContentProvider;\r
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.store.UsageTermCollection;\r
\r
/**\r
* The class provides the required content to the Uses View\r
if(parentElement instanceof Taxon){\r
Taxon taxon = (Taxon) parentElement;\r
this.markerTypes.addAll(CdmStore.getTermManager().getPreferredTerms(MarkerType.class));\r
- for(DescriptionBase description : taxon.getDescriptions()){\r
+ for(DescriptionBase<?> description : taxon.getDescriptions()){\r
if(! description.isImageGallery()){\r
- MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);\r
- Set<Marker> descriptionMarkers = description.getMarkers();\r
+ Set<Marker> descriptionMarkers = description.getMarkers();\r
if(descriptionMarkers != null) {\r
for (Marker marker: descriptionMarkers) {\r
- if(marker.getMarkerType().equals(useMarkertype)) {\r
+ if(marker.getMarkerType() != null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {\r
descriptions.add(description);\r
}\r
}\r
import eu.etaxonomy.cdm.model.description.TextData;\r
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;\r
+import eu.etaxonomy.taxeditor.store.UsageTermCollection;\r
\r
/**\r
* UsesLabelProvider Class\r
import org.eclipse.swt.widgets.Tree;\r
\r
import eu.etaxonomy.cdm.model.common.CdmBase;\r
-import eu.etaxonomy.taxeditor.editor.UseObjectManager;\r
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener;\r
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;\r
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;\r
*/\r
public class UsesViewPart extends DescriptiveViewPart {\r
\r
- \r
- \r
public UsesViewPart() {\r
super();\r
- UseObjectManager useManager = new UseObjectManager();\r
}\r
\r
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.uses"</code> */\r
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
import eu.etaxonomy.taxeditor.editor.view.descriptive.handler.CreateDescriptionElementHandler;
import eu.etaxonomy.taxeditor.editor.view.uses.operation.CreateUseRecordOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.UsageTermCollection;
+import eu.etaxonomy.taxeditor.store.UseObjectStore;
/**
* CreateUseRecordHandler Class
@Override
protected AbstractPostOperation operationCreationInstance(String label, ExecutionEvent event, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
//Use Record Feature retrieval below
- Feature feature = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseRecordFeature);
+ Feature feature = UseObjectStore.getUseRecordFeature();
feature.setSupportsCategoricalData(true);
return new CreateUseRecordOperation(label,
EditorUtil.getUndoContext(),
\r
import org.eclipse.core.commands.ExecutionEvent;\r
\r
-import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
import eu.etaxonomy.cdm.model.description.Feature;\r
import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;\r
import eu.etaxonomy.taxeditor.editor.view.descriptive.handler.CreateDescriptionElementHandler;\r
import eu.etaxonomy.taxeditor.editor.view.uses.operation.CreateUseSummaryOperation;\r
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.store.UseObjectStore;\r
\r
/**\r
* CreateUseSummaryHandler Class\r
@Override\r
protected AbstractPostOperation operationCreationInstance(String label, ExecutionEvent event, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {\r
//Use Record Feature retrieval below\r
- Feature feature = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseSummaryFeature);\r
+ Feature feature = UseObjectStore.getUseSummaryFeature();\r
+ \r
feature.setSupportsTextData(true);\r
return new CreateUseSummaryOperation(label, EditorUtil.getUndoContext(), description, feature, postOperationEnabled);\r
}\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.IStatus;\r
\r
-import eu.etaxonomy.cdm.api.service.ITermService;\r
import eu.etaxonomy.cdm.model.common.Marker;\r
import eu.etaxonomy.cdm.model.common.MarkerType;\r
import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;\r
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;\r
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.store.UseObjectStore;\r
\r
/**\r
* CreateTaxonUseOperation Class\r
super(label, undoContext, taxon, postOperationEnabled);\r
}\r
\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
+\r
/** {@inheritDoc} */\r
@Override\r
public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
\r
description = TaxonDescription.NewInstance(element);\r
monitor.worked(20);\r
- MarkerType useMarkerType = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);\r
+ MarkerType useMarkerType = UseObjectStore.getUseMarkerType();\r
marker = Marker.NewInstance(useMarkerType, true);\r
description.addMarker(marker);\r
monitor.worked(40);\r
+++ /dev/null
-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\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
-package eu.etaxonomy.taxeditor.editor;\r
-\r
-import java.util.UUID;\r
-\r
-import eu.etaxonomy.cdm.model.common.VocabularyEnum;\r
-\r
-public class UsageTermCollection {\r
- public final static UUID uuidMarkersVocabulary = UUID.fromString("19dffff7-e142-429c-a420-5d28e4ebe305");\r
- \r
- public final static UUID uuidUseMarkerType = UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039");\r
- public final static String useMakerLabel = "use";\r
- \r
- public final static UUID uuidFeatureVocabulary = VocabularyEnum.Feature.getUuid(); // UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8");\r
- public final static UUID uuidPalmWebFeatureTree = UUID.fromString("72ccce05-7cc8-4dab-8e47-bf3f5fd848a0");\r
- \r
- \r
- public final static UUID uuidUseRecordFeature = UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599");\r
- public final static String useRecordFeatureLabel = "Use Record";\r
- \r
- public final static UUID uuidUseSummaryFeature = UUID.fromString("6acb0348-c070-4512-a37c-67bcac016279");\r
- public final static String useSummaryFeatureLabel = "Use";\r
- \r
- public final static UUID uuidUseCategoryVocabulary = UUID.fromString("67430d7c-fd43-4e9d-af5e-d0dca3f74931");\r
- public final static String useCategoryVocabularyLabel = "Use Category";\r
- public final static String useSubCategoryVocabularyLabel = "Use SubCategory";\r
- public final static UUID uuidUseCategoryDummy = UUID.fromString("983a7184-6a51-489e-aca1-f21fc4fdbae3");\r
- public final static UUID uuidUseSubCategoryDummy = UUID.fromString("a8d80223-5c79-4063-8c6b-4dc8681e9c62");\r
- \r
- public final static UUID uuidCountryVocabulary = UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b");\r
- public final static String countryLabel = "Country";\r
- public final static UUID uuidCountryDummy = UUID.fromString("761dddee-bfa2-41f4-82df-3a19c71adee0");\r
- \r
- public final static UUID uuidPlantPartVocabulary = UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35");\r
- public final static String plantPartLabel = "Plant Part";\r
- public final static UUID uuidPlantPartDummy = UUID.fromString("30150a82-a12f-4278-96ad-7ce708efa082");\r
- \r
- public final static UUID uuidHumanGroupVocabulary = UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc");\r
- public final static String humanGroupLabel = "Human Group";\r
- public final static UUID uuidHumanGroupDummy = UUID.fromString("c4b63327-2548-429d-8d55-81fdba5900a5");\r
- public final static UUID uuidEthnicGroupDummy = UUID.fromString("3ca851e5-d0d4-41cd-9066-f79e246c36c2");\r
- \r
- public final static String ethnicGroupLabel = "Ethnic Group";\r
- \r
- public final static String notAvailableLabel = "N/A";\r
- \r
- \r
- \r
- \r
- \r
- \r
-\r
-\r
- \r
- \r
-}\r
private static SearchManager searchManager = new SearchManager();
private static EditorManager editorManager = new EditorManager();
+
+ private static UseObjectStore useObjectInitializer = new UseObjectStore();
private static CdmStoreConnector job;
--- /dev/null
+/**\r
+* Copyright (C) 2007 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla protected License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.store;\r
+\r
+import java.util.UUID;\r
+\r
+import eu.etaxonomy.cdm.model.common.VocabularyEnum;\r
+\r
+public class UsageTermCollection {\r
+ protected final static UUID uuidMarkersVocabulary = UUID.fromString("19dffff7-e142-429c-a420-5d28e4ebe305");\r
+ \r
+ public final static UUID uuidUseMarkerType = UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039");\r
+ \r
+ protected final static UUID uuidFeatureVocabulary = VocabularyEnum.Feature.getUuid(); // UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8");\r
+ protected final static UUID uuidPalmWebFeatureTree = UUID.fromString("72ccce05-7cc8-4dab-8e47-bf3f5fd848a0");\r
+ \r
+ \r
+ protected final static UUID uuidUseRecordFeature = UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599");\r
+ \r
+ protected final static UUID uuidUseSummaryFeature = UUID.fromString("6acb0348-c070-4512-a37c-67bcac016279");\r
+ \r
+ public final static UUID uuidUseCategoryVocabulary = UUID.fromString("67430d7c-fd43-4e9d-af5e-d0dca3f74931");\r
+ protected final static UUID uuidUseCategoryDummy = UUID.fromString("983a7184-6a51-489e-aca1-f21fc4fdbae3");\r
+ protected final static UUID uuidUseSubCategoryDummy = UUID.fromString("a8d80223-5c79-4063-8c6b-4dc8681e9c62");\r
+ \r
+ protected final static UUID uuidCountryVocabulary = UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b");\r
+ protected final static UUID uuidCountryDummy = UUID.fromString("761dddee-bfa2-41f4-82df-3a19c71adee0");\r
+ \r
+ protected final static UUID uuidPlantPartVocabulary = UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35");\r
+ protected final static UUID uuidPlantPartDummy = UUID.fromString("30150a82-a12f-4278-96ad-7ce708efa082");\r
+ \r
+ protected final static UUID uuidHumanGroupVocabulary = UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc");\r
+ protected final static UUID uuidHumanGroupDummy = UUID.fromString("c4b63327-2548-429d-8d55-81fdba5900a5");\r
+ protected final static UUID uuidEthnicGroupDummy = UUID.fromString("3ca851e5-d0d4-41cd-9066-f79e246c36c2");\r
+\r
+ public final static String useMakerLabel = "use";\r
+ public final static String useRecordFeatureLabel = "Use Record";\r
+ public final static String useSummaryFeatureLabel = "Use";\r
+ public final static String useCategoryVocabularyLabel = "Use Category";\r
+ public final static String useSubCategoryVocabularyLabel = "Use SubCategory";\r
+ public final static String countryLabel = "Country";\r
+ public final static String plantPartLabel = "Plant Part";\r
+ public final static String humanGroupLabel = "Human Group";\r
+ public final static String ethnicGroupLabel = "Ethnic Group";\r
+ public final static String notAvailableLabel = "N/A";\r
+ \r
+ \r
+ \r
+ \r
+ \r
+ \r
+\r
+\r
+ \r
+ \r
+}\r
--- /dev/null
+/**\r
+* Copyright (C) 2011 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\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
+package eu.etaxonomy.taxeditor.store;\r
+\r
+import java.net.URI;\r
+import java.net.URISyntaxException;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.NullProgressMonitor;\r
+\r
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
+import eu.etaxonomy.cdm.api.service.ITermService;\r
+import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.model.common.DefinedTerm;\r
+import eu.etaxonomy.cdm.model.common.MarkerType;\r
+import eu.etaxonomy.cdm.model.common.TermType;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.cdm.model.description.Feature;\r
+import eu.etaxonomy.cdm.model.description.State;\r
+\r
+/**\r
+ * A store to handle all terms and vocabulary required for \r
+ * the UseObjects view and components.\r
+ * Whenever one of the terms is requested, all required terms are generated\r
+ * in the database as we consider the requests as an indicator that \r
+ * someone wants to use the terms.\r
+ * This \r
+ * @author a.theys\r
+ * @author a.mueller\r
+ * @created mar 13, 2012\r
+ */\r
+public class UseObjectStore {\r
+\r
+ private static boolean isInitialized;\r
+ \r
+ private static MarkerType useMarkerType;\r
+ private static Feature useSummaryFeature;\r
+ private static Feature useRecordFeature;\r
+ \r
+ \r
+ public static void reset() {\r
+ isInitialized = false;\r
+ useMarkerType = null;\r
+ useSummaryFeature = null;\r
+ useRecordFeature = null;\r
+ }\r
+ \r
+ public static MarkerType getUseMarkerType() {\r
+ initialize();\r
+ return useMarkerType;\r
+ }\r
+ \r
+ public static Feature getUseSummaryFeature() {\r
+ initialize();\r
+ return useSummaryFeature;\r
+ }\r
+ \r
+ public static Feature getUseRecordFeature() {\r
+ initialize();\r
+ return useRecordFeature;\r
+ }\r
+\r
+ \r
+ private static void initialize(){\r
+ setupNecessaryItems(null);\r
+ isInitialized = true;\r
+ }\r
+ \r
+ private static void setupNecessaryItems( IProgressMonitor monitor ) {\r
+ if (isInitialized){\r
+ return;\r
+ }\r
+ if (monitor == null){\r
+ //TODO can we use a better one?\r
+ monitor = new NullProgressMonitor();\r
+ }\r
+ \r
+ ConversationHolder conversation = CdmStore.createConversation();\r
+ \r
+ //retrieve terms and vocabularies from db\r
+ useRecordFeature = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseRecordFeature);\r
+ useSummaryFeature = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseSummaryFeature);\r
+\r
+ \r
+\r
+ //create use marker type if not exists\r
+ createUseMarkerType(conversation);\r
+\r
+ //create state vocabulary if not exists\r
+ createStateVocabulary(monitor, conversation);\r
+\r
+ //create state vocabulary if not exists\r
+ createCountryVocabulary(monitor, conversation);\r
+\r
+ //create plant part vocabulary\r
+ createPlantVocabulary(monitor, conversation);\r
+\r
+ //create human group vocabulary\r
+ createHumanGroupVocabulary(monitor, conversation);\r
+\r
+ if(useRecordFeature == null || useSummaryFeature == null) {\r
+ TermVocabulary<Feature> featureVocabulary = CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidFeatureVocabulary));\r
+// FeatureTree palmWebFeatureTree = CdmStore.getService(IFeatureTreeService.class).find(UsageTermCollection.uuidPalmWebFeatureTree);\r
+\r
+ if (useRecordFeature == null ) {\r
+ useRecordFeature = Feature.NewInstance(UsageTermCollection.useRecordFeatureLabel, UsageTermCollection.useRecordFeatureLabel, null);\r
+ useRecordFeature.setUuid(UsageTermCollection.uuidUseRecordFeature);\r
+ useRecordFeature.setSupportsCategoricalData(true);\r
+ featureVocabulary.addTerm(useRecordFeature);\r
+ \r
+// if (palmWebFeatureTree != null){\r
+// FeatureNode useRecFeatureNode = FeatureNode.NewInstance(featureUseRecord);\r
+// palmWebFeatureTree.getRoot().addChild(useRecFeatureNode);\r
+// }else{\r
+// StoreUtil.warn(getClass(), "No current feature tree available to add useRecord feature");\r
+// }\r
+ }\r
+ if (useSummaryFeature == null) {\r
+ useSummaryFeature = Feature.NewInstance(UsageTermCollection.useSummaryFeatureLabel, UsageTermCollection.useSummaryFeatureLabel, null);\r
+ useSummaryFeature.setUuid(UsageTermCollection.uuidUseSummaryFeature);\r
+ useSummaryFeature.setSupportsTextData(true);\r
+ featureVocabulary.addTerm(useSummaryFeature);\r
+// if (palmWebFeatureTree != null){\r
+// FeatureNode useSumFeatureNode = FeatureNode.NewInstance(featureUseSummary);\r
+// palmWebFeatureTree.getRoot().addChild(useSumFeatureNode);\r
+// }else{\r
+// StoreUtil.warn(getClass(), "No current feature tree available to add use summary feature");\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
+ conversation.close();\r
+ }\r
+\r
+\r
+ private static void createHumanGroupVocabulary(IProgressMonitor monitor,ConversationHolder conversation) {\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
+ try {\r
+ termSourceUri = new URI("eu.etaxonomy.cdm.model.description.DefinedTerm");\r
+ } catch (URISyntaxException e) {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ humanGroupVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.humanGroupLabel, UsageTermCollection.humanGroupLabel, null, termSourceUri);\r
+ humanGroupVocabulary.setUuid(UsageTermCollection.uuidHumanGroupVocabulary);\r
+\r
+ DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
+ newDummyModifier.setUuid(UsageTermCollection.uuidHumanGroupDummy);\r
+\r
+ DefinedTerm newSubDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
+ newSubDummyModifier.setUuid(UsageTermCollection.uuidEthnicGroupDummy);\r
+ newDummyModifier.addIncludes(newSubDummyModifier);\r
+ humanGroupVocabulary.addTerm(newDummyModifier);\r
+\r
+ CdmStore.getService(IVocabularyService.class).saveOrUpdate(humanGroupVocabulary);\r
+ conversation.commit(true);\r
+ }\r
+ }\r
+\r
+\r
+ private static void createPlantVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\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
+ try {\r
+ termSourceUri = new URI("eu.etaxonomy.cdm.model.description.DefinedTerm");\r
+ } catch (URISyntaxException e) {\r
+ e.printStackTrace();\r
+ }\r
+ plantPartVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.plantPartLabel, UsageTermCollection.plantPartLabel, null, termSourceUri);\r
+ plantPartVocabulary.setUuid(UsageTermCollection.uuidPlantPartVocabulary);\r
+\r
+ DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
+ newDummyModifier.setUuid(UsageTermCollection.uuidPlantPartDummy);\r
+ plantPartVocabulary.addTerm(newDummyModifier);\r
+\r
+ CdmStore.getService(IVocabularyService.class).saveOrUpdate(plantPartVocabulary);\r
+ conversation.commit(true);\r
+ }\r
+ }\r
+\r
+\r
+ private static void createCountryVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\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
+ try {\r
+ termSourceUri = new URI("eu.etaxonomy.cdm.model.description.DefinedTerm");\r
+ } catch (URISyntaxException e) {\r
+ e.printStackTrace();\r
+ }\r
+ countryVocabulary = TermVocabulary.NewInstance(TermType.Modifier, UsageTermCollection.countryLabel, UsageTermCollection.countryLabel, null, termSourceUri);\r
+ countryVocabulary.setUuid(UsageTermCollection.uuidCountryVocabulary);\r
+\r
+ DefinedTerm newDummyModifier = DefinedTerm.NewInstance(TermType.Modifier, UsageTermCollection.notAvailableLabel, UsageTermCollection.notAvailableLabel, null);\r
+ newDummyModifier.setUuid(UsageTermCollection.uuidCountryDummy);\r
+ countryVocabulary.addTerm(newDummyModifier);\r
+\r
+ CdmStore.getService(IVocabularyService.class).saveOrUpdate(countryVocabulary);\r
+ conversation.commit(true);\r
+ }\r
+ }\r
+\r
+\r
+ private static void createStateVocabulary(IProgressMonitor monitor, ConversationHolder conversation) {\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
+ try {\r
+ termSourceUri = new URI("eu.etaxonomy.cdm.model.description.State");\r
+ } catch (URISyntaxException e) {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ stateVocabulary = TermVocabulary.NewInstance(TermType.State, UsageTermCollection.useCategoryVocabularyLabel, UsageTermCollection.useCategoryVocabularyLabel, null, termSourceUri);\r
+ stateVocabulary.setUuid(UsageTermCollection.uuidUseCategoryVocabulary);\r
+\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
+\r
+ stateVocabulary.addTerm(newDummyState);\r
+\r
+ CdmStore.getService(IVocabularyService.class).saveOrUpdate(stateVocabulary);\r
+ conversation.commit(true);\r
+ }\r
+ }\r
+\r
+\r
+ private static void createUseMarkerType(ConversationHolder conversation) {\r
+ useMarkerType = (MarkerType) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseMarkerType);\r
+ if (useMarkerType == null){\r
+ useMarkerType = MarkerType.NewInstance(UsageTermCollection.useMakerLabel, UsageTermCollection.useMakerLabel, null);\r
+ useMarkerType.setUuid( UsageTermCollection.uuidUseMarkerType);\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
+ }\r
+ }\r
+\r
+\r
+}\r
import eu.etaxonomy.cdm.model.description.CategoricalData;\r
import eu.etaxonomy.cdm.model.description.State;\r
import eu.etaxonomy.cdm.model.description.StateData;\r
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
import eu.etaxonomy.taxeditor.store.TermStore;\r
+import eu.etaxonomy.taxeditor.store.UsageTermCollection;\r
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;\r
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;\r
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;\r
List<State> termsToAdd = new ArrayList<State>();\r
for (State term : listOfTerms) {\r
\r
- if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(UsageTermCollection.useCategoryVocabularyLabel))) {\r
+ if ((term.getPartOf() != null) && (term.getPartOf().getUuid().equals( UsageTermCollection.uuidUseCategoryVocabulary))) {\r
termsToAdd.add(term);\r
}\r
- else if ((term.getVocabulary() !=null) && (term.getPartOf() == null) && (term.getVocabulary().getTitleCache().equals(UsageTermCollection.useCategoryVocabularyLabel))) {\r
+ else if ((term.getVocabulary() !=null) && (term.getPartOf() == null) && (term.getVocabulary().getUuid().equals(UsageTermCollection.uuidUseCategoryVocabulary))) {\r
termsToAdd.add(term);\r
}\r
}\r
this.selection = selection;
}
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
@Override
public void run() {
try{
}
}
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createPartControl(org
- * .eclipse.swt.widgets.Composite)
- */
/** {@inheritDoc} */
@Override
public void createPartControl(Composite parent) {
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
-import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.Marker;
-import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.model.description.CategoricalData;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.UsageTermCollection;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
// editor
// and not derived unit facade objects,
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
- * .lang.Object)
- */
@Override
public void setInput(Object input) {
if(input instanceof TreeNode){
// END HACK TO MAKE THE DERIVED UNIT FACADE WORK
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.Viewer#refresh()
- */
+
/** {@inheritDoc} */
@Override
protected void showParts() {
}
else{
Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
- MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
- UsageTermCollection.uuidUseMarkerType);
+
Boolean isUseDescription = false;
for (Marker marker : descriptionMarkers) {
- if (marker.getMarkerType().equals(useMarkertype)) {
+ if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
isUseDescription = true;
}
}
}
} else if (input instanceof DescriptionElementBase) {
Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
- MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
- UsageTermCollection.uuidUseMarkerType);
+
Boolean isUseDescription = false;
for (Marker marker : descriptionMarkers) {
- if (marker.getMarkerType().equals(useMarkertype)) {
+ if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
isUseDescription = true;
}
}
return selection;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
- * .ISelection, boolean)
- */
/** {@inheritDoc} */
@Override
public void setSelection(ISelection selection, boolean reveal) {
private void createDefinedTermSection(RootElement parent) {
destroySections();
- AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(definedTermDetailSection);
}