- Reviewed-Eigenschaft aus den einzelnen Publikationstypen in Publication verlegt. Dies ist notwendig um per DataQuery nach

dieser Eigenschaft zu filtern. Dies ist unter anderem notwenig, um Publikationen einer Person auf effiziente Weise 
  abfragen zu können. Bei den Publikationstypen, die bisher keine Reviewed Property hatten wird reviewed derzeit über den 
  jeweiligen TraveralAdapter ausgeblendet. Auch das Setzen der Property ist nicht möglich, da es kein Widget im Content-Center 
  dafür gibt.

  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
master
jensp 2011-11-08 19:50:31 +00:00
parent ae44d61441
commit ba2e897c30
32 changed files with 1089 additions and 406 deletions

View File

@ -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() {

View File

@ -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);
}

View File

@ -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<DataObject> 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<String, List<Publication>> 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<String, List<String>> groupsConfig = getGroupsConfig();
final Map<String, DataQuery> groupQueries =
new LinkedHashMap<String, DataQuery>();
logger.debug(String.format("2: %d ms until now...", System.
currentTimeMillis() - start));
for (Map.Entry<String, List<String>> entry : groupsConfig.entrySet()) {
createGroupQuery(person,
entry.getKey(),
entry.getValue(),
groupQueries);
logger.debug(String.format("3: %d ms until now...", System.
currentTimeMillis() - start));
}
private List<DataObject> collectPublications(final GenericPerson person) {
final List<DataObject> publications = new ArrayList<DataObject>();
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<DataObject> 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<String, List<Publication>> processPublications(
final List<DataObject> publications) {
final GroupConfig groupConfig = new GroupConfig(config.
getPublictionGroups());
final Map<String, List<Publication>> pubGroups =
new LinkedHashMap<String, List<Publication>>();
for (String group : groupConfig.getGroups()) {
initalizePubGroupMap(pubGroups, group);
}
initalizePubGroupMap(pubGroups, MISC);
Publication publication;
String type;
String groupName;
Boolean reviewed;
List<Publication> 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<String, List<String>> 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<Publication> currentGroup : pubGroups.values()) {
Collections.sort(currentGroup, comparator);
}
return pubGroups;
}
private void initalizePubGroupMap(
final Map<String, List<Publication>> pubGroups,
final String groupName) {
pubGroups.put(groupName, new ArrayList<Publication>());
}
private void generateGroupsXml(final Element parent,
final Map<String, List<Publication>> publications) {
final Element availableGroups = parent.newChildElement(
"availablePublicationGroups");
for (Map.Entry<String, List<Publication>> 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<String, List<Publication>> publications,
final PageState state) {
final Element publicationsElem = parent.newChildElement("publications");
int numberOfPubs = 0;
final int groupSplit = config.getGroupSplit();
for (List<Publication> list : publications.values()) {
numberOfPubs += list.size();
}
if (numberOfPubs < groupSplit) {
publicationsElem.addAttribute("all", "all");
for (Map.Entry<String, List<Publication>> entry : publications.
entrySet()) {
if (entry.getValue().size() > 0) {
generatePublicationGroupXml(publicationsElem,
entry.getKey(),
entry.getValue(),
state);
final List<String> availableGroups = new ArrayList<String>();
logger.debug(String.format("6: %d ms until now...", System.
currentTimeMillis() - start));
for (Map.Entry<String, List<String>> 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<String, List<String>> getGroupsConfig() {
final String conf = config.getPublictionGroups();
final Map<String, List<String>> groups =
new LinkedHashMap<String, List<String>>();
final String[] groupTokens = conf.split(";");
for (String groupToken : groupTokens) {
processGroupToken(groupToken, groups);
}
return groups;
}
private void processGroupToken(final String groupToken,
final Map<String, List<String>> groups) {
final String[] tokens = groupToken.split(":");
if (tokens.length != 2) {
throw new IllegalArgumentException("Failed to parse group config.");
}
final List<String> types = new ArrayList<String>();
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<Publication> publications,
final PageState state) {
if (publications == null) {
private String generateFilterForTypeTokens(final List<String> 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<String, List<String>> groups) {
final StringBuffer buffer = new StringBuffer();
for (Map.Entry<String, List<String>> 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<String> 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<String, String> typeGroupMap =
new HashMap<String, String>();
private final List<String> groups = new ArrayList<String>();
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<String> 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<String> 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<String, String> getTypeGroupMap() {
return Collections.unmodifiableMap(typeGroupMap);
}
public List<String> getGroups() {
return Collections.unmodifiableList(groups);
}
return group;
}
private class PublicationGroupComparator implements Comparator<Publication> {
private void createGroupQuery(final GenericPerson author,
final String groupName,
final List<String> typeTokens,
final Map<String, DataQuery> 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<DataObject> publications = collectPublications(person);
//
// final Element personalPubsElem = parent.newChildElement(
// "personalPublications");
//
// if ((publications == null) || publications.isEmpty()) {
// personalPubsElem.newChildElement("noPublications");
//
// return;
// } else {
// final Map<String, List<Publication>> 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<DataObject> collectPublications(final GenericPerson person) {
// final long start = System.currentTimeMillis();
// final List<DataObject> publications = new ArrayList<DataObject>();
// 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<DataObject> 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<String, List<Publication>> processPublications(
// final List<DataObject> publications) {
//
// final long start = System.currentTimeMillis();
// final GroupConfig groupConfig = new GroupConfig(config.
// getPublictionGroups());
// final Map<String, List<Publication>> pubGroups =
// new LinkedHashMap<String, List<Publication>>();
//
// for (String group : groupConfig.getGroups()) {
// initalizePubGroupMap(pubGroups, group);
// }
// initalizePubGroupMap(pubGroups, MISC);
//
// Publication publication;
// String type;
// String groupName;
// Boolean reviewed;
// List<Publication> 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<Publication> 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<String, List<Publication>> pubGroups,
// final String groupName) {
// pubGroups.put(groupName, new ArrayList<Publication>());
// }
//
// private void generateGroupsXml(final Element parent,
// final Map<String, List<Publication>> publications) {
// final Element availableGroups = parent.newChildElement(
// "availablePublicationGroups");
//
// for (Map.Entry<String, List<Publication>> 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<String, List<Publication>> publications,
// final PageState state) {
// final Element publicationsElem = parent.newChildElement("publications");
//
// int numberOfPubs = 0;
// final int groupSplit = config.getGroupSplit();
//
// for (List<Publication> list : publications.values()) {
// numberOfPubs += list.size();
// }
//
// if (numberOfPubs < groupSplit) {
// publicationsElem.addAttribute("all", "all");
//
// for (Map.Entry<String, List<Publication>> 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<Publication> 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<String, String> typeGroupMap =
// new HashMap<String, String>();
// private final List<String> groups = new ArrayList<String>();
//
// /**
// * 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<String> 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<String, String> getTypeGroupMap() {
// return Collections.unmodifiableMap(typeGroupMap);
// }
//
// public List<String> getGroups() {
// return Collections.unmodifiableList(groups);
// }
// }
//
// private class PublicationGroupComparator implements Comparator<Publication> {
//
// 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);
// }
// }
}

View File

@ -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
@ -62,6 +62,10 @@ public class PersonalPublicationsConfig extends AbstractConfig {
*/
private final Parameter defaultGroup;
private final Parameter pageSize;
private final Parameter order;
public PersonalPublicationsConfig() {
publicationGroups =
new StringParameter(
@ -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);
}
}

View File

@ -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
@ -12,3 +12,13 @@ com.arsdigita.cms.publicpersonlprofile.publications.defaultGroup.title = Default
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]
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]

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Expertise"
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Expertise"
extends="com.arsdigita.cms.contenttypes.PublicationWithPublisher">
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
<xrd:property name="/object/orderer"/>
</xrd:associations>
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
</xrd:adapter>
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
<xrd:property name="/object/orderer"/>
</xrd:associations>
</xrd:context>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GreyLiterature"
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GreyLiterature"
extends="com.arsdigita.cms.contenttypes.Publication">
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
</xrd:associations>
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
</xrd:adapter>
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
</xrd:associations>
</xrd:context>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.InProceedings"
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.InProceedings"
extends="com.arsdigita.cms.contenttypes.Publication">
<xrd:associations rule="include">
<xrd:property name="/object/proceedings"/>
</xrd:associations>
</xrd:adapter>
<xrd:associations rule="include">
</xrd:context>
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
<xrd:property name="/object/proceedings"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Expertise"
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Expertise"
extends="com.arsdigita.cms.contenttypes.PublicationWithPublisher">
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
</xrd:associations>
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
</xrd:adapter>
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
</xrd:associations>
</xrd:context>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Journal"
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Journal"
extends="com.arsdigita.cms.contenttypes.PublicationWithPublisher">
<xrd:associations rule="include">
<xrd:property name="/object/articles"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
<xrd:associations rule="include">
<xrd:property name="/object/articles"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Proceedings"
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Proceedings"
extends="com.arsdigita.cms.contenttypes.PublicationWithPublisher">
<xrd:associations rule="include">
<xrd:property name="/object/papers"/>
<xrd:property name="/object/papers/authors"/>
<xrd:property name="/object/organizer"/>
</xrd:associations>
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
</xrd:adapter>
<xrd:associations rule="include">
<xrd:property name="/object/papers"/>
<xrd:property name="/object/papers/authors"/>
<xrd:property name="/object/organizer"/>
</xrd:associations>
</xrd:context>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<xrd:adapters
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Review"
extends="com.arsdigita.cms.contenttypes.Review">
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
<xrd:associations rule="include">
<xrd:property name="/object/journal"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -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">
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.UnPublished"
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.UnPublished"
extends="com.arsdigita.cms.contenttypes.PublicationWithPublisher">
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
</xrd:associations>
<xrd:attributes rule="exclude">
<xrd:property name="/object/reviewed"/>
</xrd:attributes>
</xrd:adapter>
<xrd:associations rule="include">
<xrd:property name="/object/organization"/>
</xrd:associations>
</xrd:context>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -0,0 +1,5 @@
<upgrade>
<version from="6.6.0" to="6.6.1">
<script sql="ccm-sci-publications/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version>
</upgrade>

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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(

View File

@ -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);
}
}*/
}

View File

@ -45,6 +45,18 @@ 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.
* </p>
* <p>
* 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.
* </p>
*
*
* @author Jens Pelzetter
@ -60,6 +72,7 @@ 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();
@ -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.
*
@ -241,7 +262,8 @@ public class Publication extends ContentPage {
final DataCollection dataCollection = (DataCollection) orgaunit.get(
ORGAUNIT_PUBLICATIONS);
return new GenericOrganizationalUnitPublicationsCollection(dataCollection);
return new GenericOrganizationalUnitPublicationsCollection(
dataCollection);
}
public static void addPublication(final GenericOrganizationalUnit orgaunit,

View File

@ -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;
/**
*

View File

@ -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);
}
}*/
}

View File

@ -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,8 +151,8 @@ 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");
@ -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) {

View File

@ -4,7 +4,7 @@
storage="ccm-sci-types-department/scidepartment.properties"/>
<config class="com.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTabConfig"
storage="ccm-sci-types-department/summarytab.properties"/>
<config class="com.arsdigita.cms.contenttypes.ui.SciDepartmentMemberTabConfig"
<config class="com.arsdigita.cms.contenttypes.ui.SciDepartmentMembersTabConfig"
storage="ccm-sci-types-department/memberstab.properties"/>
<config class="com.arsdigita.cms.contenttypes.ui.SciDepartmentProjectsTabConfig"
storage="ccm-sci-types-department/projectstab.properties"/>