Korrekturen und Feinarbeiten an den Tabs für SciInstitute und SciDepartment
git-svn-id: https://svn.libreccm.org/ccm/trunk@1313 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
4ea7b71896
commit
4e04b6335d
|
|
@ -15,8 +15,8 @@ import java.util.Map;
|
|||
*/
|
||||
public class CompareFilter implements Filter {
|
||||
|
||||
private static final String ALL = "--ALL--";
|
||||
private static final String NONE = "--NONE--";
|
||||
public static final String ALL = "--ALL--";
|
||||
public static final String NONE = "--NONE--";
|
||||
private final String property;
|
||||
private final String label;
|
||||
private final boolean allOption;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import com.redhat.persistence.pdl.PDL;
|
|||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
|
@ -445,7 +446,7 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
|
||||
Object secondElement = orderTwo;
|
||||
if (orderTwo instanceof String && orderTwo != null) {
|
||||
if ((orderTwo != null) && (orderTwo instanceof String)) {
|
||||
Path two = unalias(Path.get((String) orderTwo));
|
||||
// XXX:
|
||||
if (!hasProperty(two)) {
|
||||
|
|
@ -465,6 +466,10 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((orderTwo != null) && (orderTwo instanceof Date)) {
|
||||
|
||||
}
|
||||
|
||||
addOrder("case when (" + orderOne + " is null) then " +
|
||||
secondElement + " else " + orderOne + " end " + suffix);
|
||||
|
|
|
|||
|
|
@ -35,17 +35,17 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
private final Logger logger = Logger.getLogger(
|
||||
SciDepartmentProjectsTab.class);
|
||||
private static final SciDepartmentProjectsTabConfig config =
|
||||
new SciDepartmentProjectsTabConfig();
|
||||
new SciDepartmentProjectsTabConfig();
|
||||
private static final String STATUS_PARAM = "projectStatus";
|
||||
private static final String TITLE_PARAM = "projectTitle";
|
||||
private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM,
|
||||
"projectEnd",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true);
|
||||
"projectEnd",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true);
|
||||
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
||||
ContentPage.TITLE);
|
||||
ContentPage.TITLE);
|
||||
|
||||
static {
|
||||
config.load();
|
||||
|
|
@ -54,18 +54,18 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
public SciDepartmentProjectsTab() {
|
||||
final Calendar now = new GregorianCalendar();
|
||||
final String today = String.format("%d-%02d-%02d",
|
||||
now.get(Calendar.YEAR),
|
||||
now.get(Calendar.MONTH) + 1,
|
||||
now.get(Calendar.DAY_OF_MONTH));
|
||||
now.get(Calendar.YEAR),
|
||||
now.get(Calendar.MONTH) + 1,
|
||||
now.get(Calendar.DAY_OF_MONTH));
|
||||
|
||||
statusFilter.addOption("currentProjects",
|
||||
CompareFilter.Operators.GTEQ,
|
||||
today,
|
||||
true);
|
||||
CompareFilter.Operators.GTEQ,
|
||||
today,
|
||||
true);
|
||||
statusFilter.addOption("finishedProjects",
|
||||
CompareFilter.Operators.LT,
|
||||
today,
|
||||
false);
|
||||
CompareFilter.Operators.LT,
|
||||
today,
|
||||
false);
|
||||
}
|
||||
|
||||
public boolean hasData(final GenericOrganizationalUnit orgaunit) {
|
||||
|
|
@ -82,16 +82,16 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
final boolean result = !getData(orgaunit).isEmpty();
|
||||
|
||||
logger.debug(String.format("Needed %d ms to determine if department "
|
||||
+ "'%s' has projects.",
|
||||
System.currentTimeMillis() - start,
|
||||
orgaunit.getName()));
|
||||
+ "'%s' has projects.",
|
||||
System.currentTimeMillis() - start,
|
||||
orgaunit.getName()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final DataQuery projects = getData(orgaunit);
|
||||
final HttpServletRequest request = state.getRequest();
|
||||
|
|
@ -101,29 +101,40 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
final Element filtersElem = depProjectsElem.newChildElement(
|
||||
"filters");
|
||||
|
||||
projects.addOrder("case when (projectBegin is null) "
|
||||
+ "then '0001-01-01' "
|
||||
+ "else projectBegin "
|
||||
+ "end desc");
|
||||
projects.addOrder("case when (projectEnd is null) "
|
||||
+ "then '0001-01-01' "
|
||||
+ "else projectEnd "
|
||||
+ "end desc");
|
||||
projects.addOrder("title asc");
|
||||
|
||||
if (((request.getParameter(STATUS_PARAM) == null)
|
||||
|| (request.getParameter(STATUS_PARAM).trim().isEmpty()))
|
||||
&& ((request.getParameter(TITLE_PARAM) == null)
|
||||
|| request.getParameter(STATUS_PARAM).trim().isEmpty()
|
||||
|| CompareFilter.NONE.equals(request.getParameter(STATUS_PARAM)))
|
||||
&& ((request.getParameter(TITLE_PARAM) == null)
|
||||
|| request.getParameter(TITLE_PARAM).trim().isEmpty())) {
|
||||
|
||||
statusFilter.generateXml(filtersElem);
|
||||
|
||||
depProjectsElem.newChildElement("greeting");
|
||||
|
||||
projects.addOrder("projectEnd desc");
|
||||
projects.addOrder("projectBegin desc");
|
||||
//projects.addOrder("projectEnd desc");
|
||||
//projects.addOrder("projectBegin desc");
|
||||
//projects.addOrder("projectEnd desc nulls last");
|
||||
//projects.addOrder("projectBegin desc nulls last");
|
||||
//projects.addOrderWithNull("projectEnd", new Date(0), false);
|
||||
//projects.addOrderWithNull("projectBegin", new Date(0), false);
|
||||
projects.addOrder("title");
|
||||
//projects.addOrder("title");
|
||||
|
||||
projects.setRange(1, config.getGreetingSize() + 1);
|
||||
|
||||
titleFilter.generateXml(filtersElem);
|
||||
|
||||
} else {
|
||||
projects.addOrder("title");
|
||||
//projects.addOrder("title");
|
||||
|
||||
applyStatusFilter(projects, request);
|
||||
applyTitleFilter(projects, request);
|
||||
|
|
@ -138,11 +149,11 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
return;
|
||||
} else {
|
||||
final Paginator paginator = new Paginator(request,
|
||||
(int) projects.size(),
|
||||
config.getPageSize());
|
||||
(int) projects.size(),
|
||||
config.getPageSize());
|
||||
|
||||
if ((paginator.getPageCount() > config.getEnableSearchLimit())
|
||||
|| ((request.getParameter(TITLE_PARAM) != null)
|
||||
|| ((request.getParameter(TITLE_PARAM) != null)
|
||||
|| !(request.getParameter(TITLE_PARAM).trim().isEmpty()))) {
|
||||
titleFilter.generateXml(filtersElem);
|
||||
}
|
||||
|
|
@ -154,14 +165,14 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
|
||||
while (projects.next()) {
|
||||
generateProjectXml((BigDecimal) projects.get("projectId"),
|
||||
depProjectsElem,
|
||||
state);
|
||||
depProjectsElem,
|
||||
state);
|
||||
}
|
||||
|
||||
logger.debug(String.format("Generated projects list of department '%s' "
|
||||
+ "in %d ms.",
|
||||
orgaunit.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
+ "in %d ms.",
|
||||
orgaunit.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
protected DataQuery getData(final GenericOrganizationalUnit orgaunit) {
|
||||
|
|
@ -183,12 +194,12 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
|
||||
if (config.isMergingProjects()) {
|
||||
final DataQuery subDepartmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||
subDepartmentsQuery.setParameter("orgaunitId",
|
||||
orgaunit.getID().toString());
|
||||
orgaunit.getID().toString());
|
||||
subDepartmentsQuery.setParameter("assocType",
|
||||
SciDepartmentSubDepartmentsStep.ASSOC_TYPE);
|
||||
SciDepartmentSubDepartmentsStep.ASSOC_TYPE);
|
||||
|
||||
while (subDepartmentsQuery.next()) {
|
||||
/*if (projectsFilter.length() > 0) {
|
||||
|
|
@ -218,55 +229,56 @@ public class SciDepartmentProjectsTab implements GenericOrgaUnitTab {
|
|||
}
|
||||
|
||||
private void applyStatusFilter(final DataQuery projects,
|
||||
final HttpServletRequest request) {
|
||||
final HttpServletRequest request) {
|
||||
final String statusValue = request.getParameter(STATUS_PARAM);
|
||||
if ((statusValue != null) && !(statusValue.trim().isEmpty())) {
|
||||
statusFilter.setValue(statusValue);
|
||||
}
|
||||
|
||||
if ((statusFilter.getFilter() != null)
|
||||
&& !(statusFilter.getFilter().trim().isEmpty())) {
|
||||
&& !(statusFilter.getFilter().trim().isEmpty())) {
|
||||
projects.addFilter(statusFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTitleFilter(final DataQuery projects,
|
||||
final HttpServletRequest request) {
|
||||
final HttpServletRequest request) {
|
||||
final String titleValue = request.getParameter(TITLE_PARAM);
|
||||
if ((titleValue != null) && !(titleValue.trim().isEmpty())) {
|
||||
titleFilter.setValue(titleValue);
|
||||
}
|
||||
|
||||
if ((titleFilter.getFilter() != null)
|
||||
&& !(titleFilter.getFilter().trim().isEmpty())) {
|
||||
&& !(titleFilter.getFilter().trim().isEmpty())) {
|
||||
projects.addFilter(titleFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void generateProjectXml(final BigDecimal projectId,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final ContentPage project = (ContentPage) DomainObjectFactory.newInstance(new OID(
|
||||
final ContentPage project = (ContentPage) DomainObjectFactory.
|
||||
newInstance(new OID(
|
||||
"com.arsdigita.cms.contenttypes.SciProject", projectId));
|
||||
logger.debug(String.format("Got domain object for project '%s' "
|
||||
+ "in %d ms.",
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
+ "in %d ms.",
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
generateProjectXml(project, parent, state);
|
||||
}
|
||||
|
||||
private void generateProjectXml(final ContentPage project,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final XmlGenerator generator = new XmlGenerator(project);
|
||||
generator.setItemElemName("project", "");
|
||||
generator.setUseExtraXml(false);
|
||||
generator.generateXML(state, parent, "");
|
||||
logger.debug(String.format("Generated XML for project '%s' in %d ms.",
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
private class XmlGenerator extends SimpleXMLGenerator {
|
||||
|
|
|
|||
|
|
@ -114,11 +114,22 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
|||
|
||||
publications.addOrder("year desc");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
publications.addOrder("case when (authorSurname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorSurname "
|
||||
+ "end asc");
|
||||
publications.addOrder("case when (authorGivenname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorGivenname "
|
||||
+ "end asc");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
publications.addOrder("case when ((authors is null) "
|
||||
+ "or (char_length(authors) = 0)) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authors "
|
||||
+ "end asc");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("title asc");
|
||||
|
||||
publications.setRange(1, config.getGreetingSize() + 1);
|
||||
|
||||
|
|
@ -174,39 +185,49 @@ public class SciDepartmentPublicationsTab implements GenericOrgaUnitTab {
|
|||
|
||||
publications.addOrder("year desc");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("case when (authorSurname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorSurname "
|
||||
+ "end asc");
|
||||
publications.addOrder("case when (authorGivenname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorGivenname "
|
||||
+ "end asc");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("case when ((authors is null) "
|
||||
+ "or (char_length(authors) = 0)) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authors "
|
||||
+ "end asc");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
|
||||
final DataQuery yearQuery = getData(orgaunit);
|
||||
yearFilter.setDataQuery(yearQuery, "year");
|
||||
|
||||
yearFilter.setDataQuery(yearQuery, "year");
|
||||
|
||||
applyYearFilter(publications, request);
|
||||
applyTitleFilter(publications, request);
|
||||
applyAuthorFilter(publications, request);
|
||||
|
||||
|
||||
applyTitleFilter(yearQuery, request);
|
||||
applyAuthorFilter(yearQuery, request);
|
||||
|
||||
|
||||
if (publications.isEmpty()) {
|
||||
yearFilter.generateXml(filtersElem);
|
||||
titleFilter.generateXml(filtersElem);
|
||||
authorFilter.generateXml(filtersElem);
|
||||
|
||||
|
||||
depPublicationsElem.newChildElement("noPublications");
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
final Paginator paginator = new Paginator(request,
|
||||
(int) publications.size(),
|
||||
config.getPageSize());
|
||||
|
||||
yearFilter.generateXml(filtersElem);
|
||||
yearFilter.generateXml(filtersElem);
|
||||
if ((paginator.getPageCount() > config.getEnableSearchLimit())
|
||||
|| ((request.getParameter(TITLE_PARAM) != null)
|
||||
&& !(request.getParameter(TITLE_PARAM).trim().isEmpty()))) {
|
||||
|
|
|
|||
|
|
@ -33,19 +33,19 @@ import org.apache.log4j.Logger;
|
|||
public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
||||
|
||||
private final Logger logger =
|
||||
Logger.getLogger(SciInstituteProjectsTab.class);
|
||||
Logger.getLogger(SciInstituteProjectsTab.class);
|
||||
private final static SciInstituteProjectsTabConfig config =
|
||||
new SciInstituteProjectsTabConfig();
|
||||
new SciInstituteProjectsTabConfig();
|
||||
private static final String STATUS_PARAM = "projectStatus";
|
||||
private static final String TITLE_PARAM = "projectTitle";
|
||||
private final CompareFilter statusFilter = new CompareFilter(STATUS_PARAM,
|
||||
"projectEnd",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true);
|
||||
"projectEnd",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true);
|
||||
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
||||
ContentPage.TITLE);
|
||||
ContentPage.TITLE);
|
||||
|
||||
static {
|
||||
config.load();
|
||||
|
|
@ -54,18 +54,18 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
public SciInstituteProjectsTab() {
|
||||
final Calendar now = new GregorianCalendar();
|
||||
final String today = String.format("%d-%02d-%02d",
|
||||
now.get(Calendar.YEAR),
|
||||
now.get(Calendar.MONTH) + 1,
|
||||
now.get(Calendar.DAY_OF_MONTH));
|
||||
now.get(Calendar.YEAR),
|
||||
now.get(Calendar.MONTH) + 1,
|
||||
now.get(Calendar.DAY_OF_MONTH));
|
||||
|
||||
statusFilter.addOption("currentProjects",
|
||||
CompareFilter.Operators.GTEQ,
|
||||
today,
|
||||
true);
|
||||
CompareFilter.Operators.GTEQ,
|
||||
today,
|
||||
true);
|
||||
statusFilter.addOption("finishedProjects",
|
||||
CompareFilter.Operators.LT,
|
||||
today,
|
||||
false);
|
||||
CompareFilter.Operators.LT,
|
||||
today,
|
||||
false);
|
||||
}
|
||||
|
||||
public boolean hasData(final GenericOrganizationalUnit orgaunit) {
|
||||
|
|
@ -82,16 +82,16 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
final boolean result = !getData(orgaunit).isEmpty();
|
||||
|
||||
logger.debug(String.format("Needed %d ms to determine if institute "
|
||||
+ "'%s' has projects.",
|
||||
System.currentTimeMillis() - start,
|
||||
orgaunit.getName()));
|
||||
+ "'%s' has projects.",
|
||||
System.currentTimeMillis() - start,
|
||||
orgaunit.getName()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final DataQuery projects = getData(orgaunit);
|
||||
final HttpServletRequest request = state.getRequest();
|
||||
|
|
@ -101,29 +101,38 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
final Element filtersElem = depProjectsElem.newChildElement(
|
||||
"filters");
|
||||
|
||||
projects.addOrder("case when (projectBegin is null) "
|
||||
+ "then '0001-01-01' "
|
||||
+ "else projectBegin "
|
||||
+ "end desc");
|
||||
projects.addOrder("case when (projectEnd is null) "
|
||||
+ "then '0001-01-01' "
|
||||
+ "else projectEnd "
|
||||
+ "end desc");
|
||||
projects.addOrder("title asc");
|
||||
|
||||
if (((request.getParameter(STATUS_PARAM) == null)
|
||||
|| (request.getParameter(STATUS_PARAM).trim().isEmpty()))
|
||||
&& ((request.getParameter(TITLE_PARAM) == null)
|
||||
|| request.getParameter(STATUS_PARAM).trim().isEmpty()
|
||||
|| CompareFilter.NONE.equals(request.getParameter(STATUS_PARAM)))
|
||||
&& ((request.getParameter(TITLE_PARAM) == null)
|
||||
|| request.getParameter(TITLE_PARAM).trim().isEmpty())) {
|
||||
|
||||
statusFilter.generateXml(filtersElem);
|
||||
|
||||
depProjectsElem.newChildElement("greeting");
|
||||
|
||||
projects.addOrder("projectEnd desc");
|
||||
projects.addOrder("projectBegin desc");
|
||||
//projects.addOrder("projectEnd desc nulls last");
|
||||
//projects.addOrder("projectBegin desc nulls last");
|
||||
//projects.addOrderWithNull("projectEnd", null, false);
|
||||
//projects.addOrderWithNull("projectBegin", null, false);
|
||||
projects.addOrder("title");
|
||||
//projects.addOrder("title");
|
||||
|
||||
projects.setRange(1, config.getGreetingSize() + 1);
|
||||
|
||||
titleFilter.generateXml(filtersElem);
|
||||
|
||||
} else {
|
||||
projects.addOrder("title");
|
||||
//projects.addOrder("title");
|
||||
|
||||
applyStatusFilter(projects, request);
|
||||
applyTitleFilter(projects, request);
|
||||
|
|
@ -138,11 +147,11 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
return;
|
||||
} else {
|
||||
final Paginator paginator = new Paginator(request,
|
||||
(int) projects.size(),
|
||||
config.getPageSize());
|
||||
(int) projects.size(),
|
||||
config.getPageSize());
|
||||
|
||||
if ((paginator.getPageCount() > config.getEnableSearchLimit())
|
||||
|| ((request.getParameter(TITLE_PARAM) != null)
|
||||
|| ((request.getParameter(TITLE_PARAM) != null)
|
||||
|| !(request.getParameter(TITLE_PARAM).trim().isEmpty()))) {
|
||||
titleFilter.generateXml(filtersElem);
|
||||
}
|
||||
|
|
@ -154,14 +163,14 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
|
||||
while (projects.next()) {
|
||||
generateProjectXml((BigDecimal) projects.get("projectId"),
|
||||
depProjectsElem,
|
||||
state);
|
||||
depProjectsElem,
|
||||
state);
|
||||
}
|
||||
|
||||
logger.debug(String.format("Generated projects list of department '%s' "
|
||||
+ "in %d ms.",
|
||||
orgaunit.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
+ "in %d ms.",
|
||||
orgaunit.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
protected DataQuery getData(final GenericOrganizationalUnit orgaunit) {
|
||||
|
|
@ -183,12 +192,12 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
|
||||
if (config.isMergingProjects()) {
|
||||
final DataQuery subDepartmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||
subDepartmentsQuery.setParameter("orgaunitId",
|
||||
orgaunit.getID().toString());
|
||||
orgaunit.getID().toString());
|
||||
subDepartmentsQuery.setParameter("assocType",
|
||||
SciInstituteDepartmentsStep.ASSOC_TYPE);
|
||||
SciInstituteDepartmentsStep.ASSOC_TYPE);
|
||||
|
||||
while (subDepartmentsQuery.next()) {
|
||||
/*if (projectsFilter.length() > 0) {
|
||||
|
|
@ -218,55 +227,56 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
}
|
||||
|
||||
private void applyStatusFilter(final DataQuery projects,
|
||||
final HttpServletRequest request) {
|
||||
final HttpServletRequest request) {
|
||||
final String statusValue = request.getParameter(STATUS_PARAM);
|
||||
if ((statusValue != null) && !(statusValue.trim().isEmpty())) {
|
||||
statusFilter.setValue(statusValue);
|
||||
}
|
||||
|
||||
if ((statusFilter.getFilter() != null)
|
||||
&& !(statusFilter.getFilter().trim().isEmpty())) {
|
||||
&& !(statusFilter.getFilter().trim().isEmpty())) {
|
||||
projects.addFilter(statusFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTitleFilter(final DataQuery projects,
|
||||
final HttpServletRequest request) {
|
||||
final HttpServletRequest request) {
|
||||
final String titleValue = request.getParameter(TITLE_PARAM);
|
||||
if ((titleValue != null) && !(titleValue.trim().isEmpty())) {
|
||||
titleFilter.setValue(titleValue);
|
||||
}
|
||||
|
||||
if ((titleFilter.getFilter() != null)
|
||||
&& !(titleFilter.getFilter().trim().isEmpty())) {
|
||||
&& !(titleFilter.getFilter().trim().isEmpty())) {
|
||||
projects.addFilter(titleFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void generateProjectXml(final BigDecimal projectId,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final ContentPage project = (ContentPage) DomainObjectFactory.newInstance(new OID(
|
||||
final ContentPage project = (ContentPage) DomainObjectFactory.
|
||||
newInstance(new OID(
|
||||
"com.arsdigita.cms.contenttypes.SciProject", projectId));
|
||||
logger.debug(String.format("Got domain object for project '%s' "
|
||||
+ "in %d ms.",
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
+ "in %d ms.",
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
generateProjectXml(project, parent, state);
|
||||
}
|
||||
|
||||
private void generateProjectXml(final ContentPage project,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final XmlGenerator generator = new XmlGenerator(project);
|
||||
generator.setItemElemName("project", "");
|
||||
generator.setUseExtraXml(false);
|
||||
generator.generateXML(state, parent, "");
|
||||
logger.debug(String.format("Generated XML for project '%s' in %d ms.",
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
project.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
private class XmlGenerator extends SimpleXMLGenerator {
|
||||
|
|
|
|||
|
|
@ -142,11 +142,21 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
|
||||
publications.addOrder("year desc");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
publications.addOrder("case when (authorSurname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorSurname "
|
||||
+ "end asc");
|
||||
publications.addOrder("case when (authorGivenname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorGivenname "
|
||||
+ "end asc");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
publications.addOrder("case when (authors is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authors "
|
||||
+ "end asc");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("title asc");
|
||||
|
||||
yearFilter.setDataQuery(getData(orgaunit), "year");
|
||||
|
||||
|
|
@ -200,12 +210,21 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
}*/
|
||||
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("case when (authorSurname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorSurname "
|
||||
+ "end asc");
|
||||
publications.addOrder("case when (authorGivenname is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authorGivenname "
|
||||
+ "end asc");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("case when (authors is null) "
|
||||
+ "then 'zzzz' "
|
||||
+ "else authors "
|
||||
+ "end asc");
|
||||
}
|
||||
publications.addOrder("title asc");
|
||||
|
||||
final DataQuery yearQuery = getData(orgaunit);
|
||||
yearFilter.setDataQuery(yearQuery, "year");
|
||||
|
|
@ -213,7 +232,7 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
applyYearFilter(publications, request);
|
||||
applyTitleFilter(publications, request);
|
||||
applyAuthorFilter(publications, request);
|
||||
|
||||
|
||||
applyTitleFilter(yearQuery, request);
|
||||
applyAuthorFilter(yearQuery, request);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue