Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xml_plugin4rosetta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Digital Preservation
xml_plugin4rosetta
Commits
ff1e612c
Commit
ff1e612c
authored
1 year ago
by
Andreas Romeyke
Browse files
Options
Downloads
Patches
Plain Diff
- init
parent
b237645f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/org/slub/rosetta/dps/repository/plugin/SLUBXmlValidationLogger.java
+66
-0
66 additions, 0 deletions
...osetta/dps/repository/plugin/SLUBXmlValidationLogger.java
with
66 additions
and
0 deletions
java/org/slub/rosetta/dps/repository/plugin/SLUBXmlValidationLogger.java
0 → 100644
+
66
−
0
View file @
ff1e612c
package
org.slub.rosetta.dps.repository.plugin
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
SLUBXmlValidationLogger
{
private
final
List
<
String
>
log
=
new
ArrayList
<>();
private
boolean
result
=
true
;
private
boolean
isDebug
;
public
void
error
(
String
err
)
{
result
=
false
;
log
.
add
(
"[ERROR] "
+
err
);
}
public
void
debug
(
String
detail
)
{
log
.
add
(
"[DEBUG] "
+
detail
);
}
public
void
info
(
String
detail
)
{
log
.
add
(
"[INFO] "
+
detail
);
}
public
void
fatal
(
String
detail
)
{
result
=
false
;
log
.
add
(
"[FATAL] "
+
detail
);
}
public
void
warning
(
String
detail
)
{
log
.
add
(
"[WARN] "
+
detail
);
}
public
void
print
(
ValidationLevel
level
)
{
for
(
String
e:
log
)
{
switch
(
level
)
{
case
debug:
if
(
e
.
startsWith
(
"[DEBUG]"
))
{
System
.
out
.
println
(
e
);
}
case
info:
if
(
e
.
startsWith
(
"[INFO]"
))
{
System
.
out
.
println
(
e
);
}
case
warn:
if
(
e
.
startsWith
(
"[WARN]"
))
{
System
.
out
.
println
(
e
);
}
case
error:
if
(
e
.
startsWith
(
"[ERROR]"
))
{
System
.
out
.
println
(
e
);
}
case
fatal:
if
(
e
.
startsWith
(
"[FATAL]"
))
{
System
.
out
.
println
(
e
);
}
}
}
}
public
void
setResult
(
boolean
r
)
{
this
.
result
=
r
;
}
public
boolean
getResult
(
)
{
return
this
.
result
;
}
public
void
clear
()
{
log
.
clear
();
this
.
result
=
true
;
}
public
List
<
String
>
getErrors
()
{
System
.
out
.
println
(
"---------------->"
);
print
(
ValidationLevel
.
debug
);
System
.
out
.
println
(
"<----------------"
);
return
log
.
stream
()
.
filter
(
f
->
f
.
startsWith
(
"[ERROR]"
)
||
f
.
startsWith
(
"FATAL"
))
.
toList
()
;
}
public
String
getLog
()
{
return
log
.
stream
()
.
filter
(
f
->
!
f
.
startsWith
(
"[DEBUG]"
))
.
reduce
(
"\n"
,
String:
:
concat
)
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment