Revision 83a1a479
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmUpdateOperation.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.operation; |
11 | 11 |
|
12 | 12 |
import java.util.Collection; |
13 |
import java.util.HashSet; |
|
14 |
import java.util.Set; |
|
13 | 15 |
|
14 | 16 |
import org.eclipse.core.runtime.IAdaptable; |
15 | 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
69 | 71 |
protected IStatus onComplete(boolean success) { |
70 | 72 |
|
71 | 73 |
if(updateResult != null) { |
74 |
int statusFlag = IStatus.OK; |
|
75 |
|
|
72 | 76 |
Collection<Exception> exceptions = updateResult.getExceptions(); |
73 |
if(success && exceptions.isEmpty()) { |
|
74 |
return Status.OK_STATUS; |
|
77 |
if(success && updateResult.isOk()) { |
|
78 |
if(exceptions.isEmpty()) { |
|
79 |
return Status.OK_STATUS; |
|
80 |
} else { |
|
81 |
statusFlag = IStatus.WARNING; |
|
82 |
} |
|
83 |
} else { |
|
84 |
statusFlag = IStatus.ERROR; |
|
75 | 85 |
} |
76 | 86 |
|
77 | 87 |
Status[] childStatus = new Status[exceptions.size()]; |
78 | 88 |
int count = 0; |
89 |
Set<String> messages = new HashSet<String>(); |
|
79 | 90 |
for(Exception ex : exceptions) { |
80 |
Status status = new Status(IStatus.ERROR,
|
|
91 |
Status status = new Status(statusFlag,
|
|
81 | 92 |
"unknown", |
82 |
IStatus.ERROR,
|
|
93 |
statusFlag,
|
|
83 | 94 |
ex.getLocalizedMessage(), |
84 | 95 |
ex); |
96 |
messages.add(ex.getLocalizedMessage()); |
|
85 | 97 |
childStatus[count] = status; |
86 | 98 |
count++; |
87 | 99 |
} |
88 |
|
|
100 |
StringBuffer statusMsg = new StringBuffer(); |
|
101 |
for(String message : messages) { |
|
102 |
statusMsg.append(message); |
|
103 |
statusMsg.append(System.lineSeparator()); |
|
104 |
} |
|
89 | 105 |
MultiStatus multiStatus = new MultiStatus("unknown", |
90 |
IStatus.ERROR,
|
|
106 |
statusFlag,
|
|
91 | 107 |
childStatus, |
92 |
getLabel() + " is in error",
|
|
108 |
statusMsg.toString(),
|
|
93 | 109 |
null); |
94 | 110 |
return multiStatus; |
95 | 111 |
} |
Also available in: Unified diff
TaxonNavigator : added refresh of navigator on data change
TaxonNavigatorLabels : new interface with label strings used by taxon navigator handlers
RemotingChangeAcceptedTaxonToSynonymHandler : using TaxonNavigatorLabels
RemotingMoveFactualDataHandler : remoting version of move factual data handler
RemotingMoveFactualDataOperation : remoting version of move factual data operation
RemotingMoveTaxonHandler : remoting version of move taxon handler
RemotingMoveTaxonOperation : remoting version of move taxon operation
RemotingChangeAcceptedTaxonToSynonymOperation : replaced constructor input cdm entities to their uuids
RemotingCdmHandler : updated to handle other status severities and to handle warning status in post operation
RemotingCdmUpdateOperation : updated for warning status
TaxonNavigatorTest : added move taxon and move factual data tests