Revision c9285745
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewTaxonNodeWizard.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.newWizard; |
5 | 5 |
|
6 |
import java.util.HashSet; |
|
7 |
import java.util.Set; |
|
6 | 8 |
import java.util.UUID; |
7 | 9 |
|
8 | 10 |
import org.apache.commons.lang.StringUtils; |
9 | 11 |
|
10 | 12 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
11 | 13 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
14 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
12 | 15 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
13 | 16 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
14 | 17 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
... | ... | |
49 | 52 |
TaxonNode taxonNode = parent.addChildTaxon(taxon, parent.getReference(), parent.getMicroReference()); |
50 | 53 |
taxonNode = CdmStore.getService(ITaxonNodeService.class).merge(taxonNode); |
51 | 54 |
generatedTaxonNodeUuid = taxonNode.getUuid(); |
52 |
CdmStore.getCurrentSessionManager().getActiveSession().addEvent(taxonNode, EventType.INSERT); |
|
55 |
Set<CdmBase> affectedObjects = new HashSet<CdmBase>(); |
|
56 |
affectedObjects.add((TaxonNode)parent); |
|
57 |
CdmStore.getCurrentSessionManager().getActiveSession().addEvent(taxonNode, affectedObjects, EventType.INSERT); |
|
58 |
CdmStore.getCurrentSessionManager().getActiveSession().fireNotifications(); |
|
53 | 59 |
}catch(IllegalArgumentException e){ |
54 | 60 |
MessagingUtils.warningDialog("Taxon already exists in classfication", getClass(), e.getMessage()); |
55 | 61 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPersistentPostOperation.java | ||
---|---|---|
33 | 33 |
*/ |
34 | 34 |
public abstract class AbstractPersistentPostOperation extends AbstractPostTaxonOperation { |
35 | 35 |
private final IConversationEnabled conversationEnabled; |
36 |
private final ICdmEntitySessionEnabled cdmEntitySessionEnabled; |
|
36 |
|
|
37 | 37 |
protected ITaxonTreeNode parentNode; |
38 | 38 |
|
39 | 39 |
/** |
... | ... | |
48 | 48 |
IPostOperationEnabled postOperationEnabled, |
49 | 49 |
IConversationEnabled conversationEnabled, |
50 | 50 |
ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
51 |
super(label, undoContext, postOperationEnabled); |
|
51 |
super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
|
|
52 | 52 |
this.conversationEnabled = conversationEnabled; |
53 |
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled; |
|
54 | 53 |
} |
55 | 54 |
|
56 | 55 |
/** |
... | ... | |
67 | 66 |
IPostOperationEnabled postOperationEnabled, |
68 | 67 |
IConversationEnabled conversationEnabled, |
69 | 68 |
ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
70 |
super(label, undoContext, taxonNode, postOperationEnabled); |
|
69 |
super(label, undoContext, taxonNode, postOperationEnabled, cdmEntitySessionEnabled);
|
|
71 | 70 |
this.conversationEnabled = conversationEnabled; |
72 |
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled; |
|
71 |
|
|
73 | 72 |
} |
74 | 73 |
|
75 | 74 |
/** |
... | ... | |
86 | 85 |
IPostOperationEnabled postOperationEnabled, |
87 | 86 |
IConversationEnabled conversationEnabled, |
88 | 87 |
ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
89 |
super(label, undoContext, postOperationEnabled); |
|
88 |
super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
|
|
90 | 89 |
this.parentNode = parentNode; |
91 | 90 |
this.conversationEnabled = conversationEnabled; |
92 |
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled; |
|
91 |
|
|
93 | 92 |
} |
94 | 93 |
|
95 | 94 |
/* (non-Javadoc) |
... | ... | |
105 | 104 |
conversationEnabled.getConversationHolder().bind(); |
106 | 105 |
conversationEnabled.getConversationHolder().commit(true); |
107 | 106 |
} |
108 |
if(cdmEntitySessionEnabled != null) {
|
|
109 |
cdmEntitySessionEnabled.getCdmEntitySession().fireNotifications();
|
|
107 |
if(getCdmEntitySessionEnabled() != null) {
|
|
108 |
getCdmEntitySessionEnabled().getCdmEntitySession().fireNotifications();
|
|
110 | 109 |
} |
111 | 110 |
IStatus status = super.postExecute(objectAffectedByOperation); |
112 | 111 |
|
... | ... | |
118 | 117 |
*/ |
119 | 118 |
public void bind(){ |
120 | 119 |
conversationEnabled.getConversationHolder().bind(); |
120 |
if(getCdmEntitySessionEnabled() != null) { |
|
121 |
getCdmEntitySessionEnabled().getCdmEntitySession().bind(); |
|
122 |
} |
|
121 | 123 |
} |
122 | 124 |
|
123 | 125 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java | ||
---|---|---|
16 | 16 |
|
17 | 17 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
18 | 18 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
19 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
19 | 20 |
|
20 | 21 |
/** |
21 | 22 |
* @author pplitzner |
... | ... | |
35 | 36 |
*/ |
36 | 37 |
protected IPostOperationEnabled postOperationEnabled; |
37 | 38 |
|
39 |
private ICdmEntitySessionEnabled cdmEntitySessionEnabled; |
|
40 |
|
|
38 | 41 |
|
39 | 42 |
/** |
40 | 43 |
* <p>Constructor for AbstractPostOperation.</p> |
... | ... | |
71 | 74 |
this.postOperationEnabled = postOperationEnabled; |
72 | 75 |
} |
73 | 76 |
|
77 |
public AbstractPostOperation(String label, IUndoContext undoContext, |
|
78 |
T element, IPostOperationEnabled postOperationEnabled, |
|
79 |
ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
|
80 |
this(label, undoContext); |
|
81 |
this.element = element; |
|
82 |
this.postOperationEnabled = postOperationEnabled; |
|
83 |
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled; |
|
84 |
} |
|
85 |
|
|
74 | 86 |
/** |
75 | 87 |
* This method will try to call the post operation on a possibly registered |
76 | 88 |
* IPostOperationEnabled implementor. Objects that were affected by the operation |
... | ... | |
80 | 92 |
* @return a {@link org.eclipse.core.runtime.IStatus} object. |
81 | 93 |
*/ |
82 | 94 |
protected IStatus postExecute(CdmBase objectAffectedByOperation) { |
83 |
if(postOperationEnabled != null){ |
|
84 |
return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS; |
|
85 |
} |
|
86 |
return Status.OK_STATUS; |
|
95 |
|
|
96 |
if(postOperationEnabled != null){ |
|
97 |
return postOperationEnabled.postOperation(objectAffectedByOperation) ? Status.OK_STATUS : Status.CANCEL_STATUS; |
|
98 |
} |
|
99 |
return Status.OK_STATUS; |
|
87 | 100 |
} |
88 | 101 |
|
89 | 102 |
/** |
... | ... | |
92 | 105 |
* @return a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
93 | 106 |
*/ |
94 | 107 |
public IPostOperationEnabled getPostOperationEnabled() { |
95 |
return postOperationEnabled; |
|
108 |
return postOperationEnabled; |
|
109 |
} |
|
110 |
|
|
111 |
// protected IStatus updateSession(CdmBase clientObjectAffectedByOperation, UpdateResult updateResult) { |
|
112 |
// Set<CdmBase> affectedObjects; |
|
113 |
// if(updateResult == null) { |
|
114 |
// affectedObjects = new HashSet<CdmBase>(); |
|
115 |
// } else { |
|
116 |
// affectedObjects = updateResult.getUpdatedObjects(); |
|
117 |
// } |
|
118 |
// |
|
119 |
// if(cdmEntitySessionEnabled != null) { |
|
120 |
// cdmEntitySessionEnabled.getCdmEntitySession().update(clientObjectAffectedByOperation, affectedObjects); |
|
121 |
// } |
|
122 |
// return Status.OK_STATUS; |
|
123 |
// } |
|
124 |
// |
|
125 |
// protected IStatus updateSession(UUID uuid) { |
|
126 |
// |
|
127 |
// if(cdmEntitySessionEnabled != null) { |
|
128 |
// CdmBase cdmBase = cdmEntitySessionEnabled.getCdmEntitySession().remoteLoad(CdmStore.getService(IService.class),uuid); |
|
129 |
// cdmEntitySessionEnabled.getCdmEntitySession().update(null, cdmBase); |
|
130 |
// } |
|
131 |
// return Status.OK_STATUS; |
|
132 |
// } |
|
133 |
|
|
134 |
public ICdmEntitySessionEnabled getCdmEntitySessionEnabled() { |
|
135 |
return cdmEntitySessionEnabled; |
|
96 | 136 |
} |
97 | 137 |
|
98 | 138 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java | ||
---|---|---|
1 | 1 |
/** |
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
2 |
* Copyright (C) 2007 EDIT
|
|
3 |
* European Distributed Institute of Taxonomy
|
|
4 |
* http://www.e-taxonomy.eu
|
|
5 |
*
|
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms.
|
|
8 |
*/
|
|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.operation; |
11 | 11 |
|
... | ... | |
16 | 16 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
17 | 17 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
18 | 18 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
19 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
19 | 20 |
|
20 | 21 |
/** |
21 | 22 |
* <p>Abstract AbstractPostOperation class.</p> |
... | ... | |
27 | 28 |
*/ |
28 | 29 |
public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<Taxon> { |
29 | 30 |
|
30 |
/** |
|
31 |
* A reference to the taxons TaxonNode |
|
32 |
*/ |
|
33 |
protected ITaxonTreeNode taxonNode; |
|
34 |
|
|
35 |
protected UUID parentNodeUuid; |
|
36 |
|
|
37 |
|
|
38 |
/** |
|
39 |
* <p>Constructor for AbstractPostOperation.</p> |
|
40 |
* |
|
41 |
* @param label a {@link java.lang.String} object. |
|
42 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
43 |
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. |
|
44 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
45 |
*/ |
|
46 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, |
|
47 |
Taxon taxon, IPostOperationEnabled postOperationEnabled) { |
|
48 |
super(label, undoContext, taxon, postOperationEnabled); |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* <p>Constructor for AbstractPostOperation.</p> |
|
53 |
* |
|
54 |
* @param label a {@link java.lang.String} object. |
|
55 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
56 |
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object. |
|
57 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
58 |
*/ |
|
59 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled){ |
|
60 |
this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled); |
|
61 |
this.taxonNode = taxonNode; |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* <p>Constructor for AbstractPostOperation.</p> |
|
66 |
* |
|
67 |
* @param label a {@link java.lang.String} object. |
|
68 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
69 |
* @param parentNodeUuid a {@link java.util.UUID} object. |
|
70 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
71 |
*/ |
|
72 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){ |
|
73 |
super(label, undoContext, null, postOperationEnabled); |
|
74 |
this.parentNodeUuid = parentNodeUuid; |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* <p>Constructor for AbstractPostOperation.</p> |
|
79 |
* |
|
80 |
* @param label a {@link java.lang.String} object. |
|
81 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
82 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
83 |
*/ |
|
84 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, |
|
85 |
IPostOperationEnabled postOperationEnabled) { |
|
86 |
super(label, undoContext, null, postOperationEnabled); |
|
87 |
} |
|
31 |
/** |
|
32 |
* A reference to the taxons TaxonNode |
|
33 |
*/ |
|
34 |
protected ITaxonTreeNode taxonNode; |
|
35 |
|
|
36 |
protected UUID parentNodeUuid; |
|
37 |
|
|
38 |
|
|
39 |
/** |
|
40 |
* <p>Constructor for AbstractPostOperation.</p> |
|
41 |
* |
|
42 |
* @param label a {@link java.lang.String} object. |
|
43 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
44 |
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. |
|
45 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
46 |
*/ |
|
47 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, |
|
48 |
Taxon taxon, IPostOperationEnabled postOperationEnabled) { |
|
49 |
super(label, undoContext, taxon, postOperationEnabled, null); |
|
50 |
} |
|
51 |
|
|
52 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, |
|
53 |
Taxon taxon, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
|
54 |
super(label, undoContext, taxon, postOperationEnabled, cdmEntitySessionEnabled); |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* <p>Constructor for AbstractPostOperation.</p> |
|
59 |
* |
|
60 |
* @param label a {@link java.lang.String} object. |
|
61 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
62 |
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object. |
|
63 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
64 |
*/ |
|
65 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled){ |
|
66 |
this(label, undoContext, taxonNode, postOperationEnabled, null); |
|
67 |
} |
|
68 |
|
|
69 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled){ |
|
70 |
this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled, cdmEntitySessionEnabled); |
|
71 |
this.taxonNode = taxonNode; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* <p>Constructor for AbstractPostOperation.</p> |
|
76 |
* |
|
77 |
* @param label a {@link java.lang.String} object. |
|
78 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
79 |
* @param parentNodeUuid a {@link java.util.UUID} object. |
|
80 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
81 |
*/ |
|
82 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){ |
|
83 |
super(label, undoContext, null, postOperationEnabled, null); |
|
84 |
this.parentNodeUuid = parentNodeUuid; |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* <p>Constructor for AbstractPostOperation.</p> |
|
89 |
* |
|
90 |
* @param label a {@link java.lang.String} object. |
|
91 |
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object. |
|
92 |
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object. |
|
93 |
*/ |
|
94 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, |
|
95 |
IPostOperationEnabled postOperationEnabled) { |
|
96 |
super(label, undoContext, null, postOperationEnabled, null); |
|
97 |
} |
|
98 |
|
|
99 |
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, |
|
100 |
IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) { |
|
101 |
super(label, undoContext, null, postOperationEnabled, cdmEntitySessionEnabled); |
|
102 |
} |
|
88 | 103 |
|
89 | 104 |
/** |
90 | 105 |
* @param text |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java | ||
---|---|---|
89 | 89 |
* @param unparsedNameString a {@link java.lang.String} object. |
90 | 90 |
* @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object. |
91 | 91 |
*/ |
92 |
public static TaxonNameBase parseReferencedName(String unparsedNameString, Rank rank){
|
|
93 |
TaxonNameBase name = nonViralNameParser.parseReferencedName(unparsedNameString,
|
|
92 |
public static NonViralName parseReferencedName(String unparsedNameString, Rank rank){
|
|
93 |
NonViralName name = nonViralNameParser.parseReferencedName(unparsedNameString,
|
|
94 | 94 |
PreferencesUtil.getPreferredNomenclaturalCode(), rank); |
95 | 95 |
|
96 | 96 |
// if (name.hasProblem()) { |
... | ... | |
100 | 100 |
return name; |
101 | 101 |
} |
102 | 102 |
|
103 |
public static TaxonNameBase parseName(String unparsedNameString, Rank rank){
|
|
104 |
TaxonNameBase name = nonViralNameParser.parseFullName(unparsedNameString,
|
|
103 |
public static NonViralName parseName(String unparsedNameString, Rank rank){
|
|
104 |
NonViralName name = nonViralNameParser.parseFullName(unparsedNameString,
|
|
105 | 105 |
PreferencesUtil.getPreferredNomenclaturalCode(), rank); |
106 | 106 |
|
107 | 107 |
return name; |
... | ... | |
113 | 113 |
* |
114 | 114 |
* @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object. |
115 | 115 |
*/ |
116 |
public static TaxonNameBase createEmptyName(){
|
|
116 |
public static NonViralName createEmptyName(){
|
|
117 | 117 |
return nonViralNameParser.getNonViralNameInstance("", PreferencesUtil.getPreferredNomenclaturalCode()); |
118 | 118 |
} |
119 | 119 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java | ||
---|---|---|
25 | 25 |
import org.springframework.security.core.context.SecurityContext; |
26 | 26 |
import org.springframework.security.core.context.SecurityContextHolder; |
27 | 27 |
|
28 |
|
|
29 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration; |
|
30 | 28 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController; |
31 | 29 |
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; |
32 | 30 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
... | ... | |
45 | 43 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
46 | 44 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
47 | 45 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
48 |
|
|
46 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager; |
|
49 | 47 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; |
50 | 48 |
import eu.etaxonomy.taxeditor.session.mock.MockCdmEntitySessionManager; |
51 | 49 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
... | ... | |
91 | 89 |
private ICdmSource cdmSource; |
92 | 90 |
|
93 | 91 |
private boolean isConnected; |
94 |
|
|
92 |
|
|
95 | 93 |
|
96 | 94 |
|
97 | 95 |
/** |
... | ... | |
120 | 118 |
|
121 | 119 |
ICdmSource cdmSource; |
122 | 120 |
try { |
121 |
|
|
123 | 122 |
cdmSource = CdmDataSourceRepository.getCurrentCdmSource(); |
124 | 123 |
connect(cdmSource); |
125 | 124 |
} catch (Exception e) { |
... | ... | |
150 | 149 |
private static void connect(final ICdmSource cdmSource, |
151 | 150 |
final DbSchemaValidation dbSchemaValidation, |
152 | 151 |
final Resource applicationContextBean) { |
152 |
if(isActive()) { |
|
153 |
// before we connect we clear the caches and the sessions |
|
154 |
CdmRemoteCacheManager.getInstance().getDefaultCacheManager().removalAll(); |
|
155 |
if(getCurrentSessionManager() != null) { |
|
156 |
getCurrentSessionManager().disposeAll(); |
|
157 |
} |
|
158 |
} |
|
153 | 159 |
MessagingUtils.info("Connecting to datasource: " + cdmSource); |
154 | 160 |
|
155 | 161 |
job = new CdmStoreConnector(Display.getDefault(), cdmSource, |
... | ... | |
256 | 262 |
} |
257 | 263 |
return conversation; |
258 | 264 |
} |
259 |
|
|
265 |
|
|
260 | 266 |
//FIXME:Remoting should be removed after moving completely to remoting |
261 | 267 |
private MockCdmEntitySessionManager mockCdmEntitySessionManager; |
262 |
|
|
268 |
|
|
263 | 269 |
private ICdmEntitySessionManager getSessionManager() { |
264 | 270 |
//FIXME:Remoting we should only have CdmApplicationRemoteConfiguration after move to remoting |
265 | 271 |
// bad hack which should be finally removed |
... | ... | |
269 | 275 |
if(mockCdmEntitySessionManager == null) { |
270 | 276 |
mockCdmEntitySessionManager = new MockCdmEntitySessionManager(); |
271 | 277 |
} |
272 |
return mockCdmEntitySessionManager;
|
|
278 |
return mockCdmEntitySessionManager; |
|
273 | 279 |
} |
274 | 280 |
} |
275 |
|
|
281 |
|
|
276 | 282 |
public static ICdmEntitySessionManager getCurrentSessionManager() { |
277 | 283 |
if (getDefault() != null) { |
278 | 284 |
return getDefault().getSessionManager(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionsDialog.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
3 |
* Copyright (C) 2015 EDIT
|
|
4 |
* European Distributed Institute of Taxonomy
|
|
5 |
* http://www.e-taxonomy.eu
|
|
6 |
*
|
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms.
|
|
9 |
*/
|
|
10 | 10 |
package eu.etaxonomy.taxeditor.view.sessions; |
11 | 11 |
|
12 | 12 |
import java.util.List; |
... | ... | |
14 | 14 |
import net.sf.ehcache.Cache; |
15 | 15 |
import net.sf.ehcache.Element; |
16 | 16 |
|
17 |
import org.eclipse.jface.viewers.ILabelProvider; |
|
17 | 18 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
18 | 19 |
import org.eclipse.jface.viewers.StyledCellLabelProvider; |
19 | 20 |
import org.eclipse.jface.viewers.StyledString; |
... | ... | |
24 | 25 |
import org.eclipse.swt.custom.SashForm; |
25 | 26 |
import org.eclipse.swt.events.SelectionAdapter; |
26 | 27 |
import org.eclipse.swt.events.SelectionEvent; |
28 |
import org.eclipse.swt.graphics.Image; |
|
27 | 29 |
import org.eclipse.swt.layout.GridData; |
28 | 30 |
import org.eclipse.swt.layout.GridLayout; |
29 | 31 |
import org.eclipse.swt.widgets.Button; |
... | ... | |
33 | 35 |
import org.eclipse.swt.widgets.Label; |
34 | 36 |
import org.eclipse.swt.widgets.Shell; |
35 | 37 |
import org.eclipse.swt.widgets.Text; |
36 |
import org.eclipse.swt.widgets.Tree; |
|
38 |
import org.eclipse.ui.dialogs.FilteredTree; |
|
39 |
import org.eclipse.ui.dialogs.PatternFilter; |
|
37 | 40 |
import org.eclipse.wb.swt.SWTResourceManager; |
38 | 41 |
|
39 | 42 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmModelFieldPropertyFromClass; |
... | ... | |
111 | 114 |
sashForm = new SashForm(shlInspectSessions, SWT.VERTICAL); |
112 | 115 |
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
113 | 116 |
|
114 |
treeViewer = new TreeViewer(sashForm, SWT.BORDER); |
|
115 |
Tree tree = treeViewer.getTree(); |
|
117 |
PatternFilter filter = new PatternFilter(); |
|
118 |
FilteredTree tree = new FilteredTree(sashForm, SWT.MULTI | SWT.H_SCROLL | SWT.BORDER |
|
119 |
| SWT.V_SCROLL, filter, true); |
|
120 |
treeViewer = tree.getViewer(); |
|
121 |
//treeViewer = new TreeViewer(sashForm, SWT.BORDER); |
|
122 |
//Tree tree = treeViewer.getTree(); |
|
116 | 123 |
|
117 |
compositeDebug = new Composite(sashForm, SWT.NONE);
|
|
118 |
compositeDebug.setLayout(new GridLayout(1, false));
|
|
124 |
compositeDebug = new Composite(sashForm, SWT.NONE); |
|
125 |
compositeDebug.setLayout(new GridLayout(1, false)); |
|
119 | 126 |
|
120 |
lblDebugInformation = new Label(compositeDebug, SWT.NONE);
|
|
121 |
lblDebugInformation.setAlignment(SWT.CENTER);
|
|
122 |
lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
|
|
123 |
lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
|
|
124 |
lblDebugInformation.setText("Debug Information");
|
|
127 |
lblDebugInformation = new Label(compositeDebug, SWT.NONE); |
|
128 |
lblDebugInformation.setAlignment(SWT.CENTER); |
|
129 |
lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1)); |
|
130 |
lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
131 |
lblDebugInformation.setText("Debug Information"); |
|
125 | 132 |
|
126 |
txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
|
|
127 |
txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
|
|
128 |
sashForm.setWeights(new int[] {338, 184});
|
|
133 |
txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI); |
|
134 |
txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); |
|
135 |
sashForm.setWeights(new int[] {338, 184}); |
|
129 | 136 |
|
130 | 137 |
btnClose = new Button(shlInspectSessions, SWT.NONE); |
131 | 138 |
btnClose.addSelectionListener(new SelectionAdapter() { |
... | ... | |
221 | 228 |
|
222 | 229 |
} |
223 | 230 |
|
224 |
class SessionsTreeLabelProvider extends StyledCellLabelProvider { |
|
231 |
class SessionsTreeLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
|
|
225 | 232 |
|
226 | 233 |
@Override |
227 | 234 |
public void update(ViewerCell cell) { |
... | ... | |
234 | 241 |
cell.setStyleRanges(text.getStyleRanges()); |
235 | 242 |
super.update(cell); |
236 | 243 |
} |
244 |
|
|
245 |
/* (non-Javadoc) |
|
246 |
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) |
|
247 |
*/ |
|
248 |
@Override |
|
249 |
public Image getImage(Object element) { |
|
250 |
// TODO Auto-generated method stub |
|
251 |
return null; |
|
252 |
} |
|
253 |
|
|
254 |
/* (non-Javadoc) |
|
255 |
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) |
|
256 |
*/ |
|
257 |
@Override |
|
258 |
public String getText(Object element) { |
|
259 |
CdmEntityInfo cei = (CdmEntityInfo)element; |
|
260 |
return cei.getLabel(); |
|
261 |
} |
|
237 | 262 |
} |
238 | 263 |
} |
239 | 264 |
|
eu.etaxonomy.taxeditor.store/src/test/java/eu/etaxonomy/taxeditor/store/operations/AbstractTaxeditorOperationTestBase.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
17 | 17 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
18 | 18 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
19 | 19 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
20 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
|
20 | 21 |
|
21 | 22 |
/** |
22 | 23 |
* @author n.hoffmann |
... | ... | |
24 | 25 |
* @version 1.0 |
25 | 26 |
*/ |
26 | 27 |
public abstract class AbstractTaxeditorOperationTestBase { |
27 |
|
|
28 |
|
|
28 | 29 |
public static final IUndoContext undoContext = null; |
29 |
|
|
30 |
|
|
30 | 31 |
public static final IProgressMonitor monitor = null; |
31 |
public static final IAdaptable info = null;
|
|
32 |
public static final IAdaptable info = null; |
|
32 | 33 |
public static final IPostOperationEnabled postOperation = null; |
33 |
|
|
34 |
public static final ICdmEntitySessionEnabled cdmEntitySessionEnabled = null; |
|
35 |
|
|
34 | 36 |
protected static AbstractPostOperation operation; |
35 | 37 |
protected static Taxon taxon; |
36 | 38 |
} |
Also available in: Unified diff
InspectSessionsDialog : added filtering
CdmStore : clearing caches and session before connecting
ParseHandler : using NonViralName instead of TaxonNameBase
AbstractPostTaxonOperation, AbstractPostOperation, AbstractPersistentPostOperation : added CdmEntitySessionEnabled object to constructor
NewTaxonNodeWizard : explicitly fire changes