Skip to content
Snippets Groups Projects
Commit 809df408 authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

mc

parent cc4179ed
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment