1
|
/**
|
2
|
* Copyright (C) 2017 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
|
package eu.etaxonomy.cdm.database.update;
|
10
|
|
11
|
import eu.etaxonomy.cdm.common.IoResultBase;
|
12
|
|
13
|
/**
|
14
|
* @author a.mueller
|
15
|
* @since 04.06.2017
|
16
|
*/
|
17
|
public class SchemaUpdateResult extends IoResultBase{
|
18
|
|
19
|
private static final long serialVersionUID = -1154009912578583419L;
|
20
|
|
21
|
@Override
|
22
|
protected void setExceptionState() {
|
23
|
// TODO Auto-generated method stub
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
public void setAborted() {
|
28
|
// TODO Auto-generated method stub
|
29
|
}
|
30
|
|
31
|
public boolean isSuccess() {
|
32
|
return this.getExceptions().isEmpty() && this.getErrors().isEmpty();
|
33
|
}
|
34
|
|
35
|
public void addException(Exception e, String message, SchemaUpdaterStepBase step,
|
36
|
String methodName) {
|
37
|
addException(e, message, step.getStepName() + ", " + step.getClass().getName() + "." + methodName);
|
38
|
}
|
39
|
|
40
|
public void addError(String message, SchemaUpdaterStepBase step, String string) {
|
41
|
addError(message, step.getStepName() + ", " + step.getClass().getName() +"." + string);
|
42
|
}
|
43
|
|
44
|
public void addWarning(String message, SchemaUpdaterStepBase step, String string) {
|
45
|
addWarning(message, step.getStepName() + ", " + step.getClass().getName() +"." + string);
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public StringBuffer createReport() {
|
50
|
boolean isSuccess = isSuccess();
|
51
|
String strSuccess = "Schema-Update ended " + (isSuccess ? "successful" : "with errors");
|
52
|
StringBuffer superReport = super.createReport();
|
53
|
superReport.insert(0, strSuccess + "\n");
|
54
|
return superReport;
|
55
|
}
|
56
|
}
|