Aktueller Stand der neuen Sci-Typen.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1271 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f6ef24d03c
commit
8a7d217789
|
|
@ -92,14 +92,14 @@ query getIdsOfPublicationsForOrgaUnitOneRowPerAuthor {
|
|||
String language;
|
||||
|
||||
do {
|
||||
select cms_pages.item_id,
|
||||
cms_pages.title,
|
||||
acs_objects.object_type,
|
||||
cms_organizationalunits.organizationalunit_id,
|
||||
ct_publications.year,
|
||||
cms_persons.surname,
|
||||
cms_persons.givenname,
|
||||
cms_items.language
|
||||
select distinct on (cms_pages.item_id) cms_pages.item_id,
|
||||
cms_pages.title,
|
||||
acs_objects.object_type,
|
||||
cms_organizationalunits.organizationalunit_id,
|
||||
ct_publications.year,
|
||||
cms_persons.surname,
|
||||
cms_persons.givenname,
|
||||
cms_items.language
|
||||
from cms_pages
|
||||
join ct_publications on cms_pages.item_id = ct_publications.publication_id
|
||||
join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
|
||||
|
|
@ -135,14 +135,14 @@ query getIdsOfPublicationsForOrgaUnit {
|
|||
Boolean reviewed;
|
||||
|
||||
do {
|
||||
select cms_pages.item_id,
|
||||
acs_objects.object_type,
|
||||
cms_pages.title,
|
||||
cms_organizationalunits.organizationalunit_id,
|
||||
ct_publications.year,
|
||||
ct_publications.authors,
|
||||
cms_items.language,
|
||||
ct_publications.reviewed
|
||||
select distinct on (cms_pages.item_id) cms_pages.item_id,
|
||||
acs_objects.object_type,
|
||||
cms_pages.title,
|
||||
cms_organizationalunits.organizationalunit_id,
|
||||
ct_publications.year,
|
||||
ct_publications.authors,
|
||||
cms_items.language,
|
||||
ct_publications.reviewed
|
||||
from cms_pages
|
||||
join ct_publications on cms_pages.item_id = ct_publications.publication_id
|
||||
join cms_organizationalunits_publications_map on cms_pages.item_id = cms_organizationalunits_publications_map.publication_id
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
|||
config.getPageSize());
|
||||
|
||||
if ((paginator.getPageCount() > config.getEnableSearchLimit())
|
||||
|| !(surnameFilter.getFilter().trim().isEmpty())) {
|
||||
|| ((surnameFilter.getFilter() != null)
|
||||
&& !(surnameFilter.getFilter().trim().isEmpty()))) {
|
||||
surnameFilter.generateXml(filtersElem);
|
||||
}
|
||||
|
||||
|
|
@ -146,17 +147,16 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
|||
|
||||
while (subDepartmentsQuery.next()) {
|
||||
/*if (personsFilter.length() > 0) {
|
||||
personsFilter.append(" or ");
|
||||
personsFilter.append(" or ");
|
||||
}
|
||||
personsFilter.append(String.format("orgaunitId = %s",
|
||||
subDepartmentsQuery.get(
|
||||
"orgaunitId").toString()));*/
|
||||
orgaUnitIds.add(subDepartmentsQuery.get(
|
||||
"orgaunitId").toString());
|
||||
subDepartmentsQuery.get(
|
||||
"orgaunitId").toString()));*/
|
||||
orgaUnitIds.add(subDepartmentsQuery.get("orgaunitId").toString());
|
||||
}
|
||||
} else {
|
||||
/*personsFilter.append(String.format("orgaunitId = %s",
|
||||
orgaunit.getID().toString()));*/
|
||||
orgaunit.getID().toString()));*/
|
||||
orgaUnitIds.add(orgaunit.getID().toString());
|
||||
}
|
||||
|
||||
|
|
@ -182,9 +182,9 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
|
|||
statusFilter.setValue(statusValue);
|
||||
}
|
||||
|
||||
String filter = statusFilter.getFilter();
|
||||
final String filter = statusFilter.getFilter();
|
||||
if ((filter != null) && !(filter.trim().isEmpty())) {
|
||||
persons.addFilter(statusFilter.getFilter());
|
||||
persons.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class SciInstituteConfig extends AbstractConfig {
|
|||
new StringParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciinstitute.tabs",
|
||||
Parameter.REQUIRED,
|
||||
"summary:com.arsdigita.cms.contenttypes.ui.SciInstituteSummaryTab");
|
||||
"summary:com.arsdigita.cms.contenttypes.ui.SciInstituteSummaryTab;desc:com.arsdigita.cms.contenttypes.ui.SciInstituteDescTab;members:com.arsdigita.cms.contenttypes.ui.SciInstituteMembersTab;projects:com.arsdigita.cms.contenttypes.ui.SciInstituteProjectsTab;publications:com.arsdigita.cms.contenttypes.ui.SciInstitutePublicationsTab");
|
||||
|
||||
register(enableDepartmentsStep);
|
||||
register(enableDepartmentInstitutesStep);
|
||||
|
|
|
|||
|
|
@ -42,14 +42,16 @@ public class SciInstituteDescTab implements GenericOrgaUnitTab {
|
|||
final long start = System.currentTimeMillis();
|
||||
final Desc desc = getData(orgaunit);
|
||||
|
||||
final Element descTabElem = parent.newChildElement("instituteDescription");
|
||||
|
||||
if ((desc.getShortDesc() != null)
|
||||
&& !desc.getShortDesc().trim().isEmpty()) {
|
||||
final Element shortDescElem = parent.newChildElement(
|
||||
final Element shortDescElem = descTabElem.newChildElement(
|
||||
"shortDescription");
|
||||
shortDescElem.setText(desc.getShortDesc());
|
||||
}
|
||||
|
||||
final Element descElem = parent.newChildElement("description");
|
||||
final Element descElem = descTabElem.newChildElement("description");
|
||||
descElem.setText(desc.getDesc());
|
||||
|
||||
logger.debug(String.format("Generated XML for description tab of "
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.arsdigita.cms.contenttypes.ui;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciInstitute;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.CompareFilter;
|
||||
|
|
@ -14,6 +13,8 @@ import com.arsdigita.persistence.DataQuery;
|
|||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -31,7 +32,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
|||
private static final String SURNAME_PARAM = "memberSurname";
|
||||
private final CompareFilter statusFilter = new CompareFilter(
|
||||
STATUS_PARAM,
|
||||
GenericOrganizationalUnitPersonCollection.LINK_STATUS,
|
||||
"status",
|
||||
false,
|
||||
false,
|
||||
false);
|
||||
|
|
@ -79,12 +80,25 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
|||
|
||||
final Element filtersElem = depMembersElem.newChildElement("filters");
|
||||
|
||||
statusFilter.generateXml(filtersElem);
|
||||
|
||||
if (persons.isEmpty()) {
|
||||
if ((surnameFilter != null)
|
||||
&& (surnameFilter.getFilter() != null)
|
||||
&& (!surnameFilter.getFilter().trim().isEmpty())) {
|
||||
surnameFilter.generateXml(filtersElem);
|
||||
}
|
||||
depMembersElem.newChildElement("noMembers");
|
||||
return;
|
||||
}
|
||||
|
||||
final Paginator paginator = new Paginator(request,
|
||||
(int) persons.size(),
|
||||
config.getPageSize());
|
||||
|
||||
statusFilter.generateXml(filtersElem);
|
||||
if (paginator.getPageCount() > config.getEnableSearchLimit()) {
|
||||
if (paginator.getPageCount() > config.getEnableSearchLimit()
|
||||
|| ((surnameFilter.getFilter() != null)
|
||||
&& !(surnameFilter.getFilter().trim().isEmpty()))) {
|
||||
surnameFilter.generateXml(filtersElem);
|
||||
}
|
||||
|
||||
|
|
@ -117,31 +131,35 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
|||
final DataQuery personsQuery = SessionManager.getSession().
|
||||
retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits");
|
||||
final StringBuffer personsFilter = new StringBuffer();
|
||||
//final StringBuffer personsFilter = new StringBuffer();
|
||||
final List<String> orgaunitsIds = new ArrayList<String>();
|
||||
|
||||
if (config.isMergingMembers()) {
|
||||
final DataQuery departmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||
departmentsQuery.setParameter("orgaunitId",
|
||||
orgaunit.getID().toString());
|
||||
orgaunit.getID().toString());
|
||||
departmentsQuery.setParameter("assocType",
|
||||
SciInstituteDepartmentsStep.ASSOC_TYPE);
|
||||
SciInstituteDepartmentsStep.ASSOC_TYPE);
|
||||
|
||||
while (departmentsQuery.next()) {
|
||||
if (personsFilter.length() > 0) {
|
||||
personsFilter.append(" or ");
|
||||
/*if (personsFilter.length() > 0) {
|
||||
personsFilter.append(" or ");
|
||||
}
|
||||
personsFilter.append(String.format("orgaunitId = %s",
|
||||
departmentsQuery.get(
|
||||
"orgaunitId").toString()));
|
||||
departmentsQuery.get(
|
||||
"orgaunitId").toString()));*/
|
||||
orgaunitsIds.add(departmentsQuery.get("orgaunitId").toString());
|
||||
}
|
||||
} else {
|
||||
personsFilter.append(String.format("orgaunitId = %s",
|
||||
orgaunit.getID().toString()));
|
||||
/*personsFilter.append(String.format("orgaunitId = %s",
|
||||
orgaunit.getID().toString()));*/
|
||||
orgaunitsIds.add(orgaunit.getID().toString());
|
||||
}
|
||||
|
||||
personsQuery.addFilter(personsFilter.toString());
|
||||
//personsQuery.addFilter(personsFilter.toString());
|
||||
personsQuery.setParameter("orgaunitIds", orgaunitsIds);
|
||||
|
||||
personsQuery.addOrder(GenericPerson.SURNAME);
|
||||
personsQuery.addOrder(GenericPerson.GIVENNAME);
|
||||
|
|
@ -155,14 +173,17 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
|||
return personsQuery;
|
||||
}
|
||||
|
||||
private void applyStatusFilter(final DataQuery persons,
|
||||
private void applyStatusFilter(final DataQuery persons,
|
||||
final HttpServletRequest request) {
|
||||
final String statusValue = request.getParameter(STATUS_PARAM);
|
||||
if ((statusValue != null) && !(statusValue.trim().isEmpty())) {
|
||||
statusFilter.setValue(statusValue);
|
||||
}
|
||||
|
||||
persons.addFilter(statusFilter.getFilter());
|
||||
final String filter = statusFilter.getFilter();
|
||||
if ((filter != null) && !(filter.trim().isEmpty())) {
|
||||
persons.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
private void applySurnameFilter(final DataQuery persons,
|
||||
|
|
@ -172,7 +193,10 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
|||
surnameFilter.setValue(surnameValue);
|
||||
}
|
||||
|
||||
persons.addFilter(surnameFilter.getFilter());
|
||||
final String filter = surnameFilter.getFilter();
|
||||
if ((filter != null) && !(filter.trim().isEmpty())) {
|
||||
persons.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateMemberXml(final BigDecimal memberId,
|
||||
|
|
@ -193,6 +217,7 @@ public class SciInstituteMembersTab implements GenericOrgaUnitTab {
|
|||
final long start = System.currentTimeMillis();
|
||||
final XmlGenerator generator = new XmlGenerator(member);
|
||||
generator.setUseExtraXml(false);
|
||||
generator.setItemElemName("member", "");
|
||||
generator.generateXML(state, parent, "");
|
||||
logger.debug(String.format("Generated XML for member '%s' in %d ms.",
|
||||
member.getFullName(),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ import com.arsdigita.persistence.OID;
|
|||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -30,13 +34,14 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
private final Logger logger =
|
||||
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);
|
||||
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
||||
ContentPage.TITLE);
|
||||
|
|
@ -45,6 +50,23 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
config.load();
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
statusFilter.addOption("currentProjects",
|
||||
CompareFilter.Operators.GTEQ,
|
||||
today,
|
||||
true);
|
||||
statusFilter.addOption("finishedProjects",
|
||||
CompareFilter.Operators.LT,
|
||||
today,
|
||||
false);
|
||||
}
|
||||
|
||||
public boolean hasData(final GenericOrganizationalUnit orgaunit) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final ContentTypeCollection types = ContentType.getAllContentTypes();
|
||||
|
|
@ -69,7 +91,7 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
public void generateXml(final GenericOrganizationalUnit orgaunit,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final long start = System.currentTimeMillis();
|
||||
final DataQuery projects = getData(orgaunit);
|
||||
final HttpServletRequest request = state.getRequest();
|
||||
|
||||
|
|
@ -81,9 +103,13 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
statusFilter.generateXml(filtersElem);
|
||||
|
||||
if (((request.getParameter(STATUS_PARAM) == null)
|
||||
|| (request.getParameter(STATUS_PARAM).trim().isEmpty()))
|
||||
|| (request.getParameter(STATUS_PARAM).trim().isEmpty())
|
||||
|| (statusFilter.getFilter() == null)
|
||||
|| (statusFilter.getFilter().trim().isEmpty()))
|
||||
&& ((request.getParameter(TITLE_PARAM) == null)
|
||||
|| request.getParameter(TITLE_PARAM).trim().isEmpty())) {
|
||||
|| request.getParameter(TITLE_PARAM).trim().isEmpty())
|
||||
|| (titleFilter.getFilter() == null)
|
||||
|| !(titleFilter.getFilter().trim().isEmpty())) {
|
||||
|
||||
depProjectsElem.newChildElement("greeting");
|
||||
|
||||
|
|
@ -124,7 +150,8 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
orgaunit.getName(),
|
||||
System.currentTimeMillis() - start));
|
||||
}
|
||||
protected DataQuery getData(final GenericOrganizationalUnit orgaunit) {
|
||||
|
||||
protected DataQuery getData(final GenericOrganizationalUnit orgaunit) {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
if (!(orgaunit instanceof SciInstitute)) {
|
||||
|
|
@ -137,8 +164,9 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
|
||||
final DataQuery projectsQuery = SessionManager.getSession().
|
||||
retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes. getIdsOfProjectsOfOrgaUnit");
|
||||
final StringBuffer projectsFilter = new StringBuffer();
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfProjectsOfOrgaUnit");
|
||||
//final StringBuffer projectsFilter = new StringBuffer();
|
||||
final List<String> orgaunitIds = new ArrayList<String>();
|
||||
|
||||
if (config.isMergingProjects()) {
|
||||
final DataQuery subDepartmentsQuery =
|
||||
|
|
@ -150,19 +178,22 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
SciInstituteProjectsStep.ASSOC_TYPE);
|
||||
|
||||
while (subDepartmentsQuery.next()) {
|
||||
if (projectsFilter.length() > 0) {
|
||||
projectsFilter.append(" or ");
|
||||
/*if (projectsFilter.length() > 0) {
|
||||
projectsFilter.append(" or ");
|
||||
}
|
||||
projectsFilter.append(String.format("orgaunitId = %s",
|
||||
subDepartmentsQuery.get(
|
||||
"orgaunitId").toString()));
|
||||
subDepartmentsQuery.get(
|
||||
"orgaunitId").toString()));*/
|
||||
orgaunitIds.add(subDepartmentsQuery.get("orgaunitId").toString());
|
||||
}
|
||||
} else {
|
||||
projectsFilter.append(String.format("orgaunitId = %s",
|
||||
orgaunit.getID().toString()));
|
||||
/*projectsFilter.append(String.format("orgaunitId = %s",
|
||||
orgaunit.getID().toString()));*/
|
||||
orgaunitIds.add(orgaunit.getID().toString());
|
||||
}
|
||||
|
||||
projectsQuery.addFilter(projectsFilter.toString());
|
||||
//projectsQuery.addFilter(projectsFilter.toString());
|
||||
projectsQuery.setParameter("orgaunitIds", orgaunitIds);
|
||||
|
||||
logger.debug(String.format(
|
||||
"Got projects of institute '%s'"
|
||||
|
|
@ -173,14 +204,17 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
return projectsQuery;
|
||||
}
|
||||
|
||||
private void applyStatusFilter(final DataQuery projects,
|
||||
private void applyStatusFilter(final DataQuery projects,
|
||||
final HttpServletRequest request) {
|
||||
final String statusValue = request.getParameter(STATUS_PARAM);
|
||||
if ((statusValue != null) && !(statusValue.trim().isEmpty())) {
|
||||
statusFilter.setValue(statusValue);
|
||||
}
|
||||
|
||||
projects.addFilter(statusFilter.getFilter());
|
||||
if ((statusFilter.getFilter() != null)
|
||||
&& !(statusFilter.getFilter().trim().isEmpty())) {
|
||||
projects.addFilter(statusFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTitleFilter(final DataQuery projects,
|
||||
|
|
@ -190,7 +224,10 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
titleFilter.setValue(titleValue);
|
||||
}
|
||||
|
||||
projects.addFilter(titleFilter.getFilter());
|
||||
if ((titleFilter.getFilter() != null)
|
||||
&& !(titleFilter.getFilter().trim().isEmpty())) {
|
||||
projects.addFilter(titleFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void generateProjectXml(final BigDecimal projectId,
|
||||
|
|
@ -212,6 +249,8 @@ public class SciInstituteProjectsTab implements GenericOrgaUnitTab {
|
|||
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(),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import com.arsdigita.persistence.OID;
|
|||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -34,16 +36,17 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
private static final String YEAR_PARAM = "year";
|
||||
private static final String TITLE_PARAM = "title";
|
||||
private static final String AUTHOR_PARAM = "author";
|
||||
private static final String SORT_PARAM = "sortBy";
|
||||
/*private static final String SORT_PARAM = "sortBy";
|
||||
private static final String SORT_BY_YEAR_ASC = "yearAsc";
|
||||
private static final String SORT_BY_YEAR_DESC = "yearDesc";
|
||||
private static final String SORT_BY_TITLE = "title";
|
||||
private static final String SORT_BY_AUTHOR = "author";
|
||||
private static final String SORT_BY_AUTHOR = "author";*/
|
||||
private final SelectFilter yearFilter = new SelectFilter(YEAR_PARAM,
|
||||
YEAR_PARAM,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true);
|
||||
private final TextFilter titleFilter = new TextFilter(TITLE_PARAM,
|
||||
ContentPage.TITLE);
|
||||
|
|
@ -97,15 +100,15 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
final String yearValue = request.getParameter(YEAR_PARAM);
|
||||
final String titleValue = request.getParameter(TITLE_PARAM);
|
||||
final String authorValue = request.getParameter(AUTHOR_PARAM);
|
||||
final String sortValue = request.getParameter(SORT_PARAM);
|
||||
//final String sortValue = request.getParameter(SORT_PARAM);
|
||||
|
||||
final Element filtersElem = publicationsElem.newChildElement(
|
||||
"filters");
|
||||
|
||||
if (((yearValue == null) || yearValue.trim().isEmpty())
|
||||
&& ((titleValue == null) || titleValue.trim().isEmpty())
|
||||
&& ((authorValue == null) || authorValue.trim().isEmpty())
|
||||
&& ((sortValue == null) || sortValue.trim().isEmpty())) {
|
||||
&& ((authorValue == null) || authorValue.trim().isEmpty())) {
|
||||
// && ((sortValue == null) || sortValue.trim().isEmpty())) {
|
||||
|
||||
publicationsElem.newChildElement("greeting");
|
||||
|
||||
|
|
@ -119,54 +122,66 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
|
||||
publications.setRange(1, config.getGreetingSize() + 1);
|
||||
|
||||
yearFilter.setDataQuery(publications, "year");
|
||||
|
||||
yearFilter.generateXml(filtersElem);
|
||||
titleFilter.generateXml(filtersElem);
|
||||
authorFilter.generateXml(filtersElem);
|
||||
|
||||
} else {
|
||||
|
||||
if (SORT_BY_AUTHOR.equals(sortValue)) {
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("year asc");
|
||||
/*if (SORT_BY_AUTHOR.equals(sortValue)) {
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("year asc");
|
||||
} else if (SORT_BY_TITLE.equals(sortValue)) {
|
||||
publications.addOrder("title");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("year asc");
|
||||
publications.addOrder("title");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("year asc");
|
||||
} else if (SORT_BY_YEAR_ASC.equals(sortValue)) {
|
||||
publications.addOrder("year asc");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("year asc");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
} else if (SORT_BY_YEAR_DESC.equals(sortValue)) {
|
||||
publications.addOrder("year desc");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("year desc");
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
} else {
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("year asc");
|
||||
}*/
|
||||
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
publications.addOrder("title");
|
||||
} else {
|
||||
if (config.getOneRowPerAuthor()) {
|
||||
publications.addOrder("surname");
|
||||
} else {
|
||||
publications.addOrder("authors");
|
||||
}
|
||||
publications.addOrder("authors");
|
||||
publications.addOrder("title");
|
||||
publications.addOrder("year asc");
|
||||
}
|
||||
|
||||
yearFilter.setDataQuery(publications, "year");
|
||||
|
||||
applyYearFilter(publications, request);
|
||||
applyTitleFilter(publications, request);
|
||||
applyAuthorFilter(publications, request);
|
||||
|
|
@ -185,18 +200,18 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
paginator.generateXml(publicationsElem);
|
||||
}
|
||||
|
||||
final Element sortFieldsElem = publicationsElem.newChildElement(
|
||||
"sortFields");
|
||||
/*final Element sortFieldsElem = publicationsElem.newChildElement(
|
||||
"sortFields");
|
||||
sortFieldsElem.addAttribute("sortBy", sortValue);
|
||||
|
||||
sortFieldsElem.newChildElement("sortField").addAttribute("label",
|
||||
SORT_BY_AUTHOR);
|
||||
SORT_BY_AUTHOR);
|
||||
sortFieldsElem.newChildElement("sortField").addAttribute("label",
|
||||
SORT_BY_TITLE);
|
||||
SORT_BY_TITLE);
|
||||
sortFieldsElem.newChildElement("sortField").addAttribute("label",
|
||||
SORT_BY_YEAR_ASC);
|
||||
SORT_BY_YEAR_ASC);
|
||||
sortFieldsElem.newChildElement("sortField").addAttribute("label",
|
||||
SORT_BY_YEAR_DESC);
|
||||
SORT_BY_YEAR_DESC);*/
|
||||
|
||||
while (publications.next()) {
|
||||
generatePublicationXml(
|
||||
|
|
@ -236,7 +251,8 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsForOrgaUnit");
|
||||
}
|
||||
final StringBuffer publicationsFilter = new StringBuffer();
|
||||
//final StringBuffer publicationsFilter = new StringBuffer();
|
||||
final List<String> orgaunitIds = new ArrayList<String>();
|
||||
|
||||
if (config.isMergingPublications()) {
|
||||
final DataQuery departmentsQuery =
|
||||
|
|
@ -247,19 +263,22 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
departmentsQuery.setParameter("assocType",
|
||||
SciInstituteDepartmentsStep.ASSOC_TYPE);
|
||||
while (departmentsQuery.next()) {
|
||||
if (publicationsFilter.length() > 0) {
|
||||
publicationsFilter.append(" or ");
|
||||
/*if (publicationsFilter.length() > 0) {
|
||||
publicationsFilter.append(" or ");
|
||||
}
|
||||
publicationsFilter.append(String.format("orgaunitId = %s",
|
||||
departmentsQuery.get(
|
||||
"orgaunitId").toString()));
|
||||
departmentsQuery.get(
|
||||
"orgaunitId").toString()));*/
|
||||
orgaunitIds.add(departmentsQuery.get("orgaunitId").toString());
|
||||
}
|
||||
} else {
|
||||
publicationsFilter.append(String.format("orgaunitId = %s",
|
||||
orgaunit.getID().toString()));
|
||||
/*publicationsFilter.append(String.format("orgaunitId = %s",
|
||||
orgaunit.getID().toString()));*/
|
||||
orgaunitIds.add(orgaunit.getID().toString());
|
||||
}
|
||||
|
||||
publicationsQuery.addFilter(publicationsFilter.toString());
|
||||
//publicationsQuery.addFilter(publicationsFilter.toString());
|
||||
publicationsQuery.setParameter("orgaunitIds", orgaunitIds);
|
||||
|
||||
logger.debug(String.format(
|
||||
"Got publications of institute '%s'"
|
||||
|
|
@ -277,7 +296,10 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
yearFilter.setValue(yearValue);
|
||||
}
|
||||
|
||||
publications.addFilter(yearFilter.getFilter());
|
||||
if ((yearFilter.getFilter() != null)
|
||||
&& !(yearFilter.getFilter().isEmpty())) {
|
||||
publications.addFilter(yearFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyTitleFilter(final DataQuery publications,
|
||||
|
|
@ -287,7 +309,10 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
titleFilter.setValue(titleValue);
|
||||
}
|
||||
|
||||
publications.addFilter(titleFilter.getFilter());
|
||||
if ((titleFilter.getFilter() != null)
|
||||
&& !(titleFilter.getFilter().isEmpty())) {
|
||||
publications.addFilter(titleFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyAuthorFilter(final DataQuery publications,
|
||||
|
|
@ -297,7 +322,10 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
authorFilter.setValue(authorValue);
|
||||
}
|
||||
|
||||
publications.addFilter(authorFilter.getFilter());
|
||||
if ((authorFilter.getFilter() != null)
|
||||
&& !(authorFilter.getFilter().isEmpty())) {
|
||||
publications.addFilter(authorFilter.getFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePublicationXml(final BigDecimal publicationId,
|
||||
|
|
@ -319,6 +347,8 @@ public class SciInstitutePublicationsTab implements GenericOrgaUnitTab {
|
|||
final PageState state) {
|
||||
final long start = System.currentTimeMillis();
|
||||
final XmlGenerator generator = new XmlGenerator(publication);
|
||||
generator.setUseExtraXml(false);
|
||||
generator.setItemElemName("publication", "");
|
||||
generator.generateXML(state, parent, "");
|
||||
logger.debug(String.format(
|
||||
"Generated XML for publication '%s' in %d ms.",
|
||||
|
|
|
|||
Loading…
Reference in New Issue