- Kleiner Fix am DaBInImporter
- Formatierung/Kommentare in RelatedLink - Publikationen werden jetzt in SciOrganizationPanel, SciDepartmentPanel und SciProjectPanel wie die anderen Daten im XML ausgegeben. git-svn-id: https://svn.libreccm.org/ccm/trunk@855 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2d55e3ab5d
commit
e15122ddd9
|
|
@ -182,6 +182,7 @@ public class RelatedLink extends Link {
|
||||||
*
|
*
|
||||||
* @param item The item to return links for
|
* @param item The item to return links for
|
||||||
* @param name Name of the link list
|
* @param name Name of the link list
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public static DataCollection getRelatedLinks(ContentItem item, String name) {
|
public static DataCollection getRelatedLinks(ContentItem item, String name) {
|
||||||
s_log.debug("Getting related links for a content item");
|
s_log.debug("Getting related links for a content item");
|
||||||
|
|
|
||||||
|
|
@ -2881,8 +2881,10 @@ public class DaBInImporter extends Program {
|
||||||
publisherDe.setName(DaBInImporter.normalizeString(publisherData.
|
publisherDe.setName(DaBInImporter.normalizeString(publisherData.
|
||||||
getName()));
|
getName()));
|
||||||
} else {
|
} else {
|
||||||
publisherDe.setTitle(String.format("%s, %s", publisherData.
|
/*publisherDe.setTitle(String.format("%s, %s", publisherData.
|
||||||
getName(), publisherData.getPlace()));
|
getName(), publisherData.getPlace()));*/
|
||||||
|
publisherDe.setTitle(String.format("%s", publisherData.
|
||||||
|
getName()));
|
||||||
publisherDe.setName(DaBInImporter.normalizeString(String.
|
publisherDe.setName(DaBInImporter.normalizeString(String.
|
||||||
format(
|
format(
|
||||||
"%s, %s", publisherData.getName(), publisherData.
|
"%s, %s", publisherData.getName(), publisherData.
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
|
@ -29,6 +30,7 @@ import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
@ -51,6 +53,7 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
public static final String SHOW_PROJECTS = "projects";
|
public static final String SHOW_PROJECTS = "projects";
|
||||||
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
||||||
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
||||||
|
public static final String SHOW_PUBLICATIONS = "publications";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultForShowParam() {
|
protected String getDefaultForShowParam() {
|
||||||
|
|
@ -447,6 +450,12 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
availableData.newChildElement("projectsFinished");
|
availableData.newChildElement("projectsFinished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DataCollection publicationLinks =
|
||||||
|
RelatedLink.getRelatedLinks(department,
|
||||||
|
"SciDepartmentPublications");
|
||||||
|
if ((publicationLinks != null) && (publicationLinks.size() > 0)) {
|
||||||
|
availableData.newChildElement("publications");
|
||||||
|
}
|
||||||
|
|
||||||
String show = getShowParam(state);
|
String show = getShowParam(state);
|
||||||
|
|
||||||
|
|
@ -481,6 +490,12 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||||
getFiltersForFinishedProjects());
|
getFiltersForFinishedProjects());
|
||||||
} else if (SHOW_SUBDEPARTMENTS.equals(show)) {
|
} else if (SHOW_SUBDEPARTMENTS.equals(show)) {
|
||||||
generateSubDepartmentsXML(department, content, state);
|
generateSubDepartmentsXML(department, content, state);
|
||||||
|
} else if (SHOW_PUBLICATIONS.equals(show)) {
|
||||||
|
generatePublicationsXML(
|
||||||
|
RelatedLink.getRelatedLinks(item,
|
||||||
|
"SciDepartmentPublications"),
|
||||||
|
content,
|
||||||
|
state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.ContentItemXMLRenderer;
|
||||||
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
|
@ -28,7 +31,13 @@ import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||||
import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
|
import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -439,4 +448,74 @@ public abstract class SciOrganizationBasePanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the XML for the list of publications, using the special
|
||||||
|
* RelatedLinks passed by the caller. To avoid a dependency to the
|
||||||
|
* sci-publications module, we are using only methods from
|
||||||
|
* {@link DataObject}, {@link DomainObject}, {@link DataCollection} and
|
||||||
|
* {@link DomainCollection}.
|
||||||
|
*
|
||||||
|
* @param links Links to the publications
|
||||||
|
* @param parent The parent XML element for the XML created by this method
|
||||||
|
* @param state The current page state.
|
||||||
|
*/
|
||||||
|
protected void generatePublicationsXML(final DataCollection links,
|
||||||
|
final Element parent,
|
||||||
|
final PageState state) {
|
||||||
|
RelatedLink link;
|
||||||
|
ContentItem publication;
|
||||||
|
String objectType;
|
||||||
|
List<ContentItem> publications;
|
||||||
|
|
||||||
|
publications = new ArrayList<ContentItem>();
|
||||||
|
|
||||||
|
while (links.next()) {
|
||||||
|
link = new RelatedLink(links.getDataObject());
|
||||||
|
publication = link.getTargetItem();
|
||||||
|
|
||||||
|
publications.add(publication);
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(publications, new Comparator<ContentItem>() {
|
||||||
|
|
||||||
|
public int compare(ContentItem o1, ContentItem o2) {
|
||||||
|
Integer year1;
|
||||||
|
Integer year2;
|
||||||
|
|
||||||
|
year1 = (Integer) o1.get("yearOfPublication");
|
||||||
|
year2 = (Integer) o2.get("yearOfPublication");
|
||||||
|
|
||||||
|
if (year1.compareTo(year2) == 0) {
|
||||||
|
String title1;
|
||||||
|
String title2;
|
||||||
|
|
||||||
|
title1 = (String) o1.get("title");
|
||||||
|
title2 = (String) o2.get("title");
|
||||||
|
|
||||||
|
return title1.compareTo(title2);
|
||||||
|
} else {
|
||||||
|
return (year1.compareTo(year2)) * -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (ContentItem pub : publications) {
|
||||||
|
generatePublicationXML(pub, parent, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generatePublicationXML(final ContentItem publication,
|
||||||
|
final Element parent,
|
||||||
|
final PageState state) {
|
||||||
|
Element publicationElem;
|
||||||
|
ContentItemXMLRenderer renderer;
|
||||||
|
|
||||||
|
publicationElem = parent.newChildElement("publications");
|
||||||
|
|
||||||
|
renderer = new ContentItemXMLRenderer(publicationElem);
|
||||||
|
renderer.setWrapAttributes(true);
|
||||||
|
|
||||||
|
renderer.walk(publication, SimpleXMLGenerator.class.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
|
@ -32,10 +33,9 @@ import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
|
import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
|
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -60,6 +60,7 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
public static final String SHOW_PROJECTS = "projects";
|
public static final String SHOW_PROJECTS = "projects";
|
||||||
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
||||||
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
||||||
|
public static final String SHOW_PUBLICATIONS = "publications";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDefaultForShowParam() {
|
protected String getDefaultForShowParam() {
|
||||||
|
|
@ -546,6 +547,12 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
availableData.newChildElement("projectsFinished");
|
availableData.newChildElement("projectsFinished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DataCollection publicationLinks =
|
||||||
|
RelatedLink.getRelatedLinks(orga,
|
||||||
|
"SciOrganizationPublications");
|
||||||
|
if ((publicationLinks != null) && (publicationLinks.size() > 0)) {
|
||||||
|
availableData.newChildElement("publications");
|
||||||
|
}
|
||||||
|
|
||||||
String show = getShowParam(state);
|
String show = getShowParam(state);
|
||||||
|
|
||||||
|
|
@ -578,6 +585,12 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||||
} else if (SHOW_PROJECTS_FINISHED.equals(show)) {
|
} else if (SHOW_PROJECTS_FINISHED.equals(show)) {
|
||||||
generateProjectsXML(
|
generateProjectsXML(
|
||||||
orga, content, state, getFiltersForFinishedProjects());
|
orga, content, state, getFiltersForFinishedProjects());
|
||||||
|
} else if (SHOW_PUBLICATIONS.equals(show)) {
|
||||||
|
generatePublicationsXML(
|
||||||
|
RelatedLink.getRelatedLinks(item,
|
||||||
|
"SciOrganizationPublications"),
|
||||||
|
content,
|
||||||
|
state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,13 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
|
||||||
import com.arsdigita.cms.contenttypes.SciMember;
|
|
||||||
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
|
import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -234,6 +232,12 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
||||||
availableData.newChildElement("formerMembers");
|
availableData.newChildElement("formerMembers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DataCollection publicationLinks =
|
||||||
|
RelatedLink.getRelatedLinks(project,
|
||||||
|
"SciProjectPublications");
|
||||||
|
if ((publicationLinks != null) && (publicationLinks.size() > 0)) {
|
||||||
|
availableData.newChildElement("publications");
|
||||||
|
}
|
||||||
|
|
||||||
String show = getShowParam(state);
|
String show = getShowParam(state);
|
||||||
|
|
||||||
|
|
@ -256,6 +260,12 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
||||||
getFiltersForFinishedProjects());
|
getFiltersForFinishedProjects());
|
||||||
} else if (SHOW_MEMBERS.equals(show)) {
|
} else if (SHOW_MEMBERS.equals(show)) {
|
||||||
generateMembersXML(project, content, state, true, true, true);
|
generateMembersXML(project, content, state, true, true, true);
|
||||||
|
} else if (SHOW_PUBLICATIONS.equals(show)) {
|
||||||
|
generatePublicationsXML(
|
||||||
|
RelatedLink.getRelatedLinks(item,
|
||||||
|
"SciProjectPublications"),
|
||||||
|
content,
|
||||||
|
state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue