Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DARIAH-DE OAI-PMH Services
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
DARIAH-DE
DARIAH-DE OAI-PMH Services
Commits
e39331e1
Commit
e39331e1
authored
2 years ago
by
Stefan E. Funk
Browse files
Options
Downloads
Patches
Plain Diff
fix: add title again to fieldLoader
parent
8981148a
No related branches found
No related tags found
No related merge requests found
Pipeline
#340695
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
oaipmh-core/src/main/java/info/textgrid/middleware/OaipmhUtilities.java
+36
-5
36 additions, 5 deletions
...c/main/java/info/textgrid/middleware/OaipmhUtilities.java
with
36 additions
and
5 deletions
oaipmh-core/src/main/java/info/textgrid/middleware/OaipmhUtilities.java
+
36
−
5
View file @
e39331e1
...
@@ -395,7 +395,7 @@ public class OaipmhUtilities {
...
@@ -395,7 +395,7 @@ public class OaipmhUtilities {
*
*
* @param resultFromGetRequestInES
* @param resultFromGetRequestInES
* @param fields
* @param fields
* @return Returns MORE params as a list!
* @return Returns
ONE or
MORE params as a list!
*/
*/
public
static
List
<
String
>
fieldLoader
(
JSONObject
resultFromGetRequestInES
,
String
[]
fields
)
{
public
static
List
<
String
>
fieldLoader
(
JSONObject
resultFromGetRequestInES
,
String
[]
fields
)
{
...
@@ -404,30 +404,61 @@ public class OaipmhUtilities {
...
@@ -404,30 +404,61 @@ public class OaipmhUtilities {
List
<
String
>
fieldResults
=
new
ArrayList
<
String
>();
List
<
String
>
fieldResults
=
new
ArrayList
<
String
>();
// Loop fields.
int
count
=
0
;
int
count
=
0
;
for
(
String
field
:
fields
)
{
for
(
String
field
:
fields
)
{
// Check if field has got "." in it, such as
// "edition.source.bibliographicCitation.placeOfPublication".
String
[]
fieldPathForESIndex
=
field
.
split
(
ES_DIVIDER_REGEXP
);
String
[]
fieldPathForESIndex
=
field
.
split
(
ES_DIVIDER_REGEXP
);
log
.
fine
(
"field["
+
count
++
+
"]: "
+
field
);
log
.
fine
(
"field["
+
count
++
+
"]: "
+
field
);
JSONObject
singlePath
=
resultFromGetRequestInES
;
JSONObject
singlePath
=
resultFromGetRequestInES
;
try
{
try
{
// Loop the splitted field components, such as "edition", "source", etcpp.
for
(
int
i
=
0
;
i
<
fieldPathForESIndex
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
fieldPathForESIndex
.
length
;
i
++)
{
// Case 1: We have only one field component.
if
(
i
<
fieldPathForESIndex
.
length
-
1
)
{
if
(
i
<
fieldPathForESIndex
.
length
-
1
)
{
String
singleFieldComponent
=
fieldPathForESIndex
[
i
];
log
.
fine
(
"case 1: we have only one field component: "
+
singleFieldComponent
);
singlePath
=
singlePath
.
getJSONObject
(
fieldPathForESIndex
[
i
]);
singlePath
=
singlePath
.
getJSONObject
(
fieldPathForESIndex
[
i
]);
}
else
if
(
fieldPathForESIndex
.
length
==
1
)
{
fieldResults
.
add
(
singlePath
.
toString
());
}
// Case 2: We have only one field component??
else
if
(
fieldPathForESIndex
.
length
==
1
)
{
String
singleFieldComponent
=
fieldPathForESIndex
[
i
];
log
.
fine
(
"case 2: we have only one field component: "
+
singleFieldComponent
);
JSONObject
resultiDingsda
=
JSONObject
resultiDingsda
=
resultFromGetRequestInES
.
getJSONObject
(
fieldPathForESIndex
[
i
]
);
resultFromGetRequestInES
.
getJSONObject
(
singleFieldComponent
);
fieldResults
.
add
(
resultiDingsda
.
toString
());
fieldResults
.
add
(
resultiDingsda
.
toString
());
}
else
{
}
// Case 3: We have got more field components.
else
{
String
res
=
singlePath
.
get
(
fieldPathForESIndex
[
i
]).
toString
();
String
res
=
singlePath
.
get
(
fieldPathForESIndex
[
i
]).
toString
();
log
.
fine
(
"case 3: we have "
+
fieldPathForESIndex
.
length
+
" components in "
+
field
);
// Examine JSONArray.
if
(
res
.
startsWith
(
"["
))
{
if
(
res
.
startsWith
(
"["
))
{
log
.
fine
(
"json array found: "
+
res
);
JSONArray
array
=
new
JSONArray
(
res
);
JSONArray
array
=
new
JSONArray
(
res
);
for
(
int
j
=
0
;
j
<
array
.
length
();
j
++)
{
for
(
int
j
=
0
;
j
<
array
.
length
();
j
++)
{
String
find
=
array
.
getString
(
j
).
toString
();
String
find
=
array
.
getString
(
j
).
toString
();
fieldResults
.
add
(
find
);
fieldResults
.
add
(
find
);
}
}
}
else
{
}
// Examine
else
{
log
.
fine
(
"no array found: "
+
res
);
fieldResults
.
add
(
singlePath
.
get
(
fieldPathForESIndex
[
i
]).
toString
());
fieldResults
.
add
(
singlePath
.
get
(
fieldPathForESIndex
[
i
]).
toString
());
}
}
}
}
...
...
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