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.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -88,4 +89,15 @@ public class EntityComparisonUtilityFunctions {
|
||||||
return highestLevelOrgURI;
|
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)
|
String subjectEntityURI, Entity entity)
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||||
subjectEntityURI, dataSource, log);
|
log, dataSource, subjectEntityURI);
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
|
||||||
.getQueryResult();
|
|
||||||
|
|
||||||
return prepareStandaloneResponse(vitroRequest, entity, subjectEntityURI,
|
return prepareStandaloneResponse(vitroRequest, entity, subjectEntityURI,
|
||||||
subOrganizationTypesResult);
|
subOrganizationTypesResult);
|
||||||
|
@ -144,11 +141,8 @@ public class EntityPublicationCountRequestHandler implements
|
||||||
|
|
||||||
Entity entity = queryManager.getQueryResult();
|
Entity entity = queryManager.getQueryResult();
|
||||||
|
|
||||||
|
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
log, dataSource, entityURI);
|
||||||
entityURI, dataSource, log);
|
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes.getQueryResult();
|
|
||||||
|
|
||||||
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
||||||
|
|
||||||
|
|
|
@ -107,10 +107,8 @@ public class EntityGrantCountRequestHandler implements
|
||||||
Entity entity = queryManager.getQueryResult();
|
Entity entity = queryManager.getQueryResult();
|
||||||
|
|
||||||
|
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||||
entityURI, dataSource, log);
|
log, dataSource, entityURI);
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes.getQueryResult();
|
|
||||||
|
|
||||||
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
return prepareDataResponse(entity, entity.getSubEntities(),subOrganizationTypesResult);
|
||||||
|
|
||||||
|
@ -149,17 +147,13 @@ public class EntityGrantCountRequestHandler implements
|
||||||
String subjectOrganization, Entity entity)
|
String subjectOrganization, Entity entity)
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
|
Map<String, Set<String>> subOrganizationTypesResult = EntityComparisonUtilityFunctions.getSubEntityTypes(
|
||||||
subjectOrganization, dataSource, log);
|
log, dataSource, subjectOrganization);
|
||||||
|
|
||||||
Map<String, Set<String>> subOrganizationTypesResult = queryManagerForsubOrganisationTypes
|
|
||||||
.getQueryResult();
|
|
||||||
|
|
||||||
return prepareStandaloneResponse(vitroRequest, entity, subjectOrganization,
|
return prepareStandaloneResponse(vitroRequest, entity, subjectOrganization,
|
||||||
subOrganizationTypesResult);
|
subOrganizationTypesResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides response when json file containing the grant count over the
|
* Provides response when json file containing the grant count over the
|
||||||
* years is requested.
|
* years is requested.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue