BugFix für Ticket #1462. PersonalPublications hat unter bestimmten Umständen einer Fehler produziert.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1973 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
042c95fb14
commit
bd603f024f
|
|
@ -123,7 +123,7 @@ public class Paginator {
|
||||||
|
|
||||||
public int getBegin() {
|
public int getBegin() {
|
||||||
if (pageNumber == 1) {
|
if (pageNumber == 1) {
|
||||||
return 1;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return ((pageNumber - 1) * pageSize) + 1;
|
return ((pageNumber - 1) * pageSize) + 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -68,10 +67,7 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
new LinkedHashMap<String, List<PublicationBundle>>();
|
new LinkedHashMap<String, List<PublicationBundle>>();
|
||||||
|
|
||||||
for (Map.Entry<String, List<String>> entry : groupsConfig.entrySet()) {
|
for (Map.Entry<String, List<String>> entry : groupsConfig.entrySet()) {
|
||||||
filterPublicationsByGroup(entry.getKey(),
|
filterPublicationsByGroup(entry.getKey(), entry.getValue(), publications, publicationsByGroup);
|
||||||
entry.getValue(),
|
|
||||||
publications,
|
|
||||||
publicationsByGroup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<PublicationBundle> miscGroup = filterPublicationsForMiscGroup(publications, groupsConfig);
|
final List<PublicationBundle> miscGroup = filterPublicationsForMiscGroup(publications, groupsConfig);
|
||||||
|
|
@ -82,8 +78,7 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
|
|
||||||
if (overallSize < config.getGroupSplit()) {
|
if (overallSize < config.getGroupSplit()) {
|
||||||
publicationsElem.addAttribute("all", "all");
|
publicationsElem.addAttribute("all", "all");
|
||||||
for (Map.Entry<String, List<PublicationBundle>> group :
|
for (Map.Entry<String, List<PublicationBundle>> group : publicationsByGroup.entrySet()) {
|
||||||
publicationsByGroup.entrySet()) {
|
|
||||||
generateXmlForGroup(group.getKey(),
|
generateXmlForGroup(group.getKey(),
|
||||||
availableGroupsElem,
|
availableGroupsElem,
|
||||||
publicationsElem,
|
publicationsElem,
|
||||||
|
|
@ -94,11 +89,10 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final List<String> availableGroups = new LinkedList<String>();
|
final List<String> availableGroups = new LinkedList<String>();
|
||||||
for (Map.Entry<String, List<String>> entry : groupsConfig.
|
for (Map.Entry<String, List<String>> entry : groupsConfig.entrySet()) {
|
||||||
entrySet()) {
|
if ((publicationsByGroup.get(entry.getKey()) != null)
|
||||||
if (!(publicationsByGroup.get(entry.getKey()).isEmpty())) {
|
&& !(publicationsByGroup.get(entry.getKey()).isEmpty())) {
|
||||||
generateAvailableForGroup(entry.getKey(),
|
generateAvailableForGroup(entry.getKey(), availableGroupsElem);
|
||||||
availableGroupsElem);
|
|
||||||
availableGroups.add(entry.getKey());
|
availableGroups.add(entry.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -109,9 +103,7 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
final HttpServletRequest request = state.getRequest();
|
final HttpServletRequest request = state.getRequest();
|
||||||
final String group = selectGroup(request,
|
final String group = selectGroup(request, config.getDefaultGroup(), availableGroups);
|
||||||
config.getDefaultGroup(),
|
|
||||||
availableGroups);
|
|
||||||
|
|
||||||
generateXmlForGroup(group,
|
generateXmlForGroup(group,
|
||||||
availableGroupsElem,
|
availableGroupsElem,
|
||||||
|
|
@ -133,9 +125,7 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<PublicationBundle> collectPublications(
|
private List<PublicationBundle> collectPublications(final GenericPerson author, final String language) {
|
||||||
final GenericPerson author,
|
|
||||||
final String language) {
|
|
||||||
final List<PublicationBundle> publications =
|
final List<PublicationBundle> publications =
|
||||||
new LinkedList<PublicationBundle>();
|
new LinkedList<PublicationBundle>();
|
||||||
//final List<BigDecimal> processed = new ArrayList<BigDecimal>();
|
//final List<BigDecimal> processed = new ArrayList<BigDecimal>();
|
||||||
|
|
@ -228,25 +218,18 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
groupElem.addAttribute("name", groupName);
|
groupElem.addAttribute("name", groupName);
|
||||||
|
|
||||||
if (withPaginator) {
|
if (withPaginator) {
|
||||||
final Paginator paginator = new Paginator(state.getRequest(),
|
final Paginator paginator = new Paginator(state.getRequest(), publications.size(), config.getPageSize());
|
||||||
publications.size(),
|
publicationList = publicationList.subList(paginator.getBegin(), paginator.getEnd());
|
||||||
config.getPageSize());
|
|
||||||
publicationList = publicationList.subList(paginator.getBegin(),
|
|
||||||
paginator.getEnd());
|
|
||||||
paginator.generateXml(groupElem);
|
paginator.generateXml(groupElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PublicationBundle publication : publicationList) {
|
for (PublicationBundle publication : publicationList) {
|
||||||
generatePublicationXml(publication.getPublication(
|
generatePublicationXml(publication.getPublication(
|
||||||
GlobalizationHelper.getNegotiatedLocale().getLanguage()),
|
GlobalizationHelper.getNegotiatedLocale().getLanguage()), groupElem, state);
|
||||||
groupElem,
|
|
||||||
state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generatePublicationXml(final Publication publication,
|
private void generatePublicationXml(final Publication publication, final Element parent, final PageState state) {
|
||||||
final Element parent,
|
|
||||||
final PageState state) {
|
|
||||||
final PersonalPublications.XmlGenerator generator = new PersonalPublications.XmlGenerator(publication);
|
final PersonalPublications.XmlGenerator generator = new PersonalPublications.XmlGenerator(publication);
|
||||||
generator.setItemElemName("publications", "");
|
generator.setItemElemName("publications", "");
|
||||||
generator.setListMode(true);
|
generator.setListMode(true);
|
||||||
|
|
@ -273,9 +256,7 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
final String defaultGroupConfig,
|
final String defaultGroupConfig,
|
||||||
final List<String> availableGroups) {
|
final List<String> availableGroups) {
|
||||||
String group = request.getParameter("group");
|
String group = request.getParameter("group");
|
||||||
if ((group == null)
|
if ((group == null) || group.trim().isEmpty() || !(availableGroups.contains(group))) {
|
||||||
|| group.trim().isEmpty()
|
|
||||||
|| !(availableGroups.contains(group))) {
|
|
||||||
String defaultGroups[] = defaultGroupConfig.split(",");
|
String defaultGroups[] = defaultGroupConfig.split(",");
|
||||||
|
|
||||||
for (String defaultGroup : defaultGroups) {
|
for (String defaultGroup : defaultGroups) {
|
||||||
|
|
@ -337,8 +318,7 @@ public class PersonalPublications implements ContentGenerator {
|
||||||
} else {
|
} else {
|
||||||
final Boolean pubReviewed = ((Publication) publication.getPrimaryInstance()).getReviewed();
|
final Boolean pubReviewed = ((Publication) publication.getPrimaryInstance()).getReviewed();
|
||||||
if (publication.getContentType().getAssociatedObjectType().equals(type)
|
if (publication.getContentType().getAssociatedObjectType().equals(type)
|
||||||
&& (reviewed.equals(pubReviewed)
|
&& (reviewed.equals(pubReviewed) || (pubReviewed == null))) {
|
||||||
|| (pubReviewed == null))) {
|
|
||||||
group.add(publication);
|
group.add(publication);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue