11 |
11 |
import io.micrometer.core.annotation.Timed;
|
12 |
12 |
import org.apache.log4j.Logger;
|
13 |
13 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
14 |
import org.springframework.http.HttpStatus;
|
14 |
15 |
import org.springframework.stereotype.Component;
|
15 |
16 |
|
16 |
17 |
import javax.servlet.http.HttpServletRequest;
|
... | ... | |
65 |
66 |
@Path("/api/resources2")
|
66 |
67 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
67 |
68 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/resources2"}, longTask = false)
|
68 |
|
public Response fetchResources(@QueryParam("query") String query,
|
|
69 |
public Response fetchResources(@QueryParam("query") final String query,
|
|
70 |
@QueryParam("pid") final String pid,
|
|
71 |
@QueryParam("pidtype") final String pidType,
|
69 |
72 |
@DefaultValue("0") @QueryParam("page") final int offset,
|
70 |
73 |
@DefaultValue("10") @QueryParam("size") final int limit,
|
71 |
74 |
@QueryParam("refine") @DefaultValue("false") final boolean refine,
|
... | ... | |
76 |
79 |
@QueryParam("type") final List<String> types,
|
77 |
80 |
@Context final HttpServletRequest request) {
|
78 |
81 |
|
79 |
|
return getResponseByEntityTypes(query, types, offset, limit, format, request, refine, refineFields, specialFacets, fieldQueries);
|
|
82 |
return getResponseByEntityTypes(query, pid, pidType, types, offset, limit, format, request, refine, refineFields, specialFacets, fieldQueries);
|
80 |
83 |
}
|
81 |
84 |
|
82 |
|
private RequestResponseHandler.Entity identifyBasicEntityType(final List<String> types) {
|
83 |
|
for(String type: types) {
|
84 |
|
if (type.equals(RequestResponseHandler.Entity.PUBLICATION.getPlural()) || type.equals(RequestResponseHandler.Entity.DATASET.getPlural()) ||
|
85 |
|
type.equals(RequestResponseHandler.Entity.SOFTWARE.getPlural()) || type.equals(RequestResponseHandler.Entity.OTHER.getPlural())) {
|
86 |
|
return RequestResponseHandler.Entity.RESULT;
|
87 |
85 |
|
88 |
|
} else if (type.equals(RequestResponseHandler.Entity.PROJECT.getPlural())) {
|
89 |
|
return RequestResponseHandler.Entity.PROJECT;
|
90 |
|
|
91 |
|
} else if (type.equals(RequestResponseHandler.Entity.DATASOURCE.getPlural())) {
|
92 |
|
return RequestResponseHandler.Entity.DATASOURCE;
|
93 |
|
|
94 |
|
} else if (type.equals(RequestResponseHandler.Entity.ORGANIZATION.getPlural())) {
|
95 |
|
return RequestResponseHandler.Entity.ORGANIZATION;
|
96 |
|
}
|
97 |
|
}
|
98 |
|
return RequestResponseHandler.Entity.NONE;
|
99 |
|
}
|
100 |
|
|
101 |
86 |
@GET
|
102 |
87 |
@Path("/api/results")
|
103 |
88 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
... | ... | |
115 |
100 |
@QueryParam("type") final List<String> types,
|
116 |
101 |
@Context final HttpServletRequest request) {
|
117 |
102 |
|
118 |
|
logger.debug("Publications request received");
|
119 |
|
|
120 |
103 |
String simpleQuery = buildSearchRequest(types, keywords, doi,sortBy, fieldQueries);
|
121 |
104 |
return getResponseByEntity(simpleQuery, RequestResponseHandler.Entity.RESULT, offset, limit, format, request, refine, refineFields, specialFacets, fieldQueries);
|
122 |
105 |
|
123 |
106 |
}
|
124 |
107 |
|
125 |
108 |
@GET
|
|
109 |
@Path("/api/results/{resultsid}")
|
|
110 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
111 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/results/{resultsid}"}, longTask = false)
|
|
112 |
public Response fetchResultsById(@PathParam("resultsid") String resultsid,
|
|
113 |
@QueryParam("format") final String format,
|
|
114 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
115 |
@Context final HttpServletRequest request) {
|
|
116 |
|
|
117 |
return getResponseByEntityId(request, RequestResponseHandler.Entity.RESULT, resultsid, format, fieldQueries);
|
|
118 |
}
|
|
119 |
|
|
120 |
@GET
|
126 |
121 |
@Path("/api/results/count")
|
127 |
122 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
128 |
123 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/results/count"}, longTask = false)
|
... | ... | |
136 |
131 |
}
|
137 |
132 |
|
138 |
133 |
|
139 |
|
/*
|
140 |
134 |
@GET
|
141 |
|
@Path("/api/results/{resultid}")
|
142 |
|
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
143 |
|
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/results/{resultid}"}, longTask = false)
|
144 |
|
public Response fetchResultsById(@PathParam("resultid") String resultid,
|
145 |
|
@QueryParam("format") final String format,
|
146 |
|
@QueryParam("fq") final List<String> fieldQueries,
|
147 |
|
@Context final HttpServletRequest request) {
|
148 |
|
return getResponseByEntityId(request, RequestResponseHandler.Entity.RESULT, resultid, format, fieldQueries);
|
149 |
|
}*/
|
150 |
|
|
151 |
|
@GET
|
152 |
135 |
@Path("/api/publications")
|
153 |
136 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
154 |
137 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/publications"}, longTask = false)
|
... | ... | |
470 |
453 |
return getCount(request, fullQuery, format, fieldQueries);
|
471 |
454 |
}
|
472 |
455 |
|
|
456 |
|
473 |
457 |
@GET
|
474 |
458 |
@Path("/api/projects/{projectId}/other")
|
475 |
459 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
... | ... | |
486 |
470 |
}
|
487 |
471 |
|
488 |
472 |
@GET
|
|
473 |
@Path("/api/projects/{projectId}/results")
|
|
474 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
475 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/projects/{projectId}/results"}, longTask = false)
|
|
476 |
public Response fetchProjectResults(@PathParam("projectId") String projectId,
|
|
477 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
478 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
479 |
@QueryParam("format") final String format,
|
|
480 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
481 |
@Context HttpServletRequest request) {
|
|
482 |
|
|
483 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.RESULT, "relprojectid", projectId, fieldQueries);
|
|
484 |
return getResponseByEntity(fullQuery, RequestResponseHandler.Entity.RESULT, offset, limit, format, request, false, null, null, fieldQueries);
|
|
485 |
}
|
|
486 |
|
|
487 |
@GET
|
|
488 |
@Path("/api/projects/{projectId}/results/count")
|
|
489 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
490 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/projects/{projectId}/results/count"}, longTask = false)
|
|
491 |
public Response fetchProjectResultsCount(@PathParam("projectId") String projectId,
|
|
492 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
493 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
494 |
@QueryParam("format") final String format,
|
|
495 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
496 |
@Context HttpServletRequest request) {
|
|
497 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.RESULT, "relprojectid", projectId, fieldQueries);
|
|
498 |
return getCount(request, fullQuery, format, fieldQueries);
|
|
499 |
}
|
|
500 |
|
|
501 |
|
|
502 |
@GET
|
489 |
503 |
@Path("/api/datasources")
|
490 |
504 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
491 |
505 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/datasources"}, longTask = false)
|
... | ... | |
629 |
643 |
@Path("/api/organizations/{organizationid}/datasets")
|
630 |
644 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
631 |
645 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/datasets"}, longTask = false)
|
632 |
|
public Response fetchOrganizationDatsets(@PathParam("organizationid") String organizationid,
|
|
646 |
public Response fetchOrganizationDatasets(@PathParam("organizationid") String organizationid,
|
633 |
647 |
@DefaultValue("0") @QueryParam("page") int offset,
|
634 |
648 |
@DefaultValue("10") @QueryParam("size") int limit,
|
635 |
649 |
@QueryParam("format") final String format,
|
... | ... | |
643 |
657 |
@Path("/api/organizations/{organizationid}/datasets/count")
|
644 |
658 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
645 |
659 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/datasets/count"}, longTask = false)
|
646 |
|
public Response fetchOrganizationDatsetsCount(@PathParam("organizationid") String organizationid,
|
|
660 |
public Response fetchOrganizationDatasetsCount(@PathParam("organizationid") String organizationid,
|
647 |
661 |
@DefaultValue("0") @QueryParam("page") int offset,
|
648 |
662 |
@DefaultValue("10") @QueryParam("size") int limit,
|
649 |
663 |
@QueryParam("format") final String format,
|
... | ... | |
654 |
668 |
}
|
655 |
669 |
|
656 |
670 |
@GET
|
|
671 |
@Path("/api/organizations/{organizationid}/software")
|
|
672 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
673 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/software"}, longTask = false)
|
|
674 |
public Response fetchOrganizationSoftware(@PathParam("organizationid") String organizationid,
|
|
675 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
676 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
677 |
@QueryParam("format") final String format,
|
|
678 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
679 |
@Context HttpServletRequest request) {
|
|
680 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.SOFTWARE, "relorganizationid", organizationid, fieldQueries);
|
|
681 |
return getResponseByEntity(fullQuery, RequestResponseHandler.Entity.SOFTWARE, offset, limit, format, request, false, null, null,fieldQueries);
|
|
682 |
}
|
|
683 |
|
|
684 |
@GET
|
|
685 |
@Path("/api/organizations/{organizationid}/software/count")
|
|
686 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
687 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/software/count"}, longTask = false)
|
|
688 |
public Response fetchOrganizationSoftwareCount(@PathParam("organizationid") String organizationid,
|
|
689 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
690 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
691 |
@QueryParam("format") final String format,
|
|
692 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
693 |
@Context HttpServletRequest request) {
|
|
694 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.SOFTWARE, "relorganizationid", organizationid, fieldQueries);
|
|
695 |
return getCount(request, fullQuery, format, fieldQueries);
|
|
696 |
}
|
|
697 |
|
|
698 |
@GET
|
|
699 |
@Path("/api/organizations/{organizationid}/other")
|
|
700 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
701 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/other"}, longTask = false)
|
|
702 |
public Response fetchOrganizationOther(@PathParam("organizationid") String organizationid,
|
|
703 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
704 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
705 |
@QueryParam("format") final String format,
|
|
706 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
707 |
@Context HttpServletRequest request) {
|
|
708 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.OTHER, "relorganizationid", organizationid, fieldQueries);
|
|
709 |
return getResponseByEntity(fullQuery, RequestResponseHandler.Entity.OTHER, offset, limit, format, request, false, null, null,fieldQueries);
|
|
710 |
}
|
|
711 |
|
|
712 |
@GET
|
|
713 |
@Path("/api/organizations/{organizationid}/other/count")
|
|
714 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
715 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/other/count"}, longTask = false)
|
|
716 |
public Response fetchOrganizationOtherCount(@PathParam("organizationid") String organizationid,
|
|
717 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
718 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
719 |
@QueryParam("format") final String format,
|
|
720 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
721 |
@Context HttpServletRequest request) {
|
|
722 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.OTHER, "relorganizationid", organizationid, fieldQueries);
|
|
723 |
return getCount(request, fullQuery, format, fieldQueries);
|
|
724 |
}
|
|
725 |
|
|
726 |
@GET
|
|
727 |
@Path("/api/organizations/{organizationid}/results")
|
|
728 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
729 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/results"}, longTask = false)
|
|
730 |
public Response fetchOrganizationResults(@PathParam("organizationid") String organizationid,
|
|
731 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
732 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
733 |
@QueryParam("format") final String format,
|
|
734 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
735 |
@Context HttpServletRequest request) {
|
|
736 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.RESULT, "relorganizationid", organizationid, fieldQueries);
|
|
737 |
return getResponseByEntity(fullQuery, RequestResponseHandler.Entity.RESULT, offset, limit, format, request, false, null, null,fieldQueries);
|
|
738 |
}
|
|
739 |
|
|
740 |
@GET
|
|
741 |
@Path("/api/organizations/{organizationid}/results/count")
|
|
742 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
743 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/other/count"}, longTask = false)
|
|
744 |
public Response fetchOrganizationResultsCount(@PathParam("organizationid") String organizationid,
|
|
745 |
@DefaultValue("0") @QueryParam("page") int offset,
|
|
746 |
@DefaultValue("10") @QueryParam("size") int limit,
|
|
747 |
@QueryParam("format") final String format,
|
|
748 |
@QueryParam("fq") final List<String> fieldQueries,
|
|
749 |
@Context HttpServletRequest request) {
|
|
750 |
String fullQuery = builtEntity2EntityRelationQuery(RequestResponseHandler.Entity.RESULT, "relorganizationid", organizationid, fieldQueries);
|
|
751 |
return getCount(request, fullQuery, format, fieldQueries);
|
|
752 |
}
|
|
753 |
|
|
754 |
@GET
|
657 |
755 |
@Path("/api/organizations/{organizationid}/projects")
|
658 |
756 |
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
659 |
757 |
@Timed(value = "http.server.request.duration", extraTags = {"referer", "portal", "uri", "/rest/v2/api/organizations/{organizationid}/projects"}, longTask = false)
|
... | ... | |
788 |
886 |
String responseType = extractResponseFormat(format);
|
789 |
887 |
|
790 |
888 |
if(checkTypes(types)) {
|
791 |
|
return Response.status(Response.Status.FORBIDDEN).
|
|
889 |
return Response.status(Response.Status.BAD_REQUEST).
|
792 |
890 |
entity(APIResponseFormatter.compose400Message(responseType, "The type parameter is missing or is invalid.")).type(responseType).build();
|
793 |
891 |
}
|
794 |
892 |
|
795 |
893 |
RequestResponseHandler.Entity basicEntity = identifyBasicEntityType(types);
|
796 |
894 |
if (basicEntity.equals(RequestResponseHandler.Entity.NONE)) {
|
797 |
|
return Response.status(Response.Status.FORBIDDEN).
|
|
895 |
return Response.status(Response.Status.BAD_REQUEST).
|
798 |
896 |
entity(APIResponseFormatter.compose400Message(responseType, "The type parameter is missing or is invalid.")).type(responseType).build();
|
799 |
897 |
}
|
800 |
898 |
|
... | ... | |
1217 |
1315 |
}
|
1218 |
1316 |
}
|
1219 |
1317 |
|
|
1318 |
private Response getResponseByEntityTypes(String fullQuery, String pid, String pidType, List<String> types, int offset, int limit, String format, HttpServletRequest request, boolean refine, List<String> refineFields, List<String> specialFacets, List<String> fieldQueries) {
|
|
1319 |
long startTime = System.nanoTime();
|
|
1320 |
|
|
1321 |
boolean special = isSpecialFormat(format);
|
|
1322 |
boolean hasTitle = hasTitle(format);
|
|
1323 |
String responseType = extractResponseFormat(format);
|
|
1324 |
|
|
1325 |
if(checkTypes(types)) {
|
|
1326 |
return Response.status(Response.Status.FORBIDDEN).
|
|
1327 |
entity(APIResponseFormatter.compose400Message(responseType, "The type parameter is missing or is invalid.")).type(responseType).build();
|
|
1328 |
}
|
|
1329 |
|
|
1330 |
RequestResponseHandler.Entity basicEntity = identifyBasicEntityType(types);
|
|
1331 |
if (basicEntity.equals(RequestResponseHandler.Entity.NONE)) {
|
|
1332 |
return Response.status(Response.Status.FORBIDDEN).
|
|
1333 |
entity(APIResponseFormatter.compose400Message(responseType, "The type parameter is missing or is invalid.")).type(responseType).build();
|
|
1334 |
}
|
|
1335 |
Transformer transformer = extractTransformer(format, basicEntity);
|
|
1336 |
|
|
1337 |
//List<RequestResponseHandler.Entity> entities = extractEntities(types);
|
|
1338 |
|
|
1339 |
if (basicEntity.equals(RequestResponseHandler.Entity.RESULT)) {
|
|
1340 |
enhanceFieldQueryWithResultType(types, fieldQueries);
|
|
1341 |
} else {
|
|
1342 |
enhanceFieldQueryWithEntityType(basicEntity, fieldQueries);
|
|
1343 |
}
|
|
1344 |
|
|
1345 |
StringBuilder queryBuilder = new StringBuilder();
|
|
1346 |
logger.debug("pid " +pid);
|
|
1347 |
logger.debug("pidtype" +pidType);
|
|
1348 |
|
|
1349 |
if (pid != null && !pid.isEmpty()) {
|
|
1350 |
if ((pidType != null) && !pidType.isEmpty()) {
|
|
1351 |
enhanceQueryWithPersistentIdentifier(queryBuilder, pid, pidType);
|
|
1352 |
} else {
|
|
1353 |
return Response.status(Response.Status.BAD_REQUEST).
|
|
1354 |
entity(APIResponseFormatter.compose400Message(responseType, "The pid type is missing.")).type(responseType).build();
|
|
1355 |
}
|
|
1356 |
}
|
|
1357 |
try {
|
|
1358 |
logger.debug("Query builder " + queryBuilder.toString());
|
|
1359 |
logger.debug("Query " + fullQuery);
|
|
1360 |
|
|
1361 |
if (!queryBuilder.toString().isEmpty()){
|
|
1362 |
if (fullQuery != null && !fullQuery.isEmpty()) {
|
|
1363 |
queryBuilder.append(" ").append(CQLQueryBuilder.Operator.AND).append(" ").append(fullQuery);
|
|
1364 |
}
|
|
1365 |
} else {
|
|
1366 |
if (fullQuery != null && !fullQuery.isEmpty()) {
|
|
1367 |
queryBuilder.append(fullQuery);
|
|
1368 |
} else {
|
|
1369 |
queryBuilder.append("*");
|
|
1370 |
}
|
|
1371 |
}
|
|
1372 |
|
|
1373 |
SearchResult solrResults = ((SearchServiceImpl)searchService).newSearch(queryBuilder.toString(), Locale.getDefault().toString(), refineFields, specialFacets, fieldQueries, offset, limit, responseType, transformer, null, false);
|
|
1374 |
long estimatedTime = System.nanoTime() - startTime;
|
|
1375 |
logger.debug("Publications search time " + estimatedTime/1000000 + " milliseconds");
|
|
1376 |
return Response.status(Response.Status.OK).entity(APIResponseFormatter.createEntitiesResponse(request, basicEntity, queryBuilder.toString(), fieldQueries, solrResults, refine, responseType, special, hasTitle)).type(responseType).build();
|
|
1377 |
|
|
1378 |
} catch (SearchServiceException sse) {
|
|
1379 |
logger.error("Fail to get " + basicEntity.getPlural() , sse);
|
|
1380 |
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).
|
|
1381 |
entity(APIResponseFormatter.compose500Message(responseType, "Fail to fetch " + basicEntity.getPlural(), sse.getMessage())).type(responseType).build();
|
|
1382 |
}
|
|
1383 |
}
|
|
1384 |
|
|
1385 |
private void enhanceQueryWithPersistentIdentifier(StringBuilder queryBuilder, String pid, String pidType) {
|
|
1386 |
queryBuilder.append("(pidclassid exact "+ pidType + " and pid exact \"" + pid + "\")");
|
|
1387 |
}
|
|
1388 |
|
1220 |
1389 |
private void enhanceQueryWithEntities(StringBuilder queryBuilder, List<String> types) {
|
1221 |
1390 |
|
1222 |
1391 |
}
|
... | ... | |
1364 |
1533 |
|
1365 |
1534 |
return true;
|
1366 |
1535 |
}
|
|
1536 |
|
|
1537 |
private RequestResponseHandler.Entity identifyBasicEntityType(final List<String> types) {
|
|
1538 |
if (types != null && !types.isEmpty() && types.get(0) != null && !types.get(0).isEmpty()) {
|
|
1539 |
String type = types.get(0);
|
|
1540 |
|
|
1541 |
if (type.equals(RequestResponseHandler.Entity.RESULT.getPlural())) {
|
|
1542 |
return RequestResponseHandler.Entity.RESULT;
|
|
1543 |
|
|
1544 |
} else if (type.equals(RequestResponseHandler.Entity.PUBLICATION.getPlural()) || type.equals(RequestResponseHandler.Entity.DATASET.getPlural()) ||
|
|
1545 |
type.equals(RequestResponseHandler.Entity.SOFTWARE.getPlural()) || type.equals(RequestResponseHandler.Entity.OTHER.getPlural())) {
|
|
1546 |
return RequestResponseHandler.Entity.RESULT;
|
|
1547 |
|
|
1548 |
} else if (type.equals(RequestResponseHandler.Entity.PROJECT.getPlural())) {
|
|
1549 |
return RequestResponseHandler.Entity.PROJECT;
|
|
1550 |
|
|
1551 |
} else if (type.equals(RequestResponseHandler.Entity.DATASOURCE.getPlural())) {
|
|
1552 |
return RequestResponseHandler.Entity.DATASOURCE;
|
|
1553 |
|
|
1554 |
} else if (type.equals(RequestResponseHandler.Entity.ORGANIZATION.getPlural())) {
|
|
1555 |
return RequestResponseHandler.Entity.ORGANIZATION;
|
|
1556 |
}
|
|
1557 |
}
|
|
1558 |
return RequestResponseHandler.Entity.NONE;
|
|
1559 |
}
|
|
1560 |
|
1367 |
1561 |
/*
|
1368 |
1562 |
public static void main(String[] args) {
|
1369 |
1563 |
String json = " {\"result\":{\"xmlns:oaf\":\"http://namespace.openaire.eu/oaf\",\"xmlns:xsi\":\"http://www.w3.o" +
|
Added results methods in APIs for all entities