NIHVIVO-1681 -- Made changes to EntityPubCountRequestHandler for graceful degradation of the vis incase the highest level org contains no pubs/grants.

This commit is contained in:
bkoniden 2011-02-02 18:22:39 +00:00
parent 9b3ce6ecd5
commit b1f72c276f

View file

@ -102,6 +102,12 @@ public class EntityPublicationCountRequestHandler implements
Entity entity = queryManager.getQueryResult(); Entity entity = queryManager.getQueryResult();
if(entity.getEntityLabel().equals("no-label")){
return prepareStandaloneErrorResponse(vitroRequest,staffProvidedHighestLevelOrganization);
} else {
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner( QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
staffProvidedHighestLevelOrganization, dataSource, log); staffProvidedHighestLevelOrganization, dataSource, log);
@ -110,7 +116,7 @@ public class EntityPublicationCountRequestHandler implements
return prepareStandaloneResponse(vitroRequest, entity, staffProvidedHighestLevelOrganization, return prepareStandaloneResponse(vitroRequest, entity, staffProvidedHighestLevelOrganization,
subOrganizationTypesResult); subOrganizationTypesResult);
}
} }
} }
@ -147,6 +153,12 @@ public class EntityPublicationCountRequestHandler implements
Entity entity = queryManager.getQueryResult(); Entity entity = queryManager.getQueryResult();
if(entity.getEntityLabel().equals("no-label")){
return prepareStandaloneErrorResponse(vitroRequest,highestLevelOrgURI);
} else {
QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner( QueryRunner<Map<String, Set<String>>> queryManagerForsubOrganisationTypes = new EntitySubOrganizationTypesQueryRunner(
highestLevelOrgURI, dataSource, log); highestLevelOrgURI, dataSource, log);
@ -156,6 +168,7 @@ public class EntityPublicationCountRequestHandler implements
return prepareStandaloneResponse(vitroRequest, entity, highestLevelOrgURI, return prepareStandaloneResponse(vitroRequest, entity, highestLevelOrgURI,
subOrganizationTypesResult); subOrganizationTypesResult);
} }
}
} }