1. Refactored common code for getting sub-organization types.
This commit is contained in:
parent
35487d0f30
commit
0abd2aa86b
3 changed files with 21 additions and 21 deletions
|
@ -2,6 +2,7 @@ package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.entitycomparis
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
@ -88,4 +89,15 @@ public class EntityComparisonUtilityFunctions {
|
|||
return highestLevelOrgURI;
|
||||
}
|
||||
|
||||
public static Map<String, Set<String>> getSubEntityTypes(Log log,
|
||||
DataSource dataSource, String subjectOrganization)
|
||||
throws MalformedQueryParametersException {
|
||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||
subjectOrganization, dataSource, log);
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
||||
.getQueryResult();
|
||||
return subOrganizationTypesResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -120,11 +120,8 @@ public class EntityPublicationCountRequestHandler implements
|
|||
String subjectEntityURI, Entity entity)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||
subjectEntityURI, dataSource, log);
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
||||
.getQueryResult();
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, subjectEntityURI);
|
||||
|
||||
return prepareStandaloneResponse(vitroRequest, entity, subjectEntityURI,
|
||||
subOrganizationTypesResult);
|
||||
|
@ -144,11 +141,8 @@ public class EntityPublicationCountRequestHandler implements
|
|||
|
||||
Entity entity = queryManager.getQueryResult();
|
||||
|
||||
|
||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||
entityURI, dataSource, log);
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes.getQueryResult();
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, entityURI);
|
||||
|
||||
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
||||
|
||||
|
|
|
@ -107,10 +107,8 @@ public class EntityGrantCountRequestHandler implements
|
|||
Entity entity = queryManager.getQueryResult();
|
||||
|
||||
|
||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||
entityURI, dataSource, log);
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes.getQueryResult();
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, entityURI);
|
||||
|
||||
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
||||
|
||||
|
@ -149,17 +147,13 @@ public class EntityGrantCountRequestHandler implements
|
|||
String subjectOrganization, Entity entity)
|
||||
throws MalformedQueryParametersException {
|
||||
|
||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
||||
subjectOrganization, dataSource, log);
|
||||
|
||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
||||
.getQueryResult();
|
||||
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||
log, dataSource, subjectOrganization);
|
||||
|
||||
return prepareStandaloneResponse(vitroRequest, entity, subjectOrganization,
|
||||
subOrganizationTypesResult);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides response when json file containing the grant count over the
|
||||
* years is requested.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue