From ba2e897c3085de93eceb601b440878fffae7adc0 Mon Sep 17 00:00:00 2001
From: jensp
Date: Tue, 8 Nov 2011 19:50:31 +0000
Subject: [PATCH] =?UTF-8?q?-=20Reviewed-Eigenschaft=20aus=20den=20einzelne?=
=?UTF-8?q?n=20Publikationstypen=20in=20Publication=20verlegt.=20Dies=20is?=
=?UTF-8?q?t=20notwendig=20um=20per=20DataQuery=20nach=20=20=20dieser=20Ei?=
=?UTF-8?q?genschaft=20zu=20filtern.=20Dies=20ist=20unter=20anderem=20notw?=
=?UTF-8?q?enig,=20um=20Publikationen=20einer=20Person=20auf=20effiziente?=
=?UTF-8?q?=20Weise=20=20=20abfragen=20zu=20k=C3=B6nnen.=20Bei=20den=20Pub?=
=?UTF-8?q?likationstypen,=20die=20bisher=20keine=20Reviewed=20Property=20?=
=?UTF-8?q?hatten=20wird=20reviewed=20derzeit=20=C3=BCber=20den=20=20=20je?=
=?UTF-8?q?weiligen=20TraveralAdapter=20ausgeblendet.=20Auch=20das=20Setze?=
=?UTF-8?q?n=20der=20Property=20ist=20nicht=20m=C3=B6glich,=20da=20es=20ke?=
=?UTF-8?q?in=20Widget=20im=20Content-Center=20=20=20daf=C3=BCr=20gibt.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Das Upgrade des Publikationsmodul von Version 6.6.0 auf Version 6.6.1 ist entsprechend ergänzt werden und kopiert auch
bereits vorhandene Einträge.
- Optimierte Version von PersonalPublications
- Kleinere Verbesserungen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1226 8810af33-2d31-482b-a856-94f89814c4df
---
.../cms/contenttypes/ui/panels/Paginator.java | 36 +-
.../cms/dispatcher/SimpleXMLGenerator.java | 17 +-
.../PersonalPublications.java | 932 +++++++++++++-----
.../PersonalPublicationsConfig.java | 32 +-
...nalPublicationsConfig_parameter.properties | 16 +-
.../ArticleInCollectedVolume.pdl | 2 +-
.../content-types/ArticleInJournal.pdl | 2 +-
.../content-types/CollectedVolume.pdl | 2 +-
.../com/arsdigita/content-types/Monograph.pdl | 2 +-
.../arsdigita/content-types/Publication.pdl | 97 +-
.../arsdigita/content-types/WorkingPaper.pdl | 2 +-
.../upgrade/6.6.0-6.6.1/move-reviewed.sql | 47 +
.../upgrade/postgres-6.6.0-6.6.1.sql | 1 +
.../arsdigita/cms/contenttypes/Expertise.xml | 20 +-
.../cms/contenttypes/GreyLiterature.xml | 18 +-
.../cms/contenttypes/InProceedings.xml | 19 +-
.../cms/contenttypes/InternetArticle.xml | 18 +-
.../arsdigita/cms/contenttypes/Journal.xml | 19 +-
.../cms/contenttypes/Proceedings.xml | 22 +-
.../com/arsdigita/cms/contenttypes/Review.xml | 24 +
.../cms/contenttypes/UnPublished.xml | 18 +-
.../src/ccm-sci-publications.upgrade | 5 +
.../ArticleInCollectedVolume.java | 6 +-
.../cms/contenttypes/ArticleInJournal.java | 6 +-
.../contenttypes/AuthorshipCollection.java | 2 +-
.../cms/contenttypes/CollectedVolume.java | 6 +-
.../arsdigita/cms/contenttypes/Monograph.java | 6 +-
.../cms/contenttypes/Publication.java | 82 +-
.../arsdigita/cms/contenttypes/Review.java | 1 -
.../cms/contenttypes/WorkingPaper.java | 6 +-
.../contenttypes/ui/PublicationXmlHelper.java | 27 +-
.../src/ccm-sci-types-department.config | 2 +-
32 files changed, 1089 insertions(+), 406 deletions(-)
create mode 100644 ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.0-6.6.1/move-reviewed.sql
create mode 100644 ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Review.xml
create mode 100644 ccm-sci-publications/src/ccm-sci-publications.upgrade
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java
index b5af9f261..15eb7bde9 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java
@@ -1,6 +1,5 @@
package com.arsdigita.cms.contenttypes.ui.panels;
-import com.arsdigita.cms.contenttypes.ui.GenericOrgaUnitTab;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
@@ -8,9 +7,11 @@ import com.arsdigita.web.Web;
import com.arsdigita.xml.Element;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
+import org.apache.log4j.Logger;
/**
- * Paginator class for the classes implementing {@link GenericOrgaUnitTab}.
+ * Paginator class for the classes implementing
+ * {@link com.arsdigita.cms.contenttypes.ui.GenericOrgaUnitTab}.
*
* @author Jens Pelzetter
* @version $Id$
@@ -21,6 +22,7 @@ public class Paginator {
private final int pageSize;
private int pageNumber;
private final int objectCount;
+ private final Logger logger = Logger.getLogger(Paginator.class);
public Paginator(final HttpServletRequest request,
final int objectCount) {
@@ -30,7 +32,17 @@ public class Paginator {
public Paginator(final HttpServletRequest request,
final int objectCount,
final int pageSize) {
- pageNumber = Integer.parseInt(request.getParameter(PAGE_NUMBER));
+ final String pageNumberStr = request.getParameter(PAGE_NUMBER);
+ if (pageNumberStr == null) {
+ logger.debug("No pageNumber parameter in request setting page number"
+ + " to 1.");
+ pageNumber = 1;
+ } else {
+ pageNumber = Integer.parseInt(pageNumberStr);
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug(String.format("pageNumber = %d", pageNumber));
+ }
this.objectCount = objectCount;
this.pageSize = pageSize;
@@ -65,6 +77,18 @@ public class Paginator {
}
public void applyLimits(final DataQuery query) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Paginator values: ");
+ logger.debug(String.format(" objectCount = %d", objectCount));
+ logger.debug(String.format(" begin = %d", getBegin()));
+ logger.debug(String.format(" end = %d", getEnd()));
+ logger.debug(String.format("pageCount = %d", getPageCount()));
+ logger.debug(String.format(" count = %d", getCount()));
+ }
+
+ logger.debug(String.format("Applying limits: %d, %d",
+ getBegin(),
+ getEnd()));
query.setRange(getBegin(), getEnd());
}
@@ -92,7 +116,11 @@ public class Paginator {
}
private int getBegin() {
- return (pageNumber - 1) * pageSize;
+ if (pageNumber == 1) {
+ return 1;
+ } else {
+ return (pageNumber - 1) * pageSize;
+ }
}
private int getCount() {
diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java
index c3d7f8123..a1b9e27fa 100755
--- a/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java
+++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java
@@ -67,6 +67,12 @@ public class SimpleXMLGenerator implements XMLGenerator {
* your generator.
*/
private boolean useExtraXml = true;
+ /**
+ * Allows to overwrite the name and the namespace of the XML element
+ * used to wrap the rendered item.
+ */
+ private String itemElemName = "cms:item";
+ private String itemElemNs = CMS.CMS_XML_NS;
// Register general purpose adaptor for all content items
static {
@@ -90,6 +96,14 @@ public class SimpleXMLGenerator implements XMLGenerator {
this.useExtraXml = useExtraXml;
}
+ public void setItemElemName(final String itemElemName,
+ final String itemElemNs) {
+ this.itemElemName = itemElemName;
+ this.itemElemNs = itemElemNs;
+ }
+
+
+
/**
* Generates the XML to render the content panel.
*
@@ -247,7 +261,8 @@ public class SimpleXMLGenerator implements XMLGenerator {
}
private Element startElement(String useContext) {
- Element element = new Element("cms:item", CMS.CMS_XML_NS);
+ //Element element = new Element("cms:item", CMS.CMS_XML_NS);
+ final Element element = new Element(itemElemName, itemElemNs);
if (useContext != null) {
element.addAttribute("useContext", useContext);
}
diff --git a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java
index c931f96f4..20be4eba6 100644
--- a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java
+++ b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java
@@ -1,18 +1,19 @@
package com.arsdigita.cms.publicpersonalprofile;
import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.contenttypes.AuthorshipCollection;
+import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.contenttypes.ui.PublicationXmlHelper;
+import com.arsdigita.cms.contenttypes.ui.panels.Paginator;
+import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
+import com.arsdigita.persistence.DataQuery;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.persistence.SessionManager;
import com.arsdigita.xml.Element;
+import java.math.BigDecimal;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -40,319 +41,704 @@ public class PersonalPublications implements ContentGenerator {
config.load();
}
+ @Override
public void generateContent(final Element parent,
final GenericPerson person,
final PageState state) {
- final List publications = collectPublications(person);
+ final long start = System.currentTimeMillis();
+
+ final DataQuery allQuery = SessionManager.getSession().retrieveQuery(
+ "com.arsdigita.cms.contenttypes.getPublicationsForAuthor");
+ applyAuthorFilter(person, allQuery, true);
final Element personalPubsElem = parent.newChildElement(
"personalPublications");
-
- if ((publications == null) || publications.isEmpty()) {
+ final long overallSize;
+ if (allQuery == null) {
+ overallSize = 0;
+ } else {
+ overallSize = allQuery.size();
+ }
+ if (overallSize <= 0) {
personalPubsElem.newChildElement("noPublications");
return;
} else {
- final Map> groupedPublications =
- processPublications(
- publications);
+ logger.debug(String.format("1: %d ms until now...", System.
+ currentTimeMillis() - start));
+ final Element availableGroupsElem =
+ personalPubsElem.newChildElement(
+ "availablePublicationGroups");
+ final Element publicationsElem = personalPubsElem.newChildElement(
+ "publications");
- generateGroupsXml(personalPubsElem, groupedPublications);
- generatePublicationsXml(personalPubsElem, groupedPublications, state);
- }
- }
+ final Map> groupsConfig = getGroupsConfig();
+ final Map groupQueries =
+ new LinkedHashMap();
+ logger.debug(String.format("2: %d ms until now...", System.
+ currentTimeMillis() - start));
+ for (Map.Entry> entry : groupsConfig.entrySet()) {
+ createGroupQuery(person,
+ entry.getKey(),
+ entry.getValue(),
+ groupQueries);
+ logger.debug(String.format("3: %d ms until now...", System.
+ currentTimeMillis() - start));
+ }
- private List collectPublications(final GenericPerson person) {
- final List publications = new ArrayList();
- final DataCollection collection = (DataCollection) person.get(
- "publication");
+ final String miscFilter = generateFilterForMiscGroup(groupsConfig);
+ final DataQuery miscQuery = SessionManager.getSession().
+ retrieveQuery(
+ "com.arsdigita.cms.contenttypes.getPublicationsForAuthor");
+ applyAuthorFilter(person, miscQuery, true);
+ miscQuery.addFilter(miscFilter);
+ groupQueries.put(MISC, miscQuery);
+ logger.debug(String.format("4: %d ms until now...", System.
+ currentTimeMillis() - start));
+ logger.debug(String.format("5: %d ms until now...", System.
+ currentTimeMillis() - start));
- while (collection.next()) {
- publications.add(collection.getDataObject());
- }
-
- if (person.getAlias() != null) {
- collectPublications(person, publications);
- }
-
- return publications;
- }
-
- private void collectPublications(final GenericPerson alias,
- final List publications) {
- final DataCollection collection = (DataCollection) alias.get(
- "publication");
-
- while (collection.next()) {
- publications.add(collection.getDataObject());
- }
-
- if (alias.getAlias() != null) {
- collectPublications(alias, publications);
- }
- }
-
- /**
- * Processes the publications and puts them into the groups.
- *
- * @param publications The publications to process
- * @param typeGroupMap The group-type map
- * @return A map with the group names as keys and a list of publications
- * as value.
- */
- private Map> processPublications(
- final List publications) {
-
- final GroupConfig groupConfig = new GroupConfig(config.
- getPublictionGroups());
- final Map> pubGroups =
- new LinkedHashMap>();
-
- for (String group : groupConfig.getGroups()) {
- initalizePubGroupMap(pubGroups, group);
- }
- initalizePubGroupMap(pubGroups, MISC);
-
- Publication publication;
- String type;
- String groupName;
- Boolean reviewed;
- List group;
- for (DataObject dobj : publications) {
- publication = (Publication) DomainObjectFactory.newInstance(dobj);
- type = publication.getClass().getName();
-
- if (dobj.getObjectType().hasProperty("reviewed")) {
- reviewed = (Boolean) dobj.get("reviewed");
- if (reviewed == null) {
- reviewed = Boolean.FALSE;
- }
- if (reviewed) {
- groupName = groupConfig.getTypeGroupMap().get(String.format(
- "%s_ref", type));
- } else {
- groupName = groupConfig.getTypeGroupMap().get(String.format(
- "%s_noref", type));
+ if (overallSize < config.getGroupSplit()) {
+ publicationsElem.addAttribute("all", "all");
+ for (Map.Entry> entry : groupsConfig.
+ entrySet()) {
+ generateXmlForGroup(entry.getKey(),
+ availableGroupsElem,
+ publicationsElem,
+ groupQueries.get(entry.getKey()),
+ state,
+ false,
+ true);
}
- if (groupName == null) {
- groupName = groupConfig.getTypeGroupMap().get(type);
- }
+ generateXmlForGroup(MISC,
+ availableGroupsElem,
+ publicationsElem,
+ groupQueries.get(MISC),
+ state,
+ false,
+ true);
} else {
- groupName = groupConfig.getTypeGroupMap().get(type);
- }
- if (groupName == null) {
- groupName = MISC;
- }
-
- group = pubGroups.get(groupName);
- group.add(publication);
- }
-
- final PublicationGroupComparator comparator =
- new PublicationGroupComparator();
- for (List currentGroup : pubGroups.values()) {
- Collections.sort(currentGroup, comparator);
- }
-
- return pubGroups;
- }
-
- private void initalizePubGroupMap(
- final Map> pubGroups,
- final String groupName) {
- pubGroups.put(groupName, new ArrayList());
- }
-
- private void generateGroupsXml(final Element parent,
- final Map> publications) {
- final Element availableGroups = parent.newChildElement(
- "availablePublicationGroups");
-
- for (Map.Entry> entry :
- publications.entrySet()) {
- if (!entry.getValue().isEmpty()) {
- createAvailablePublicationGroupXml(availableGroups,
- entry.getKey());
- }
- }
- }
-
- private void createAvailablePublicationGroupXml(final Element parent,
- final String name) {
- final Element group =
- parent.newChildElement("availablePublicationGroup");
- group.addAttribute("name", name);
- }
-
- private void generatePublicationsXml(
- final Element parent,
- final Map> publications,
- final PageState state) {
- final Element publicationsElem = parent.newChildElement("publications");
-
- int numberOfPubs = 0;
- final int groupSplit = config.getGroupSplit();
-
- for (List list : publications.values()) {
- numberOfPubs += list.size();
- }
-
- if (numberOfPubs < groupSplit) {
- publicationsElem.addAttribute("all", "all");
-
- for (Map.Entry> entry : publications.
- entrySet()) {
- if (entry.getValue().size() > 0) {
- generatePublicationGroupXml(publicationsElem,
- entry.getKey(),
- entry.getValue(),
- state);
+ final List availableGroups = new ArrayList();
+ logger.debug(String.format("6: %d ms until now...", System.
+ currentTimeMillis() - start));
+ for (Map.Entry> entry : groupsConfig.
+ entrySet()) {
+ if (!(groupQueries.get(entry.getKey()).isEmpty())) {
+ generateAvailableForGroup(entry.getKey(),
+ availableGroupsElem);
+ availableGroups.add(entry.getKey());
+ }
+ logger.debug(String.format("7: %d ms until now...", System.
+ currentTimeMillis() - start));
}
+ logger.debug(String.format("8: %d ms until now...", System.
+ currentTimeMillis() - start));
+
+ final long b1 = System.currentTimeMillis();
+ if (!(groupQueries.get(MISC).isEmpty())) {
+ generateAvailableForGroup(MISC,
+ availableGroupsElem);
+ availableGroups.add(MISC);
+ }
+ if (logger.isDebugEnabled()) {
+ logger.debug(String.format("9: %d ms until now...", System.
+ currentTimeMillis() - start));
+ logger.debug(String.format(
+ "Determined if misc group is available in %d ms",
+ System.currentTimeMillis() - b1));
+ logger.debug(String.format("Determined available groups "
+ + "in %d ms.",
+ System.currentTimeMillis()
+ - start));
+ }
+
+ final HttpServletRequest request = state.getRequest();
+ String group = selectGroup(request, config.getDefaultGroup(),
+ availableGroups);
+ if (logger.isDebugEnabled()) {
+ logger.debug(String.format("Selected group: '%s'", group));
+ }
+ logger.debug(String.format("10: %d ms until now...", System.
+ currentTimeMillis() - start));
+ generateXmlForGroup(group,
+ availableGroupsElem,
+ publicationsElem,
+ groupQueries.get(group),
+ state,
+ true,
+ false);
+ logger.debug(String.format("11: %d ms until now...", System.
+ currentTimeMillis() - start));
}
+
+ allQuery.close();
+ logger.debug(String.format("12: %d ms until now...", System.
+ currentTimeMillis() - start));
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.warn(String.format("Generated publications of %d publications "
+ + "for '%s' (%s) in %d ms.",
+ overallSize,
+ person.getFullName(),
+ person.getID().toString(),
+ System.currentTimeMillis() - start));
+ }
+ }
+
+ private void applyAuthorFilter(final GenericPerson person,
+ final DataQuery query,
+ final boolean addOrders) {
+ query.addFilter(String.format("authorId = %s",
+ person.getID().toString()));
+ if (addOrders) {
+ final String[] orders = config.getOrder().split(",");
+ for (String order : orders) {
+ query.addOrder(order);
+ }
+ }
+ }
+
+ private Map> getGroupsConfig() {
+ final String conf = config.getPublictionGroups();
+
+ final Map> groups =
+ new LinkedHashMap>();
+ final String[] groupTokens = conf.split(";");
+
+ for (String groupToken : groupTokens) {
+ processGroupToken(groupToken, groups);
+ }
+
+ return groups;
+ }
+
+ private void processGroupToken(final String groupToken,
+ final Map> groups) {
+ final String[] tokens = groupToken.split(":");
+ if (tokens.length != 2) {
+ throw new IllegalArgumentException("Failed to parse group config.");
+ }
+
+ final List types = new ArrayList();
+ final String[] typeTokens = tokens[1].split(",");
+ for (String typeToken : typeTokens) {
+ types.add(typeToken.trim());
+ }
+
+ groups.put(tokens[0], types);
+ }
+
+ private String generateFilterForTypeToken(String typeToken) {
+ if (typeToken.endsWith("_reviewed")) {
+ return String.format("(objectType = '%s' and reviewed = 'true')",
+ typeToken.substring(0, typeToken.length() - 9));
+ } else if (typeToken.endsWith("notreviewed")) {
+ return String.format(
+ "(objectType = '%s' and (reviewed = 'false' or reviewed is null))",
+ typeToken.substring(0, typeToken.length() - 12));
} else {
- final HttpServletRequest request = state.getRequest();
- final String[] defaultGroup = config.getDefaultGroup().split(",");
-
- String groupToShow = request.getParameter("group");
- if ((groupToShow == null)
- || groupToShow.isEmpty()
- || !(publications.containsKey(groupToShow))) {
- int i = 0;
- groupToShow = defaultGroup[i];
- while ((publications.get(groupToShow).isEmpty())
- && i < defaultGroup.length) {
- groupToShow = defaultGroup[i];
- i++;
- }
- }
-
- if (groupToShow == null) {
- groupToShow = MISC;
- }
-
- generatePublicationGroupXml(publicationsElem,
- groupToShow,
- publications.get(groupToShow),
- state);
+ return String.format("(objectType = '%s')", typeToken);
}
}
- private void generatePublicationGroupXml(final Element publicationsElem,
- final String groupName,
- final List publications,
- final PageState state) {
- if (publications == null) {
+ private String generateFilterForTypeTokens(final List typeTokens) {
+ final StringBuffer buffer = new StringBuffer();
+ for (String typeToken : typeTokens) {
+ if (buffer.length() > 0) {
+ buffer.append(" or ");
+ }
+ buffer.append(generateFilterForTypeToken(typeToken));
+ }
+
+ return buffer.toString();
+ }
+
+ private String generateFilterForMiscGroup(
+ final Map> groups) {
+ final StringBuffer buffer = new StringBuffer();
+
+ for (Map.Entry> entry : groups.entrySet()) {
+ if (buffer.length() > 0) {
+ buffer.append(" and ");
+ }
+ buffer.append(String.format("not (%s)",
+ generateFilterForTypeTokens(entry.
+ getValue())));
+ }
+
+ return buffer.toString();
+ }
+
+ private void applyFiltersForTypeTokens(final List typeTokens,
+ final DataQuery query) {
+ query.addFilter(generateFilterForTypeTokens(typeTokens));
+ }
+
+ private void generateAvailableForGroup(final String groupName,
+ final Element availableGroupsElem) {
+ final Element group =
+ availableGroupsElem.newChildElement(
+ "availablePublicationGroup");
+ group.addAttribute("name", groupName);
+ }
+
+ private void generateXmlForGroup(final String groupName,
+ final Element availableGroupsElem,
+ final Element publicationsElem,
+ final DataQuery query,
+ final PageState state,
+ final boolean withPaginator,
+ final boolean generateAvailable) {
+ if ((query == null) || query.isEmpty()) {
return;
}
+ if (generateAvailable) {
+ generateAvailableForGroup(groupName, availableGroupsElem);
+ }
+
final Element groupElem = publicationsElem.newChildElement(
"publicationGroup");
groupElem.addAttribute("name", groupName);
- for (Publication publication : publications) {
- generatePublicationXml(groupElem, publication, state);
+ if (withPaginator) {
+ final Paginator paginator = new Paginator(state.getRequest(),
+ (int) query.size(),
+ config.getPageSize());
+ paginator.applyLimits(query);
+ paginator.generateXml(groupElem);
}
+
+ while (query.next()) {
+ generatePublicationXml((BigDecimal) query.get("publicationId"),
+ (String) query.get("objectType"),
+ groupElem,
+ state);
+ }
+
}
- private void generatePublicationXml(final Element publicationGroupElem,
- final Publication publication,
+ private void generatePublicationXml(final BigDecimal publicationId,
+ final String objectType,
+ final Element parent,
final PageState state) {
- /*final PublicPersonalProfileXmlGenerator generator =
- new PublicPersonalProfileXmlGenerator(
- publication);
- generator.generateXML(state, publicationGroupElem, "");*/
- final PublicationXmlHelper xmlHelper = new PublicationXmlHelper(
- publicationGroupElem, publication);
+ final long start = System.currentTimeMillis();
+ final ContentItem publication = (ContentItem) DomainObjectFactory.
+ newInstance(new OID(
+ objectType, publicationId));
+ if (logger.isDebugEnabled()) {
+ logger.debug(String.format("Got domain object for publication "
+ + "'%s' in %d ms.",
+ publication.getName(),
+ System.currentTimeMillis() - start));
+ }
+ /*final XmlGenerator generator = new XmlGenerator(publication);
+ generator.setItemElemName("publications", "");
+ generator.generateXML(state, parent, "");*/
+ final PublicationXmlHelper xmlHelper = new PublicationXmlHelper(parent,
+ (Publication) publication);
xmlHelper.generateXml();
+ if (logger.isDebugEnabled()) {
+ logger.debug(String.format("Generated XML for publication '%s' "
+ + "in %d ms.",
+ publication.getName(),
+ System.currentTimeMillis() - start));
+ }
}
- /**
- * Processes the publications and puts them into the groups.
- *
- * @param publications The publications to process
- * @param typeGroupMap The group-type map
- * @return A map with the group names as keys and a list of publications
- * as value.
- */
- private class GroupConfig {
+ private class XmlGenerator extends SimpleXMLGenerator {
- private final Map typeGroupMap =
- new HashMap();
- private final List groups = new ArrayList();
+ private final ContentItem item;
- /**
- * Processes the configuration string and puts the result into the
- * collections.
- *
- * @param groupStr
- */
- public GroupConfig(final String groupStr) {
- final String[] groupTokens = groupStr.split(";");
- String[] groupTokenSplit;
- String groupName;
- String publicationTypeTokens;
- String[] publicationTypeTokensSplit;
- List types;
- for (String groupToken : groupTokens) {
- groupTokenSplit = groupToken.split(":");
- if (groupTokenSplit.length != 2) {
- logger.warn(String.format(
- "Invalid entry in publication group config: '%s'. "
- + "Ignoring.",
- groupToken));
- continue;
- }
+ public XmlGenerator(final ContentItem item) {
+ super();
+ this.item = item;
+ }
- groupName = groupTokenSplit[0];
- groups.add(groupName);
- publicationTypeTokens = groupTokenSplit[1];
- publicationTypeTokensSplit = publicationTypeTokens.split(",");
- for (String publicationTypeToken : publicationTypeTokensSplit) {
- typeGroupMap.put(publicationTypeToken, groupName);
+ @Override
+ protected ContentItem getContentItem(final PageState state) {
+ return item;
+ }
+ }
+
+ private String selectGroup(final HttpServletRequest request,
+ final String defaultGroupConfig,
+ final List availableGroups) {
+ String group = request.getParameter("group");
+ if ((group == null)
+ || group.trim().isEmpty()
+ || !(availableGroups.contains(group))) {
+ String defaultGroups[] = defaultGroupConfig.split(",");
+
+ for (String defaultGroup : defaultGroups) {
+ if (availableGroups.contains(defaultGroup)) {
+ group = defaultGroup;
+ break;
}
}
}
- public Map getTypeGroupMap() {
- return Collections.unmodifiableMap(typeGroupMap);
- }
-
- public List getGroups() {
- return Collections.unmodifiableList(groups);
- }
+ return group;
}
- private class PublicationGroupComparator implements Comparator {
+ private void createGroupQuery(final GenericPerson author,
+ final String groupName,
+ final List typeTokens,
+ final Map groupQueries) {
+ final DataQuery query = SessionManager.getSession().retrieveQuery(
+ "com.arsdigita.cms.contenttypes.getPublicationsForAuthor");
+ applyAuthorFilter(author, query, true);
+ applyFiltersForTypeTokens(typeTokens, query);
- public int compare(final Publication publication1,
- final Publication publication2) {
- AuthorshipCollection authors1;
- AuthorshipCollection authors2;
- GenericPerson author;
- String authorsStr1;
- String authorsStr2;
- final StringBuffer authors1Buffer = new StringBuffer();
- final StringBuffer authors2Buffer = new StringBuffer();
-
- authors1 = publication1.getAuthors();
- while (authors1.next()) {
- author = authors1.getAuthor();
- authors1Buffer.append(author.getSurname());
- authors1Buffer.append(author.getGivenName());
- }
- authors2 = publication2.getAuthors();
- while (authors2.next()) {
- author = authors2.getAuthor();
- authors2Buffer.append(author.getSurname());
- authors2Buffer.append(author.getGivenName());
- }
-
- authorsStr1 = authors1Buffer.toString();
- authorsStr2 = authors2Buffer.toString();
-
- return authorsStr1.compareTo(authorsStr2);
- }
+ groupQueries.put(groupName, query);
}
+
+ /* ------------ */
+// public void generateContentOld(final Element parent,
+// final GenericPerson person,
+// final PageState state) {
+// final long start = System.currentTimeMillis();
+// final List publications = collectPublications(person);
+//
+// final Element personalPubsElem = parent.newChildElement(
+// "personalPublications");
+//
+// if ((publications == null) || publications.isEmpty()) {
+// personalPubsElem.newChildElement("noPublications");
+//
+// return;
+// } else {
+// final Map> groupedPublications =
+// processPublications(
+// publications);
+//
+// generateGroupsXml(personalPubsElem, groupedPublications);
+// generatePublicationsXml(personalPubsElem, groupedPublications, state);
+// }
+// if (logger.isDebugEnabled()) {
+// logger.debug(String.format("Generated publications of %d publications "
+// + "for '%s' in %d ms.",
+// publications.size(),
+// person.getFullName(),
+// System.currentTimeMillis() - start));
+// }
+// }
+//
+// private List collectPublications(final GenericPerson person) {
+// final long start = System.currentTimeMillis();
+// final List publications = new ArrayList();
+// final DataCollection collection = (DataCollection) person.get(
+// "publication");
+//
+// while (collection.next()) {
+// publications.add(collection.getDataObject());
+// }
+//
+// if (person.getAlias() != null) {
+// collectPublications(person, publications);
+// }
+//
+// if (logger.isDebugEnabled()) {
+// logger.debug(String.format(
+// "Collected publications of '%s' in %d ms.",
+// person.getFullName(),
+// System.currentTimeMillis() - start));
+// }
+// return publications;
+// }
+//
+// private void collectPublications(final GenericPerson alias,
+// final List publications) {
+// final DataCollection collection = (DataCollection) alias.get(
+// "publication");
+//
+// while (collection.next()) {
+// publications.add(collection.getDataObject());
+// }
+//
+// if (alias.getAlias() != null) {
+// collectPublications(alias, publications);
+// }
+// }
+//
+// /**
+// * Processes the publications and puts them into the groups.
+// *
+// * @param publications The publications to process
+// * @param typeGroupMap The group-type map
+// * @return A map with the group names as keys and a list of publications
+// * as value.
+// */
+// private Map> processPublications(
+// final List publications) {
+//
+// final long start = System.currentTimeMillis();
+// final GroupConfig groupConfig = new GroupConfig(config.
+// getPublictionGroups());
+// final Map> pubGroups =
+// new LinkedHashMap>();
+//
+// for (String group : groupConfig.getGroups()) {
+// initalizePubGroupMap(pubGroups, group);
+// }
+// initalizePubGroupMap(pubGroups, MISC);
+//
+// Publication publication;
+// String type;
+// String groupName;
+// Boolean reviewed;
+// List group;
+// int i = 1;
+// for (DataObject dobj : publications) {
+// if (logger.isDebugEnabled()) {
+// logger.debug(String.format("Processing publications %d "
+// + "of %d...",
+// i,
+// publications.size()));
+// }
+// i++;
+// publication = (Publication) DomainObjectFactory.newInstance(dobj);
+// type = publication.getClass().getName();
+//
+// if (dobj.getObjectType().hasProperty("reviewed")) {
+// reviewed = (Boolean) dobj.get("reviewed");
+// if (reviewed == null) {
+// reviewed = Boolean.FALSE;
+// }
+// if (reviewed) {
+// groupName = groupConfig.getTypeGroupMap().get(String.format(
+// "%s_ref", type));
+// } else {
+// groupName = groupConfig.getTypeGroupMap().get(String.format(
+// "%s_noref", type));
+// }
+//
+// if (groupName == null) {
+// groupName = groupConfig.getTypeGroupMap().get(type);
+// }
+// } else {
+// groupName = groupConfig.getTypeGroupMap().get(type);
+// }
+//
+// if (groupName == null) {
+// groupName = MISC;
+// }
+//
+// group = pubGroups.get(groupName);
+// group.add(publication);
+// }
+//
+// final PublicationGroupComparator comparator =
+// new PublicationGroupComparator();
+// for (List currentGroup : pubGroups.values()) {
+// Collections.sort(currentGroup, comparator);
+// }
+//
+// if (logger.isDebugEnabled()) {
+// logger.debug(String.format("Proceessed %d publications in %d ms.",
+// publications.size(),
+// System.currentTimeMillis() - start));
+// }
+// return pubGroups;
+// }
+//
+// private void initalizePubGroupMap(
+// final Map> pubGroups,
+// final String groupName) {
+// pubGroups.put(groupName, new ArrayList());
+// }
+//
+// private void generateGroupsXml(final Element parent,
+// final Map> publications) {
+// final Element availableGroups = parent.newChildElement(
+// "availablePublicationGroups");
+//
+// for (Map.Entry> entry :
+// publications.entrySet()) {
+// if (!entry.getValue().isEmpty()) {
+// createAvailablePublicationGroupXml(availableGroups,
+// entry.getKey());
+// }
+// }
+// }
+//
+// private void createAvailablePublicationGroupXml(final Element parent,
+// final String name) {
+// final Element group =
+// parent.newChildElement("availablePublicationGroup");
+// group.addAttribute("name", name);
+// }
+//
+// private void generatePublicationsXml(
+// final Element parent,
+// final Map> publications,
+// final PageState state) {
+// final Element publicationsElem = parent.newChildElement("publications");
+//
+// int numberOfPubs = 0;
+// final int groupSplit = config.getGroupSplit();
+//
+// for (List list : publications.values()) {
+// numberOfPubs += list.size();
+// }
+//
+// if (numberOfPubs < groupSplit) {
+// publicationsElem.addAttribute("all", "all");
+//
+// for (Map.Entry> entry : publications.
+// entrySet()) {
+// if (entry.getValue().size() > 0) {
+// generatePublicationGroupXml(publicationsElem,
+// entry.getKey(),
+// entry.getValue(),
+// state);
+// }
+// }
+// } else {
+// final HttpServletRequest request = state.getRequest();
+// final String[] defaultGroup = config.getDefaultGroup().split(",");
+//
+// String groupToShow = request.getParameter("group");
+// if ((groupToShow == null)
+// || groupToShow.isEmpty()
+// || !(publications.containsKey(groupToShow))) {
+// int i = 0;
+// groupToShow = defaultGroup[i];
+// while ((publications.get(groupToShow).isEmpty())
+// && i < defaultGroup.length) {
+// groupToShow = defaultGroup[i];
+// i++;
+// }
+// }
+//
+// if (groupToShow == null) {
+// groupToShow = MISC;
+// }
+//
+// generatePublicationGroupXml(publicationsElem,
+// groupToShow,
+// publications.get(groupToShow),
+// state);
+// }
+// }
+//
+// private void generatePublicationGroupXml(final Element publicationsElem,
+// final String groupName,
+// final List publications,
+// final PageState state) {
+// if (publications == null) {
+// return;
+// }
+//
+// final Element groupElem = publicationsElem.newChildElement(
+// "publicationGroup");
+// groupElem.addAttribute("name", groupName);
+//
+// for (Publication publication : publications) {
+// generatePublicationXml(groupElem, publication, state);
+// }
+// }
+//
+// private void generatePublicationXml(final Element publicationGroupElem,
+// final Publication publication,
+// final PageState state) {
+// /*final PublicPersonalProfileXmlGenerator generator =
+// new PublicPersonalProfileXmlGenerator(
+// publication);
+// generator.generateXML(state, publicationGroupElem, "");*/
+// final PublicationXmlHelper xmlHelper = new PublicationXmlHelper(
+// publicationGroupElem, publication);
+// xmlHelper.generateXml();
+// }
+//
+// /**
+// * Processes the publications and puts them into the groups.
+// *
+// * @param publications The publications to process
+// * @param typeGroupMap The group-type map
+// * @return A map with the group names as keys and a list of publications
+// * as value.
+// */
+// private class GroupConfig {
+//
+// private final Map typeGroupMap =
+// new HashMap();
+// private final List groups = new ArrayList();
+//
+// /**
+// * Processes the configuration string and puts the result into the
+// * collections.
+// *
+// * @param groupStr
+// */
+// public GroupConfig(final String groupStr) {
+// final String[] groupTokens = groupStr.split(";");
+// String[] groupTokenSplit;
+// String groupName;
+// String publicationTypeTokens;
+// String[] publicationTypeTokensSplit;
+// List types;
+// for (String groupToken : groupTokens) {
+// groupTokenSplit = groupToken.split(":");
+// if (groupTokenSplit.length != 2) {
+// logger.warn(String.format(
+// "Invalid entry in publication group config: '%s'. "
+// + "Ignoring.",
+// groupToken));
+// continue;
+// }
+//
+// groupName = groupTokenSplit[0];
+// groups.add(groupName);
+// publicationTypeTokens = groupTokenSplit[1];
+// publicationTypeTokensSplit = publicationTypeTokens.split(",");
+// for (String publicationTypeToken : publicationTypeTokensSplit) {
+// typeGroupMap.put(publicationTypeToken, groupName);
+// }
+// }
+// }
+//
+// public Map getTypeGroupMap() {
+// return Collections.unmodifiableMap(typeGroupMap);
+// }
+//
+// public List getGroups() {
+// return Collections.unmodifiableList(groups);
+// }
+// }
+//
+// private class PublicationGroupComparator implements Comparator {
+//
+// public int compare(final Publication publication1,
+// final Publication publication2) {
+// AuthorshipCollection authors1;
+// AuthorshipCollection authors2;
+// GenericPerson author;
+// String authorsStr1;
+// String authorsStr2;
+// final StringBuffer authors1Buffer = new StringBuffer();
+// final StringBuffer authors2Buffer = new StringBuffer();
+//
+// authors1 = publication1.getAuthors();
+// while (authors1.next()) {
+// author = authors1.getAuthor();
+// authors1Buffer.append(author.getSurname());
+// authors1Buffer.append(author.getGivenName());
+// }
+// authors2 = publication2.getAuthors();
+// while (authors2.next()) {
+// author = authors2.getAuthor();
+// authors2Buffer.append(author.getSurname());
+// authors2Buffer.append(author.getGivenName());
+// }
+//
+// authorsStr1 = authors1Buffer.toString();
+// authorsStr2 = authors2Buffer.toString();
+//
+// return authorsStr1.compareTo(authorsStr2);
+// }
+// }
}
diff --git a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java
index 461b72c42..852476a4b 100644
--- a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java
+++ b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java
@@ -35,7 +35,7 @@ public class PersonalPublicationsConfig extends AbstractConfig {
* lowercase), all numbers and the underscore "{@code _}". A type name
* is the fully qualified name of content type derived from
* {@link Publication}. A type name can be followed by the literals
- * {@code _ref} and {@code _noref}. If a type name is not followed by
+ * {@code _reviewed} and {@code _notriewed}. If a type name is not followed by
* one of this literals, all publications of the type will be put into the
* group. If the type name is followed by one of this literals, the property
* {@code reviewed} is checked. If the type has this property, publications
@@ -61,6 +61,10 @@ public class PersonalPublicationsConfig extends AbstractConfig {
* be used here.
*/
private final Parameter defaultGroup;
+
+ private final Parameter pageSize;
+
+ private final Parameter order;
public PersonalPublicationsConfig() {
publicationGroups =
@@ -70,22 +74,34 @@ public class PersonalPublicationsConfig extends AbstractConfig {
"monographs:com.arsdigita.cms.contenttypes.Monograph;"
+ "collectedVolumeArticles:com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;"
+ "journalArticles:com.arsdigita.cms.contenttypes.ArticleInJournal;"
- + "journalArticlesRef:com.arsdigita.cms.contenttypes.ArticleInJournal_ref;"
+ + "journalArticlesReviewed:com.arsdigita.cms.contenttypes.ArticleInJournal_reviewed;"
+ "collectedVolumes:com.arsdigita.cms.contenttypes.CollectedVolume");
groupSplit = new IntegerParameter(
"com.arsdigita.cms.publicpersonlprofile.publications.groupSplit",
Parameter.REQUIRED,
- 32);
+ 12);
defaultGroup = new StringParameter(
"com.arsdigita.cms.publicpersonalprofile.publications.defaultGroup",
Parameter.REQUIRED,
- "monographs,journalArticlesRef,journalArticles,misc");
+ "monographs,journalArticlesReviewed,journalArticles,misc");
+
+ pageSize = new IntegerParameter(
+ "com.arsdigita.cms.publicpersonlprofile.publications.pageSize",
+ Parameter.REQUIRED,
+ 10);
+
+ order = new StringParameter(
+ "com.arsdigita.cms.publicpersonlprofile.publications.order",
+ Parameter.REQUIRED,
+ "year,title");
register(publicationGroups);
register(groupSplit);
register(defaultGroup);
+ register(pageSize);
+ register(order);
loadInfo();
}
@@ -101,4 +117,12 @@ public class PersonalPublicationsConfig extends AbstractConfig {
public final String getDefaultGroup() {
return (String) get(defaultGroup);
}
+
+ public final Integer getPageSize() {
+ return (Integer) get(pageSize);
+ }
+
+ public final String getOrder() {
+ return (String) get(order);
+ }
}
diff --git a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig_parameter.properties b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig_parameter.properties
index 4eb84afd0..c4a7f4682 100644
--- a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig_parameter.properties
+++ b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig_parameter.properties
@@ -1,6 +1,6 @@
com.arsdigita.cms.publicpersonalprofile.publications.groups.title = Groups of publications
-com.arsdigita.cms.publicpersonalprofile.publications.groups.purpose = Groups the publications of a person by their Type and optional the Property "Referenced". See the JavaDoc of com.arsdigita.cms.publicpersonalprofile.PersonalPublications for a detailed explanation of the syntax of this parameter
-com.arsdigita.cms.publicpersonalprofile.publications.groups.example = monographs:com.arsdigita.cms.contenttypes.Monograph;collectedVolumeArticles:com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;journalArticles:com.arsdigita.cms.contenttypes.ArticleInJournal;journalArticlesRef:com.arsdigita.cms.contenttypes.ArticleInJournal_ref;collectedVolumes:com.arsdigita.cms.contenttypes.CollectedVolume
+com.arsdigita.cms.publicpersonalprofile.publications.groups.purpose = Groups the publications of a person by their Type and optional the Property "reviewed". See the JavaDoc of com.arsdigita.cms.publicpersonalprofile.PersonalPublications for a detailed explanation of the syntax of this parameter
+com.arsdigita.cms.publicpersonalprofile.publications.groups.example = monographs:com.arsdigita.cms.contenttypes.Monograph;collectedVolumeArticles:com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;journalArticles:com.arsdigita.cms.contenttypes.ArticleInJournal;journalArticlesRef:com.arsdigita.cms.contenttypes.ArticleInJournal_reviewed;collectedVolumes:com.arsdigita.cms.contenttypes.CollectedVolume
com.arsdigita.cms.publicpersonalprofile.publications.groups.format = [String]
com.arsdigita.cms.publicpersonlprofile.publications.groupSplit.title = Group Split
@@ -11,4 +11,14 @@ com.arsdigita.cms.publicpersonlprofile.publications.groupSplit.format = [Integer
com.arsdigita.cms.publicpersonlprofile.publications.defaultGroup.title = Default Group
com.arsdigita.cms.publicpersonlprofile.publications.defaultGroup.purpose = Default group to show
com.arsdigita.cms.publicpersonlprofile.publications.defaultGroup.example = monographs,journalArticlesRef,journalArticles,misc
-com.arsdigita.cms.publicpersonlprofile.publications.defaultGroup.format = [String]
\ No newline at end of file
+com.arsdigita.cms.publicpersonlprofile.publications.defaultGroup.format = [String]
+
+com.arsdigita.cms.publicpersonlprofile.publications.pageSize.title = Page size
+com.arsdigita.cms.publicpersonlprofile.publications.pageSize.purpose = Page size
+com.arsdigita.cms.publicpersonlprofile.publications.pageSize.example = 30
+com.arsdigita.cms.publicpersonlprofile.publications.pageSize.format = [Integer]
+
+com.arsdigita.cms.publicpersonlprofile.publications.order.title = Order
+com.arsdigita.cms.publicpersonlprofile.publications.order.purpose = Order of publications
+com.arsdigita.cms.publicpersonlprofile.publications.order.example = Order of publications. Comma separated list of the following properties: title, year, authors
+com.arsdigita.cms.publicpersonlprofile.publications.order.format = [String]
\ No newline at end of file
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInCollectedVolume.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInCollectedVolume.pdl
index 6d65cfd7c..de98df320 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInCollectedVolume.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInCollectedVolume.pdl
@@ -28,7 +28,7 @@ object type ArticleInCollectedVolume extends Publication {
Integer[0..1] pagesFrom = ct_article_in_collected_volume.pages_from INTEGER;
Integer[0..1] pagesTo = ct_article_in_collected_volume.pages_to INTEGER;
String[0..1] chapter = ct_article_in_collected_volume.chapter VARCHAR(512);
- Boolean[0..1] reviewed = ct_article_in_collected_volume.reviewed BIT;
+ //Moved to Publication Boolean[0..1] reviewed = ct_article_in_collected_volume.reviewed BIT;
reference key (ct_article_in_collected_volume.article_id);
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInJournal.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInJournal.pdl
index 44ea17158..adfd77e14 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInJournal.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/ArticleInJournal.pdl
@@ -30,7 +30,7 @@ object type ArticleInJournal extends Publication {
Integer[0..1] pagesFrom = ct_article_in_journal.pages_from INTEGER;
Integer[0..1] pagesTo = ct_article_in_journal.pages_to INTEGER;
Date[0..1] publicationDate = ct_article_in_journal.publication_date DATE;
- Boolean[0..1] reviewed = ct_article_in_journal.reviewed BIT;
+ //Moved to publication Boolean[0..1] reviewed = ct_article_in_journal.reviewed BIT;
reference key (ct_article_in_journal.article_in_journal_id);
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/CollectedVolume.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/CollectedVolume.pdl
index f6d313670..c3350fe9f 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/CollectedVolume.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/CollectedVolume.pdl
@@ -27,7 +27,7 @@ object type CollectedVolume extends PublicationWithPublisher {
reference key (ct_collected_volume.collected_volume_id);
- Boolean[0..1] reviewed = ct_collected_volume.reviewed BIT;
+ //Moved to publication Boolean[0..1] reviewed = ct_collected_volume.reviewed BIT;
}
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/Monograph.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/Monograph.pdl
index 57c7f467f..5c592d233 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/Monograph.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/Monograph.pdl
@@ -27,6 +27,6 @@ object type Monograph extends PublicationWithPublisher {
reference key (ct_monograph.monograph_id);
- Boolean[0..1] reviewed = ct_monograph.reviewed BIT;
+ //Moved to publication Boolean[0..1] reviewed = ct_monograph.reviewed BIT;
}
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl
index 34489c979..cc035e90a 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/Publication.pdl
@@ -1,6 +1,5 @@
//
-// Copyright (C) 2010 Jens Pelzetter, for the Center of Social Politics (ZeS) of
-// the University of Bremen
+// Copyright (C) 2010, 2011 Jens Pelzetter
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
@@ -28,6 +27,13 @@ object type Publication extends ContentPage {
Integer[0..1] yearOfPublication = ct_publications.year INTEGER;
String[0..1] abstract = ct_publications.abstract VARCHAR(4096);
String[0..1] misc = ct_publications.misc VARCHAR(4096);
+ //The reviewed property has been moved for performance reasons. It
+ //is necessary to have access to this property from a data query
+ //over all publications of a person. Since this property was only
+ //available on some types, it was not possible to use joins *and*
+ //get publications of *all* types. But exactly this use case appears on
+ //several points.
+ Boolean[0..1] reviewed = ct_publications.reviewed BIT ;
reference key (ct_publications.publication_id);
}
@@ -79,7 +85,13 @@ query getIdsOfPublicationsForOrgaUnitOneRowPerAuthor {
String authorGivenname;
do {
- select cms_pages.item_id, cms_pages.title, acs_objects.object_type, cms_organizationalunits.organizationalunit_id, ct_publications.year, cms_persons.surname, cms_persons.givenname
+ select cms_pages.item_id,
+ cms_pages.title,
+ acs_objects.object_type,
+ cms_organizationalunits.organizationalunit_id,
+ ct_publications.year,
+ cms_persons.surname,
+ cms_persons.givenname
from cms_pages
join ct_publications on cms_pages.item_id = ct_publications.publication_id
join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
@@ -110,10 +122,15 @@ query getIdsOfPublicationsForOrgaUnit {
String authors;
do {
- select cms_pages.item_id, acs_object.object_type, cms_pages.title, cms_organizationalunits.organizationalunit_id, ct_publications.year, (select array_to_string (array (select cms_persons.surname || ', ' || cms_persons.givenname
- from cms_persons
- join ct_publications_authorship_map on cms_persons.person_id = ct_publications_authorship.person_id
- where ct_publications_authorship.publication_id = cms_pages.item_id), '; ')) as authors
+ select cms_pages.item_id,
+ acs_objects.object_type,
+ cms_pages.title,
+ cms_organizationalunits.organizationalunit_id,
+ ct_publications.year,
+ (select array_to_string (array (select cms_persons.surname || ', ' || cms_persons.givenname
+ from cms_persons
+ join ct_publications_authorship on cms_persons.person_id = ct_publications_authorship.person_id
+ where ct_publications_authorship.publication_id = cms_pages.item_id), '; ')) as authors
from cms_pages
join ct_publications on cms_pages.item_id = ct_publications.publication_id
join cms_organizationalunits_publications_map on cms_pages.item_id = cms_organizationalunits_publications_map.publication_id
@@ -129,6 +146,72 @@ query getIdsOfPublicationsForOrgaUnit {
}
}
+//Retrieves all publications of an author
+query getPublicationsForAuthor {
+ BigDecimal publicationId;
+ BigDecimal authorId;
+ String objectType;
+ String title;
+ Integer year;
+ Boolean reviewed;
+
+ do {
+ select cms_pages.item_id,
+ acs_objects.object_type,
+ cms_pages.title,
+ ct_publications_authorship.person_id,
+ ct_publications.year,
+ ct_publications.reviewed
+ from cms_pages
+ join ct_publications on cms_pages.item_id = ct_publications.publication_id
+ join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
+ join acs_objects on cms_pages.item_id = acs_objects.object_id
+ } map {
+ publicationId = cms_pages.item_id;
+ objectType = acs_objects.object_type;
+ authorId = ct_publications_authorship.person_id;
+ title = cms_pages.title;
+ year = ct_publications.year;
+ reviewed = ct_publications.reviewed;
+ }
+}
+
+//Retrieves all publications of an author
+query getPublicationsForAuthorWithAuthors {
+ BigDecimal publicationId;
+ BigDecimal authorId;
+ String objectType;
+ String title;
+ Integer year;
+ String authors;
+ Boolean reviewed;
+
+ do {
+ select cms_pages.item_id,
+ acs_objects.object_type,
+ cms_pages.title,
+ ct_publications_authorship.person_id,
+ ct_publications.year,
+ ct_publications.reviewed,
+ (select array_to_string(array (select cms_persons.surname || ', ' || cms_persons.givenname
+ from cms_persons
+ join ct_publications_authorship on cms_persons.person_id = ct_publications_authorship.person_id
+ where ct_publications_authorship.publication_id = cms_pages.item_id), '; ')) as authors
+ from cms_pages
+ join ct_publications on cms_pages.item_id = ct_publications.publication_id
+ join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
+ join acs_objects on cms_pages.item_id = acs_objects.object_id
+ } map {
+ publicationId = cms_pages.item_id;
+ objectType = acs_objects.object_type;
+ authorId = ct_publications_authorship.person_id;
+ title = cms_pages.title;
+ year = ct_publications.year;
+ authors = authors;
+ reviewed = ct_publications.reviewed;
+ }
+}
+
//Old, possible obsolete queries. Will be removed soon
query getAllYearsOfPublication {
Integer yearOfPublication;
diff --git a/ccm-sci-publications/pdl/com/arsdigita/content-types/WorkingPaper.pdl b/ccm-sci-publications/pdl/com/arsdigita/content-types/WorkingPaper.pdl
index f650261b5..fd35f7826 100644
--- a/ccm-sci-publications/pdl/com/arsdigita/content-types/WorkingPaper.pdl
+++ b/ccm-sci-publications/pdl/com/arsdigita/content-types/WorkingPaper.pdl
@@ -26,6 +26,6 @@ import com.arsdigita.cms.ContentPage;
object type WorkingPaper extends UnPublished {
reference key (ct_working_paper.working_paper_id);
- Boolean[0..1] reviewed = ct_working_paper.reviewed BIT;
+ //Moved to publication Boolean[0..1] reviewed = ct_working_paper.reviewed BIT;
}
\ No newline at end of file
diff --git a/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.0-6.6.1/move-reviewed.sql b/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.0-6.6.1/move-reviewed.sql
new file mode 100644
index 000000000..741f008e7
--- /dev/null
+++ b/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.0-6.6.1/move-reviewed.sql
@@ -0,0 +1,47 @@
+-- Add column for reviewed property to ct_publications table
+alter table ct_publications add column reviewed boolean;
+
+-- Copy existing values for reviewed from
+-- * ct_article_in_collected_volume
+-- * ct_article_in_journal
+-- * ct_collected_volume
+-- * ct_monograph
+-- * ct_working_paper
+
+update ct_publications set reviewed = (select ct_article_in_collected_volume.reviewed
+ from ct_article_in_collected_volume
+ where ct_article_in_collected_volume.article_id = ct_publications.publication_id)
+from ct_article_in_collected_volume
+where ct_publications.publication_id = ct_article_in_collected_volume.article_id;
+
+update ct_publications set reviewed = (select ct_article_in_journal.reviewed
+ from ct_article_in_journal
+ where ct_article_in_journal.article_in_journal_id = ct_publications.publication_id)
+from ct_article_in_journal
+where ct_publications.publication_id = ct_article_in_journal.article_in_journal_id;
+
+update ct_publications set reviewed = (select ct_collected_volume.reviewed
+ from ct_collected_volume
+ where ct_collected_volume.collected_volume_id = ct_publications.publication_id)
+from ct_collected_volume
+where ct_publications.publication_id = ct_collected_volume.collected_volume_id;
+
+update ct_publications set reviewed = (select ct_monograph.reviewed
+ from ct_monograph
+ where ct_monograph.monograph_id = ct_publications.publication_id)
+from ct_monograph
+where ct_publications.publication_id = ct_monograph.monograph_id;
+
+update ct_publications set reviewed = (select ct_working_paper.reviewed
+ from ct_working_paper
+ where ct_working_paper.working_paper_id = ct_publications.publication_id)
+from ct_working_paper
+where ct_publications.publication_id = ct_working_paper.working_paper_id;
+
+-- Drop obsoletes columns
+
+alter table ct_article_in_collected_volume drop column reviewed;
+alter table ct_article_in_journal drop column reviewed;
+alter table ct_collected_volume drop column reviewed;
+alter table ct_monograph drop column reviewed;
+alter table ct_working_paper drop column reviewed;
\ No newline at end of file
diff --git a/ccm-sci-publications/sql/ccm-sci-publications/upgrade/postgres-6.6.0-6.6.1.sql b/ccm-sci-publications/sql/ccm-sci-publications/upgrade/postgres-6.6.0-6.6.1.sql
index 487e980e7..f64388290 100644
--- a/ccm-sci-publications/sql/ccm-sci-publications/upgrade/postgres-6.6.0-6.6.1.sql
+++ b/ccm-sci-publications/sql/ccm-sci-publications/upgrade/postgres-6.6.0-6.6.1.sql
@@ -3,5 +3,6 @@
begin;
\i ../default/upgrade/6.6.0-6.6.1/update-genericorgaunit-publication-assoc.sql
+\i ../default/upgrade/6.6.0-6.6.1/move-reviewed.sql
commit;
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Expertise.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Expertise.xml
index 763afe5ab..a2cb07227 100644
--- a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Expertise.xml
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Expertise.xml
@@ -4,18 +4,22 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
-
+
-
-
-
-
-
+
+
+
-
+
+
+
+
-
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GreyLiterature.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GreyLiterature.xml
index ba9a2c8bc..b0c705128 100644
--- a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GreyLiterature.xml
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GreyLiterature.xml
@@ -4,17 +4,21 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
-
+
-
-
-
-
+
+
+
-
+
+
+
-
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InProceedings.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InProceedings.xml
index 724290933..c2d947bf0 100644
--- a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InProceedings.xml
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InProceedings.xml
@@ -4,15 +4,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InternetArticle.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InternetArticle.xml
index 940697d1d..2a6b18ec3 100644
--- a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InternetArticle.xml
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/InternetArticle.xml
@@ -4,17 +4,21 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
-
+
-
-
-
-
+
+
+
-
+
+
+
-
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Journal.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Journal.xml
index b9c294a67..3c92222ed 100644
--- a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Journal.xml
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Journal.xml
@@ -4,15 +4,20 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Proceedings.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Proceedings.xml
index 59baaf337..1fe29b789 100644
--- a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Proceedings.xml
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Proceedings.xml
@@ -4,19 +4,23 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Review.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Review.xml
new file mode 100644
index 000000000..39cb9ba34
--- /dev/null
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Review.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/UnPublished.xml b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/UnPublished.xml
index f2c4571bc..c90ccfadd 100644
--- a/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/UnPublished.xml
+++ b/ccm-sci-publications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/UnPublished.xml
@@ -4,17 +4,21 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
-
+
-
-
-
-
+
+
+
-
+
+
+
-
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/ccm-sci-publications.upgrade b/ccm-sci-publications/src/ccm-sci-publications.upgrade
new file mode 100644
index 000000000..75ed4ddf1
--- /dev/null
+++ b/ccm-sci-publications/src/ccm-sci-publications.upgrade
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInCollectedVolume.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInCollectedVolume.java
index ece9014b6..407ea5cbe 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInCollectedVolume.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInCollectedVolume.java
@@ -37,7 +37,7 @@ public class ArticleInCollectedVolume extends Publication {
public final static String PAGES_TO = "pagesTo";
public final static String CHAPTER = "chapter";
public final static String COLLECTED_VOLUME = "collectedVolume";
- public static final String REVIEWED = "reviewed";
+ //public static final String REVIEWED = "reviewed";
public final static String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.ArticleInCollectedVolume";
@@ -88,13 +88,13 @@ public class ArticleInCollectedVolume extends Publication {
set(CHAPTER, chapter);
}
- public Boolean getReviewed() {
+ /*public Boolean getReviewed() {
return (Boolean) get(REVIEWED);
}
public void setReviewed(Boolean reviewed) {
set(REVIEWED, reviewed);
- }
+// }*/
public CollectedVolume getCollectedVolume() {
DataCollection collection;
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInJournal.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInJournal.java
index 4a29ad957..b5909a484 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInJournal.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ArticleInJournal.java
@@ -40,7 +40,7 @@ public class ArticleInJournal extends Publication {
public static final String PAGES_TO = "pagesTo";
public static final String JOURNAL = "journal";
public static final String PUBLICATION_DATE = "publicationDate";
- public static final String REVIEWED = "reviewed";
+ //public static final String REVIEWED = "reviewed";
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.ArticleInJournal";
@@ -104,13 +104,13 @@ public class ArticleInJournal extends Publication {
set(PUBLICATION_DATE, publicationDate);
}
- public Boolean getReviewed() {
+ /* public Boolean getReviewed() {
return (Boolean) get(REVIEWED);
}
public void setReviewed(Boolean reviewed) {
set(REVIEWED, reviewed);
- }
+ }*/
public Journal getJournal() {
DataCollection collection;
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/AuthorshipCollection.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/AuthorshipCollection.java
index 100fc94c3..072ee25c7 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/AuthorshipCollection.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/AuthorshipCollection.java
@@ -53,7 +53,7 @@ public class AuthorshipCollection extends DomainCollection {
}
public Boolean isEditor() {
- System.out.printf("isEditor?\n");
+ //System.out.printf("isEditor?\n");
return (Boolean) m_dataCollection.get(LINKEDITOR);
}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/CollectedVolume.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/CollectedVolume.java
index 50688a036..0d27fe037 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/CollectedVolume.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/CollectedVolume.java
@@ -36,7 +36,7 @@ public class CollectedVolume extends PublicationWithPublisher {
public static final String ARTICLES = "articles";
public static final String ARTICLE_ORDER = "articleOrder";
- public static final String REVIEWED = "reviewed";
+ //public static final String REVIEWED = "reviewed";
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.CollectedVolume";
@@ -60,13 +60,13 @@ public class CollectedVolume extends PublicationWithPublisher {
super(type);
}
- public Boolean getReviewed() {
+ /*public Boolean getReviewed() {
return (Boolean) get(REVIEWED);
}
public void setReviewed(Boolean reviewed) {
set(REVIEWED, reviewed);
- }
+ }*/
public ArticleInCollectedVolumeCollection getArticles() {
return new ArticleInCollectedVolumeCollection(
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Monograph.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Monograph.java
index bb9f05472..3db942c5a 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Monograph.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Monograph.java
@@ -30,7 +30,7 @@ import java.math.BigDecimal;
*/
public class Monograph extends PublicationWithPublisher {
- public static final String REVIEWED = "reviewed";
+ //public static final String REVIEWED = "reviewed";
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.Monograph";
@@ -54,12 +54,12 @@ public class Monograph extends PublicationWithPublisher {
super(type);
}
- public Boolean getReviewed() {
+ /*public Boolean getReviewed() {
return (Boolean) get(REVIEWED);
}
public void setReviewed(Boolean reviewed) {
set(REVIEWED, reviewed);
- }
+ }*/
}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java
index 19aedc5b2..40793ed90 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java
@@ -45,12 +45,24 @@ import java.math.BigDecimal;
* This class is not a directly usable Content type. Its is only used to
* define some common attributes needed for all kinds of publications.
*
+ *
+ * As of version 6.6.1 of this module, the reviewed property has been moved
+ * from the types {@link ArticleInCollectedVolume}, {@link ArticleInJournal},
+ * {@link CollectedVolume}, {@link Monograph} and {@link WorkingPaper} to this
+ * class. This has been done for performance reasons. Several use cases demanded
+ * the use of a data query (for performance reasons) over all publications with
+ * the option to filter for reviewed publications. Since the reviewed property
+ * was only available for some types this was not possible, even with joins.
+ * The publications types which do not need the reviewed property will not show
+ * this property in their forms. Also, the reviewed property was excluded from
+ * the XML of these types using their traversal adapters.
+ *
*
*
* @author Jens Pelzetter
*/
public class Publication extends ContentPage {
-
+
public final static String YEAR_OF_PUBLICATION = "yearOfPublication";
public final static String ABSTRACT = "abstract";
public final static String MISC = "misc";
@@ -60,31 +72,32 @@ public class Publication extends ContentPage {
public final static String SERIES = "series";
public final static String ORGAUNITS = "orgaunits";
public final static String ORGAUNIT_PUBLICATIONS = "publications";
+ public static final String REVIEWED = "reviewed";
public final static String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.Publication";
private final static PublicationsConfig config = new PublicationsConfig();
-
+
static {
config.load();
}
-
+
public Publication() {
this(BASE_DATA_OBJECT_TYPE);
}
-
+
public Publication(final BigDecimal id) throws
DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
-
+
public Publication(final OID oid) throws DataObjectNotFoundException {
super(oid);
}
-
+
public Publication(final DataObject obj) {
super(obj);
}
-
+
public Publication(final String type) {
super(type);
}
@@ -92,7 +105,7 @@ public class Publication extends ContentPage {
public static PublicationsConfig getConfig() {
return config;
}
-
+
/**
* Gets the year of publications.
*
@@ -149,6 +162,14 @@ public class Publication extends ContentPage {
set(MISC, misc);
}
+ public Boolean getReviewed() {
+ return (Boolean) get(REVIEWED);
+ }
+
+ public void setReviewed(Boolean reviewed) {
+ set(REVIEWED, reviewed);
+ }
+
/**
* Retrieves a collection of the authors of the publication.
*
@@ -167,9 +188,9 @@ public class Publication extends ContentPage {
*/
public void addAuthor(final GenericPerson author, final Boolean editor) {
Assert.exists(author, GenericPerson.class);
-
+
DataObject link = add(AUTHORS, author);
-
+
link.set(EDITOR, editor);
link.set(AUTHOR_ORDER, Integer.valueOf((int) getAuthors().size()));
}
@@ -193,69 +214,70 @@ public class Publication extends ContentPage {
public boolean hasAuthors() {
return !getAuthors().isEmpty();
}
-
+
public SeriesCollection getSeries() {
return new SeriesCollection((DataCollection) get(SERIES));
}
-
+
public void addSeries(final Series series) {
Assert.exists(series, Series.class);
-
+
add(SERIES, series);
}
-
+
public void removeSeries(final Series series) {
Assert.exists(series, Series.class);
-
+
remove(SERIES, series);
}
-
+
public boolean hasSeries() {
return !getSeries().isEmpty();
}
-
+
public PublicationGenericOrganizationalsUnitCollection getOrganizationalUnits() {
return new PublicationGenericOrganizationalsUnitCollection((DataCollection) get(
ORGAUNITS));
}
-
+
public void addOrganizationalUnit(final GenericOrganizationalUnit orgaunit) {
Assert.exists(orgaunit, GenericOrganizationalUnit.class);
-
+
add(ORGAUNITS, orgaunit);
}
-
+
public void removeOrganizationalUnit(
final GenericOrganizationalUnit orgaunit) {
Assert.exists(orgaunit, GenericOrganizationalUnit.class);
-
+
remove(ORGAUNITS, orgaunit);
}
-
+
public boolean hasOrganizationalUnits() {
return !getOrganizationalUnits().isEmpty();
}
-
+
public static GenericOrganizationalUnitPublicationsCollection getPublications(
final GenericOrganizationalUnit orgaunit) {
final DataCollection dataCollection = (DataCollection) orgaunit.get(
ORGAUNIT_PUBLICATIONS);
-
- return new GenericOrganizationalUnitPublicationsCollection(dataCollection);
+
+ return new GenericOrganizationalUnitPublicationsCollection(
+ dataCollection);
}
-
+
public static void addPublication(final GenericOrganizationalUnit orgaunit,
final Publication publication) {
Assert.exists(publication);
-
+
orgaunit.add(ORGAUNIT_PUBLICATIONS, publication);
}
-
+
public static void removePublication(
final GenericOrganizationalUnit orgaunit,
final Publication publication) {
Assert.exists(publication);
-
- orgaunit.remove(ORGAUNIT_PUBLICATIONS, publication);
+
+ orgaunit.remove(ORGAUNIT_PUBLICATIONS, publication);
}
}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Review.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Review.java
index 0ea2fc15c..affcb47e2 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Review.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Review.java
@@ -24,7 +24,6 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import java.math.BigDecimal;
-import java.util.Date;
/**
*
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/WorkingPaper.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/WorkingPaper.java
index 92e1ad21d..7def6c707 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/WorkingPaper.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/WorkingPaper.java
@@ -29,7 +29,7 @@ import java.math.BigDecimal;
*/
public class WorkingPaper extends UnPublished {
- public static final String REVIEWED = "reviewed";
+ //public static final String REVIEWED = "reviewed";
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.WorkingPaper";
@@ -53,11 +53,11 @@ public class WorkingPaper extends UnPublished {
super(type);
}
- public Boolean getReviewed() {
+ /*public Boolean getReviewed() {
return (Boolean) get(REVIEWED);
}
public void setReviewed(Boolean reviewed) {
set(REVIEWED, reviewed);
- }
+ }*/
}
diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationXmlHelper.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationXmlHelper.java
index d4f00f25c..63ee18c4b 100644
--- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationXmlHelper.java
+++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationXmlHelper.java
@@ -37,8 +37,17 @@ public class PublicationXmlHelper {
}
public void generateXml() {
- Element publicationElem = parent.newChildElement(
- "publications");
+ generateXml(true);
+ }
+
+ public void generateXml(boolean wrap) {
+ Element publicationElem;
+ if (wrap) {
+ publicationElem = parent.newChildElement(
+ "publications");
+ } else {
+ publicationElem = parent;
+ }
generateSystemXml(publicationElem);
generatePublicationXml(publicationElem);
@@ -142,13 +151,13 @@ public class PublicationXmlHelper {
publicationElem.addAttribute("oid", publication.getOID().toString());
publicationElem.addAttribute("version", publication.getVersion());
generateXmlElement(publicationElem, "title", publication.getTitle());
- System.out.printf("\n\npublication.oid = '%s'", publication.getOID());
- System.out.printf("publication.title = '%s'\n\n", publication.getTitle());
+ //System.out.printf("\n\npublication.oid = '%s'", publication.getOID());
+ //System.out.printf("publication.title = '%s'\n\n", publication.getTitle());
if (publication.getYearOfPublication() != null) {
Element yearElem = publicationElem.newChildElement(
"yearOfPublication");
yearElem.setText(publication.getYearOfPublication().toString());
- }
+ }
generateXmlElement(publicationElem, "misc", publication.getMisc());
generateXmlElement(parent, "abstract", publication.getAbstract());
generateAuthorsXml(publicationElem);
@@ -161,7 +170,7 @@ public class PublicationXmlHelper {
return;
}
- while (authors.next()) {
+ while (authors.next()) {
Element authorsElem = publicationElem.newChildElement(
"authors");
Element linkElem = authorsElem.newChildElement("link");
@@ -243,7 +252,7 @@ public class PublicationXmlHelper {
PublicationXmlHelper xmlHelper =
new PublicationXmlHelper(collectedVolumeElem,
collectedVolume);
- xmlHelper.generateXml();
+ xmlHelper.generateXml(false);
}
}
@@ -268,7 +277,7 @@ public class PublicationXmlHelper {
PublicationXmlHelper xmlHelper = new PublicationXmlHelper(
journalElem,
journal);
- xmlHelper.generateXml();
+ xmlHelper.generateXml(false);
}
}
@@ -317,7 +326,7 @@ public class PublicationXmlHelper {
PublicationXmlHelper xmlHelper = new PublicationXmlHelper(
proceedingsElem,
inProceedings.getProceedings());
- xmlHelper.generateXml();
+ xmlHelper.generateXml(false);
}
private void generateInternetArticleXml(final Element publicationElem) {
diff --git a/ccm-sci-types-department/src/ccm-sci-types-department.config b/ccm-sci-types-department/src/ccm-sci-types-department.config
index c22f263f1..d0d73ebd8 100644
--- a/ccm-sci-types-department/src/ccm-sci-types-department.config
+++ b/ccm-sci-types-department/src/ccm-sci-types-department.config
@@ -4,7 +4,7 @@
storage="ccm-sci-types-department/scidepartment.properties"/>
-