merging r9990 into the trunk
This commit is contained in:
parent
cadff5e548
commit
1b75b2a93f
3 changed files with 52 additions and 4 deletions
|
@ -38,6 +38,7 @@ log4j.logger.edu.cornell.mannlib.vitro.webapp.startup.StartupStatus=WARN
|
||||||
log4j.logger.edu.cornell.mannlib.vitro.webapp.controller.freemarker.BrowseController=WARN
|
log4j.logger.edu.cornell.mannlib.vitro.webapp.controller.freemarker.BrowseController=WARN
|
||||||
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener=WARN
|
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener=WARN
|
||||||
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.RDBGraphGenerator=WARN
|
log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.RDBGraphGenerator=WARN
|
||||||
|
log4j.logger.edu.cornell.mannlib.vitro.webapp.servlet.setup.UpdateKnowledgeBase=DEBUG
|
||||||
|
|
||||||
# Spring as a whole is too chatty to display INFO messages.
|
# Spring as a whole is too chatty to display INFO messages.
|
||||||
log4j.logger.org.springframework=WARN
|
log4j.logger.org.springframework=WARN
|
||||||
|
|
|
@ -87,9 +87,14 @@ class IndividualResponseBuilder {
|
||||||
* into the data model: no real data can be modified.
|
* into the data model: no real data can be modified.
|
||||||
*/
|
*/
|
||||||
// body.put("individual", wrap(itm, BeansWrapper.EXPOSE_SAFE));
|
// body.put("individual", wrap(itm, BeansWrapper.EXPOSE_SAFE));
|
||||||
|
if ( itm.person() ) {
|
||||||
|
body.put("publicationCount", getPublicationCount(itm.getUri(), vreq));
|
||||||
|
body.put("grantCount", getGrantCount(itm.getUri(), vreq));
|
||||||
|
}
|
||||||
|
if ( itm.organization() ) {
|
||||||
|
body.put("peopleCount", getPeopleCount(itm.getUri(), vreq));
|
||||||
|
}
|
||||||
body.put("labelCount", getLabelCount(itm.getUri(), vreq));
|
body.put("labelCount", getLabelCount(itm.getUri(), vreq));
|
||||||
body.put("publicationCount", getPublicationCount(itm.getUri(), vreq));
|
|
||||||
body.put("grantCount", getGrantCount(itm.getUri(), vreq));
|
|
||||||
body.put("individual", wrap(itm, new ReadOnlyBeansWrapper()));
|
body.put("individual", wrap(itm, new ReadOnlyBeansWrapper()));
|
||||||
|
|
||||||
body.put("headContent", getRdfLinkTag(itm));
|
body.put("headContent", getRdfLinkTag(itm));
|
||||||
|
@ -264,6 +269,12 @@ class IndividualResponseBuilder {
|
||||||
+ " { ?subject core:hasResearcherRole ?role } \n"
|
+ " { ?subject core:hasResearcherRole ?role } \n"
|
||||||
+ "}" ;
|
+ "}" ;
|
||||||
|
|
||||||
|
private static String PEOPLE_COUNT_QUERY = ""
|
||||||
|
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||||
|
+ "SELECT ( str(COUNT(?position)) AS ?positionCount ) WHERE { \n"
|
||||||
|
+ " ?subject core:organizationForPosition ?position \n"
|
||||||
|
+ "}" ;
|
||||||
|
|
||||||
private static Integer getLabelCount(String subjectUri, VitroRequest vreq) {
|
private static Integer getLabelCount(String subjectUri, VitroRequest vreq) {
|
||||||
|
|
||||||
String queryStr = QueryUtils.subUriForQueryVar(LABEL_COUNT_QUERY, "subject", subjectUri);
|
String queryStr = QueryUtils.subUriForQueryVar(LABEL_COUNT_QUERY, "subject", subjectUri);
|
||||||
|
@ -315,4 +326,22 @@ class IndividualResponseBuilder {
|
||||||
}
|
}
|
||||||
return theCount;
|
return theCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Integer getPeopleCount(String subjectUri, VitroRequest vreq) {
|
||||||
|
|
||||||
|
String queryStr = QueryUtils.subUriForQueryVar(PEOPLE_COUNT_QUERY, "subject", subjectUri);
|
||||||
|
log.debug("queryStr = " + queryStr);
|
||||||
|
int theCount = 0;
|
||||||
|
try {
|
||||||
|
ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
|
||||||
|
if (results.hasNext()) {
|
||||||
|
QuerySolution soln = results.nextSolution();
|
||||||
|
String countStr = soln.get("positionCount").toString();
|
||||||
|
theCount = Integer.parseInt(countStr);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e, e);
|
||||||
|
}
|
||||||
|
return theCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,21 +25,39 @@
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
<#-- List the properties in the group -->
|
<#-- List the properties in the group -->
|
||||||
|
<#assign pubCount = 0 >
|
||||||
|
<#assign researchCount = 0 >
|
||||||
|
<#assign peepsCount = 0 >
|
||||||
|
<#if publicationCount?? >
|
||||||
|
<#assign pubCount = publicationCount >
|
||||||
|
</#if>
|
||||||
|
<#if grantCount?? >
|
||||||
|
<#assign researchCount = grantCount >
|
||||||
|
</#if>
|
||||||
|
<#if peopleCount?? >
|
||||||
|
<#assign peepsCount = peopleCount >
|
||||||
|
</#if>
|
||||||
<#list group.properties as property>
|
<#list group.properties as property>
|
||||||
<article class="property" role="article">
|
<article class="property" role="article">
|
||||||
<#-- Property display name -->
|
<#-- Property display name -->
|
||||||
<#if property.localName == "authorInAuthorship" && editable && (publicationCount > 0) >
|
<#if property.localName == "authorInAuthorship" && editable && (pubCount > 0) >
|
||||||
<h3 id="${property.localName}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />
|
<h3 id="${property.localName}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />
|
||||||
<a id="managePropLink" class="manageLinks" href="${urls.base}/managePublications?subjectUri=${subjectUri[1]!}" title="manage publications" <#if verbose>style="padding-top:10px"</#if> >
|
<a id="managePropLink" class="manageLinks" href="${urls.base}/managePublications?subjectUri=${subjectUri[1]!}" title="manage publications" <#if verbose>style="padding-top:10px"</#if> >
|
||||||
manage publications
|
manage publications
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
<#elseif property.localName == "hasResearcherRole" && editable && (grantCount > 0) >
|
<#elseif property.localName == "hasResearcherRole" && editable && (researchCount! > 0) >
|
||||||
<h3 id="${property.localName}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />
|
<h3 id="${property.localName}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />
|
||||||
<a id="manageGrantLink" class="manageLinks" href="${urls.base}/manageGrants?subjectUri=${subjectUri[1]!}" title="manage grants & projects" <#if verbose>style="padding-top:10px"</#if> >
|
<a id="manageGrantLink" class="manageLinks" href="${urls.base}/manageGrants?subjectUri=${subjectUri[1]!}" title="manage grants & projects" <#if verbose>style="padding-top:10px"</#if> >
|
||||||
manage grants & projects
|
manage grants & projects
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
<#elseif property.localName == "organizationForPosition" && editable && (peepsCount! > 0) >
|
||||||
|
<h3 id="${property.localName}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />
|
||||||
|
<a id="managePeopleLink" class="manageLinks" href="${urls.base}/managePeople?subjectUri=${subjectUri[1]!}" title="manage people" <#if verbose>style="padding-top:10px"</#if> >
|
||||||
|
manage affiliated people
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
<#else>
|
<#else>
|
||||||
<h3 id="${property.localName}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property /> </h3>
|
<h3 id="${property.localName}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property /> </h3>
|
||||||
</#if>
|
</#if>
|
||||||
|
|
Loading…
Add table
Reference in a new issue