- ccm-sci-types-organizationwithpublications fertiggestellt.
- SciOrganizationPanel, SciDepartmentPanel um Filterformular für Projekte erweitert - Allgemeine Hilfsklassen für Integration von Filterformularen in von CompoundContentItemPanel abgeleiteteten Klassen. - Default-Wert für show-Parameter kann bei CompoundContentItemPanel jetzt aus einer JSP heraus überschrieben werden. Ebenso kann die Anzeigen der verfügbaren Daten (die Reiter) aus einer JSP heraus deaktiviert werden. Dadurch können bestimmte Informationen z.B. aus einem SciOrganizationItem, z.B. die Publikationen, auch über einen Navigationspunkt (unter Verwendung einer speziellen JSP) angezeigt werden. - Die üblichen Kleinigkeiten git-svn-id: https://svn.libreccm.org/ccm/trunk@958 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
ce4a8b42fc
commit
0bead44e82
|
|
@ -37,6 +37,7 @@ import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,6 +62,8 @@ public abstract class CompoundContentItemPanel
|
||||||
* Parameter which indicates which page to show
|
* Parameter which indicates which page to show
|
||||||
*/
|
*/
|
||||||
protected StringParameter m_show;
|
protected StringParameter m_show;
|
||||||
|
private String showDefault;
|
||||||
|
private boolean showOnlyDefault = false;
|
||||||
private static final String PAGE_NUMBER = "pageNumber";
|
private static final String PAGE_NUMBER = "pageNumber";
|
||||||
/**
|
/**
|
||||||
* Parameter for a paginator
|
* Parameter for a paginator
|
||||||
|
|
@ -125,7 +128,7 @@ public abstract class CompoundContentItemPanel
|
||||||
if (!context.hasContentItem()) {
|
if (!context.hasContentItem()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return context.getContentItem();
|
return context.getContentItem().getLiveVersion();
|
||||||
} else {
|
} else {
|
||||||
return m_item;
|
return m_item;
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +154,7 @@ public abstract class CompoundContentItemPanel
|
||||||
resolved = bundle.getPrimaryInstance();
|
resolved = bundle.getPrimaryInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_item = resolved;
|
m_item = resolved.getLiveVersion();
|
||||||
} else {
|
} else {
|
||||||
m_item = item;
|
m_item = item;
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +248,27 @@ public abstract class CompoundContentItemPanel
|
||||||
*
|
*
|
||||||
* @return Default value for the show parameter.
|
* @return Default value for the show parameter.
|
||||||
*/
|
*/
|
||||||
protected abstract String getDefaultForShowParam();
|
protected final String getDefaultForShowParam() {
|
||||||
|
if ((showDefault == null) || showDefault.isEmpty()) {
|
||||||
|
return getDefaultShowParam();
|
||||||
|
} else {
|
||||||
|
return showDefault;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultForShowParam(final String showDefault) {
|
||||||
|
this.showDefault = showDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract String getDefaultShowParam();
|
||||||
|
|
||||||
|
public boolean isShowOnlyDefault() {
|
||||||
|
return showOnlyDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowOnlyDefault(final boolean showOnlyDefault) {
|
||||||
|
this.showOnlyDefault = showOnlyDefault;
|
||||||
|
}
|
||||||
|
|
||||||
protected String getShowParam(final PageState state) {
|
protected String getShowParam(final PageState state) {
|
||||||
String show;
|
String show;
|
||||||
|
|
@ -268,6 +291,15 @@ public abstract class CompoundContentItemPanel
|
||||||
return show;
|
return show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getHttpParam(final String param, final PageState state) {
|
||||||
|
final HttpServletRequest request = state.getRequest();
|
||||||
|
String value;
|
||||||
|
|
||||||
|
value = request.getParameter(param);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
protected long getPageNumber(final PageState state) {
|
protected long getPageNumber(final PageState state) {
|
||||||
int pageNumber = 1;
|
int pageNumber = 1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,15 +40,15 @@ import org.apache.log4j.Logger;
|
||||||
*/
|
*/
|
||||||
public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
|
public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
|
||||||
|
|
||||||
private final static Logger logger = Logger.getLogger(GenericOrganizationalUnit.class);
|
private final static Logger logger =
|
||||||
|
Logger.getLogger(GenericOrganizationalUnit.class);
|
||||||
public static final String SHOW_CONTACTS = "contacts";
|
public static final String SHOW_CONTACTS = "contacts";
|
||||||
public static final String SHOW_MEMBERS = "members";
|
public static final String SHOW_MEMBERS = "members";
|
||||||
private boolean displayContacts = true;
|
private boolean displayContacts = true;
|
||||||
private boolean displayMembers = true;
|
private boolean displayMembers = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultForShowParam() {
|
protected String getDefaultShowParam() {
|
||||||
return SHOW_CONTACTS;
|
return SHOW_CONTACTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,12 +97,14 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
|
||||||
contact = contacts.getContact();
|
contact = contacts.getContact();
|
||||||
|
|
||||||
generateGenericContactXML(contact,
|
generateGenericContactXML(contact,
|
||||||
contactsElem,
|
contactsElem,
|
||||||
state,
|
state,
|
||||||
Integer.toString(contacts.getContactOrder()),
|
Integer.toString(
|
||||||
true);
|
contacts.getContactOrder()),
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
System.out.printf("Generated Contacts XML in %d ms.\n", System.currentTimeMillis() - start);
|
System.out.printf("Generated Contacts XML in %d ms.\n", System.
|
||||||
|
currentTimeMillis() - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateMembersXML(GenericOrganizationalUnit orga,
|
protected void generateMembersXML(GenericOrganizationalUnit orga,
|
||||||
|
|
@ -249,41 +251,73 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateGenericContactXML(final GenericContact contact,
|
protected void generateGenericContactXML(final GenericContact contact,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state,
|
final PageState state,
|
||||||
final String order,
|
final String order,
|
||||||
final boolean withPerson) {
|
final boolean withPerson) {
|
||||||
ContactXmlLGenerator generator = new ContactXmlLGenerator(contact);
|
ContactXmlLGenerator generator = new ContactXmlLGenerator(contact);
|
||||||
|
|
||||||
generator.generateXML(state, parent, order);
|
generator.generateXML(state, parent, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||||
public void generateXML(ContentItem item, Element element,
|
final Element element,
|
||||||
PageState state) {
|
final PageState state) {
|
||||||
Element content = generateBaseXML(item, element, state);
|
|
||||||
|
|
||||||
Element availableData = content.newChildElement("availableData");
|
|
||||||
|
|
||||||
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) item;
|
|
||||||
|
|
||||||
if ((orga.getContacts() != null)
|
if ((orga.getContacts() != null)
|
||||||
&& (orga.getContacts().size() > 0)
|
&& (orga.getContacts().size() > 0)
|
||||||
&& displayMembers) {
|
&& displayMembers) {
|
||||||
availableData.newChildElement("contacts");
|
element.newChildElement("contacts");
|
||||||
}
|
}
|
||||||
if ((orga.getPersons() != null)
|
if ((orga.getPersons() != null)
|
||||||
&& (orga.getPersons().size() > 0)
|
&& (orga.getPersons().size() > 0)
|
||||||
&& displayMembers) {
|
&& displayMembers) {
|
||||||
availableData.newChildElement("members");
|
element.newChildElement("members");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generateDataXml(final GenericOrganizationalUnit orga,
|
||||||
|
final Element element,
|
||||||
|
final PageState state) {
|
||||||
|
String show = getShowParam(state);
|
||||||
|
if (SHOW_CONTACTS.equals(show)) {
|
||||||
|
generateContactsXML(orga, element, state);
|
||||||
|
} else if (SHOW_MEMBERS.equals(show)) {
|
||||||
|
generateMembersXML(orga, element, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateXML(ContentItem item,
|
||||||
|
Element element,
|
||||||
|
PageState state) {
|
||||||
|
Element content = generateBaseXML(item, element, state);
|
||||||
|
|
||||||
|
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) item;
|
||||||
|
Element availableData = content.newChildElement("availableData");
|
||||||
|
|
||||||
|
if (!isShowOnlyDefault()) {
|
||||||
|
generateAvailableDataXml(orga, availableData, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
generateDataXml(orga, content, state);
|
||||||
|
|
||||||
|
/*if ((orga.getContacts() != null)
|
||||||
|
&& (orga.getContacts().size() > 0)
|
||||||
|
&& displayMembers) {
|
||||||
|
availableData.newChildElement("contacts");
|
||||||
|
}
|
||||||
|
if ((orga.getPersons() != null)
|
||||||
|
&& (orga.getPersons().size() > 0)
|
||||||
|
&& displayMembers) {
|
||||||
|
availableData.newChildElement("members");
|
||||||
}
|
}
|
||||||
|
|
||||||
String show = getShowParam(state);
|
String show = getShowParam(state);
|
||||||
if (SHOW_CONTACTS.equals(show)) {
|
if (SHOW_CONTACTS.equals(show)) {
|
||||||
generateContactsXML(orga, content, state);
|
generateContactsXML(orga, content, state);
|
||||||
} else if (SHOW_MEMBERS.equals(show)) {
|
} else if (SHOW_MEMBERS.equals(show)) {
|
||||||
generateMembersXML(orga, content, state);
|
generateMembersXML(orga, content, state);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ContactXmlLGenerator extends SimpleXMLGenerator {
|
private class ContactXmlLGenerator extends SimpleXMLGenerator {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,207 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui.panels;
|
||||||
|
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@code CompareFilter}
|
||||||
|
* filters the object list using a provided value and a operator. Valid
|
||||||
|
* operators defined in the {@link Operators} enumeration.
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class CompareFilter implements Filter {
|
||||||
|
|
||||||
|
private static final String ALL = "--ALL--";
|
||||||
|
private final String property;
|
||||||
|
private final String label;
|
||||||
|
private final boolean allOption;
|
||||||
|
private final boolean allOptionIsDefault;
|
||||||
|
private final boolean propertyIsNumeric;
|
||||||
|
private Map<String, Option> options = new LinkedHashMap<String, Option>();
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public CompareFilter(final String label,
|
||||||
|
final String property,
|
||||||
|
final boolean allOption,
|
||||||
|
final boolean allOptionIsDefault,
|
||||||
|
final boolean propertyIsNumeric) {
|
||||||
|
this.property = property;
|
||||||
|
this.label = label;
|
||||||
|
this.allOption = allOption;
|
||||||
|
this.allOptionIsDefault = allOptionIsDefault;
|
||||||
|
this.propertyIsNumeric = propertyIsNumeric;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProperty() {
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompareFilter addOption(final String label, final String value) {
|
||||||
|
return addOption(label, Operators.EQ, value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompareFilter addOption(final String label,
|
||||||
|
final Operators operator,
|
||||||
|
final String value,
|
||||||
|
final boolean includeNull) {
|
||||||
|
Option option;
|
||||||
|
option = new Option(label, operator, value, includeNull);
|
||||||
|
options.put(label, option);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilter() {
|
||||||
|
Option selectedOption;
|
||||||
|
StringBuffer filter;
|
||||||
|
|
||||||
|
if ((value == null) || value.isEmpty()) {
|
||||||
|
if (allOptionIsDefault) {
|
||||||
|
value = ALL;
|
||||||
|
} else {
|
||||||
|
value =
|
||||||
|
new ArrayList<Option>(options.values()).get(0).getLabel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ALL.equals(value)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedOption = options.get(value);
|
||||||
|
|
||||||
|
if (selectedOption == null) {
|
||||||
|
throw new IllegalArgumentException(String.format(
|
||||||
|
"Unknown option '%s' selected for CompareFilter for property '%s'.",
|
||||||
|
value,
|
||||||
|
property));
|
||||||
|
}
|
||||||
|
|
||||||
|
filter = new StringBuffer();
|
||||||
|
filter.append(property);
|
||||||
|
|
||||||
|
switch (selectedOption.getOperator()) {
|
||||||
|
case EQ:
|
||||||
|
filter.append(" = ");
|
||||||
|
break;
|
||||||
|
case LT:
|
||||||
|
filter.append(" < ");
|
||||||
|
break;
|
||||||
|
case GT:
|
||||||
|
filter.append(" > ");
|
||||||
|
break;
|
||||||
|
case LTEQ:
|
||||||
|
filter.append(" <= ");
|
||||||
|
break;
|
||||||
|
case GTEQ:
|
||||||
|
filter.append(" >= ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertyIsNumeric) {
|
||||||
|
filter.append(selectedOption.getValue());
|
||||||
|
} else {
|
||||||
|
filter.append('\'');
|
||||||
|
filter.append(selectedOption.getValue());
|
||||||
|
filter.append('\'');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedOption.getIncludeNull()) {
|
||||||
|
filter.append(String.format(" or %s is null", property));
|
||||||
|
}
|
||||||
|
|
||||||
|
return filter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateXml(final Element parent) {
|
||||||
|
Element filter;
|
||||||
|
String selected;
|
||||||
|
|
||||||
|
filter = parent.newChildElement("filter");
|
||||||
|
filter.addAttribute("type", "compare");
|
||||||
|
|
||||||
|
if ((value == null) || value.isEmpty()) {
|
||||||
|
if (allOptionIsDefault) {
|
||||||
|
selected = ALL;
|
||||||
|
} else {
|
||||||
|
List<Option> optionsList =
|
||||||
|
new ArrayList<Option>(options.values());
|
||||||
|
selected = optionsList.get(0).getLabel();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selected = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
filter.addAttribute("label", label);
|
||||||
|
filter.addAttribute("selected", selected);
|
||||||
|
|
||||||
|
if (allOption) {
|
||||||
|
Element option;
|
||||||
|
|
||||||
|
option = filter.newChildElement("option");
|
||||||
|
option.addAttribute("label", ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
Element option;
|
||||||
|
for (Map.Entry<String, Option> entry : options.entrySet()) {
|
||||||
|
option = filter.newChildElement("option");
|
||||||
|
option.addAttribute("label", entry.getValue().getLabel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(final String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum Operators {
|
||||||
|
|
||||||
|
EQ, //equal, '{@code =}'
|
||||||
|
LT, //less than, '{@code <}'
|
||||||
|
GT, //greater than, '{@code >}'
|
||||||
|
LTEQ, //less than or equal, '{@code <=}'
|
||||||
|
GTEQ //greater than or equal, '{@code >=}'
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Option {
|
||||||
|
|
||||||
|
private final String label;
|
||||||
|
private final Operators operator;
|
||||||
|
private final String value;
|
||||||
|
private final boolean includeNull;
|
||||||
|
|
||||||
|
public Option(final String label,
|
||||||
|
final Operators operator,
|
||||||
|
final String value,
|
||||||
|
final boolean includeNull) {
|
||||||
|
this.label = label;
|
||||||
|
this.operator = operator;
|
||||||
|
this.value = value;
|
||||||
|
this.includeNull = includeNull;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Operators getOperator() {
|
||||||
|
return operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getIncludeNull() {
|
||||||
|
return includeNull;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contenttypes.ui.panels;
|
||||||
|
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementations of these interface are used by the
|
||||||
|
* {@link GenericOrganizationalUnitPanel} for filtering the objects in the
|
||||||
|
* various list.
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public interface Filter {
|
||||||
|
|
||||||
|
public String getLabel();
|
||||||
|
|
||||||
|
public String getProperty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return The SQL filter for filtering the object list.
|
||||||
|
*/
|
||||||
|
String getFilter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates the XML for the filter with the provided element as parent.
|
||||||
|
*
|
||||||
|
* @parent The parent XML element for the XML of the filter.
|
||||||
|
*/
|
||||||
|
void generateXml(Element parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to set the value of the filter if the HTTP request contains a value
|
||||||
|
* for the filter.
|
||||||
|
*
|
||||||
|
* @param value The value from the input component.
|
||||||
|
*/
|
||||||
|
void setValue(String value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui.panels;
|
||||||
|
|
||||||
|
import com.arsdigita.persistence.DataQuery;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This filter allows the user to filter the object list for a specific value
|
||||||
|
* of a property. The selectable values are determined by traversing
|
||||||
|
* through all objects of the list (before the list is processed by the
|
||||||
|
* paginator) and using each distinct value of the property as option.
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SelectFilter implements Filter {
|
||||||
|
|
||||||
|
public static final String ALL = "--ALL--";
|
||||||
|
private final String property;
|
||||||
|
private final String label;
|
||||||
|
private DataQuery dataQuery;
|
||||||
|
private String queryProperty;
|
||||||
|
private final boolean allOption;
|
||||||
|
private final boolean allOptionIsDefault;
|
||||||
|
private final boolean reverseOptions;
|
||||||
|
private final boolean propertyIsNumeric;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public SelectFilter(final String label,
|
||||||
|
final String property,
|
||||||
|
final boolean reverseOptions,
|
||||||
|
final boolean allOption,
|
||||||
|
final boolean allOptionIsDefault,
|
||||||
|
final boolean propertyIsNumeric) {
|
||||||
|
this.property = property;
|
||||||
|
this.label = label;
|
||||||
|
|
||||||
|
this.reverseOptions = reverseOptions;
|
||||||
|
this.allOption = allOption;
|
||||||
|
this.allOptionIsDefault = allOptionIsDefault;
|
||||||
|
this.propertyIsNumeric = propertyIsNumeric;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProperty() {
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataQuery(final DataQuery dataQuery,
|
||||||
|
final String queryProperty) {
|
||||||
|
this.dataQuery = dataQuery;
|
||||||
|
this.queryProperty = queryProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilter() {
|
||||||
|
List<String> options;
|
||||||
|
|
||||||
|
options = getOptions();
|
||||||
|
if ((value == null) || value.isEmpty()) {
|
||||||
|
if (allOptionIsDefault) {
|
||||||
|
value = ALL;
|
||||||
|
} else {
|
||||||
|
value = options.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ALL.equals(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (propertyIsNumeric) {
|
||||||
|
return String.format("%s = %s", property, value);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return String.format("%s = '%s'", property, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateXml(final Element parent) {
|
||||||
|
Element filter;
|
||||||
|
Element optionElem;
|
||||||
|
String selected;
|
||||||
|
List<String> options;
|
||||||
|
|
||||||
|
options = getOptions();
|
||||||
|
|
||||||
|
filter = parent.newChildElement("filter");
|
||||||
|
filter.addAttribute("type", "select");
|
||||||
|
|
||||||
|
if ((value == null) || value.isEmpty()) {
|
||||||
|
if (allOptionIsDefault) {
|
||||||
|
selected = ALL;
|
||||||
|
} else {
|
||||||
|
selected = options.get(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
selected = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
filter.addAttribute("label", label);
|
||||||
|
filter.addAttribute("selected", selected);
|
||||||
|
|
||||||
|
if (allOption) {
|
||||||
|
optionElem = filter.newChildElement("option");
|
||||||
|
optionElem.addAttribute("label", ALL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String optionStr : options) {
|
||||||
|
optionElem = filter.newChildElement("option");
|
||||||
|
optionElem.addAttribute("label", optionStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(final String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> getOptions() {
|
||||||
|
Object obj;
|
||||||
|
String option;
|
||||||
|
Set<String> optionsSet;
|
||||||
|
List<String> options;
|
||||||
|
|
||||||
|
optionsSet = new HashSet<String>();
|
||||||
|
|
||||||
|
while(dataQuery.next()) {
|
||||||
|
obj = dataQuery.get(queryProperty);
|
||||||
|
if (obj == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
option = obj.toString();
|
||||||
|
optionsSet.add(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
dataQuery.rewind();
|
||||||
|
|
||||||
|
options = new ArrayList<String>(optionsSet);
|
||||||
|
Collections.sort(options);
|
||||||
|
if (reverseOptions) {
|
||||||
|
Collections.reverse(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui.panels;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param <T>
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SortField<T extends ContentItem> {
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
private Comparator<T> comparator;
|
||||||
|
|
||||||
|
public SortField(final String label, final Comparator<T> comparator) {
|
||||||
|
this.label = label;
|
||||||
|
this.comparator = comparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Comparator<T> getComparator() {
|
||||||
|
return comparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateXml(final Element element) {
|
||||||
|
final Element sortFieldElem = element.newChildElement("sortField");
|
||||||
|
sortFieldElem.addAttribute("label", label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui.panels;
|
||||||
|
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This filter is usually
|
||||||
|
* rendered as a input box. The SQL filter created by this filter looks like
|
||||||
|
* this:
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* {@code property LIKE 'value'}
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class TextFilter implements Filter {
|
||||||
|
|
||||||
|
private final String property;
|
||||||
|
private final String label;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProperty() {
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new text filter.
|
||||||
|
*
|
||||||
|
* @param property The property which is used by this filter.
|
||||||
|
* @param label The label for the input component of the filter.
|
||||||
|
*/
|
||||||
|
public TextFilter(final String label, final String property) {
|
||||||
|
this.property = property;
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFilter() {
|
||||||
|
if ((value == null) || value.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return String.format("(lower(%s) LIKE lower('%%%s%%'))",
|
||||||
|
property, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateXml(final Element parent) {
|
||||||
|
Element textFilter;
|
||||||
|
|
||||||
|
textFilter = parent.newChildElement("filter");
|
||||||
|
textFilter.addAttribute("type", "text");
|
||||||
|
|
||||||
|
textFilter.addAttribute("label", label);
|
||||||
|
if ((value != null) && !(value.isEmpty())) {
|
||||||
|
textFilter.addAttribute("value", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(final String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -297,7 +297,8 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
|
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Element controls = content.newChildElement("controls");
|
Element controls = content.newChildElement("filterControls");
|
||||||
|
controls.addAttribute("customName", m_customName);
|
||||||
|
|
||||||
Element filterElems = controls.newChildElement("filters");
|
Element filterElems = controls.newChildElement("filters");
|
||||||
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ query getIdsOfSubDepartmentsOfSciDepartment {
|
||||||
from ct_sciorga_departments_subdepartments_map
|
from ct_sciorga_departments_subdepartments_map
|
||||||
where ct_sciorga_departments_subdepartments_map.department_id = :department
|
where ct_sciorga_departments_subdepartments_map.department_id = :department
|
||||||
} map {
|
} map {
|
||||||
departmentId = ct_sciorga_departments_subdepartments_map;
|
departmentId = ct_sciorga_departments_subdepartments_map.department_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ public class SciOrganization extends GenericOrganizationalUnit {
|
||||||
*
|
*
|
||||||
* @param merge Should I also look into the departments and return true
|
* @param merge Should I also look into the departments and return true
|
||||||
* if the organization or at least one of the departments has members?
|
* if the organization or at least one of the departments has members?
|
||||||
|
* @param status
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasMembers(final boolean merge, final MemberStatus status) {
|
public boolean hasMembers(final boolean merge, final MemberStatus status) {
|
||||||
|
|
@ -357,7 +358,7 @@ public class SciOrganization extends GenericOrganizationalUnit {
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
|
"com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
|
||||||
departmentsQuery.setParameter("organization", getID());
|
departmentsQuery.setParameter("organization", getID());
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (departmentsQuery.size() > 0) {
|
||||||
BigDecimal departmentId;
|
BigDecimal departmentId;
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
while (departmentsQuery.next()) {
|
while (departmentsQuery.next()) {
|
||||||
|
|
@ -429,7 +430,7 @@ public class SciOrganization extends GenericOrganizationalUnit {
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||||
subDepartmentsQuery.setParameter("department", departmentId);
|
subDepartmentsQuery.setParameter("department", departmentId);
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (subDepartmentsQuery.size() > 0) {
|
||||||
BigDecimal subDepartmentId;
|
BigDecimal subDepartmentId;
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
while (subDepartmentsQuery.next()) {
|
while (subDepartmentsQuery.next()) {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
|
@ -30,12 +31,17 @@ import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.Filter;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -54,13 +60,20 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
public static final String SHOW_PROJECTS = "projects";
|
public static final String SHOW_PROJECTS = "projects";
|
||||||
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
||||||
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
||||||
|
private static final String TITLE = "title";
|
||||||
|
private String show;
|
||||||
private boolean displayDescription = true;
|
private boolean displayDescription = true;
|
||||||
private boolean displaySubDepartments = true;
|
private boolean displaySubDepartments = true;
|
||||||
private boolean displayProjects = true;
|
private boolean displayProjects = true;
|
||||||
private boolean displayPublications = true;
|
private Map<String, Filter> projectFilters =
|
||||||
|
new LinkedHashMap<String, Filter>();
|
||||||
|
|
||||||
|
public SciDepartmentPanel() {
|
||||||
|
projectFilters.put(TITLE, new TextFilter(TITLE, TITLE));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultForShowParam() {
|
protected String getDefaultShowParam() {
|
||||||
return SHOW_DESCRIPTION;
|
return SHOW_DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,16 +331,45 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void generateProjectFiltersXml(
|
||||||
|
final List<SciProject> projects,
|
||||||
|
final Element element) {
|
||||||
|
final Element filterElement = element.newChildElement("filters");
|
||||||
|
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||||
|
filterEntry.getValue().generateXml(filterElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void applyProjectFilters(
|
||||||
|
final List<String> filters,
|
||||||
|
final HttpServletRequest request) {
|
||||||
|
//Get parameters from HTTP request
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||||
|
String value = request.getParameter(
|
||||||
|
filterEntry.getValue().getLabel());
|
||||||
|
|
||||||
|
if ((value != null) && !(value.trim().isEmpty())) {
|
||||||
|
filterEntry.getValue().setValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void generateProjectsXML(final SciDepartment department,
|
protected void generateProjectsXML(final SciDepartment department,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state,
|
final PageState state,
|
||||||
final List<String> filters) {
|
final List<String> filters) {
|
||||||
|
Element controls = parent.newChildElement("filterControls");
|
||||||
|
controls.addAttribute("customName", "sciDepartmentProjects");
|
||||||
|
controls.addAttribute("show", show);
|
||||||
|
|
||||||
if (SciDepartment.getConfig().getOrganizationProjectsMerge()) {
|
if (SciDepartment.getConfig().getOrganizationProjectsMerge()) {
|
||||||
List<SciProject> projects;
|
List<SciProject> projects;
|
||||||
projects = new LinkedList<SciProject>();
|
projects = new LinkedList<SciProject>();
|
||||||
SciDepartmentProjectsCollection departmentProjects;
|
SciDepartmentProjectsCollection departmentProjects;
|
||||||
departmentProjects = department.getProjects();
|
departmentProjects = department.getProjects();
|
||||||
|
|
||||||
|
applyProjectFilters(filters, state.getRequest());
|
||||||
if ((filters != null)
|
if ((filters != null)
|
||||||
&& !(filters.isEmpty())) {
|
&& !(filters.isEmpty())) {
|
||||||
for (String filter : filters) {
|
for (String filter : filters) {
|
||||||
|
|
@ -358,6 +400,7 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generateProjectFiltersXml(projectsWithoutDoubles, controls);
|
||||||
createPaginatorElement(parent,
|
createPaginatorElement(parent,
|
||||||
pageNumber,
|
pageNumber,
|
||||||
pageCount,
|
pageCount,
|
||||||
|
|
@ -399,6 +442,7 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generateProjectFiltersXml(projects, controls);
|
||||||
createPaginatorElement(
|
createPaginatorElement(
|
||||||
parent, pageNumber, pageCount, begin, end, count, projects.
|
parent, pageNumber, pageCount, begin, end, count, projects.
|
||||||
size());
|
size());
|
||||||
|
|
@ -412,11 +456,14 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateAvailableDataXml(final SciDepartment department,
|
@Override
|
||||||
|
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final SciOrganizationConfig config = SciOrganization.getConfig();
|
final SciOrganizationConfig config = SciOrganization.getConfig();
|
||||||
|
|
||||||
|
SciDepartment department = (SciDepartment) orga;
|
||||||
|
|
||||||
if ((department.getDepartmentDescription() != null)
|
if ((department.getDepartmentDescription() != null)
|
||||||
&& !department.getDepartmentDescription().isEmpty()
|
&& !department.getDepartmentDescription().isEmpty()
|
||||||
&& displayDescription) {
|
&& displayDescription) {
|
||||||
|
|
@ -466,10 +513,13 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateDataXml(SciDepartment department,
|
@Override
|
||||||
|
protected void generateDataXml(GenericOrganizationalUnit orga,
|
||||||
Element element,
|
Element element,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
String show = getShowParam(state);
|
show = getShowParam(state);
|
||||||
|
|
||||||
|
SciDepartment department = (SciDepartment) orga;
|
||||||
|
|
||||||
if (SHOW_DESCRIPTION.equals(show)) {
|
if (SHOW_DESCRIPTION.equals(show)) {
|
||||||
String desc;
|
String desc;
|
||||||
|
|
@ -505,18 +555,18 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public void generateXML(ContentItem item,
|
public void generateXML(ContentItem item,
|
||||||
Element element,
|
Element element,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
Element content = generateBaseXML(item, element, state);
|
Element content = generateBaseXML(item, element, state);
|
||||||
|
|
||||||
Element availableData = content.newChildElement("availableData");
|
Element availableData = content.newChildElement("availableData");
|
||||||
|
|
||||||
SciDepartment department = (SciDepartment) item;
|
SciDepartment department = (SciDepartment) item;
|
||||||
|
|
||||||
generateAvailableDataXml(department, availableData, state);
|
generateAvailableDataXml(department, availableData, state);
|
||||||
|
|
||||||
generateDataXml(department, content, state);
|
generateDataXml(department, content, state);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
|
@ -32,12 +33,17 @@ import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
|
import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
|
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.Filter;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -58,13 +64,20 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
public static final String SHOW_PROJECTS = "projects";
|
public static final String SHOW_PROJECTS = "projects";
|
||||||
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
||||||
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
||||||
|
private static final String TTILE = "title";
|
||||||
|
private String show;
|
||||||
private boolean displayDescription = true;
|
private boolean displayDescription = true;
|
||||||
private boolean displayDepartments = true;
|
private boolean displayDepartments = true;
|
||||||
private boolean displayProjects = true;
|
private boolean displayProjects = true;
|
||||||
//private boolean displayPublications = true;
|
private final Map<String, Filter> projectFilters =
|
||||||
|
new LinkedHashMap<String, Filter>();
|
||||||
|
|
||||||
|
public SciOrganizationPanel() {
|
||||||
|
projectFilters.put(TTILE, new TextFilter(TTILE, TTILE));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultForShowParam() {
|
protected String getDefaultShowParam() {
|
||||||
return SHOW_DESCRIPTION;
|
return SHOW_DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,7 +311,8 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
protected void mergeProjects(
|
protected void mergeProjects(
|
||||||
final SciOrganizationDepartmentsCollection departments,
|
final SciOrganizationDepartmentsCollection departments,
|
||||||
final List<SciProject> projects,
|
final List<SciProject> projects,
|
||||||
final List<String> filters) {
|
final List<String> filters,
|
||||||
|
final PageState state) {
|
||||||
|
|
||||||
while (departments.next()) {
|
while (departments.next()) {
|
||||||
SciDepartmentProjectsCollection departmentProjects;
|
SciDepartmentProjectsCollection departmentProjects;
|
||||||
|
|
@ -329,12 +343,17 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state,
|
final PageState state,
|
||||||
final List<String> filters) {
|
final List<String> filters) {
|
||||||
|
Element controls = parent.newChildElement("filterControls");
|
||||||
|
controls.addAttribute("customName", "sciOrganizationProjects");
|
||||||
|
controls.addAttribute("show", show);
|
||||||
|
|
||||||
if (SciOrganization.getConfig().getOrganizationProjectsMerge()) {
|
if (SciOrganization.getConfig().getOrganizationProjectsMerge()) {
|
||||||
List<SciProject> projects;
|
List<SciProject> projects;
|
||||||
projects = new LinkedList<SciProject>();
|
projects = new LinkedList<SciProject>();
|
||||||
SciOrganizationProjectsCollection orgaProjects;
|
SciOrganizationProjectsCollection orgaProjects;
|
||||||
orgaProjects = orga.getProjects();
|
orgaProjects = orga.getProjects();
|
||||||
|
|
||||||
|
applyProjectFilters(filters, state.getRequest());
|
||||||
if ((filters != null)
|
if ((filters != null)
|
||||||
&& !(filters.isEmpty())) {
|
&& !(filters.isEmpty())) {
|
||||||
for (String filter : filters) {
|
for (String filter : filters) {
|
||||||
|
|
@ -349,7 +368,7 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
projects.add(orgaProjects.getProject());
|
projects.add(orgaProjects.getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeProjects(departments, projects, filters);
|
mergeProjects(departments, projects, filters, state);
|
||||||
|
|
||||||
Set<SciProject> projectsSet;
|
Set<SciProject> projectsSet;
|
||||||
List<SciProject> projectsWithoutDoubles;
|
List<SciProject> projectsWithoutDoubles;
|
||||||
|
|
@ -365,6 +384,7 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generateProjectFiltersXml(projectsWithoutDoubles, controls);
|
||||||
createPaginatorElement(
|
createPaginatorElement(
|
||||||
parent, pageNumber, pageCount, begin, end, count,
|
parent, pageNumber, pageCount, begin, end, count,
|
||||||
projectsWithoutDoubles.size());
|
projectsWithoutDoubles.size());
|
||||||
|
|
@ -381,6 +401,7 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
SciOrganizationProjectsCollection orgaProjects;
|
SciOrganizationProjectsCollection orgaProjects;
|
||||||
orgaProjects = orga.getProjects();
|
orgaProjects = orga.getProjects();
|
||||||
|
|
||||||
|
applyProjectFilters(filters, state.getRequest());
|
||||||
if ((filters != null)
|
if ((filters != null)
|
||||||
&& !(filters.isEmpty())) {
|
&& !(filters.isEmpty())) {
|
||||||
for (String filter : filters) {
|
for (String filter : filters) {
|
||||||
|
|
@ -403,6 +424,7 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generateProjectFiltersXml(projects, controls);
|
||||||
createPaginatorElement(
|
createPaginatorElement(
|
||||||
parent, pageNumber, pageCount, begin, end, count, projects.
|
parent, pageNumber, pageCount, begin, end, count, projects.
|
||||||
size());
|
size());
|
||||||
|
|
@ -416,12 +438,57 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateAvailableDataXml(final SciOrganization organization,
|
protected void generateProjectFiltersXml(
|
||||||
|
final List<SciProject> projects,
|
||||||
|
final Element element) {
|
||||||
|
final Element filterElement = element.newChildElement("filters");
|
||||||
|
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||||
|
filterEntry.getValue().generateXml(filterElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void applyProjectFilters(
|
||||||
|
final List<String> filters,
|
||||||
|
final HttpServletRequest request) {
|
||||||
|
//Get parameters from HTTP request
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||||
|
String value = request.getParameter(
|
||||||
|
filterEntry.getValue().getLabel());
|
||||||
|
|
||||||
|
if ((value != null) && !(value.trim().isEmpty())) {
|
||||||
|
filterEntry.getValue().setValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Apply filters to DomainCollection
|
||||||
|
final StringBuilder filterBuilder = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||||
|
if ((filterEntry.getValue().getFilter() == null)
|
||||||
|
|| (filterEntry.getValue().getFilter().isEmpty())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterBuilder.length() > 0) {
|
||||||
|
filterBuilder.append(" AND ");
|
||||||
|
}
|
||||||
|
filterBuilder.append(filterEntry.getValue().getFilter());
|
||||||
|
s_log.debug(String.format("filters: %s", filterBuilder));
|
||||||
|
if (filterBuilder.length() > 0) {
|
||||||
|
filters.add(filterBuilder.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
SciOrganizationConfig config;
|
SciOrganizationConfig config;
|
||||||
config = SciOrganization.getConfig();
|
config = SciOrganization.getConfig();
|
||||||
|
|
||||||
|
SciOrganization organization = (SciOrganization) orga;
|
||||||
|
|
||||||
if ((organization.getOrganizationDescription() != null)
|
if ((organization.getOrganizationDescription() != null)
|
||||||
&& !(organization.getOrganizationDescription().isEmpty())
|
&& !(organization.getOrganizationDescription().isEmpty())
|
||||||
&& displayDescription) {
|
&& displayDescription) {
|
||||||
|
|
@ -471,10 +538,13 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateDataXml(SciOrganization organization,
|
@Override
|
||||||
Element element,
|
protected void generateDataXml(final GenericOrganizationalUnit orga,
|
||||||
PageState state) {
|
final Element element,
|
||||||
String show = getShowParam(state);
|
final PageState state) {
|
||||||
|
show = getShowParam(state);
|
||||||
|
|
||||||
|
SciOrganization organization = (SciOrganization) orga;
|
||||||
|
|
||||||
if (SHOW_DESCRIPTION.equals(show)) {
|
if (SHOW_DESCRIPTION.equals(show)) {
|
||||||
String desc;
|
String desc;
|
||||||
|
|
@ -511,17 +581,17 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public void generateXML(ContentItem item,
|
public void generateXML(ContentItem item,
|
||||||
Element element,
|
Element element,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
Element content = generateBaseXML(item, element, state);
|
Element content = generateBaseXML(item, element, state);
|
||||||
|
|
||||||
SciOrganization orga = (SciOrganization) item;
|
SciOrganization orga = (SciOrganization) item;
|
||||||
Element availableData = content.newChildElement("availableData");
|
Element availableData = content.newChildElement("availableData");
|
||||||
|
|
||||||
generateAvailableDataXml(orga, availableData, state);
|
generateAvailableDataXml(orga, availableData, state);
|
||||||
|
|
||||||
generateDataXml(orga, content, state);
|
generateDataXml(orga, content, state);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
|
@ -46,7 +47,7 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
||||||
private boolean displayPublications = true;
|
private boolean displayPublications = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultForShowParam() {
|
protected String getDefaultShowParam() {
|
||||||
return SHOW_DESCRIPTION;
|
return SHOW_DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,12 +190,15 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
||||||
generateMembersListXML(members, parent, state);
|
generateMembersListXML(members, parent, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateAvailableDataXml(final SciProject project,
|
@Override
|
||||||
|
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
||||||
SciOrganizationConfig config = SciProject.getConfig();
|
SciOrganizationConfig config = SciProject.getConfig();
|
||||||
|
|
||||||
|
SciProject project = (SciProject) orga;
|
||||||
|
|
||||||
if ((project.getProjectDescription() != null)
|
if ((project.getProjectDescription() != null)
|
||||||
&& !project.getProjectDescription().isEmpty()
|
&& !project.getProjectDescription().isEmpty()
|
||||||
&& displayDescription) {
|
&& displayDescription) {
|
||||||
|
|
@ -229,12 +233,15 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateDataXml(final SciProject project,
|
@Override
|
||||||
|
protected void generateDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
||||||
String show = getShowParam(state);
|
String show = getShowParam(state);
|
||||||
|
|
||||||
|
SciProject project = (SciProject) orga;
|
||||||
|
|
||||||
if (SHOW_DESCRIPTION.equals(show)) {
|
if (SHOW_DESCRIPTION.equals(show)) {
|
||||||
Element description = element.newChildElement("description");
|
Element description = element.newChildElement("description");
|
||||||
description.setText(project.getProjectDescription());
|
description.setText(project.getProjectDescription());
|
||||||
|
|
@ -257,7 +264,7 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public void generateXML(ContentItem item,
|
public void generateXML(ContentItem item,
|
||||||
Element element,
|
Element element,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
|
|
@ -271,5 +278,5 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
||||||
|
|
||||||
generateDataXml(project, element, state);
|
generateDataXml(project, element, state);
|
||||||
|
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,17 @@ query getIdsOfPublicationsOfSciDepartment {
|
||||||
publicationId = ct_department_publication_map.publication_id;
|
publicationId = ct_department_publication_map.publication_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query getIdsOfWorkingPapersOfSciDepartment {
|
||||||
|
BigDecimal workingPaperId;
|
||||||
|
String objectType;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select ct_department_publication_map.publication_id, acs_objects.object_type
|
||||||
|
from ct_department_publication_map join acs_objects on ct_department_publication_map.publication_id = acs_objects.object_id
|
||||||
|
where ct_department_publication_map.department_id = :department and acs_objects.object_type = 'com.arsdigita.cms.contenttypes.WorkingPaper'
|
||||||
|
} map {
|
||||||
|
workingPaperId = ct_department_publication_map.publication_id;
|
||||||
|
objectType = acs_objects.object_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,12 +23,40 @@ association {
|
||||||
|
|
||||||
query getIdsOfPublicationsOfSciOrganization {
|
query getIdsOfPublicationsOfSciOrganization {
|
||||||
BigDecimal publicationId;
|
BigDecimal publicationId;
|
||||||
|
String objectType;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
select ct_organization_publication_map.publication_id
|
select ct_organization_publication_map.publication_id, acs_objects.object_type
|
||||||
from ct_organization_publication_map
|
from ct_organization_publication_map join acs_objects on ct_organization_publication_map.publication_id = acs_objects.object_id
|
||||||
where ct_organization_publication_map.organization_id = :organization
|
where ct_organization_publication_map.organization_id = :organization
|
||||||
} map {
|
} map {
|
||||||
publicationId = ct_organization_publication_map.publication_id;
|
publicationId = ct_organization_publication_map.publication_id;
|
||||||
|
objectType = acs_objects.object_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query getIdsOfWorkingPapersOfSciOrganization {
|
||||||
|
BigDecimal workingPaperId;
|
||||||
|
String objectType;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select ct_organization_publication_map.publication_id, acs_objects.object_type
|
||||||
|
from ct_organization_publication_map join acs_objects on ct_organization_publication_map.publication_id = acs_objects.object_id
|
||||||
|
where ct_organization_publication_map.organization_id = :organization and acs_objects.object_type = 'com.arsdigita.cms.contenttypes.WorkingPaper'
|
||||||
|
} map {
|
||||||
|
workingPaperId = ct_organization_publication_map.publication_id;
|
||||||
|
objectType = acs_objects.object_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query getAllYearsOfPublication {
|
||||||
|
Integer yearOfPublication;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select distinct ct_publications.year
|
||||||
|
from ct_publications
|
||||||
|
} map {
|
||||||
|
yearOfPublication = ct_publications.year;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,17 @@ query getIdsOfPublicationsOfSciProject {
|
||||||
publicationId = ct_project_publication_map.publication_id;
|
publicationId = ct_project_publication_map.publication_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query getIdsOfWorkingPapersOfSciProject {
|
||||||
|
BigDecimal workingPaperId;
|
||||||
|
String objectType;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select ct_project_publication_map.publication_id, acs_objects.object_type
|
||||||
|
from ct_project_publication_map join acs_objects on ct_project_publication_map.publication_id = acs_objects.object_id
|
||||||
|
where ct_project_publication_map.project_id = :project and acs_objects.object_type = 'com.arsdigita.cms.contenttypes.WorkingPaper'
|
||||||
|
} map {
|
||||||
|
workingPaperId = ct_project_publication_map.publication_id;
|
||||||
|
objectType = acs_objects.object_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -61,7 +61,7 @@ public class SciDepartmentWithPublications extends SciDepartment {
|
||||||
public boolean hasPublications(final boolean merge) {
|
public boolean hasPublications(final boolean merge) {
|
||||||
DataQuery query =
|
DataQuery query =
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciDepartment");
|
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciDepartment");
|
||||||
query.setParameter("department", getID());
|
query.setParameter("department", getID());
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (query.size() > 0) {
|
||||||
|
|
@ -105,8 +105,8 @@ public class SciDepartmentWithPublications extends SciDepartment {
|
||||||
final boolean merge) {
|
final boolean merge) {
|
||||||
DataQuery query =
|
DataQuery query =
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciDepartment");
|
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciDepartment");
|
||||||
query.setParameter("departmentId", departmentId);
|
query.setParameter("department", departmentId);
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (query.size() > 0) {
|
||||||
query.close();
|
query.close();
|
||||||
|
|
@ -119,7 +119,94 @@ public class SciDepartmentWithPublications extends SciDepartment {
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||||
subDepartmentsQuery.setParameter("department", departmentId);
|
subDepartmentsQuery.setParameter("department", departmentId);
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (subDepartmentsQuery.size() > 0) {
|
||||||
|
BigDecimal subDepartmentId;
|
||||||
|
boolean result = false;
|
||||||
|
while (subDepartmentsQuery.next()) {
|
||||||
|
subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
|
||||||
|
"departmentId");
|
||||||
|
result = hasPublications(subDepartmentId, merge);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subDepartmentsQuery.close();
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
subDepartmentsQuery.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
query.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasWorkingPapers(final boolean merge) {
|
||||||
|
DataQuery query =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciDepartment");
|
||||||
|
query.setParameter("department", getID());
|
||||||
|
|
||||||
|
if (query.size() > 0) {
|
||||||
|
query.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (merge) {
|
||||||
|
query.close();
|
||||||
|
DataQuery departmentsQuery =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||||
|
departmentsQuery.setParameter("department", getID());
|
||||||
|
|
||||||
|
if (departmentsQuery.size() > 0) {
|
||||||
|
BigDecimal departmentId;
|
||||||
|
boolean result = false;
|
||||||
|
while (departmentsQuery.next()) {
|
||||||
|
departmentId = (BigDecimal) departmentsQuery.get(
|
||||||
|
"departmentId");
|
||||||
|
result = hasWorkingPapers(departmentId, merge);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
departmentsQuery.close();
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
departmentsQuery.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
query.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasWorkingPapers(final BigDecimal departmentId,
|
||||||
|
final boolean merge) {
|
||||||
|
DataQuery query =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciDepartment");
|
||||||
|
query.setParameter("department", departmentId);
|
||||||
|
|
||||||
|
if (query.size() > 0) {
|
||||||
|
query.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (merge) {
|
||||||
|
query.close();
|
||||||
|
DataQuery subDepartmentsQuery =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||||
|
subDepartmentsQuery.setParameter("department", departmentId);
|
||||||
|
|
||||||
|
if (subDepartmentsQuery.size() > 0) {
|
||||||
BigDecimal subDepartmentId;
|
BigDecimal subDepartmentId;
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
while (subDepartmentsQuery.next()) {
|
while (subDepartmentsQuery.next()) {
|
||||||
|
|
@ -154,7 +241,8 @@ public class SciDepartmentWithPublications extends SciDepartment {
|
||||||
Assert.exists(publication, Publication.class);
|
Assert.exists(publication, Publication.class);
|
||||||
|
|
||||||
DataObject link = add(PUBLICATIONS, publication);
|
DataObject link = add(PUBLICATIONS, publication);
|
||||||
link.set("publicationOrder", Integer.valueOf((int) getPublications().size()));
|
link.set("publicationOrder", Integer.valueOf((int) getPublications().
|
||||||
|
size()));
|
||||||
link.save();
|
link.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,10 @@ public class SciOrganizationWithPublications extends SciOrganization {
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciOrganization");
|
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciOrganization");
|
||||||
query.setParameter("organization", getID());
|
query.setParameter("organization", getID());
|
||||||
|
if (getConfig().getOrganizationPublicationsSeparateWorkingPapers()) {
|
||||||
|
query.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (query.size() > 0) {
|
||||||
query.close();
|
query.close();
|
||||||
|
|
@ -118,6 +122,103 @@ public class SciOrganizationWithPublications extends SciOrganization {
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciOrganization");
|
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciOrganization");
|
||||||
query.setParameter("organization", departmentId);
|
query.setParameter("organization", departmentId);
|
||||||
|
if (getConfig().getOrganizationPublicationsSeparateWorkingPapers()) {
|
||||||
|
query.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query.size() > 0) {
|
||||||
|
query.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (merge) {
|
||||||
|
query.close();
|
||||||
|
DataQuery subDepartmentsQuery =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||||
|
subDepartmentsQuery.setParameter("department", departmentId);
|
||||||
|
|
||||||
|
if (subDepartmentsQuery.size() > 0) {
|
||||||
|
BigDecimal subDepartmentId;
|
||||||
|
boolean result = false;
|
||||||
|
while (subDepartmentsQuery.next()) {
|
||||||
|
subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
|
||||||
|
"departmentId");
|
||||||
|
result = hasPublications(subDepartmentId, merge);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subDepartmentsQuery.close();
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
subDepartmentsQuery.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
query.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasWorkingPapers(final boolean merge) {
|
||||||
|
DataQuery query =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciOrganization");
|
||||||
|
query.setParameter("organization", getID());
|
||||||
|
|
||||||
|
if (query.size() > 0) {
|
||||||
|
query.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (merge) {
|
||||||
|
query.close();
|
||||||
|
|
||||||
|
DataQuery departmentsQuery =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
|
||||||
|
departmentsQuery.setParameter("organization",
|
||||||
|
getID());
|
||||||
|
|
||||||
|
if (departmentsQuery.size() > 0) {
|
||||||
|
BigDecimal departmentId;
|
||||||
|
boolean result = false;
|
||||||
|
while (departmentsQuery.next()) {
|
||||||
|
departmentId = (BigDecimal) departmentsQuery.get(
|
||||||
|
"departmentId");
|
||||||
|
result = hasWorkingPapers(departmentId, merge);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
departmentsQuery.close();
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
departmentsQuery.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
query.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasWorkingPapers(final BigDecimal departmentId,
|
||||||
|
final boolean merge) {
|
||||||
|
DataQuery query =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contentassets.getIdsOfWorkingPapersOfSciOrganization");
|
||||||
|
query.setParameter("organization", departmentId);
|
||||||
|
if (getConfig().getOrganizationPublicationsSeparateWorkingPapers()) {
|
||||||
|
query.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (query.size() > 0) {
|
||||||
query.close();
|
query.close();
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ import com.arsdigita.util.parameter.Parameter;
|
||||||
public class SciOrganizationWithPublicationsConfig extends SciOrganizationConfig {
|
public class SciOrganizationWithPublicationsConfig extends SciOrganizationConfig {
|
||||||
|
|
||||||
private final Parameter m_organizationPublicationsMerge;
|
private final Parameter m_organizationPublicationsMerge;
|
||||||
|
private final Parameter m_organizationPublicationsSeparateWorkingPapers;
|
||||||
|
private final Parameter m_departmentPublicationsSeparateWorkingPapers;
|
||||||
|
private final Parameter m_projectPublicationsSeparateWorkingPapers;
|
||||||
|
|
||||||
public SciOrganizationWithPublicationsConfig() {
|
public SciOrganizationWithPublicationsConfig() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -17,15 +20,48 @@ public class SciOrganizationWithPublicationsConfig extends SciOrganizationConfig
|
||||||
m_organizationPublicationsMerge =
|
m_organizationPublicationsMerge =
|
||||||
new BooleanParameter(
|
new BooleanParameter(
|
||||||
"com.arsdigita.cms.contenttypes.sciorganization.publications_merge",
|
"com.arsdigita.cms.contenttypes.sciorganization.publications_merge",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.TRUE);
|
Boolean.TRUE);
|
||||||
|
|
||||||
register(m_organizationPublicationsMerge);
|
register(m_organizationPublicationsMerge);
|
||||||
|
|
||||||
|
m_organizationPublicationsSeparateWorkingPapers =
|
||||||
|
new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.sciorganization..organization.workingpapers_separate",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.TRUE);
|
||||||
|
register(m_organizationPublicationsSeparateWorkingPapers);
|
||||||
|
|
||||||
|
m_departmentPublicationsSeparateWorkingPapers =
|
||||||
|
new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.sciorganization.department.workingpapers_separate",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.TRUE);
|
||||||
|
register(m_departmentPublicationsSeparateWorkingPapers);
|
||||||
|
|
||||||
|
m_projectPublicationsSeparateWorkingPapers =
|
||||||
|
new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.sciorganization.project.workingpapers_separate",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.FALSE);
|
||||||
|
register(m_projectPublicationsSeparateWorkingPapers);
|
||||||
|
|
||||||
loadInfo();
|
loadInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean getOrganizationPublicationsMerge() {
|
public final boolean getOrganizationPublicationsMerge() {
|
||||||
return (Boolean) get(m_organizationPublicationsMerge);
|
return (Boolean) get(m_organizationPublicationsMerge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean getOrganizationPublicationsSeparateWorkingPapers() {
|
||||||
|
return (Boolean) get(m_organizationPublicationsSeparateWorkingPapers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean getDepartmentPublicationsSeparateWorkingPapers() {
|
||||||
|
return (Boolean) get(m_departmentPublicationsSeparateWorkingPapers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean getProjectPublicationsSeparateWorkingPapers() {
|
||||||
|
return (Boolean) get(m_projectPublicationsSeparateWorkingPapers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,18 @@ com.arsdigita.cms.contenttypes.sciorganization.publications_merge.purpose = Merg
|
||||||
com.arsdigita.cms.contenttypes.sciorganization.publications_merge.example = true
|
com.arsdigita.cms.contenttypes.sciorganization.publications_merge.example = true
|
||||||
com.arsdigita.cms.contenttypes.sciorganization.publications_merge.format = [boolean]
|
com.arsdigita.cms.contenttypes.sciorganization.publications_merge.format = [boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.title = Separate working papers of SciOrganization
|
||||||
|
com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.purpose = Show a separate panel for the working papers on SciOrganizationWithPublicationsPanel
|
||||||
|
com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.example = true
|
||||||
|
com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.format [boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.title = Separate working papers of SciDepartment
|
||||||
|
com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.purpose = Show a separate panel for the working papers on SciDepartmentWithPublicationsPanel
|
||||||
|
com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.example = true
|
||||||
|
com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.format [boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.title = Separate working papers of SciProject
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.purpose = Show a separate panel for the working papers on SciProjectWithPublicationsPanel
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.example = false
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.format [boolean]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,8 @@ public class SciProjectWithPublications extends SciProject {
|
||||||
public boolean hasPublications(final boolean merge) {
|
public boolean hasPublications(final boolean merge) {
|
||||||
DataQuery query =
|
DataQuery query =
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciProject");
|
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciProject");
|
||||||
query.setParameter("organization", getID());
|
query.setParameter("project", getID());
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (query.size() > 0) {
|
||||||
query.close();
|
query.close();
|
||||||
|
|
@ -104,7 +104,94 @@ public class SciProjectWithPublications extends SciProject {
|
||||||
final boolean merge) {
|
final boolean merge) {
|
||||||
DataQuery query =
|
DataQuery query =
|
||||||
SessionManager.getSession().retrieveQuery(
|
SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciProject");
|
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciProject");
|
||||||
|
query.setParameter("project", projectId);
|
||||||
|
|
||||||
|
if (query.size() > 0) {
|
||||||
|
query.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (merge) {
|
||||||
|
query.close();
|
||||||
|
DataQuery subProjectsQuery =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
|
||||||
|
subProjectsQuery.setParameter("project", projectId);
|
||||||
|
|
||||||
|
if (subProjectsQuery.size() > 0) {
|
||||||
|
BigDecimal subProjectId;
|
||||||
|
boolean result = false;
|
||||||
|
while (subProjectsQuery.next()) {
|
||||||
|
subProjectId = (BigDecimal) subProjectsQuery.get(
|
||||||
|
"projectId");
|
||||||
|
result = hasPublications(subProjectId, merge);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subProjectsQuery.close();
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
subProjectsQuery.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
query.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasWorkingPapers(final boolean merge) {
|
||||||
|
DataQuery query =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciProject");
|
||||||
|
query.setParameter("project", getID());
|
||||||
|
|
||||||
|
if (query.size() > 0) {
|
||||||
|
query.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
if (merge) {
|
||||||
|
query.close();
|
||||||
|
DataQuery subProjectsQuery =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
|
||||||
|
subProjectsQuery.setParameter("project", getID());
|
||||||
|
|
||||||
|
if (subProjectsQuery.size() > 0) {
|
||||||
|
BigDecimal subProjectId;
|
||||||
|
boolean result = false;
|
||||||
|
while (subProjectsQuery.next()) {
|
||||||
|
subProjectId = (BigDecimal) subProjectsQuery.get(
|
||||||
|
"projectId");
|
||||||
|
result = hasPublications(subProjectId, merge);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subProjectsQuery.close();
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
subProjectsQuery.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
query.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasWorkingPapers(final BigDecimal projectId,
|
||||||
|
final boolean merge) {
|
||||||
|
DataQuery query =
|
||||||
|
SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciProject");
|
||||||
query.setParameter("projectId", projectId);
|
query.setParameter("projectId", projectId);
|
||||||
|
|
||||||
if (query.size() > 0) {
|
if (query.size() > 0) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.persistence.DataQuery;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciPublicationAuthorComparator implements Comparator<Publication> {
|
||||||
|
|
||||||
|
private Logger logger = Logger.getLogger(
|
||||||
|
SciPublicationAuthorComparator.class);
|
||||||
|
|
||||||
|
public int compare(Publication publication1, Publication publication2) {
|
||||||
|
if ((publication1.getAuthors() == null)
|
||||||
|
|| publication1.getAuthors().size() == 0) {
|
||||||
|
logger.debug("publication1 has no authors, returning -1");
|
||||||
|
return -1;
|
||||||
|
} else if ((publication2.getAuthors() == null)
|
||||||
|
|| publication2.getAuthors().size() == 0) {
|
||||||
|
logger.debug("publication2 has no authors, returning ");
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
logger.debug("Both publication have authors, comparing authors...");
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
AuthorshipCollection authors1 = publication1.getAuthors();
|
||||||
|
AuthorshipCollection authors2 = publication2.getAuthors();
|
||||||
|
|
||||||
|
while ((ret == 0) && authors1.next() && authors2.next()) {
|
||||||
|
GenericPerson author1 = authors1.getAuthor();
|
||||||
|
GenericPerson author2 = authors2.getAuthor();
|
||||||
|
logger.debug(String.format(
|
||||||
|
"Comparing surnames: author1.surname = '%s'; author2.surname = '%s'",
|
||||||
|
author1.getSurname(),
|
||||||
|
author2.getSurname()));
|
||||||
|
ret = author1.getSurname().compareTo(author2.getSurname());
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
logger.debug(String.format(
|
||||||
|
"Surnames are identical, comparing given names:"
|
||||||
|
+ "author1.givenName = '%s'; author2.givenName = '%s'",
|
||||||
|
author1.getGivenName(),
|
||||||
|
author2.getGivenName()));
|
||||||
|
ret = author1.getGivenName().compareTo(
|
||||||
|
author2.getGivenName());
|
||||||
|
}
|
||||||
|
logger.debug(String.format("ret = %d", ret));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -37,7 +37,7 @@ public class SciPublicationTitleComparator implements Comparator<Publication> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return title1.compareTo(title2);
|
return title1.compareToIgnoreCase(title2);
|
||||||
//return publication1.getTitle().compareTo(publication2.getTitle());
|
//return publication1.getTitle().compareTo(publication2.getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciPublicationYearAscComparator implements Comparator<Publication> {
|
||||||
|
|
||||||
|
public int compare(Publication publication1, Publication publication2) {
|
||||||
|
if (publication1.getYearOfPublication() == null) {
|
||||||
|
return -1;
|
||||||
|
} else if (publication2.getYearOfPublication() == null) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
int ret = publication1.getYearOfPublication().compareTo(publication2.
|
||||||
|
getYearOfPublication());
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
SciPublicationTitleComparator titleComparator =
|
||||||
|
new SciPublicationTitleComparator();
|
||||||
|
ret = titleComparator.compare(publication1, publication2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciPublicationYearDescComparator implements Comparator<Publication> {
|
||||||
|
|
||||||
|
public int compare(Publication publication1, Publication publication2) {
|
||||||
|
if (publication1.getYearOfPublication() == null) {
|
||||||
|
return 1;
|
||||||
|
} else if (publication2.getYearOfPublication() == null) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
int ret = publication2.getYearOfPublication().compareTo(publication1.
|
||||||
|
getYearOfPublication());
|
||||||
|
if (ret == 0) {
|
||||||
|
SciPublicationTitleComparator titleComparator = new SciPublicationTitleComparator();
|
||||||
|
ret = titleComparator.compare(publication1, publication2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -139,10 +139,14 @@ public class PublicationXmlHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generatePublicationXml(final Element publicationElem) {
|
private void generatePublicationXml(final Element publicationElem) {
|
||||||
|
publicationElem.addAttribute("oid", publication.getOID().toString());
|
||||||
|
publicationElem.addAttribute("version", publication.getVersion());
|
||||||
generateXmlElement(publicationElem, "title", publication.getTitle());
|
generateXmlElement(publicationElem, "title", publication.getTitle());
|
||||||
Element yearElem = publicationElem.newChildElement(
|
if (publication.getYearOfPublication() != null) {
|
||||||
"yearOfPublication");
|
Element yearElem = publicationElem.newChildElement(
|
||||||
yearElem.setText(publication.getYearOfPublication().toString());
|
"yearOfPublication");
|
||||||
|
yearElem.setText(publication.getYearOfPublication().toString());
|
||||||
|
}
|
||||||
generateXmlElement(publicationElem,
|
generateXmlElement(publicationElem,
|
||||||
"yearOfPublication",
|
"yearOfPublication",
|
||||||
publication.getYearOfPublication());
|
publication.getYearOfPublication());
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItemXMLRenderer;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||||
import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
|
import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
|
||||||
|
|
@ -29,13 +30,26 @@ import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
|
import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
import com.arsdigita.cms.contenttypes.SciPublicationYearAscComparator;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciPublicationYearDescComparator;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.Filter;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.SelectFilter;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.SortField;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.persistence.DataQuery;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -43,8 +57,62 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
|
public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
|
||||||
|
|
||||||
|
private static final Logger logger =
|
||||||
|
Logger.getLogger(
|
||||||
|
SciDepartmentWithPublicationsPanel.class);
|
||||||
public static final String SHOW_PUBLICATIONS = "publications";
|
public static final String SHOW_PUBLICATIONS = "publications";
|
||||||
|
public static final String SHOW_WORKING_PAPERS = "workingPapers";
|
||||||
|
private static final String SORT = "sort";
|
||||||
|
private static final String TITLE = "title";
|
||||||
|
private static final String AUTHORS = "authors";
|
||||||
|
private static final String YEAR_OF_PUBLICATION = "yearOfPublication";
|
||||||
|
private static final String YEAR_ASC = "yearAsc";
|
||||||
|
private static final String YEAR_DESC = "yearAsc";
|
||||||
|
private String show;
|
||||||
private boolean displayPublications = true;
|
private boolean displayPublications = true;
|
||||||
|
private boolean displayWorkingPapers = true;
|
||||||
|
private final Map<String, Filter> filters =
|
||||||
|
new LinkedHashMap<String, Filter>();
|
||||||
|
private final Map<String, SortField<Publication>> sortFields =
|
||||||
|
new LinkedHashMap<String, SortField<Publication>>();
|
||||||
|
private String sortByKey;
|
||||||
|
|
||||||
|
public SciDepartmentWithPublicationsPanel() {
|
||||||
|
filters.put(TITLE, new TextFilter(TITLE, TITLE));
|
||||||
|
filters.put(AUTHORS, new TextFilter(AUTHORS, "authors.surname"));
|
||||||
|
SelectFilter yearFilter = new SelectFilter(YEAR_OF_PUBLICATION,
|
||||||
|
YEAR_OF_PUBLICATION,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true);
|
||||||
|
DataQuery query = SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getAllYearsOfPublication");
|
||||||
|
yearFilter.setDataQuery(query, "yearOfPublication");
|
||||||
|
filters.put(YEAR_OF_PUBLICATION, yearFilter);
|
||||||
|
sortFields.put(TITLE,
|
||||||
|
new SortField<Publication>(TITLE,
|
||||||
|
new SciPublicationTitleComparator()));
|
||||||
|
sortFields.put(YEAR_ASC,
|
||||||
|
new SortField<Publication>(YEAR_ASC,
|
||||||
|
new SciPublicationYearAscComparator()));
|
||||||
|
sortFields.put(YEAR_DESC,
|
||||||
|
new SortField<Publication>(YEAR_DESC,
|
||||||
|
new SciPublicationYearDescComparator()));
|
||||||
|
/*sortFields.put(AUTHORS,
|
||||||
|
new SortField<Publication>(AUTHORS,
|
||||||
|
new SciPublicationAuthorComparator()));*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends ContentItem> getAllowedClass() {
|
||||||
|
return SciDepartmentWithPublications.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPanelName() {
|
||||||
|
return SciDepartment.class.getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isDisplayPublications() {
|
public boolean isDisplayPublications() {
|
||||||
return displayPublications;
|
return displayPublications;
|
||||||
|
|
@ -54,10 +122,20 @@ public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
|
||||||
this.displayPublications = displayPublications;
|
this.displayPublications = displayPublications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDisplayWorkingPapers() {
|
||||||
|
return displayWorkingPapers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayWorkingPapers(final boolean displayWorkingPapers) {
|
||||||
|
this.displayWorkingPapers = displayWorkingPapers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateAvailableDataXml(final SciDepartment department,
|
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
SciDepartment department = (SciDepartment) orga;
|
||||||
|
|
||||||
super.generateAvailableDataXml(department, element, state);
|
super.generateAvailableDataXml(department, element, state);
|
||||||
|
|
||||||
SciOrganizationWithPublicationsConfig config =
|
SciOrganizationWithPublicationsConfig config =
|
||||||
|
|
@ -72,65 +150,169 @@ public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
|
||||||
&& displayPublications) {
|
&& displayPublications) {
|
||||||
element.newChildElement("publications");
|
element.newChildElement("publications");
|
||||||
}
|
}
|
||||||
|
if ((dep.hasWorkingPapers(config.getOrganizationPublicationsMerge())
|
||||||
|
&& displayWorkingPapers
|
||||||
|
&& config.getDepartmentPublicationsSeparateWorkingPapers())) {
|
||||||
|
element.newChildElement("workingPapers");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void mergePublications(
|
protected void mergePublications(
|
||||||
final SciDepartmentSubDepartmentsCollection subDepartments,
|
final SciDepartmentSubDepartmentsCollection subDepartments,
|
||||||
final List<Publication> publications) {
|
final List<Publication> publications,
|
||||||
|
final boolean workingPapersOnly,
|
||||||
|
final PageState state) {
|
||||||
while (subDepartments.next()) {
|
while (subDepartments.next()) {
|
||||||
SciDepartment dep;
|
SciDepartment dep;
|
||||||
SciDepartmentWithPublications department;
|
SciDepartmentWithPublications department;
|
||||||
SciDepartmentPublicationsCollection departmentPublications;
|
SciDepartmentPublicationsCollection departmentPublications;
|
||||||
|
|
||||||
dep = subDepartments.getSubDepartment();
|
dep = subDepartments.getSubDepartment();
|
||||||
|
if (!(dep instanceof SciDepartmentWithPublications)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
department = (SciDepartmentWithPublications) dep;
|
department = (SciDepartmentWithPublications) dep;
|
||||||
departmentPublications = department.getPublications();
|
departmentPublications = department.getPublications();
|
||||||
|
applyFilters(departmentPublications, state.getRequest());
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getDepartmentPublicationsSeparateWorkingPapers()) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (publications instanceof ArrayList) {
|
||||||
|
((ArrayList<Publication>) publications).ensureCapacity(
|
||||||
|
publications.size()
|
||||||
|
+ (int) departmentPublications.size());
|
||||||
|
}
|
||||||
|
|
||||||
Publication publication;
|
Publication publication;
|
||||||
while (departmentPublications.next()) {
|
while (departmentPublications.next()) {
|
||||||
publication = (Publication) departmentPublications.
|
publication = departmentPublications.getPublication();
|
||||||
getPublication().getLiveVersion();
|
publications.add(publication);
|
||||||
if (publication == null) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
publications.add(publication);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SciDepartmentSubDepartmentsCollection subSubDepartments = dep.
|
SciDepartmentSubDepartmentsCollection subSubDepartments = dep.
|
||||||
getSubDepartments();
|
getSubDepartments();
|
||||||
|
|
||||||
if ((subSubDepartments != null) && subSubDepartments.size() > 0) {
|
if ((subSubDepartments != null) && subSubDepartments.size() > 0) {
|
||||||
mergePublications(subDepartments, publications);
|
mergePublications(subDepartments,
|
||||||
|
publications,
|
||||||
|
workingPapersOnly,
|
||||||
|
state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generateFiltersXml(
|
||||||
|
final List<Publication> publications,
|
||||||
|
final Element element) {
|
||||||
|
final Element sortFieldsElement = element.newChildElement("sortFields");
|
||||||
|
sortFieldsElement.addAttribute("sortBy", sortByKey);
|
||||||
|
for (Map.Entry<String, SortField<Publication>> sortField :
|
||||||
|
sortFields.entrySet()) {
|
||||||
|
sortField.getValue().generateXml(sortFieldsElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generateSortFieldsXml(final Element element) {
|
||||||
|
final Element sortFieldsElement = element.newChildElement("sortFields");
|
||||||
|
sortFieldsElement.addAttribute("sortBy", sortByKey);
|
||||||
|
for (Map.Entry<String, SortField<Publication>> sortField :
|
||||||
|
sortFields.entrySet()) {
|
||||||
|
sortField.getValue().generateXml(sortFieldsElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void applySortFields(
|
||||||
|
final List<Publication> publications,
|
||||||
|
final HttpServletRequest request) {
|
||||||
|
sortByKey = request.getParameter("sort");
|
||||||
|
if (!sortFields.containsKey(sortByKey)) {
|
||||||
|
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sortFields.containsKey(sortByKey)) {
|
||||||
|
Collections.sort(publications, sortFields.get(sortByKey).
|
||||||
|
getComparator());
|
||||||
|
} else {
|
||||||
|
Collections.sort(publications, new SciPublicationTitleComparator());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void applyFilters(
|
||||||
|
final DomainCollection publications,
|
||||||
|
final HttpServletRequest request) {
|
||||||
|
//Get parameters from HTTP request
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||||
|
String value = request.getParameter(
|
||||||
|
filterEntry.getValue().getLabel());
|
||||||
|
|
||||||
|
if ((value != null) && !(value.trim().isEmpty())) {
|
||||||
|
filterEntry.getValue().setValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Apply filters to DomainCollection
|
||||||
|
final StringBuilder filterBuilder = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||||
|
if ((filterEntry.getValue().getFilter() == null)
|
||||||
|
|| (filterEntry.getValue().getFilter().isEmpty())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterBuilder.length() > 0) {
|
||||||
|
filterBuilder.append(" AND ");
|
||||||
|
}
|
||||||
|
filterBuilder.append(filterEntry.getValue().getFilter());
|
||||||
|
logger.debug(String.format("filters: %s", filterBuilder));
|
||||||
|
if (filterBuilder.length() > 0) {
|
||||||
|
publications.addFilter(filterBuilder.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generatePublicationsXml(final SciDepartment department,
|
protected void generatePublicationsXml(final SciDepartment department,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state,
|
||||||
|
final boolean workingPapersOnly) {
|
||||||
final SciDepartmentWithPublications dep =
|
final SciDepartmentWithPublications dep =
|
||||||
(SciDepartmentWithPublications) department;
|
(SciDepartmentWithPublications) department;
|
||||||
|
|
||||||
|
Element controls = parent.newChildElement("filterControls");
|
||||||
|
controls.addAttribute("customName", "sciDepartmentPublications");
|
||||||
|
controls.addAttribute("show", show);
|
||||||
|
|
||||||
if (SciOrganizationWithPublications.getConfig().
|
if (SciOrganizationWithPublications.getConfig().
|
||||||
getOrganizationPublicationsMerge()) {
|
getOrganizationPublicationsMerge()) {
|
||||||
List<Publication> publications;
|
List<Publication> publications;
|
||||||
publications = new LinkedList<Publication>();
|
|
||||||
SciDepartmentPublicationsCollection departmentPublications;
|
SciDepartmentPublicationsCollection departmentPublications;
|
||||||
departmentPublications = dep.getPublications();
|
departmentPublications = dep.getPublications();
|
||||||
|
applyFilters(departmentPublications, state.getRequest());
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getDepartmentPublicationsSeparateWorkingPapers()) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
publications =
|
||||||
|
new ArrayList<Publication>((int) departmentPublications.size());
|
||||||
|
|
||||||
Publication publication;
|
Publication publication;
|
||||||
while (departmentPublications.next()) {
|
while (departmentPublications.next()) {
|
||||||
publication = (Publication) departmentPublications.
|
publication = departmentPublications.getPublication();
|
||||||
getPublication().getLiveVersion();
|
publications.add(publication);
|
||||||
if (publication == null) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
publications.add(publication);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mergePublications(department.getSubDepartments(), publications);
|
mergePublications(department.getSubDepartments(),
|
||||||
|
publications,
|
||||||
|
workingPapersOnly,
|
||||||
|
state);
|
||||||
|
|
||||||
Set<Publication> publicationsSet;
|
Set<Publication> publicationsSet;
|
||||||
List<Publication> publicationsWithoutDoubles;
|
List<Publication> publicationsWithoutDoubles;
|
||||||
|
|
@ -138,8 +320,10 @@ public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
|
||||||
publicationsWithoutDoubles = new LinkedList<Publication>(
|
publicationsWithoutDoubles = new LinkedList<Publication>(
|
||||||
publicationsSet);
|
publicationsSet);
|
||||||
|
|
||||||
Collections.sort(publicationsWithoutDoubles,
|
applySortFields(publications, state.getRequest());
|
||||||
new SciPublicationTitleComparator());
|
|
||||||
|
//Collections.sort(publicationsWithoutDoubles,
|
||||||
|
// new SciPublicationTitleComparator());
|
||||||
|
|
||||||
long pageNumber = getPageNumber(state);
|
long pageNumber = getPageNumber(state);
|
||||||
long pageCount = getPageCount(publicationsWithoutDoubles.size());
|
long pageCount = getPageCount(publicationsWithoutDoubles.size());
|
||||||
|
|
@ -149,30 +333,40 @@ public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generateFiltersXml(publicationsWithoutDoubles, controls);
|
||||||
|
generateSortFieldsXml(controls);
|
||||||
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
||||||
count, publicationsWithoutDoubles.size());
|
count, publicationsWithoutDoubles.size());
|
||||||
List<Publication> publicationsToShow = publicationsWithoutDoubles.
|
List<Publication> publicationsToShow = publicationsWithoutDoubles.
|
||||||
subList((int) begin, (int) end);
|
subList((int) begin, (int) end);
|
||||||
|
|
||||||
final Element publicationsElem = parent.newChildElement(
|
|
||||||
"publications");
|
|
||||||
final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(
|
|
||||||
publicationsElem);
|
|
||||||
renderer.setWrapAttributes(true);
|
|
||||||
for (Publication pub : publicationsToShow) {
|
for (Publication pub : publicationsToShow) {
|
||||||
renderer.walk(pub, SimpleXMLGenerator.class.getName());
|
PublicationXmlHelper xmlHelper = new PublicationXmlHelper(parent,
|
||||||
|
pub);
|
||||||
|
xmlHelper.generateXml();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SciDepartmentPublicationsCollection departmentPublications;
|
SciDepartmentPublicationsCollection departmentPublications;
|
||||||
departmentPublications = dep.getPublications();
|
departmentPublications = dep.getPublications();
|
||||||
|
applyFilters(departmentPublications, state.getRequest());
|
||||||
|
|
||||||
List<Publication> publications = new LinkedList<Publication>();
|
List<Publication> publications = new LinkedList<Publication>();
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getDepartmentPublicationsSeparateWorkingPapers()) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
while (departmentPublications.next()) {
|
while (departmentPublications.next()) {
|
||||||
publications.add(departmentPublications.getPublication());
|
publications.add(departmentPublications.getPublication());
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(publications, new SciPublicationTitleComparator());
|
applySortFields(publications, state.getRequest());
|
||||||
|
|
||||||
|
//Collections.sort(publications, new SciPublicationTitleComparator());
|
||||||
|
|
||||||
long pageNumber = getPageNumber(state);
|
long pageNumber = getPageNumber(state);
|
||||||
long pageCount = getPageCount(publications.size());
|
long pageCount = getPageCount(publications.size());
|
||||||
|
|
@ -181,32 +375,34 @@ public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generateFiltersXml(publications, controls);
|
||||||
|
generateSortFieldsXml(controls);
|
||||||
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
||||||
count, publications.size());
|
count, publications.size());
|
||||||
List<Publication> publicationsToShow = publications.subList(
|
List<Publication> publicationsToShow = publications.subList(
|
||||||
(int) begin, (int) end);
|
(int) begin, (int) end);
|
||||||
|
|
||||||
final Element publicationsElem = parent.newChildElement(
|
|
||||||
"publications");
|
|
||||||
final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(
|
|
||||||
publicationsElem);
|
|
||||||
renderer.setWrapAttributes(true);
|
|
||||||
for (Publication publication : publicationsToShow) {
|
for (Publication publication : publicationsToShow) {
|
||||||
renderer.walk(publication, SimpleXMLGenerator.class.getName());
|
PublicationXmlHelper xmlHelper =
|
||||||
|
new PublicationXmlHelper(parent,
|
||||||
|
publication);
|
||||||
|
xmlHelper.generateXml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateDataXml(final SciDepartment department,
|
public void generateDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
String show = getShowParam(state);
|
show = getShowParam(state);
|
||||||
|
|
||||||
if (SHOW_PUBLICATIONS.equals(show)) {
|
if (SHOW_PUBLICATIONS.equals(show)) {
|
||||||
generatePublicationsXml(department, element, state);
|
generatePublicationsXml((SciDepartment) orga, element, state, false);
|
||||||
|
} else if (SHOW_WORKING_PAPERS.equals(show)) {
|
||||||
|
generatePublicationsXml((SciDepartment) orga, element, state, true);
|
||||||
} else {
|
} else {
|
||||||
super.generateDataXml(department, element, state);
|
super.generateDataXml(orga, element, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentItemXMLRenderer;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||||
import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
|
import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
|
||||||
|
|
@ -33,15 +33,27 @@ import com.arsdigita.cms.contenttypes.SciOrganizationPublicationsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
|
import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
import com.arsdigita.cms.contenttypes.SciPublicationYearAscComparator;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciPublicationYearDescComparator;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.Filter;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.SelectFilter;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.SortField;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.persistence.DataQuery;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -49,8 +61,52 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
|
|
||||||
|
private static final Logger logger =
|
||||||
|
Logger.getLogger(
|
||||||
|
SciOrganizationWithPublicationsPanel.class);
|
||||||
public static final String SHOW_PUBLICATIONS = "publications";
|
public static final String SHOW_PUBLICATIONS = "publications";
|
||||||
|
public static final String SHOW_WORKING_PAPERS = "workingPapers";
|
||||||
|
private static final String SORT = "sort";
|
||||||
|
private static final String TITLE = "title";
|
||||||
|
private static final String AUTHORS = "authors";
|
||||||
|
private static final String YEAR_OF_PUBLICATION = "yearOfPublication";
|
||||||
|
private static final String YEAR_ASC = "yearAsc";
|
||||||
|
private static final String YEAR_DESC = "yearDesc";
|
||||||
|
private String show;
|
||||||
private boolean displayPublications = true;
|
private boolean displayPublications = true;
|
||||||
|
private boolean displayWorkingPapers = true;
|
||||||
|
private final Map<String, Filter> filters =
|
||||||
|
new LinkedHashMap<String, Filter>();
|
||||||
|
private final Map<String, SortField<Publication>> sortFields =
|
||||||
|
new LinkedHashMap<String, SortField<Publication>>();
|
||||||
|
private String sortByKey;
|
||||||
|
|
||||||
|
public SciOrganizationWithPublicationsPanel() {
|
||||||
|
filters.put(TITLE, new TextFilter(TITLE, TITLE));
|
||||||
|
filters.put(AUTHORS, new TextFilter(AUTHORS, "authors.surname"));
|
||||||
|
SelectFilter yearFilter = new SelectFilter(YEAR_OF_PUBLICATION,
|
||||||
|
YEAR_OF_PUBLICATION,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true);
|
||||||
|
DataQuery query = SessionManager.getSession().retrieveQuery(
|
||||||
|
"com.arsdigita.cms.contenttypes.getAllYearsOfPublication");
|
||||||
|
yearFilter.setDataQuery(query, "yearOfPublication");
|
||||||
|
filters.put(YEAR_OF_PUBLICATION, yearFilter);
|
||||||
|
sortFields.put(TITLE,
|
||||||
|
new SortField<Publication>(TITLE,
|
||||||
|
new SciPublicationTitleComparator()));
|
||||||
|
sortFields.put(YEAR_ASC,
|
||||||
|
new SortField<Publication>(YEAR_ASC,
|
||||||
|
new SciPublicationYearAscComparator()));
|
||||||
|
sortFields.put(YEAR_DESC,
|
||||||
|
new SortField<Publication>(YEAR_DESC,
|
||||||
|
new SciPublicationYearDescComparator()));
|
||||||
|
/*sortFields.put(AUTHORS,
|
||||||
|
new SortField<Publication>(AUTHORS,
|
||||||
|
new SciPublicationAuthorComparator()));*/
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<? extends ContentItem> getAllowedClass() {
|
protected Class<? extends ContentItem> getAllowedClass() {
|
||||||
|
|
@ -70,10 +126,19 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
this.displayPublications = displayPublications;
|
this.displayPublications = displayPublications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDisplayWorkingPapers() {
|
||||||
|
return displayWorkingPapers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayWorkingPapers(final boolean displayWorkingPapers) {
|
||||||
|
this.displayWorkingPapers = displayWorkingPapers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateAvailableDataXml(final SciOrganization organization,
|
protected void generateAvailableDataXml(
|
||||||
final Element element,
|
final GenericOrganizationalUnit organization,
|
||||||
final PageState state) {
|
final Element element,
|
||||||
|
final PageState state) {
|
||||||
super.generateAvailableDataXml(organization, element, state);
|
super.generateAvailableDataXml(organization, element, state);
|
||||||
|
|
||||||
SciOrganizationWithPublicationsConfig config;
|
SciOrganizationWithPublicationsConfig config;
|
||||||
|
|
@ -87,6 +152,12 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
&& displayPublications) {
|
&& displayPublications) {
|
||||||
element.newChildElement("publications");
|
element.newChildElement("publications");
|
||||||
}
|
}
|
||||||
|
if ((orga.hasWorkingPapers(config.getOrganizationPublicationsMerge()))
|
||||||
|
&& displayWorkingPapers
|
||||||
|
&& config.getOrganizationPublicationsSeparateWorkingPapers()) {
|
||||||
|
element.newChildElement("workingPapers");
|
||||||
|
}
|
||||||
|
|
||||||
System.out.printf(
|
System.out.printf(
|
||||||
"\n\nNeeded %d ms to determine if organization has publications\n\n",
|
"\n\nNeeded %d ms to determine if organization has publications\n\n",
|
||||||
System.currentTimeMillis() - start);
|
System.currentTimeMillis() - start);
|
||||||
|
|
@ -94,20 +165,29 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
|
|
||||||
protected void mergePublications(
|
protected void mergePublications(
|
||||||
final SciOrganizationDepartmentsCollection departments,
|
final SciOrganizationDepartmentsCollection departments,
|
||||||
final Collection<Publication> publications) {
|
final Collection<Publication> publications,
|
||||||
|
final boolean workingPapersOnly,
|
||||||
|
final PageState state) {
|
||||||
while (departments.next()) {
|
while (departments.next()) {
|
||||||
SciDepartment dep;
|
SciDepartment dep;
|
||||||
SciDepartmentWithPublications department;
|
SciDepartmentWithPublications department;
|
||||||
SciDepartmentPublicationsCollection departmentPublications;
|
SciDepartmentPublicationsCollection departmentPublications;
|
||||||
|
|
||||||
dep = departments.getDepartment();
|
dep = departments.getDepartment();
|
||||||
if (!dep.isPublished()
|
if (!(dep instanceof SciDepartmentWithPublications)) {
|
||||||
|| !(dep instanceof SciDepartmentWithPublications)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
department = (SciDepartmentWithPublications) dep;
|
department = (SciDepartmentWithPublications) dep;
|
||||||
departmentPublications = department.getPublications();
|
departmentPublications = department.getPublications();
|
||||||
departmentPublications.addFilter("version = 'live'");
|
applyPublicationFilters(departmentPublications, state.getRequest());
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getOrganizationPublicationsSeparateWorkingPapers()) {
|
||||||
|
departmentPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
if (publications instanceof ArrayList) {
|
if (publications instanceof ArrayList) {
|
||||||
((ArrayList<Publication>) publications).ensureCapacity(
|
((ArrayList<Publication>) publications).ensureCapacity(
|
||||||
|
|
@ -118,38 +198,119 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
Publication publication;
|
Publication publication;
|
||||||
while (departmentPublications.next()) {
|
while (departmentPublications.next()) {
|
||||||
publication = departmentPublications.getPublication();
|
publication = departmentPublications.getPublication();
|
||||||
publications.add(publication);
|
publications.add(publication);
|
||||||
}
|
}
|
||||||
|
|
||||||
SciDepartmentSubDepartmentsCollection subDepartments;
|
SciDepartmentSubDepartmentsCollection subDepartments;
|
||||||
subDepartments = dep.getSubDepartments();
|
subDepartments = dep.getSubDepartments();
|
||||||
|
|
||||||
if ((subDepartments != null) && subDepartments.size() > 0) {
|
if ((subDepartments != null) && subDepartments.size() > 0) {
|
||||||
mergePublications(departments, publications);
|
mergePublications(departments,
|
||||||
|
publications,
|
||||||
|
workingPapersOnly,
|
||||||
|
state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generatePublicationFiltersXml(
|
||||||
|
final List<Publication> publications,
|
||||||
|
final Element element) {
|
||||||
|
final Element filterElement = element.newChildElement("filters");
|
||||||
|
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||||
|
filterEntry.getValue().generateXml(filterElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generatePublicationSortFieldsXml(final Element element) {
|
||||||
|
final Element sortFieldsElement = element.newChildElement("sortFields");
|
||||||
|
sortFieldsElement.addAttribute("sortBy", sortByKey);
|
||||||
|
for (Map.Entry<String, SortField<Publication>> sortField :
|
||||||
|
sortFields.entrySet()) {
|
||||||
|
sortField.getValue().generateXml(sortFieldsElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void applyPublicationSortFields(
|
||||||
|
final List<Publication> publications,
|
||||||
|
final HttpServletRequest request) {
|
||||||
|
sortByKey = request.getParameter("sort");
|
||||||
|
if (!sortFields.containsKey(sortByKey)) {
|
||||||
|
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sortFields.containsKey(sortByKey)) {
|
||||||
|
Collections.sort(publications, sortFields.get(sortByKey).
|
||||||
|
getComparator());
|
||||||
|
} else {
|
||||||
|
Collections.sort(publications, new SciPublicationTitleComparator());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void applyPublicationFilters(
|
||||||
|
final DomainCollection publications,
|
||||||
|
final HttpServletRequest request) {
|
||||||
|
//Get parameters from HTTP request
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||||
|
String value = request.getParameter(
|
||||||
|
filterEntry.getValue().getLabel());
|
||||||
|
|
||||||
|
if ((value != null) && !(value.trim().isEmpty())) {
|
||||||
|
filterEntry.getValue().setValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Apply filters to DomainCollection
|
||||||
|
final StringBuilder filterBuilder = new StringBuilder();
|
||||||
|
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||||
|
if ((filterEntry.getValue().getFilter() == null)
|
||||||
|
|| (filterEntry.getValue().getFilter().isEmpty())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filterBuilder.length() > 0) {
|
||||||
|
filterBuilder.append(" AND ");
|
||||||
|
}
|
||||||
|
filterBuilder.append(filterEntry.getValue().getFilter());
|
||||||
|
logger.debug(String.format("filters: %s", filterBuilder));
|
||||||
|
if (filterBuilder.length() > 0) {
|
||||||
|
publications.addFilter(filterBuilder.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generatePublicationsXml(final SciOrganization organization,
|
protected void generatePublicationsXml(final SciOrganization organization,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state,
|
||||||
|
final boolean workingPapersOnly) {
|
||||||
final SciOrganizationWithPublications orga =
|
final SciOrganizationWithPublications orga =
|
||||||
(SciOrganizationWithPublications) organization;
|
(SciOrganizationWithPublications) organization;
|
||||||
|
|
||||||
|
Element controls = parent.newChildElement("filterControls");
|
||||||
|
controls.addAttribute("customName", "sciOrganizationPublications");
|
||||||
|
controls.addAttribute("show", show);
|
||||||
|
|
||||||
if (SciOrganizationWithPublications.getConfig().
|
if (SciOrganizationWithPublications.getConfig().
|
||||||
getOrganizationPublicationsMerge()) {
|
getOrganizationPublicationsMerge()) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
List<Publication> publications;
|
List<Publication> publications;
|
||||||
SciOrganizationPublicationsCollection orgaPublications;
|
SciOrganizationPublicationsCollection orgaPublications;
|
||||||
orgaPublications = orga.getPublications();
|
orgaPublications = orga.getPublications();
|
||||||
orgaPublications.addFilter("version = 'live'");
|
applyPublicationFilters(orgaPublications, state.getRequest());
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
orgaPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getOrganizationPublicationsSeparateWorkingPapers()) {
|
||||||
|
orgaPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
publications = new ArrayList<Publication>((int) orgaPublications.
|
publications = new ArrayList<Publication>((int) orgaPublications.
|
||||||
size());
|
size());
|
||||||
|
|
||||||
|
|
||||||
Publication publication;
|
Publication publication;
|
||||||
while (orgaPublications.next()) {
|
while (orgaPublications.next()) {
|
||||||
//publication = (Publication) orgaPublications.getPublication().getLiveVersion();
|
|
||||||
publication = orgaPublications.getPublication();
|
publication = orgaPublications.getPublication();
|
||||||
publications.add(publication);
|
publications.add(publication);
|
||||||
}
|
}
|
||||||
|
|
@ -157,44 +318,48 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
System.out.printf("Got publications of organization in %d ms\n",
|
System.out.printf("Got publications of organization in %d ms\n",
|
||||||
System.currentTimeMillis() - start);
|
System.currentTimeMillis() - start);
|
||||||
|
|
||||||
|
|
||||||
SciOrganizationDepartmentsCollection departments = organization.
|
SciOrganizationDepartmentsCollection departments = organization.
|
||||||
getDepartments();
|
getDepartments();
|
||||||
long mergeStart = System.currentTimeMillis();
|
long mergeStart = System.currentTimeMillis();
|
||||||
mergePublications(departments, publications);
|
mergePublications(departments,
|
||||||
|
publications,
|
||||||
|
workingPapersOnly,
|
||||||
|
state);
|
||||||
System.err.printf("Merged publications in %d ms\n", System.
|
System.err.printf("Merged publications in %d ms\n", System.
|
||||||
currentTimeMillis() - mergeStart);
|
currentTimeMillis() - mergeStart);
|
||||||
|
|
||||||
long sortStart = System.currentTimeMillis();
|
long sortStart = System.currentTimeMillis();
|
||||||
Set<Publication> publicationsSet;
|
Set<Publication> publicationsSet;
|
||||||
List<Publication> publicationWithoutDoubles;
|
List<Publication> publicationsWithoutDoubles;
|
||||||
publicationsSet = new HashSet<Publication>(publications);
|
publicationsSet = new HashSet<Publication>(publications);
|
||||||
//publicationWithoutDoubles = new LinkedList<Publication>(
|
publicationsWithoutDoubles = new LinkedList<Publication>(
|
||||||
// publicationsSet);
|
|
||||||
publicationWithoutDoubles = new ArrayList<Publication>(
|
|
||||||
publicationsSet);
|
publicationsSet);
|
||||||
|
|
||||||
|
|
||||||
Collections.sort(publicationWithoutDoubles,
|
applyPublicationSortFields(publicationsWithoutDoubles, state.
|
||||||
new SciPublicationTitleComparator());
|
getRequest());
|
||||||
|
|
||||||
|
//Collections.sort(publicationsWithoutDoubles,
|
||||||
|
// new SciPublicationTitleComparator());
|
||||||
System.out.printf("Sorted publications in %d ms\n", System.
|
System.out.printf("Sorted publications in %d ms\n", System.
|
||||||
currentTimeMillis() - sortStart);
|
currentTimeMillis() - sortStart);
|
||||||
|
|
||||||
|
|
||||||
long paginatorStart = System.currentTimeMillis();
|
long paginatorStart = System.currentTimeMillis();
|
||||||
long pageNumber = getPageNumber(state);
|
long pageNumber = getPageNumber(state);
|
||||||
long pageCount = getPageCount(publicationWithoutDoubles.size());
|
long pageCount = getPageCount(publicationsWithoutDoubles.size());
|
||||||
long begin = getPaginatorBegin(pageNumber);
|
long begin = getPaginatorBegin(pageNumber);
|
||||||
long count = getPaginatorCount(begin,
|
long count = getPaginatorCount(begin,
|
||||||
publicationWithoutDoubles.size());
|
publicationsWithoutDoubles.size());
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generatePublicationFiltersXml(publicationsWithoutDoubles, controls);
|
||||||
|
generatePublicationSortFieldsXml(controls);
|
||||||
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
||||||
count, publicationWithoutDoubles.size());
|
count, publicationsWithoutDoubles.size());
|
||||||
System.out.printf("Created paginator in %d ms", System.
|
System.out.printf("Created paginator in %d ms", System.
|
||||||
currentTimeMillis() - paginatorStart);
|
currentTimeMillis() - paginatorStart);
|
||||||
List<Publication> publicationsToShow = publicationWithoutDoubles.
|
List<Publication> publicationsToShow = publicationsWithoutDoubles.
|
||||||
subList((int) begin, (int) end);
|
subList((int) begin, (int) end);
|
||||||
|
|
||||||
System.out.printf(
|
System.out.printf(
|
||||||
|
|
@ -215,6 +380,15 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
} else {
|
} else {
|
||||||
SciOrganizationPublicationsCollection orgaPublications;
|
SciOrganizationPublicationsCollection orgaPublications;
|
||||||
orgaPublications = orga.getPublications();
|
orgaPublications = orga.getPublications();
|
||||||
|
applyPublicationFilters(orgaPublications, state.getRequest());
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
orgaPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getOrganizationPublicationsSeparateWorkingPapers()) {
|
||||||
|
orgaPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
List<Publication> publications = new LinkedList<Publication>();
|
List<Publication> publications = new LinkedList<Publication>();
|
||||||
|
|
||||||
|
|
@ -222,7 +396,9 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
publications.add(orgaPublications.getPublication());
|
publications.add(orgaPublications.getPublication());
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(publications, new SciPublicationTitleComparator());
|
applyPublicationSortFields(publications, state.getRequest());
|
||||||
|
|
||||||
|
//Collections.sort(publications, new SciPublicationTitleComparator());
|
||||||
|
|
||||||
long pageNumber = getPageNumber(state);
|
long pageNumber = getPageNumber(state);
|
||||||
long pageCount = getPageCount(publications.size());
|
long pageCount = getPageCount(publications.size());
|
||||||
|
|
@ -231,31 +407,38 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
||||||
long end = getPaginatorEnd(begin, count);
|
long end = getPaginatorEnd(begin, count);
|
||||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||||
|
|
||||||
|
generatePublicationFiltersXml(publications, controls);
|
||||||
|
generatePublicationSortFieldsXml(controls);
|
||||||
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
createPaginatorElement(parent, pageNumber, pageCount, begin, end,
|
||||||
count, publications.size());
|
count, publications.size());
|
||||||
List<Publication> publicationsToShow = publications.subList(
|
List<Publication> publicationsToShow = publications.subList(
|
||||||
(int) begin, (int) end);
|
(int) begin, (int) end);
|
||||||
|
|
||||||
final Element publicationsElem = parent.newChildElement(
|
|
||||||
"publications");
|
|
||||||
final ContentItemXMLRenderer renderer =
|
|
||||||
new ContentItemXMLRenderer(
|
|
||||||
publicationsElem);
|
|
||||||
renderer.setWrapAttributes(true);
|
|
||||||
for (Publication publication : publicationsToShow) {
|
for (Publication publication : publicationsToShow) {
|
||||||
renderer.walk(publication, SimpleXMLGenerator.class.getName());
|
PublicationXmlHelper xmlHelper =
|
||||||
|
new PublicationXmlHelper(parent,
|
||||||
|
publication);
|
||||||
|
xmlHelper.generateXml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateDataXml(final SciOrganization organization,
|
protected void generateDataXml(final GenericOrganizationalUnit organization,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
String show = getShowParam(state);
|
show = getShowParam(state);
|
||||||
|
|
||||||
if (SHOW_PUBLICATIONS.equals(show)) {
|
if (SHOW_PUBLICATIONS.equals(show)) {
|
||||||
generatePublicationsXml(organization, element, state);
|
generatePublicationsXml((SciOrganization) organization,
|
||||||
|
element,
|
||||||
|
state,
|
||||||
|
false);
|
||||||
|
} else if (SHOW_WORKING_PAPERS.equals(show)) {
|
||||||
|
generatePublicationsXml((SciOrganization) organization,
|
||||||
|
element,
|
||||||
|
state,
|
||||||
|
true);
|
||||||
} else {
|
} else {
|
||||||
super.generateDataXml(organization, element, state);
|
super.generateDataXml(organization, element, state);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItemXMLRenderer;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
|
||||||
|
|
@ -29,8 +30,8 @@ import com.arsdigita.cms.contenttypes.SciProjectPublicationsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
|
import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
|
import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
|
||||||
import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
|
import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
@ -44,7 +45,22 @@ import java.util.Set;
|
||||||
public class SciProjectWithPublicationsPanel extends SciProjectPanel {
|
public class SciProjectWithPublicationsPanel extends SciProjectPanel {
|
||||||
|
|
||||||
public static final String SHOW_PUBLICATIONS = "publications";
|
public static final String SHOW_PUBLICATIONS = "publications";
|
||||||
|
public static final String SHOW_WORKING_PAPERS = "workingPapers";
|
||||||
private boolean displayPublications = true;
|
private boolean displayPublications = true;
|
||||||
|
private boolean displayWorkingPapers = true;
|
||||||
|
|
||||||
|
public SciProjectWithPublicationsPanel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends ContentItem> getAllowedClass() {
|
||||||
|
return SciProjectWithPublications.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPanelName() {
|
||||||
|
return SciProject.class.getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isDisplayPublications() {
|
public boolean isDisplayPublications() {
|
||||||
return displayPublications;
|
return displayPublications;
|
||||||
|
|
@ -54,10 +70,20 @@ public class SciProjectWithPublicationsPanel extends SciProjectPanel {
|
||||||
this.displayPublications = displayPublications;
|
this.displayPublications = displayPublications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDisplayWorkingPapers() {
|
||||||
|
return displayWorkingPapers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayWorkingPapers(final boolean displayWorkingPapers) {
|
||||||
|
this.displayWorkingPapers = displayWorkingPapers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateAvailableDataXml(final SciProject project,
|
public void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
SciProject project = (SciProject) orga;
|
||||||
|
|
||||||
super.generateAvailableDataXml(project, element, state);
|
super.generateAvailableDataXml(project, element, state);
|
||||||
|
|
||||||
SciOrganizationWithPublicationsConfig config =
|
SciOrganizationWithPublicationsConfig config =
|
||||||
|
|
@ -71,11 +97,17 @@ public class SciProjectWithPublicationsPanel extends SciProjectPanel {
|
||||||
&& displayPublications) {
|
&& displayPublications) {
|
||||||
element.newChildElement("publications");
|
element.newChildElement("publications");
|
||||||
}
|
}
|
||||||
|
if ((proj.hasWorkingPapers(config.getOrganizationPublicationsMerge()))
|
||||||
|
&& displayWorkingPapers
|
||||||
|
&& config.getProjectPublicationsSeparateWorkingPapers()) {
|
||||||
|
element.newChildElement("workingPapers");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void mergePublications(
|
protected void mergePublications(
|
||||||
final SciProjectSubProjectsCollection subProjects,
|
final SciProjectSubProjectsCollection subProjects,
|
||||||
final List<Publication> publications) {
|
final List<Publication> publications,
|
||||||
|
final boolean workingPapersOnly) {
|
||||||
while (subProjects.next()) {
|
while (subProjects.next()) {
|
||||||
SciProject proj;
|
SciProject proj;
|
||||||
SciProjectWithPublications project;
|
SciProjectWithPublications project;
|
||||||
|
|
@ -84,51 +116,69 @@ public class SciProjectWithPublicationsPanel extends SciProjectPanel {
|
||||||
proj = subProjects.getSubProject();
|
proj = subProjects.getSubProject();
|
||||||
project = (SciProjectWithPublications) proj;
|
project = (SciProjectWithPublications) proj;
|
||||||
projectPublications = project.getPublications();
|
projectPublications = project.getPublications();
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
projectPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getProjectPublicationsSeparateWorkingPapers()) {
|
||||||
|
projectPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (publications instanceof ArrayList) {
|
||||||
|
((ArrayList<Publication>) publications).ensureCapacity(
|
||||||
|
publications.size() + (int) projectPublications.size());
|
||||||
|
}
|
||||||
|
|
||||||
Publication publication;
|
Publication publication;
|
||||||
while (projectPublications.next()) {
|
while (projectPublications.next()) {
|
||||||
publication = (Publication) projectPublications.getPublication().
|
publication = projectPublications.getPublication();
|
||||||
getLiveVersion();
|
publications.add(publication);
|
||||||
if (publication == null) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
publications.add(publication);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SciProjectSubProjectsCollection subSubProjects =
|
SciProjectSubProjectsCollection subSubProjects =
|
||||||
proj.getSubProjects();
|
proj.getSubProjects();
|
||||||
|
|
||||||
if ((subSubProjects != null) && subSubProjects.size() > 0) {
|
if ((subSubProjects != null) && subSubProjects.size() > 0) {
|
||||||
mergePublications(subSubProjects, publications);
|
mergePublications(subSubProjects, publications,
|
||||||
|
workingPapersOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generatePublicationsXml(final SciProject project,
|
protected void generatePublicationsXml(final SciProject project,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state,
|
||||||
|
final boolean workingPapersOnly) {
|
||||||
final SciProjectWithPublications proj =
|
final SciProjectWithPublications proj =
|
||||||
(SciProjectWithPublications) project;
|
(SciProjectWithPublications) project;
|
||||||
|
|
||||||
if (SciOrganizationWithPublications.getConfig().
|
if (SciOrganizationWithPublications.getConfig().
|
||||||
getOrganizationPublicationsMerge()) {
|
getOrganizationPublicationsMerge()) {
|
||||||
List<Publication> publications = new LinkedList<Publication>();
|
List<Publication> publications;
|
||||||
SciProjectPublicationsCollection projectPublications = proj.
|
SciProjectPublicationsCollection projectPublications = proj.
|
||||||
getPublications();
|
getPublications();
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
projectPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getProjectPublicationsSeparateWorkingPapers()) {
|
||||||
|
projectPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
|
publications =
|
||||||
|
new ArrayList<Publication>((int) projectPublications.size());
|
||||||
|
|
||||||
Publication publication;
|
Publication publication;
|
||||||
while (projectPublications.next()) {
|
while (projectPublications.next()) {
|
||||||
publication = (Publication) projectPublications.getPublication().
|
publication = projectPublications.getPublication();
|
||||||
getLiveVersion();
|
publications.add(publication);
|
||||||
if (publication == null) {
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
publications.add(publication);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mergePublications(project.getSubProjects(), publications);
|
mergePublications(project.getSubProjects(),
|
||||||
|
publications,
|
||||||
|
workingPapersOnly);
|
||||||
|
|
||||||
Set<Publication> publicationsSet;
|
Set<Publication> publicationsSet;
|
||||||
List<Publication> publicationsWithoutDoubles;
|
List<Publication> publicationsWithoutDoubles;
|
||||||
|
|
@ -151,17 +201,22 @@ public class SciProjectWithPublicationsPanel extends SciProjectPanel {
|
||||||
List<Publication> publicationsToShow = publicationsWithoutDoubles.
|
List<Publication> publicationsToShow = publicationsWithoutDoubles.
|
||||||
subList((int) begin, (int) end);
|
subList((int) begin, (int) end);
|
||||||
|
|
||||||
final Element publicationsElem = parent.newChildElement(
|
|
||||||
"publications");
|
|
||||||
final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(
|
|
||||||
publicationsElem);
|
|
||||||
renderer.setWrapAttributes(true);
|
|
||||||
for (Publication pub : publicationsToShow) {
|
for (Publication pub : publicationsToShow) {
|
||||||
renderer.walk(pub, SimpleXMLGenerator.class.getName());
|
PublicationXmlHelper xmlHelper = new PublicationXmlHelper(parent,
|
||||||
|
pub);
|
||||||
|
xmlHelper.generateXml();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SciProjectPublicationsCollection projectPublications = proj.
|
SciProjectPublicationsCollection projectPublications = proj.
|
||||||
getPublications();
|
getPublications();
|
||||||
|
if (workingPapersOnly) {
|
||||||
|
projectPublications.addFilter(
|
||||||
|
"objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
} else if (SciOrganizationWithPublications.getConfig().
|
||||||
|
getProjectPublicationsSeparateWorkingPapers()) {
|
||||||
|
projectPublications.addFilter(
|
||||||
|
"objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
|
||||||
|
}
|
||||||
|
|
||||||
List<Publication> publications = new LinkedList<Publication>();
|
List<Publication> publications = new LinkedList<Publication>();
|
||||||
|
|
||||||
|
|
@ -183,27 +238,27 @@ public class SciProjectWithPublicationsPanel extends SciProjectPanel {
|
||||||
List<Publication> publicationsToShow = publications.subList(
|
List<Publication> publicationsToShow = publications.subList(
|
||||||
(int) begin, (int) end);
|
(int) begin, (int) end);
|
||||||
|
|
||||||
final Element publicationsElem = parent.newChildElement(
|
|
||||||
"publications");
|
|
||||||
final ContentItemXMLRenderer renderer = new ContentItemXMLRenderer(
|
|
||||||
publicationsElem);
|
|
||||||
renderer.setWrapAttributes(true);
|
|
||||||
for (Publication publication : publicationsToShow) {
|
for (Publication publication : publicationsToShow) {
|
||||||
renderer.walk(publication, SimpleXMLGenerator.class.getName());
|
PublicationXmlHelper xmlHelper =
|
||||||
|
new PublicationXmlHelper(parent,
|
||||||
|
publication);
|
||||||
|
xmlHelper.generateXml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateDataXml(final SciProject project,
|
public void generateDataXml(final GenericOrganizationalUnit orga,
|
||||||
final Element element,
|
final Element element,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
String show = getShowParam(state);
|
String show = getShowParam(state);
|
||||||
|
|
||||||
if (SHOW_PUBLICATIONS.equals(show)) {
|
if (SHOW_PUBLICATIONS.equals(show)) {
|
||||||
generatePublicationsXml(project, element, state);
|
generatePublicationsXml((SciProject) orga, element, state, false);
|
||||||
|
} else if (SHOW_WORKING_PAPERS.equals(show)) {
|
||||||
|
generatePublicationsXml((SciProject) orga, element, state, true);
|
||||||
} else {
|
} else {
|
||||||
super.generateDataXml(project, element, state);
|
super.generateDataXml(orga, element, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getDefinition().setDescendCategories(true);
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getDefinition().setDescendCategories(true);
|
||||||
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getDefinition().setExcludeIndexObjects(false);
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getDefinition().setExcludeIndexObjects(false);
|
||||||
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getDefinition().setFilterCategory(false);
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getDefinition().setFilterCategory(false);
|
||||||
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getDefinition().setAddOrder("title");
|
||||||
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getRenderer().setSpecializeObjectsContext("sciProjectList");
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) projectList).getRenderer().setSpecializeObjectsContext("sciProjectList");
|
||||||
if((request.getParameterMap().get("DaBInId") != null) && (((String[])request.getParameterMap().get("DaBInId")).length > 0)) {
|
if((request.getParameterMap().get("DaBInId") != null) && (((String[])request.getParameterMap().get("DaBInId")).length > 0)) {
|
||||||
String[] params = (String[]) request.getParameterMap().get("DaBInId");
|
String[] params = (String[]) request.getParameterMap().get("DaBInId");
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
<define:page name="publications"
|
<define:page name="publications"
|
||||||
application="content"
|
application="content"
|
||||||
title="Publications4Homepages"
|
title="Publications4Homepages"
|
||||||
cache="true">
|
cache="false">
|
||||||
|
|
||||||
<define:component name="publicationList"
|
<define:component name="publicationList"
|
||||||
classname="com.arsdigita.london.navigation.ui.object.ComplexObjectList"/>
|
classname="com.arsdigita.london.navigation.ui.object.ComplexObjectList"/>
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) publicationList).getDefinition().setDescendCategories(true);
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) publicationList).getDefinition().setDescendCategories(true);
|
||||||
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) publicationList).getDefinition().setExcludeIndexObjects(false);
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) publicationList).getDefinition().setExcludeIndexObjects(false);
|
||||||
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) publicationList).getDefinition().setFilterCategory(false);
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) publicationList).getDefinition().setFilterCategory(false);
|
||||||
|
((com.arsdigita.london.navigation.ui.object.ComplexObjectList) publicationList).getDefinition().addOrder("yearOfPublication desc");
|
||||||
if((request.getParameterMap().get("DaBInId") != null) && (((String[])request.getParameterMap().get("DaBInId")).length > 0)) {
|
if((request.getParameterMap().get("DaBInId") != null) && (((String[])request.getParameterMap().get("DaBInId")).length > 0)) {
|
||||||
String[] params = (String[]) request.getParameterMap().get("DaBInId");
|
String[] params = (String[]) request.getParameterMap().get("DaBInId");
|
||||||
String dabinid = params[0];
|
String dabinid = params[0];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue