Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DDA
dda-wizard
Commits
4133d663
Commit
4133d663
authored
Apr 11, 2022
by
Steinberg, Jan
Browse files
adding set to BundlesSource reference for oai pmh sources
parent
b9df07e7
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
.factorypath
View file @
4133d663
This diff is collapsed.
Click to expand it.
src/main/java/org/gesis/dda/wizard/web/rest/BundlesSourceResource.java
View file @
4133d663
...
...
@@ -25,6 +25,7 @@ import org.gesis.dda.wizard.security.SecurityUtils;
import
org.gesis.dda.wizard.service.FeederService
;
import
org.gesis.dda.wizard.web.rest.util.HeaderUtil
;
import
org.gesis.dda.wizard.web.rest.util.PaginationUtil
;
import
org.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.data.domain.Page
;
...
...
@@ -80,8 +81,16 @@ public class BundlesSourceResource {
if
(
bundlesSource
.
getId
()
!=
null
)
{
return
ResponseEntity
.
badRequest
().
headers
(
HeaderUtil
.
createFailureAlert
(
"bundlesSource"
,
"idexists"
,
"A new bundlesSource cannot already have an ID"
)).
body
(
null
);
}
final
String
setSpec
=
getSetSpec
(
bundlesSource
.
getData
());
BundlesSource
result
=
bundlesSourceRepository
.
save
(
bundlesSource
);
if
(
result
.
getType
().
equals
(
BundlesSourceType
.
XML_XSLT_SOURCE
)
)
{
if
(
result
.
getType
().
equals
(
BundlesSourceType
.
XSLT_OAI_PMH
)
&&
null
!=
setSpec
)
{
final
String
currentReference
=
result
.
getReference
();
result
.
setReference
(
currentReference
+
"___"
+
setSpec
);
result
=
bundlesSourceRepository
.
save
(
result
);
}
else
if
(
result
.
getType
().
equals
(
BundlesSourceType
.
XML_XSLT_SOURCE
)
)
{
result
.
setReference
(
"xmlxslt-bundlessource-"
+
result
.
getId
()
);
result
=
bundlesSourceRepository
.
save
(
result
);
}
...
...
@@ -94,6 +103,16 @@ public class BundlesSourceResource {
.
body
(
result
);
}
private
String
getSetSpec
(
String
data
)
{
if
(
null
!=
data
)
{
final
JSONObject
obj
=
new
JSONObject
(
data
);
if
(
null
!=
obj
.
get
(
"setSpec"
))
{
return
(
String
)
obj
.
get
(
"setSpec"
);
}
}
return
null
;
}
/**
* POST /bundlesSources/forCurrentUser -> Create a new bundlesSource, setting its owner to currentUser.
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment