Verschiedene Ergänzungen und Korrekturen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1517 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
280e924978
commit
e3ff2038c7
|
|
@ -7,7 +7,6 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
import com.arsdigita.persistence.DataQuery;
|
import com.arsdigita.persistence.DataQuery;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -53,7 +52,10 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (persons.next()) {
|
while (persons.next()) {
|
||||||
generatePersonXml((BigDecimal) persons.get("memberId"),
|
/*generatePersonXml((BigDecimal) persons.get("memberId"),
|
||||||
|
parent,
|
||||||
|
state);*/
|
||||||
|
generatePersonXml(((GenericOrganizationalUnitPersonCollection) persons).getPerson().getID(),
|
||||||
parent,
|
parent,
|
||||||
state);
|
state);
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +92,9 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataQuery getData(final GenericOrganizationalUnit orgaunit) {
|
protected DataQuery getData(final GenericOrganizationalUnit orgaunit) {
|
||||||
final long start = System.currentTimeMillis();
|
return orgaunit.getPersons();
|
||||||
|
|
||||||
|
/*final long start = System.currentTimeMillis();
|
||||||
|
|
||||||
final DataQuery personsQuery = SessionManager.getSession().retrieveQuery(
|
final DataQuery personsQuery = SessionManager.getSession().retrieveQuery(
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits");
|
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits");
|
||||||
|
|
@ -159,7 +163,7 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab {
|
||||||
orgaunit.getName(),
|
orgaunit.getName(),
|
||||||
System.currentTimeMillis() - start,
|
System.currentTimeMillis() - start,
|
||||||
isMergingMembers()));
|
isMergingMembers()));
|
||||||
return personsQuery;
|
return personsQuery;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -13,42 +13,30 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p> An object list variant which can be filtered and sorted by the visitor of
|
||||||
* An object list variant which can be filtered and sorted by the visitor of
|
|
||||||
* the website. The available filters and sort options are added in a JSP
|
* the website. The available filters and sort options are added in a JSP
|
||||||
* template. There are three kinds of filters yet:
|
* template. There are three kinds of filters yet: </p> <dl> <dt><code>TextFilter</code></dt>
|
||||||
* </p>
|
|
||||||
* <dl>
|
|
||||||
* <dt><code>TextFilter</code></dt>
|
|
||||||
* <dd>This filter filters the object list using a user provided string, which
|
* <dd>This filter filters the object list using a user provided string, which
|
||||||
* is put into the <code>WHERE</code> clause with <code>LIKE</code> operator.
|
* is put into the
|
||||||
* You might use this filter to allow the visitor to filter an object list for
|
* <code>WHERE</code> clause with
|
||||||
* items with a specific name.</dd>
|
* <code>LIKE</code> operator. You might use this filter to allow the visitor to
|
||||||
* <dt><code>SelectFilter</code></dt>
|
* filter an object list for items with a specific name.</dd> <dt><code>SelectFilter</code></dt>
|
||||||
* <dd>This filter traverses through the objects displayed by the list and
|
* <dd>This filter traverses through the objects displayed by the list and
|
||||||
* determines all distinct values of a property. The visitor can choose one
|
* determines all distinct values of a property. The visitor can choose one of
|
||||||
* of this values, and the displayed list will only contain items which where
|
* this values, and the displayed list will only contain items which where the
|
||||||
* the property has the selected value.</dd>
|
* property has the selected value.</dd> <dt><code>CompareFilter</code></dt>
|
||||||
* <dt><code>CompareFilter</code></dt>
|
* <dd>This filter also provides selectable options. But these options can be
|
||||||
* <dd>This filter also provides selectable options. But these options
|
* configured by the developer in the template.</dd> </dl> <p> If there is more
|
||||||
* can be configured by the developer in the template.</dd>
|
* than one filter, the values of all filters are combined using
|
||||||
* </dl>
|
* <code>AND</code>. </p> <p> This object list class was developed for
|
||||||
* <p>
|
* displaying list of items from the Sci modules (SciPublications and
|
||||||
* If there is more than one filter, the values of all filters are combined
|
* SciOrganization). For example, we use this list to provide lists of
|
||||||
* using <code>AND</code>.
|
* publications which be filtered for publications from a specific year, for a
|
||||||
* </p>
|
* specific author and for a specific title. The list can be sorted by the
|
||||||
* <p>
|
* titles of the publications, the years of the publications and the (surnames
|
||||||
* This object list class was developed for displaying list of items from
|
* of the) authors of the publications. </p> <p> As an example how to use this
|
||||||
* the Sci modules (SciPublications and SciOrganization). For example, we use
|
* object list in a JSP template here are the relevant parts from the template
|
||||||
* this list to provide lists of publications which be filtered for publications
|
* for the publication list: </p>
|
||||||
* from a specific year, for a specific author and for a specific title. The
|
|
||||||
* list can be sorted by the titles of the publications, the years of the
|
|
||||||
* publications and the (surnames of the) authors of the publications.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* As an example how to use this object list in a JSP template here are the
|
|
||||||
* relevant parts from the template for the publication list:
|
|
||||||
* </p>
|
|
||||||
* <pre>
|
* <pre>
|
||||||
* {@code
|
* {@code
|
||||||
* ...
|
* ...
|
||||||
|
|
@ -56,35 +44,35 @@ import org.apache.log4j.Logger;
|
||||||
* classname="com.arsdigita.navigation.ui.object.CustomizableObjectList"/>
|
* classname="com.arsdigita.navigation.ui.object.CustomizableObjectList"/>
|
||||||
* ...
|
* ...
|
||||||
* <jsp:scriptlet>
|
* <jsp:scriptlet>
|
||||||
CustomizableObjectList objList = (CustomizableObjectList) itemList;
|
* CustomizableObjectList objList = (CustomizableObjectList) itemList;
|
||||||
objList.setDefinition(new CMSDataCollectionDefinition());
|
* objList.setDefinition(new CMSDataCollectionDefinition());
|
||||||
objList.setRenderer(new CMSDataCollectionRenderer());
|
* objList.setRenderer(new CMSDataCollectionRenderer());
|
||||||
objList.getDefinition().setObjectType("com.arsdigita.cms.contenttypes.Publication");
|
* objList.getDefinition().setObjectType("com.arsdigita.cms.contenttypes.Publication");
|
||||||
objList.getDefinition().setDescendCategories(false);
|
* objList.getDefinition().setDescendCategories(false);
|
||||||
objList.addTextFilter("title", "title");
|
* objList.addTextFilter("title", "title");
|
||||||
objList.addTextFilter("authors.surname", "author");
|
* objList.addTextFilter("authors.surname", "author");
|
||||||
objList.addSelectFilter("yearOfPublication", "year", true, true, true, true);
|
* objList.addSelectFilter("yearOfPublication", "year", true, true, true, true);
|
||||||
objList.addSortField("title", "title asc");
|
* objList.addSortField("title", "title asc");
|
||||||
objList.addSortField("yearAsc", "yearOfPublication asc");
|
* objList.addSortField("yearAsc", "yearOfPublication asc");
|
||||||
objList.addSortField("yearDesc", "yearOfPublication desc");
|
* objList.addSortField("yearDesc", "yearOfPublication desc");
|
||||||
objList.addSortField("authors", "authors.surname asc, authors.givenname asc");
|
* objList.addSortField("authors", "authors.surname asc, authors.givenname asc");
|
||||||
objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));
|
* objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));
|
||||||
|
*
|
||||||
objList.getRenderer().setPageSize(20);
|
* objList.getRenderer().setPageSize(20);
|
||||||
objList.getRenderer().setSpecializeObjects(true);
|
* objList.getRenderer().setSpecializeObjects(true);
|
||||||
|
*
|
||||||
</jsp:scriptlet>
|
* </jsp:scriptlet>
|
||||||
* ...
|
* ...
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre> <p> You may notice the line
|
||||||
* <p>
|
|
||||||
* You may notice the line
|
|
||||||
* <code>objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));</code>.
|
* <code>objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));</code>.
|
||||||
* This line may looks a bit weird to you. The reason is that it is not possible
|
* This line may looks a bit weird to you. The reason is that it is not possible
|
||||||
* to access the <code>DataCollectionDefinition</code> from the methods in this
|
* to access the
|
||||||
* class. If you try call the <code>addOrder()</code> from within this class
|
* <code>DataCollectionDefinition</code> from the methods in this class. If you
|
||||||
* you will cause an locking error.
|
* try call the
|
||||||
* </p>
|
* <code>addOrder()</code> from within this class you will cause an locking
|
||||||
|
* error. </p>
|
||||||
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @see Filter
|
* @see Filter
|
||||||
|
|
@ -133,11 +121,11 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
* @param allOption Add an <em>all</em> option to the filter.
|
* @param allOption Add an <em>all</em> option to the filter.
|
||||||
* @param allOptionIsDefault Is the all option the default?
|
* @param allOptionIsDefault Is the all option the default?
|
||||||
* @param propertyIsNumeric Is the property to filter numeric?
|
* @param propertyIsNumeric Is the property to filter numeric?
|
||||||
* @return The new filter. Options can be added to the filter by calling
|
* @return The new filter. Options can be added to the filter by calling the {@link CompareFilter#addOption(java.lang.String, java.lang.String)}
|
||||||
* the {@link CompareFilter#addOption(java.lang.String, java.lang.String)} or
|
* or the {@link CompareFilter#addOption(java.lang.String, com.arsdigita.navigation.ui.object.CompareFilter.Operators, java.lang.String)}
|
||||||
* the {@link CompareFilter#addOption(java.lang.String, com.arsdigita.navigation.ui.object.CompareFilter.Operators, java.lang.String)}
|
|
||||||
* method.
|
* method.
|
||||||
* @see CompareFilter#CompareFilter(java.lang.String, java.lang.String, boolean, boolean, boolean)
|
* @see CompareFilter#CompareFilter(java.lang.String, java.lang.String,
|
||||||
|
* boolean, boolean, boolean)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public CompareFilter addCompareFilter(final String property,
|
public CompareFilter addCompareFilter(final String property,
|
||||||
|
|
@ -166,7 +154,9 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
* @param allOption Add an all option?
|
* @param allOption Add an all option?
|
||||||
* @param allOptionIsDefault Is the all option the default.
|
* @param allOptionIsDefault Is the all option the default.
|
||||||
* @param propertyIsNumeric Is the property numeric?
|
* @param propertyIsNumeric Is the property numeric?
|
||||||
* @see SelectFilter#SelectFilter(java.lang.String, java.lang.String, com.arsdigita.navigation.ui.object.CustomizableObjectList, boolean, boolean, boolean, boolean)
|
* @see SelectFilter#SelectFilter(java.lang.String, java.lang.String,
|
||||||
|
* com.arsdigita.navigation.ui.object.CustomizableObjectList, boolean,
|
||||||
|
* boolean, boolean, boolean)
|
||||||
*/
|
*/
|
||||||
public void addSelectFilter(final String property,
|
public void addSelectFilter(final String property,
|
||||||
final String label,
|
final String label,
|
||||||
|
|
@ -211,9 +201,10 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This overwritten version of the <code>getObjects</code> method evaluates
|
* This overwritten version of the
|
||||||
* the parameters in HTTP request for the filters and creates an
|
* <code>getObjects</code> method evaluates the parameters in HTTP request
|
||||||
* appropriate SQL filter and sets this filter.
|
* for the filters and creates an appropriate SQL filter and sets this
|
||||||
|
* filter.
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
|
|
@ -247,16 +238,12 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p> Generates the XML for the list. The root element for the list is
|
||||||
* Generates the XML for the list. The root element for the list is
|
* <code>customizableObjectList</code>. The available filters are put into a
|
||||||
* <code>customizableObjectList</code>. The available filters are
|
* <code>filters</code> element. </p> <p> The available sort fields are put
|
||||||
* put into a <code>filters</code> element.
|
* into a
|
||||||
* </p>
|
* <code>sortFields</code> element. This element has also an attribute
|
||||||
* <p>
|
* indicating the current selected sort field. </p>
|
||||||
* The available sort fields are put into a <code>sortFields</code> element.
|
|
||||||
* This element has also an attribute indicating the current selected sort
|
|
||||||
* field.
|
|
||||||
* </p>
|
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param response
|
* @param response
|
||||||
|
|
@ -283,7 +270,9 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
//- The HttpRequest is available here.
|
//- The HttpRequest is available here.
|
||||||
//So we use the HTTP request directly, which allows use to use a
|
//So we use the HTTP request directly, which allows use to use a
|
||||||
//dedicated parameter for each of the filters.
|
//dedicated parameter for each of the filters.
|
||||||
/*if (request.getCharacterEncoding() == null) {*/
|
/*
|
||||||
|
* if (request.getCharacterEncoding() == null) {
|
||||||
|
*/
|
||||||
try {
|
try {
|
||||||
request.setCharacterEncoding("UTF-8");
|
request.setCharacterEncoding("UTF-8");
|
||||||
} catch (UnsupportedEncodingException ex) {
|
} catch (UnsupportedEncodingException ex) {
|
||||||
|
|
@ -299,14 +288,6 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Look for a sort parameter. If one is found, use one to sort the data
|
|
||||||
//collection (if it is a valid value). If no sort parameter is found,
|
|
||||||
//use the first sort field as default.
|
|
||||||
String sortByKey = request.getParameter("sort");
|
|
||||||
if (!sortFields.containsKey(sortByKey)) {
|
|
||||||
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Element controls = content.newChildElement("filterControls");
|
Element controls = content.newChildElement("filterControls");
|
||||||
controls.addAttribute("customName", m_customName);
|
controls.addAttribute("customName", m_customName);
|
||||||
|
|
||||||
|
|
@ -315,12 +296,23 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
filterElems.addContent(filterEntry.getValue().getXml());
|
filterElems.addContent(filterEntry.getValue().getXml());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sortFields.size() > 0) {
|
||||||
|
//Look for a sort parameter. If one is found, use one to sort the data
|
||||||
|
//collection (if it is a valid value). If no sort parameter is found,
|
||||||
|
//use the first sort field as default.
|
||||||
|
String sortByKey = request.getParameter("sort");
|
||||||
|
if (!sortFields.containsKey(sortByKey)) {
|
||||||
|
sortByKey = new ArrayList<String>(sortFields.keySet()).get(0);
|
||||||
|
}
|
||||||
|
|
||||||
Element sortFieldElems = controls.newChildElement("sortFields");
|
Element sortFieldElems = controls.newChildElement("sortFields");
|
||||||
sortFieldElems.addAttribute("sortBy", sortByKey);
|
sortFieldElems.addAttribute("sortBy", sortByKey);
|
||||||
for (Map.Entry<String, String> sortField : sortFields.entrySet()) {
|
for (Map.Entry<String, String> sortField : sortFields.entrySet()) {
|
||||||
Element sortFieldElem = sortFieldElems.newChildElement("sortField");
|
Element sortFieldElem = sortFieldElems.newChildElement(
|
||||||
|
"sortField");
|
||||||
sortFieldElem.addAttribute("label", sortField.getKey());
|
sortFieldElem.addAttribute("label", sortField.getKey());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Add object list
|
//Add object list
|
||||||
content.addContent(generateObjectListXML(request, response));
|
content.addContent(generateObjectListXML(request, response));
|
||||||
|
|
|
||||||
|
|
@ -62,4 +62,11 @@ public class SciMember extends GenericPerson {
|
||||||
return generators;
|
return generators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
||||||
|
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
||||||
|
generators.add(new SciMemberExtraXmlGenerator());
|
||||||
|
return generators;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
import com.arsdigita.cms.contenttypes.ui.SciProjectExtraXmlGenerator;
|
import com.arsdigita.cms.contenttypes.ui.SciProjectExtraXmlGenerator;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.SciProjectListExtraXmlGenerator;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
|
@ -367,6 +368,13 @@ public class SciProject extends GenericOrganizationalUnit {
|
||||||
return generators;
|
return generators;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
||||||
|
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
||||||
|
generators.add(new SciProjectListExtraXmlGenerator());
|
||||||
|
return generators;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSearchSummary() {
|
public String getSearchSummary() {
|
||||||
return getProjectShortDescription();
|
return getProjectShortDescription();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectListExtraXmlGenerator implements ExtraXMLGenerator {
|
||||||
|
|
||||||
|
public void generateXML(final ContentItem item,
|
||||||
|
final Element element,
|
||||||
|
final PageState state) {
|
||||||
|
if (!(item instanceof SciProject)) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"This ExtraXMLGenerator supports items of type "
|
||||||
|
+ "'com.arsdigita.cms.contenttypes.SciProject' only.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final SciProject project = (SciProject) item;
|
||||||
|
final GenericOrganizationalUnitPersonCollection members = project.
|
||||||
|
getPersons();
|
||||||
|
|
||||||
|
final Element membersElem = element.newChildElement("members");
|
||||||
|
while (members.next()) {
|
||||||
|
generateMemberXml(membersElem,
|
||||||
|
members.getPerson(),
|
||||||
|
members.getRoleName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addGlobalStateParams(final Page page) {
|
||||||
|
//Nothing for now
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateMemberXml(final Element membersElem,
|
||||||
|
final GenericPerson member,
|
||||||
|
final String roleName) {
|
||||||
|
final Element memberElem = membersElem.newChildElement("member");
|
||||||
|
memberElem.addAttribute("role", roleName);
|
||||||
|
|
||||||
|
final Element surnameElem = memberElem.newChildElement("surname");
|
||||||
|
surnameElem.setText(member.getSurname());
|
||||||
|
final Element givenNameElem = memberElem.newChildElement("givenName");
|
||||||
|
givenNameElem.setText(member.getGivenName());
|
||||||
|
final Element titlePreElem = memberElem.newChildElement("titlePre");
|
||||||
|
titlePreElem.setText(member.getTitlePre());
|
||||||
|
final Element titlePostElem = memberElem.newChildElement("titlePost");
|
||||||
|
titlePostElem.setText(member.getTitlePost());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -94,6 +94,7 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the XML for the basic data (addendum, begin, end, shortDesc)
|
* Generates the XML for the basic data (addendum, begin, end, shortDesc)
|
||||||
|
*
|
||||||
* @param project
|
* @param project
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
|
|
@ -194,56 +195,49 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
||||||
|
|
||||||
final Element membersElem = parent.newChildElement("members");
|
final Element membersElem = parent.newChildElement("members");
|
||||||
|
|
||||||
if (config.isMergingMembers()) {
|
|
||||||
final DataQuery subProjectsQuery =
|
|
||||||
SessionManager.getSession().retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
|
||||||
subProjectsQuery.setParameter("orgaunitId",
|
|
||||||
project.getID().toString());
|
|
||||||
subProjectsQuery.setParameter("assocType",
|
|
||||||
SciProjectSubProjectsStep.ASSOC_TYPE);
|
|
||||||
|
|
||||||
final DataQuery personsQuery = SessionManager.getSession().
|
|
||||||
retrieveQuery(
|
|
||||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits");
|
|
||||||
|
|
||||||
//final StringBuffer personsFilter = new StringBuffer();
|
|
||||||
final List<String> projectIds = new ArrayList<String>();
|
|
||||||
while (subProjectsQuery.next()) {
|
|
||||||
/*if (personsFilter.length() > 0) {
|
|
||||||
personsFilter.append(" or ");
|
|
||||||
}
|
|
||||||
personsFilter.append(String.format("orgaunitId = %s",
|
|
||||||
subProjectsQuery.get(
|
|
||||||
"orgaunitId").toString()));*/
|
|
||||||
projectIds.add(subProjectsQuery.get("orgaunitId").toString());
|
|
||||||
}
|
|
||||||
//personsQuery.addFilter(personsFilter.toString());
|
|
||||||
personsQuery.setParameter("orgaunitIds", projectIds);
|
|
||||||
|
|
||||||
personsQuery.addOrder(GenericPerson.SURNAME);
|
|
||||||
personsQuery.addOrder(GenericPerson.GIVENNAME);
|
|
||||||
|
|
||||||
while (personsQuery.next()) {
|
|
||||||
generateMemberXml((BigDecimal) personsQuery.get("memberId"),
|
|
||||||
membersElem,
|
|
||||||
(String) personsQuery.get("roleName"),
|
|
||||||
state);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final GenericOrganizationalUnitPersonCollection members = project.
|
final GenericOrganizationalUnitPersonCollection members = project.
|
||||||
getPersons();
|
getPersons();
|
||||||
|
|
||||||
members.addOrder("surname");
|
|
||||||
members.addOrder("givenname");
|
|
||||||
|
|
||||||
while (members.next()) {
|
while (members.next()) {
|
||||||
generateMemberXml(members.getPerson(),
|
generateMemberXml(members.getPerson(),
|
||||||
membersElem,
|
membersElem,
|
||||||
members.getRoleName(),
|
members.getRoleName(),
|
||||||
state);
|
state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if (config.isMergingMembers()) { final DataQuery subProjectsQuery =
|
||||||
|
* SessionManager.getSession().retrieveQuery(
|
||||||
|
* "com.arsdigita.cms.contenttypes.getIdsOfSubordinateOrgaUnitsRecursivlyWithAssocType");
|
||||||
|
* subProjectsQuery.setParameter("orgaunitId",
|
||||||
|
* project.getID().toString());
|
||||||
|
* subProjectsQuery.setParameter("assocType",
|
||||||
|
* SciProjectSubProjectsStep.ASSOC_TYPE);
|
||||||
|
*
|
||||||
|
* final DataQuery personsQuery = SessionManager.getSession().
|
||||||
|
* retrieveQuery(
|
||||||
|
* "com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits");
|
||||||
|
*
|
||||||
|
* final List<String> projectIds = new ArrayList<String>(); while
|
||||||
|
* (subProjectsQuery.next()) {
|
||||||
|
* projectIds.add(subProjectsQuery.get("orgaunitId").toString()); }
|
||||||
|
* personsQuery.setParameter("orgaunitIds", projectIds);
|
||||||
|
*
|
||||||
|
* personsQuery.addOrder(GenericPerson.SURNAME);
|
||||||
|
* personsQuery.addOrder(GenericPerson.GIVENNAME);
|
||||||
|
*
|
||||||
|
* while (personsQuery.next()) { generateMemberXml((BigDecimal)
|
||||||
|
* personsQuery.get("memberId"), membersElem, (String)
|
||||||
|
* personsQuery.get("roleName"), state); } } else { final
|
||||||
|
* GenericOrganizationalUnitPersonCollection members = project.
|
||||||
|
* getPersons();
|
||||||
|
*
|
||||||
|
* members.addOrder("surname"); members.addOrder("givenname");
|
||||||
|
*
|
||||||
|
* while (members.next()) { generateMemberXml(members.getPerson(),
|
||||||
|
* membersElem, members.getRoleName(), state); }
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
logger.debug(String.format("Generated members XML for project '%s'"
|
logger.debug(String.format("Generated members XML for project '%s'"
|
||||||
+ "in '%d ms'. MergeMembers is set to '%b'.",
|
+ "in '%d ms'. MergeMembers is set to '%b'.",
|
||||||
|
|
@ -428,9 +422,12 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
||||||
final XmlGenerator generator = new XmlGenerator(subProject);
|
final XmlGenerator generator = new XmlGenerator(subProject);
|
||||||
generator.setUseExtraXml(false);
|
generator.setUseExtraXml(false);
|
||||||
generator.generateXML(state, parent, "");
|
generator.generateXML(state, parent, "");
|
||||||
/*final Element subProjectElem = parent.newChildElement("subProject");
|
/*
|
||||||
final Element subProjectTitle = subProjectElem.newChildElement("title");
|
* final Element subProjectElem = parent.newChildElement("subProject");
|
||||||
subProjectTitle.setText(subProject.getTitle());*/
|
* final Element subProjectTitle =
|
||||||
|
* subProjectElem.newChildElement("title");
|
||||||
|
subProjectTitle.setText(subProject.getTitle());
|
||||||
|
*/
|
||||||
logger.debug(String.format("Generated XML for subproject '%s' in"
|
logger.debug(String.format("Generated XML for subproject '%s' in"
|
||||||
+ "%d ms",
|
+ "%d ms",
|
||||||
subProject.getName(),
|
subProject.getName(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue