Verschiedene Kleinigkeiten und Demo der Publikationsliste für die persönlichen Homepages.
git-svn-id: https://svn.libreccm.org/ccm/trunk@983 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
a9212fcaaf
commit
54f7dd09fc
|
|
@ -200,7 +200,11 @@ public abstract class CompoundContentItemPanel
|
|||
}
|
||||
|
||||
protected long getPaginatorEnd(final long begin, final long count) {
|
||||
return begin + count;
|
||||
long paginatorEnd = begin + count;
|
||||
if (paginatorEnd < 0) {
|
||||
paginatorEnd = 0;
|
||||
}
|
||||
return paginatorEnd;
|
||||
}
|
||||
|
||||
protected void createPaginatorElement(final Element parent,
|
||||
|
|
@ -373,7 +377,7 @@ public abstract class CompoundContentItemPanel
|
|||
if (!isVisible(state)
|
||||
|| (item == null)
|
||||
|| !(item.getClass().equals(getAllowedClass()))) {
|
||||
s_log.debug("Skipping generate XML isVisible: " + isVisible(
|
||||
s_log.warn("Skipping generate XML isVisible: " + isVisible(
|
||||
state) + " item "
|
||||
+ (item == null ? null : item.getOID()));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,11 @@ public class SelectFilter implements Filter {
|
|||
for (String optionStr : options) {
|
||||
optionElem = filter.newChildElement("option");
|
||||
optionElem.addAttribute("label", optionStr);
|
||||
if (propertyIsNumeric) {
|
||||
optionElem.addAttribute("valueType", "number");
|
||||
} else {
|
||||
optionElem.addAttribute("valueType", "text");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,11 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
|||
//}
|
||||
|
||||
txn.commitTxn();
|
||||
} catch(Exception ex) {
|
||||
//jensp 2011-06-24: There was no catch Block for this try. This is
|
||||
//an extremly BAD practicse!!! At least there should be a log output
|
||||
//of the execption of debugging.
|
||||
s_log.error("An exception occured in the init(DomainInitEvent) method: ", ex);
|
||||
} finally {
|
||||
if (txn != null && txn.inTxn()) {
|
||||
txn.abortTxn();
|
||||
|
|
|
|||
|
|
@ -121,12 +121,13 @@ public class PooledConnectionSource implements ConnectionSource {
|
|||
s_connectionTags.put(result.toString(), tag(result));
|
||||
m_connections.add(result);
|
||||
renameThread(result);
|
||||
try {
|
||||
/**
|
||||
* jensp 2011-06-18: Change to prevent connections from being
|
||||
* in "idle in transaction" state. Such connections seam to
|
||||
* cause problems (memory etc.) with PostgreSQL.
|
||||
*/
|
||||
try {
|
||||
|
||||
result.setAutoCommit(false);
|
||||
} catch (SQLException ex) {
|
||||
s_log.warn("Failed to set autocommit to false");
|
||||
|
|
|
|||
|
|
@ -35,11 +35,10 @@ import org.apache.log4j.Logger;
|
|||
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
|
||||
* @version $Id: TransactionContext.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
|
||||
public class TransactionContext {
|
||||
|
||||
private static final Logger s_cat =
|
||||
Logger.getLogger(TransactionContext.class);
|
||||
|
||||
private Session m_ossn;
|
||||
// used in test infrastructure
|
||||
com.redhat.persistence.Session m_ssn;
|
||||
|
|
@ -64,7 +63,6 @@ public class TransactionContext {
|
|||
* This should be a transparent behavior change introduced as a
|
||||
* performance optimization, SDM #159142.
|
||||
**/
|
||||
|
||||
public void beginTxn() {
|
||||
s_cat.debug("Beginning transaction...");
|
||||
// Do nothing. This is implicit now.
|
||||
|
|
@ -81,7 +79,6 @@ public class TransactionContext {
|
|||
*
|
||||
* @post !inTxn()
|
||||
**/
|
||||
|
||||
public void commitTxn() {
|
||||
s_cat.debug("Commiting transaction...");
|
||||
boolean success = false;
|
||||
|
|
@ -94,12 +91,17 @@ public class TransactionContext {
|
|||
m_inTxn = false;
|
||||
fireCommitEvent();
|
||||
s_cat.debug("Done.");
|
||||
} catch (Exception ex) {
|
||||
s_cat.error("Exception occured: ", ex);
|
||||
} finally {
|
||||
s_cat.debug("Cleaning up...");
|
||||
clearAttributes();
|
||||
if (!success) { m_ossn.invalidateDataObjects(false, true); }
|
||||
if (!success) {
|
||||
m_ossn.invalidateDataObjects(false, true);
|
||||
}
|
||||
if (m_inTxn) {
|
||||
s_cat.warn("Warning: Cleanup after commit was reached, but m_inTxn is true.");
|
||||
s_cat.warn(
|
||||
"Warning: Cleanup after commit was reached, but m_inTxn is true.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -120,7 +122,9 @@ public class TransactionContext {
|
|||
fireCommitEvent();
|
||||
} finally {
|
||||
clearAttributes();
|
||||
if (!success) { m_ossn.invalidateDataObjects(false, true); }
|
||||
if (!success) {
|
||||
m_ossn.invalidateDataObjects(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +135,6 @@ public class TransactionContext {
|
|||
*
|
||||
* @post !inTxn()
|
||||
**/
|
||||
|
||||
public void abortTxn() {
|
||||
s_cat.warn("Aborting transaction...");
|
||||
boolean success = false;
|
||||
|
|
@ -145,7 +148,9 @@ public class TransactionContext {
|
|||
}
|
||||
success = true;
|
||||
} finally {
|
||||
if (!success) { m_ossn.invalidateDataObjects(false, true); }
|
||||
if (!success) {
|
||||
m_ossn.invalidateDataObjects(false, true);
|
||||
}
|
||||
fireAbortEvent();
|
||||
clearAttributes();
|
||||
}
|
||||
|
|
@ -175,17 +180,16 @@ public class TransactionContext {
|
|||
* before the transaction
|
||||
*/
|
||||
private void fireBeforeCommitEvent() {
|
||||
Assert.isTrue
|
||||
(inTxn(), "The beforeCommit event was fired outside of " +
|
||||
"the transaction");
|
||||
Assert.isTrue(inTxn(), "The beforeCommit event was fired outside of "
|
||||
+ "the transaction");
|
||||
|
||||
Object listeners[] = m_listeners.toArray();
|
||||
|
||||
for (int i = 0 ; i < listeners.length ; i++) {
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
if (s_cat.isDebugEnabled()) {
|
||||
s_cat.debug("Firing transaction beforeCommit event");
|
||||
}
|
||||
TransactionListener listener = (TransactionListener)listeners[i];
|
||||
TransactionListener listener = (TransactionListener) listeners[i];
|
||||
listener.beforeCommit(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -196,22 +200,22 @@ public class TransactionContext {
|
|||
* after the transaction
|
||||
*/
|
||||
private void fireCommitEvent() {
|
||||
Assert.isTrue
|
||||
(!inTxn(), "transaction commit event fired during transaction");
|
||||
Assert.isTrue(!inTxn(),
|
||||
"transaction commit event fired during transaction");
|
||||
|
||||
Object listeners[] = m_listeners.toArray();
|
||||
m_listeners.clear();
|
||||
|
||||
for (int i = 0 ; i < listeners.length ; i++) {
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
if (s_cat.isDebugEnabled()) {
|
||||
s_cat.debug("Firing transaction commit event");
|
||||
}
|
||||
TransactionListener listener = (TransactionListener)listeners[i];
|
||||
TransactionListener listener = (TransactionListener) listeners[i];
|
||||
listener.afterCommit(this);
|
||||
}
|
||||
|
||||
Assert.isTrue
|
||||
(!inTxn(), "transaction commit listener didn't close transaction");
|
||||
Assert.isTrue(!inTxn(),
|
||||
"transaction commit listener didn't close transaction");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -220,16 +224,15 @@ public class TransactionContext {
|
|||
* before the transaction
|
||||
*/
|
||||
private void fireBeforeAbortEvent() {
|
||||
Assert.isTrue
|
||||
(inTxn(), "The beforeAbort event was fired outside of " +
|
||||
"the transaction");
|
||||
Assert.isTrue(inTxn(), "The beforeAbort event was fired outside of "
|
||||
+ "the transaction");
|
||||
|
||||
Object listeners[] = m_listeners.toArray();
|
||||
for (int i = 0 ; i < listeners.length ; i++) {
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
if (s_cat.isDebugEnabled()) {
|
||||
s_cat.debug("Firing transaction beforeAbort event");
|
||||
}
|
||||
TransactionListener listener = (TransactionListener)listeners[i];
|
||||
TransactionListener listener = (TransactionListener) listeners[i];
|
||||
listener.beforeAbort(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -240,22 +243,22 @@ public class TransactionContext {
|
|||
* after the transaction
|
||||
*/
|
||||
private void fireAbortEvent() {
|
||||
Assert.isTrue
|
||||
(!inTxn(), "transaction abort event fired during transaction");
|
||||
Assert.isTrue(!inTxn(),
|
||||
"transaction abort event fired during transaction");
|
||||
|
||||
Object listeners[] = m_listeners.toArray();
|
||||
m_listeners.clear();
|
||||
|
||||
for (int i = 0 ; i < listeners.length ; i++) {
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
if (s_cat.isDebugEnabled()) {
|
||||
s_cat.debug("Firing transaction abort event");
|
||||
}
|
||||
TransactionListener listener = (TransactionListener)listeners[i];
|
||||
TransactionListener listener = (TransactionListener) listeners[i];
|
||||
listener.afterAbort(this);
|
||||
}
|
||||
|
||||
Assert.isTrue
|
||||
(!inTxn(), "transaction abort listener didn't close transaction");
|
||||
Assert.isTrue(!inTxn(),
|
||||
"transaction abort listener didn't close transaction");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -263,7 +266,6 @@ public class TransactionContext {
|
|||
*
|
||||
* @return True if a transaction is in progress, false otherwise.
|
||||
**/
|
||||
|
||||
public boolean inTxn() {
|
||||
return m_inTxn;
|
||||
}
|
||||
|
|
@ -275,7 +277,6 @@ public class TransactionContext {
|
|||
*
|
||||
* @return The isolation level of the current transaction.
|
||||
**/
|
||||
|
||||
public int getTransactionIsolation() {
|
||||
try {
|
||||
Connection conn = m_ossn.getConnection();
|
||||
|
|
@ -347,5 +348,4 @@ public class TransactionContext {
|
|||
void clearAttributes() {
|
||||
m_attrs.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.arsdigita.cms.*;
|
|||
|
||||
object type PersonalInformationPage extends ContentPage {
|
||||
|
||||
String homepageUrl = homepage_url VARCHAR(256);
|
||||
|
||||
reference key (ct_personal_information_pages.personal_information_page_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public class AuthorshipCollection extends DomainCollection {
|
|||
}
|
||||
|
||||
public Boolean isEditor() {
|
||||
System.out.printf("isEditor?\n");
|
||||
return (Boolean) m_dataCollection.get(LINKEDITOR);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ public class ArticleInJournalPropertyForm
|
|||
ParameterModel volumeParam =
|
||||
new IntegerParameter(ArticleInJournal.VOLUME);
|
||||
TextField volume = new TextField(volumeParam);
|
||||
volume.addValidationListener(new NotNullValidationListener());
|
||||
volume.addValidationListener(new NotEmptyValidationListener());
|
||||
//volume.addValidationListener(new NotNullValidationListener());
|
||||
//volume.addValidationListener(new NotEmptyValidationListener());
|
||||
add(volume);
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
|
|
|
|||
|
|
@ -385,6 +385,8 @@ public abstract class SciOrganizationBasePanel
|
|||
Element title = projectElem.newChildElement("title");
|
||||
title.setText(project.getTitle());
|
||||
|
||||
Element beginElem = projectElem.newChildElement("projectbegin");
|
||||
|
||||
if ((project.getAddendum() != null)
|
||||
&& !(project.getAddendum().isEmpty())) {
|
||||
Element addendum = projectElem.newChildElement("addendum");
|
||||
|
|
|
|||
|
|
@ -60,3 +60,64 @@ query getAllYearsOfPublication {
|
|||
}
|
||||
}
|
||||
|
||||
query getAllYearsOfPublicationForAuthor {
|
||||
Integer yearOfPublication;
|
||||
|
||||
do {
|
||||
select distinct ct_publications.year
|
||||
from ct_publications join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
|
||||
where person_id = :author
|
||||
} map {
|
||||
yearOfPublication = ct_publications.year;
|
||||
}
|
||||
}
|
||||
|
||||
query getAllPublicationTypes {
|
||||
|
||||
String objectType;
|
||||
|
||||
do {
|
||||
select distinct acs_objects.object_type
|
||||
from ct_publications join acs_objects on ct_publications.publication_id = acs_objects.object_id
|
||||
} map {
|
||||
objectType = acs_objects.object_type;
|
||||
}
|
||||
}
|
||||
|
||||
query getAllPublicationTypesForAuthor {
|
||||
|
||||
String objectType;
|
||||
|
||||
do {
|
||||
select distinct acs_objects.object_type
|
||||
from ct_publications join acs_objects on ct_publications.publication_id = acs_objects.object_id join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
|
||||
where person_id = :author
|
||||
} map {
|
||||
objectType = acs_objects.object_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
query getIdsOfPublicationsOfSciMember {
|
||||
BigDecimal publicationId;
|
||||
|
||||
do {
|
||||
select ct_publications_authorship.publication_id
|
||||
from ct_publications_authorship
|
||||
where ct_publications_authorship.person_id = :author
|
||||
} map {
|
||||
publicationId = ct_publications_authorship.publication_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfProjectsOfSciMember {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_projects.project_id
|
||||
from ct_sciorga_projects join cms_organizationalunits_person_map on ct_sciorga_projects.project_id = cms_organizationalunits_person_map.organizationalunit_id
|
||||
where cms_organizationalunits_person_map.person_id = :member
|
||||
} map {
|
||||
projectId = ct_sciorga_projects.project_id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,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());
|
||||
if (publication.getYearOfPublication() != null) {
|
||||
Element yearElem = publicationElem.newChildElement(
|
||||
"yearOfPublication");
|
||||
|
|
@ -189,7 +191,7 @@ public class PublicationXmlHelper {
|
|||
(PublicationWithPublisher) publication;
|
||||
generatePublisherXml(publicationElem, pwp);
|
||||
|
||||
generateXmlElement(publicationElem, "misc", pwp.getISBN());
|
||||
generateXmlElement(publicationElem, "isbn", pwp.getISBN());
|
||||
generateXmlElement(publicationElem, "volume", pwp.getVolume());
|
||||
generateXmlElement(publicationElem,
|
||||
"numberOfVolumes",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,270 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.xml.Element;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.domain.DomainCollection;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.Filter;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.SelectFilter;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.CollectionSortField;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.LinkedHashMap;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMemberDemoPanel extends CompoundContentItemPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
SciMemberDemoPanel.class);
|
||||
private static final String SHOW_PUBLICATIONS = "publications";
|
||||
private static final String SHOW_PROJECTS = "projects";
|
||||
private static final String TITLE = "title";
|
||||
private static final String AUTHORS = "authors";
|
||||
private static final String YEAR_OF_PUBLICATION = "yearOfPublication";
|
||||
private static final String YEAR_ASC = "yearAsc";
|
||||
private static final String YEAR_DESC = "yearDesc";
|
||||
private static final String TYPE = "type";
|
||||
private String show;
|
||||
private final Map<String, Filter> filters =
|
||||
new LinkedHashMap<String, Filter>();
|
||||
private final Map<String, CollectionSortField> sortFields =
|
||||
new LinkedHashMap<String, CollectionSortField>();
|
||||
private String sortByKey;
|
||||
|
||||
public SciMemberDemoPanel() {
|
||||
filters.put(TITLE, new TextFilter(TITLE, TITLE));
|
||||
filters.put(AUTHORS, new TextFilter(AUTHORS, "authors.surname"));
|
||||
SelectFilter yearFilter = new SelectFilter(YEAR_OF_PUBLICATION,
|
||||
YEAR_OF_PUBLICATION,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
filters.put(YEAR_OF_PUBLICATION, yearFilter);
|
||||
SelectFilter typeFilter = new SelectFilter(TYPE,
|
||||
"objectType",
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false);
|
||||
filters.put(TYPE, typeFilter);
|
||||
sortFields.put(TITLE,
|
||||
new CollectionSortField(TITLE, "title"));
|
||||
sortFields.put(YEAR_ASC,
|
||||
new CollectionSortField(YEAR_ASC, "year asc"));
|
||||
sortFields.put(YEAR_DESC,
|
||||
new CollectionSortField(YEAR_DESC, "year desc"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultShowParam() {
|
||||
return "publications";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends ContentItem> getAllowedClass() {
|
||||
return SciMember.class;
|
||||
}
|
||||
|
||||
protected void generatePublicationsXml(final SciMember member,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
|
||||
Element controls = parent.newChildElement("filterControls");
|
||||
controls.addAttribute("customName", "sciOrganizationPublications");
|
||||
controls.addAttribute("show", show);
|
||||
|
||||
DataQuery yearQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getAllYearsOfPublicationForAuthor");
|
||||
yearQuery.setParameter("author", member.getID());
|
||||
((SelectFilter) filters.get(YEAR_OF_PUBLICATION)).setDataQuery(yearQuery,
|
||||
"yearOfPublication");
|
||||
DataQuery typeQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getAllPublicationTypesForAuthor");
|
||||
typeQuery.setParameter("author", member.getID());
|
||||
((SelectFilter) filters.get(TYPE)).setDataQuery(typeQuery, "objectType");
|
||||
|
||||
DataCollection publicationsData = (DataCollection) member.get(
|
||||
"publication");
|
||||
DomainCollection publications = new DomainCollection(publicationsData);
|
||||
// publications.addOrder("yearOfPublication desc");
|
||||
|
||||
applyPublicationsFilter(publications, state.getRequest());
|
||||
applyPublicationSortFields(publications, state.getRequest());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(publications.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, publications.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
generatePublicationFiltersXml(controls);
|
||||
generatePublicationSortFieldsXml(controls);
|
||||
createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
|
||||
publications.size());
|
||||
System.out.printf("\n\n\npublications.size = %d\n", publications.size());
|
||||
if ((publications.size() <= 1) || publications.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (publications.size() == 1) {
|
||||
publications.setRange((int) begin, (int) end);
|
||||
} else {
|
||||
publications.setRange((int) begin + 1, (int) end);
|
||||
}
|
||||
|
||||
while (publications.next()) {
|
||||
/*Publication publication = (Publication) DomainObjectFactory.
|
||||
newInstance(publications.getDomainObject().getOID());*/
|
||||
PublicationXmlHelper xmlHelper =
|
||||
new PublicationXmlHelper(parent,
|
||||
(Publication) publications.
|
||||
getDomainObject());
|
||||
xmlHelper.generateXml();
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateProjectsXml(final SciMember member,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
/*DataCollection projectsData = (DataCollection) member.get("project");
|
||||
DomainCollection projects = new DomainCollection(projectsData);
|
||||
projects.addOrder("title");
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(projects.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, projects.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
|
||||
projects.size());*/
|
||||
}
|
||||
|
||||
protected void generatePublicationFiltersXml(final Element element) {
|
||||
final Element filterElement = element.newChildElement("filters");
|
||||
|
||||
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||
filterEntry.getValue().generateXml(filterElement);
|
||||
}
|
||||
}
|
||||
|
||||
protected void generatePublicationSortFieldsXml(final Element element) {
|
||||
final Element sortFieldsElement = element.newChildElement("sortFields");
|
||||
sortFieldsElement.addAttribute("sortBy", sortByKey);
|
||||
for (Map.Entry<String, CollectionSortField> sortField : sortFields.
|
||||
entrySet()) {
|
||||
sortField.getValue().generateXml(sortFieldsElement);
|
||||
}
|
||||
}
|
||||
|
||||
protected void applyPublicationsFilter(final DomainCollection publications,
|
||||
final HttpServletRequest request) {
|
||||
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||
String value = request.getParameter(
|
||||
filterEntry.getValue().getLabel());
|
||||
|
||||
if ((value != null) && !(value.trim().isEmpty())) {
|
||||
filterEntry.getValue().setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
final StringBuilder filterBuilder = new StringBuilder();
|
||||
for (Map.Entry<String, Filter> filterEntry : filters.entrySet()) {
|
||||
if ((filterEntry.getValue().getFilter() == null)
|
||||
|| (filterEntry.getValue().getFilter().isEmpty())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filterBuilder.length() > 0) {
|
||||
filterBuilder.append(" AND ");
|
||||
}
|
||||
filterBuilder.append(filterEntry.getValue().getFilter());
|
||||
logger.debug(String.format("filters: %s", filterBuilder));
|
||||
if (filterBuilder.length() > 0) {
|
||||
publications.addFilter(filterBuilder.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void applyPublicationSortFields(
|
||||
final DomainCollection publications,
|
||||
final HttpServletRequest request) {
|
||||
sortByKey = request.getParameter("sort");
|
||||
if (!sortFields.containsKey(sortByKey)) {
|
||||
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
|
||||
}
|
||||
|
||||
publications.addOrder(sortFields.get(sortByKey).getField());
|
||||
}
|
||||
|
||||
protected void generateAvailableDataXml(final SciMember member,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
Session session = SessionManager.getSession();
|
||||
DataQuery hasPublicationsQuery =
|
||||
session.retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciMember");
|
||||
hasPublicationsQuery.setParameter("author", member.getID().toString());
|
||||
|
||||
if (hasPublicationsQuery.size() > 0) {
|
||||
element.newChildElement("publications");
|
||||
}
|
||||
hasPublicationsQuery.close();
|
||||
|
||||
DataQuery hasProjectsQuery = session.retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciMember");
|
||||
hasProjectsQuery.setParameter("member", member.getID().toString());
|
||||
|
||||
if (hasProjectsQuery.size() > 0) {
|
||||
element.newChildElement("projects");
|
||||
}
|
||||
hasProjectsQuery.close();
|
||||
|
||||
}
|
||||
|
||||
public void generateDataXml(final SciMember member,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
show = getShowParam(state);
|
||||
|
||||
if (SHOW_PUBLICATIONS.equals(show)) {
|
||||
generatePublicationsXml(member, element, state);
|
||||
} else if (SHOW_PROJECTS.equals(show)) {
|
||||
generateProjectsXml(member, element, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(final ContentItem item,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
Element content = generateBaseXML(item, element, state);
|
||||
|
||||
SciMember member = (SciMember) item;
|
||||
Element availableData = content.newChildElement("availableData");
|
||||
|
||||
if (!(isShowOnlyDefault())) {
|
||||
generateAvailableDataXml(member, availableData, state);
|
||||
}
|
||||
|
||||
generateDataXml(member, content, state);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ waf.dispatcher.default_expiry=3600
|
|||
;
|
||||
waf.kernel.data_permission_check_enabled=false
|
||||
waf.kernel.primary_user_identifier=email
|
||||
; if you activate screen_name, forum loader doesn't work.
|
||||
; if you activate screen_name, forum loader does not work.
|
||||
; waf.kernel.primary_user_identifier=screen_name
|
||||
waf.kernel.supported_languages=de,en
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ waf.admin.password=nge2015
|
|||
waf.admin.password.question=12345
|
||||
waf.admin.password.answer=6
|
||||
|
||||
waf.runtime.jdbc_url=jdbc\:postgresql\://localhost/zes-test?user\=zes&password\=zes47web
|
||||
waf.runtime.jdbc_url=jdbc\:postgresql\://localhost/zes?user\=zes&password\=zes47web&stringtype\=unspecified
|
||||
; waf.runtime.jdbc_url=jdbc\:postgresql\://localhost/zes-testupd?user\=zes&password\=zes47web
|
||||
waf.runtime.jdbc_pool_size=30
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue