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
809df408
Commit
809df408
authored
3 years ago
by
Stefan E. Funk
Browse files
Options
Downloads
Patches
Plain Diff
mc
parent
cc4179ed
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
oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java
+80
-78
80 additions, 78 deletions
.../src/main/java/info/textgrid/middleware/SetDeliverer.java
with
80 additions
and
78 deletions
oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java
+
80
−
78
View file @
809df408
...
...
@@ -140,9 +140,8 @@ public class SetDeliverer {
System
.
out
.
println
(
" ## SetDeliverer() ## request: "
+
request
);
SearchResponse
getRecordListItems
=
null
;
// Get items with TG or DH request.
SearchResponse
getRecordListItems
=
null
;
try
{
getRecordListItems
=
OAI_ESClient
.
getEsClient
().
search
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -154,98 +153,101 @@ public class SetDeliverer {
e
.
printStackTrace
();
}
// **
// TG
// **
if
(
this
.
textgrid
&&
getRecordListItems
.
getAggregations
()
!=
null
)
{
String
projectName
=
""
;
for
(
Entry
<
String
,
Aggregation
>
entry
:
getRecordListItems
.
getAggregations
().
asMap
()
.
entrySet
())
{
String
name
=
entry
.
getKey
();
if
(
name
.
equals
(
"projectsPublic"
))
{
Filter
trytry
=
getRecordListItems
.
getAggregations
().
get
(
"projectsPublic"
);
Terms
trytry2
=
trytry
.
getAggregations
().
get
(
"projects"
);
for
(
Bucket
bentry
:
trytry2
.
getBuckets
())
{
projectName
=
bentry
.
getKey
().
toString
();
String
[]
projectInfos
=
projectName
.
split
(
"&"
);
SetType
setsForTextGrid
=
new
SetType
();
setsForTextGrid
.
setSetSpec
(
"project:"
+
projectInfos
[
0
]);
setsForTextGrid
.
setSetName
(
projectInfos
[
1
]);
setList
.
getSet
().
add
(
setsForTextGrid
);
// Fill ListSets request...
if
(
getRecordListItems
.
getAggregations
()
!=
null
)
{
// ...for TG
if
(
this
.
textgrid
)
{
String
projectName
=
""
;
for
(
Entry
<
String
,
Aggregation
>
entry
:
getRecordListItems
.
getAggregations
().
asMap
()
.
entrySet
())
{
String
name
=
entry
.
getKey
();
if
(
name
.
equals
(
"projectsPublic"
))
{
Filter
trytry
=
getRecordListItems
.
getAggregations
().
get
(
"projectsPublic"
);
Terms
trytry2
=
trytry
.
getAggregations
().
get
(
"projects"
);
for
(
Bucket
bentry
:
trytry2
.
getBuckets
())
{
projectName
=
bentry
.
getKey
().
toString
();
String
[]
projectInfos
=
projectName
.
split
(
"&"
);
SetType
setsForTextGrid
=
new
SetType
();
setsForTextGrid
.
setSetSpec
(
"project:"
+
projectInfos
[
0
]);
setsForTextGrid
.
setSetName
(
projectInfos
[
1
]);
setList
.
getSet
().
add
(
setsForTextGrid
);
}
}
}
// Set for OpenAIRE.
SetType
setOpenAire
=
new
SetType
();
setOpenAire
.
setSetName
(
"OpenAIRE"
);
setOpenAire
.
setSetSpec
(
"openaire_data"
);
setList
.
getSet
().
add
(
setOpenAire
);
// for (SearchHit hit : getRecordListItems.getHits().getHits()) {
// if (this.dariah == true
// && hit.getSourceAsMap().get(this.identifierField).toString().startsWith("hdl:")) {
// String pid = hit.getSourceAsMap().get(this.identifierField).toString();
// this.identifier.add(pid);
// }
// }
}
// Set for OpenAIRE.
SetType
setOpenAire
=
new
SetType
();
setOpenAire
.
setSetName
(
"OpenAIRE"
);
setOpenAire
.
setSetSpec
(
"openaire_data"
);
setList
.
getSet
().
add
(
setOpenAire
);
// for (SearchHit hit : getRecordListItems.getHits().getHits()) {
// if (this.dariah == true
// && hit.getSourceAsMap().get(this.identifierField).toString().startsWith("hdl:")) {
// String pid = hit.getSourceAsMap().get(this.identifierField).toString();
// this.identifier.add(pid);
// }
// }
}
// ...for DH
if
(
this
.
dariah
)
{
if
(
this
.
dariah
)
{
for
(
Entry
<
String
,
Aggregation
>
entry
:
getRecordListItems
.
getAggregations
().
asMap
()
.
entrySet
())
{
for
(
Entry
<
String
,
Aggregation
>
entry
:
getRecordListItems
.
getAggregations
().
asMap
()
.
entrySet
())
{
System
.
out
.
println
(
" ## SetDeliverer() ## key "
+
entry
.
getKey
());
System
.
out
.
println
(
" ## valname "
+
entry
.
getValue
().
getName
());
System
.
out
.
println
(
" ## valtype "
+
entry
.
getValue
().
getType
());
System
.
out
.
println
(
" ## value "
+
entry
.
getValue
());
}
System
.
out
.
println
(
" ## SetDeliverer() ## key "
+
entry
.
getKey
());
System
.
out
.
println
(
" ## valname "
+
entry
.
getValue
().
getName
());
System
.
out
.
println
(
" ## valtype "
+
entry
.
getValue
().
getType
());
System
.
out
.
println
(
" ## value "
+
entry
.
getValue
());
}
for
(
String
identifierSetSpec
:
this
.
identifier
)
{
for
(
String
identifierSetSpec
:
this
.
identifier
)
{
System
.
out
.
println
(
" ## SetDeliverer() ## id "
+
identifierSetSpec
);
System
.
out
.
println
(
" ## SetDeliverer() ## id "
+
identifierSetSpec
);
String
id
=
identifierSetSpec
;
try
{
id
=
URLDecoder
.
decode
(
id
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
String
id
=
identifierSetSpec
;
try
{
id
=
URLDecoder
.
decode
(
id
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
id
=
identifierSetSpec
.
substring
(
this
.
repositoryObjectURIPrefix
.
length
());
id
=
identifierSetSpec
.
substring
(
this
.
repositoryObjectURIPrefix
.
length
());
String
[]
includes2
=
new
String
[]
{
this
.
specField
};
String
[]
excludes2
=
Strings
.
EMPTY_ARRAY
;
FetchSourceContext
fetchSourceContext2
=
new
FetchSourceContext
(
true
,
includes2
,
excludes2
);
String
[]
includes2
=
new
String
[]
{
this
.
specField
};
String
[]
excludes2
=
Strings
.
EMPTY_ARRAY
;
FetchSourceContext
fetchSourceContext2
=
new
FetchSourceContext
(
true
,
includes2
,
excludes2
);
GetRequest
getRequest
=
new
GetRequest
(
OAI_ESClient
.
getEsIndex
(),
OAI_ESClient
.
getEsType
(),
id
)
.
fetchSourceContext
(
fetchSourceContext2
);
GetResponse
setSpec
=
null
;
GetRequest
getRequest
=
new
GetRequest
(
OAI_ESClient
.
getEsIndex
(),
OAI_ESClient
.
getEsType
(),
id
)
.
fetchSourceContext
(
fetchSourceContext2
);
GetResponse
setSpec
=
null
;
try
{
setSpec
=
OAI_ESClient
.
getEsClient
().
get
(
getRequest
,
RequestOptions
.
DEFAULT
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
try
{
setSpec
=
OAI_ESClient
.
getEsClient
().
get
(
getRequest
,
RequestOptions
.
DEFAULT
);
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
String
setName
=
""
;
if
(
setSpec
!=
null
&&
setSpec
.
isExists
())
{
if
(
setSpec
.
getField
(
this
.
specField
)
!=
null
)
{
setName
=
setSpec
.
getSourceAsMap
().
get
(
this
.
specField
).
toString
();
String
setName
=
""
;
if
(
setSpec
!=
null
&&
setSpec
.
isExists
())
{
if
(
setSpec
.
getField
(
this
.
specField
)
!=
null
)
{
setName
=
setSpec
.
getSourceAsMap
().
get
(
this
.
specField
).
toString
();
}
}
}
SetType
set
=
new
SetType
();
set
.
setSetName
(
setName
);
set
.
setSetSpec
(
this
.
specFieldPrefix
+
id
);
setList
.
getSet
().
add
(
set
);
SetType
set
=
new
SetType
();
set
.
setSetName
(
setName
);
set
.
setSetSpec
(
this
.
specFieldPrefix
+
id
);
setList
.
getSet
().
add
(
set
);
}
}
}
...
...
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