/**
- *
- */
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
package eu.etaxonomy.taxeditor.editor.key.polytomous;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
/**
* @author n.hoffmann
- *
*/
public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput<PolytomousKey> {
- private final String name;
- private final UUID keyUuid;
private PolytomousKey key;
protected PolytomousKeyEditorInput(ConversationHolder conversation,
UUID polytomousKeyUuid) {
super(conversation);
- this.keyUuid = polytomousKeyUuid;
- this.key = CdmStore.getService(IPolytomousKeyService.class).load(polytomousKeyUuid, null);
- this.name = key.getTitleCache();
+ List<String> propertyPath = new ArrayList<>();
+ propertyPath.add("root");
+ propertyPath.add("root.*");
+ this.key = CdmStore.getService(IPolytomousKeyService.class).load(polytomousKeyUuid, propertyPath);
}
-// public PolytomousKeyEditorInput(UUID polytomousKeyUuid, String name) {
-// super(CdmStore.createConversation());
-// this.keyUuid = polytomousKeyUuid;
-// this.name = name;
-// }
-
-
public static PolytomousKeyEditorInput NewInstance(UUID polytomousKeyUuid) throws Exception{
try{
ConversationHolder conversation = CdmStore.createConversation();
}
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
- public String getName() {
- return name;
- }
-
@Override
public PolytomousKey getKey() {
return key;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
@Override
public boolean equals(Object object) {
if (object instanceof PolytomousKeyEditorInput
return super.equals(object);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
- */
@Override
public List<PolytomousKey> getRootEntities() {
return Arrays.asList(key);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
- */
@Override
public void merge() {
- key = CdmStore.getService(IPolytomousKeyService.class).merge(key);
+ key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true).getMergedEntity();
}
-}
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ Map<Object,List<String>> propertyPathsMap = new HashMap<>();
+
+ List<String> polytomousKeyNodePropertyPaths = Arrays.asList(new String[] {
+ "statement" //$NON-NLS-1$
+ });
+ propertyPathsMap.put("children", polytomousKeyNodePropertyPaths); //$NON-NLS-1$
+ return propertyPathsMap;
+ }
+}
\ No newline at end of file