- Nächster Teil der Restruktuierung der Verknüpfung zwischen Publication und SciOrganization/SciDepartment/SciProject.
- Panels funktionieren soweit benötigen aber noch Optimierung. - Konverter-Programm für alte RelatedLinks - Optimierungen an SciOrganizationPanel, SciDepartmentPanel und SciProjectPanel git-svn-id: https://svn.libreccm.org/ccm/trunk@951 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
644868eeea
commit
a83b943274
|
|
@ -208,8 +208,14 @@ public class Link extends ACSObject {
|
|||
// If acsObject is instance of ContentBundle
|
||||
if (acsObject instanceof ContentBundle) {
|
||||
// get the negotiated language version of this ContentBundle
|
||||
ci = ((ContentBundle) acsObject).negotiate(DispatcherHelper.
|
||||
getRequest().getLocales());
|
||||
//jensp: If there is no request object - for example if getTargetItem
|
||||
//is called from a command line program - use the primary instance.
|
||||
if (DispatcherHelper.getRequest() == null) {
|
||||
ci = ((ContentBundle) acsObject).getPrimaryInstance();
|
||||
} else {
|
||||
ci = ((ContentBundle) acsObject).negotiate(DispatcherHelper.
|
||||
getRequest().getLocales());
|
||||
}
|
||||
} else {
|
||||
// else there are no language versions so just use the acsObject
|
||||
ci = (ContentItem) acsObject;
|
||||
|
|
@ -301,7 +307,7 @@ public class Link extends ACSObject {
|
|||
* @return the Link URI
|
||||
*/
|
||||
public String getInternalOrExternalURI(PageState state) {
|
||||
|
||||
|
||||
if (EXTERNAL_LINK.equals(getTargetType())) {
|
||||
return getTargetURI();
|
||||
} else {
|
||||
|
|
@ -317,7 +323,7 @@ public class Link extends ACSObject {
|
|||
ItemResolver resolver = section.getItemResolver();
|
||||
String url = resolver.generateItemURL(
|
||||
state, item, section, item.getVersion());
|
||||
|
||||
|
||||
if ((getTargetURI() != null) && getTargetURI().startsWith("&")) {
|
||||
ParameterMap parameters;
|
||||
StringTokenizer tokenizer;
|
||||
|
|
@ -340,8 +346,8 @@ public class Link extends ACSObject {
|
|||
toString()));
|
||||
return URL.there(state.getRequest(), url, parameters).
|
||||
toString();
|
||||
} else {
|
||||
return URL.there(state.getRequest(), url).toString();
|
||||
} else {
|
||||
return URL.there(state.getRequest(), url).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -498,8 +504,8 @@ public class Link extends ACSObject {
|
|||
|
||||
int otherKey = key;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (swapNext) {
|
||||
otherKey = key + 1;
|
||||
query.addOrder("linkOrder ASC");
|
||||
|
|
@ -516,8 +522,8 @@ public class Link extends ACSObject {
|
|||
if (query.next()) {
|
||||
otherKey = ((Integer) query.get("linkOrder")).intValue();
|
||||
query.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DataOperation operation = getSwapOperation(operationName);
|
||||
operation.setParameter("linkOrder", new Integer(key));
|
||||
operation.setParameter("nextLinkOrder", new Integer(otherKey));
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ public class ConfigRegistry {
|
|||
|
||||
private class ConfigRegistryParser extends DefaultHandler {
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qn,
|
||||
Attributes attrs) {
|
||||
if (localName.equals("config")) {
|
||||
|
|
|
|||
|
|
@ -15,4 +15,16 @@ association {
|
|||
to cms_organization_publication_map.organization_id,
|
||||
join cms_organization_publication_map.publication_id
|
||||
to ct_publications.publication_id;
|
||||
}
|
||||
|
||||
query getIdsOfPublicationsOfSciOrganization {
|
||||
BigDecimal publicationId;
|
||||
|
||||
do {
|
||||
select cms_organization_publication_map.publication_id
|
||||
from cms_organization_publication_map
|
||||
where cms_organization_publication_map.organization_id = :organization
|
||||
} map {
|
||||
publicationId = cms_organization_publication_map.publication_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<!-- <config class="com.arsdigita.cms.SciOrganizationPublicationsConfig" storage="ccm-sci-assets-sciorganizationpublication/sciorganizationpublication.properties"/> -->
|
||||
</registry>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<config class="com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig"
|
||||
storage="ccm-sci-types-organization/sciorganization.properties"/>
|
||||
</registry>
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
package com.arsdigita.cms.contentassets;
|
||||
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitWithPublications;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.dispatcher.ContentItemDispatcher;
|
||||
import com.arsdigita.cms.installer.xml.ContentItemHelper;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.TransactionContext;
|
||||
import java.math.BigDecimal;
|
||||
import javax.sound.sampled.TargetDataLine;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class ConvertRelatedPublicationsLinkToPublicationAssoc {
|
||||
|
||||
public static void main(String[] args) {
|
||||
final com.arsdigita.runtime.Runtime runtime =
|
||||
new com.arsdigita.runtime.Runtime();
|
||||
|
||||
runtime.startup();
|
||||
|
||||
final Session session = SessionManager.getSession();
|
||||
final TransactionContext tc = session.getTransactionContext();
|
||||
|
||||
tc.beginTxn();
|
||||
try {
|
||||
DataCollection data = session.retrieve(
|
||||
SciDepartment.BASE_DATA_OBJECT_TYPE);
|
||||
data.addOrder("title");
|
||||
|
||||
SciDepartment department;
|
||||
while (data.next()) {
|
||||
department =
|
||||
(SciDepartment) DomainObjectFactory.newInstance(data.
|
||||
getDataObject());
|
||||
|
||||
if (department.isDraftVersion()) {
|
||||
|
||||
System.out.printf("Found department '%s'\n",
|
||||
department.getTitle());
|
||||
|
||||
DataCollection relatedLinks = RelatedLink.getRelatedLinks(
|
||||
department, "SciDepartmentPublications");
|
||||
|
||||
System.out.printf(
|
||||
"Found %d related links from department '%s' with link list name '%s':\n",
|
||||
relatedLinks.size(),
|
||||
department.getTitle(),
|
||||
"SciDepartmentPublications");
|
||||
int i = 1;
|
||||
while (relatedLinks.next()) {
|
||||
RelatedLink relatedLink =
|
||||
(RelatedLink) DomainObjectFactory.
|
||||
newInstance(relatedLinks.getDataObject());
|
||||
|
||||
if (relatedLink == null) {
|
||||
System.out.println(
|
||||
"Failed to convert related link to domain object...");
|
||||
continue;
|
||||
}
|
||||
|
||||
ContentItem target = relatedLink.getTargetItem();
|
||||
Publication publication = (Publication) target;
|
||||
System.out.printf(
|
||||
"\tconverting related link to '%s' (%d of %d)\n",
|
||||
publication.getTitle(),
|
||||
i,
|
||||
relatedLinks.size());
|
||||
|
||||
GenericOrganizationalUnitWithPublications orga =
|
||||
new GenericOrganizationalUnitWithPublications(
|
||||
department.getID());
|
||||
orga.addPublication(publication);
|
||||
|
||||
relatedLink.delete();
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DataCollection persons = session.retrieve(
|
||||
GenericPerson.BASE_DATA_OBJECT_TYPE);
|
||||
persons.addOrder("surname");
|
||||
persons.addOrder("givenname");
|
||||
|
||||
GenericPerson person;
|
||||
while (persons.next()) {
|
||||
person =
|
||||
(GenericPerson) DomainObjectFactory.newInstance(persons.
|
||||
getDataObject());
|
||||
|
||||
if (person.isDraftVersion()) {
|
||||
System.out.printf("Found person '%s'\n",
|
||||
person.getGivenName(),
|
||||
person.getSurname());
|
||||
|
||||
DataCollection relatedLinks = RelatedLink.getRelatedLinks(
|
||||
person, "MyPublications");
|
||||
|
||||
System.out.printf(
|
||||
"Found %d related links from person '%s' '%s' with link list name '%s'\n",
|
||||
relatedLinks.size(),
|
||||
person.getGivenName(),
|
||||
person.getSurname(),
|
||||
"MyPublications");
|
||||
int i = 1;
|
||||
while (relatedLinks.next()) {
|
||||
RelatedLink relatedLink =
|
||||
(RelatedLink) DomainObjectFactory.
|
||||
newInstance(relatedLinks.getDataObject());
|
||||
|
||||
if (relatedLink == null) {
|
||||
System.out.println(
|
||||
"Failed to convert related link to domain object...");
|
||||
continue;
|
||||
}
|
||||
|
||||
ContentItem target = relatedLink.getTargetItem();
|
||||
if (target == null) {
|
||||
System.out.println(
|
||||
"\t Strange: Target item is null. But thats no problem, since we are only deleting this related link.");
|
||||
|
||||
} else {
|
||||
Publication publication = (Publication) target;
|
||||
System.out.printf(
|
||||
"\tDeleting obsolete related link to '%s' (%d of %d)\n",
|
||||
publication.getTitle(),
|
||||
i,
|
||||
relatedLinks.size());
|
||||
}
|
||||
relatedLink.delete();
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tc.commitTxn();
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Exception ocurred during convert process:");
|
||||
ex.printStackTrace(System.err);
|
||||
} finally {
|
||||
if (tc.inTxn()) {
|
||||
tc.abortTxn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,7 @@ public class SciDepartmentWithPublications extends SciDepartment {
|
|||
}
|
||||
|
||||
public SciDepartmentWithPublications(final SciDepartment department) {
|
||||
super(department.getID());
|
||||
departmentWithPublications =
|
||||
new GenericOrganizationalUnitWithPublications(department.getID());
|
||||
}
|
||||
|
|
@ -57,8 +58,8 @@ public class SciDepartmentWithPublications extends SciDepartment {
|
|||
public boolean hasPublications(final boolean merge) {
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciDepartment");
|
||||
query.setParameter("departmentId", getID());
|
||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciOrganization");
|
||||
query.setParameter("organization", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
|
|
|
|||
|
|
@ -55,8 +55,9 @@ public class SciOrganizationWithPublications extends SciOrganization {
|
|||
}
|
||||
|
||||
public SciOrganizationWithPublications(final SciOrganization organization) {
|
||||
super(organization.getID());
|
||||
orgaWithPublications = new GenericOrganizationalUnitWithPublications(
|
||||
organization.getID());
|
||||
organization.getID());
|
||||
}
|
||||
|
||||
public static SciOrganizationWithPublicationsConfig getConfig() {
|
||||
|
|
@ -78,14 +79,15 @@ public class SciOrganizationWithPublications extends SciOrganization {
|
|||
DataQuery departmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
|
||||
departmentsQuery.setParameter("organization", getID());
|
||||
departmentsQuery.setParameter("organization",
|
||||
getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
if (departmentsQuery.size() > 0) {
|
||||
BigDecimal departmentId;
|
||||
boolean result = false;
|
||||
while (departmentsQuery.next()) {
|
||||
departmentId = (BigDecimal) departmentsQuery.get(
|
||||
"departmentsId");
|
||||
"departmentId");
|
||||
result = hasPublications(departmentId, merge);
|
||||
|
||||
if (result) {
|
||||
|
|
@ -110,8 +112,8 @@ public class SciOrganizationWithPublications extends SciOrganization {
|
|||
final boolean merge) {
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciDepartment");
|
||||
query.setParameter("departmentId", departmentId);
|
||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciOrganization");
|
||||
query.setParameter("organization", departmentId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
|
|
@ -124,7 +126,7 @@ public class SciOrganizationWithPublications extends SciOrganization {
|
|||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
subDepartmentsQuery.setParameter("department", departmentId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
if (subDepartmentsQuery.size() > 0) {
|
||||
BigDecimal subDepartmentId;
|
||||
boolean result = false;
|
||||
while(subDepartmentsQuery.next()) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class SciProjectWithPublications extends SciProject {
|
|||
}
|
||||
|
||||
public SciProjectWithPublications(final SciProject project) {
|
||||
super(project.getID());
|
||||
projectWithPublications =
|
||||
new GenericOrganizationalUnitWithPublications(project.getID());
|
||||
}
|
||||
|
|
@ -57,8 +58,8 @@ public class SciProjectWithPublications extends SciProject {
|
|||
public boolean hasPublications(final boolean merge) {
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciProject");
|
||||
query.setParameter("projectId", getID());
|
||||
"com.arsdigita.cms.contentassets.getIdsOfPublicationsOfSciOrganization");
|
||||
query.setParameter("organization", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,404 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;
|
||||
import com.arsdigita.cms.contenttypes.ArticleInJournal;
|
||||
import com.arsdigita.cms.contenttypes.AuthorshipCollection;
|
||||
import com.arsdigita.cms.contenttypes.CollectedVolume;
|
||||
import com.arsdigita.cms.contenttypes.Expertise;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.GreyLiterature;
|
||||
import com.arsdigita.cms.contenttypes.InProceedings;
|
||||
import com.arsdigita.cms.contenttypes.InternetArticle;
|
||||
import com.arsdigita.cms.contenttypes.Journal;
|
||||
import com.arsdigita.cms.contenttypes.Monograph;
|
||||
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
|
||||
import com.arsdigita.cms.contenttypes.Publisher;
|
||||
import com.arsdigita.cms.contenttypes.Review;
|
||||
import com.arsdigita.cms.contenttypes.UnPublished;
|
||||
import com.arsdigita.cms.contenttypes.WorkingPaper;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class PublicationXmlHelper {
|
||||
|
||||
private Element parent;
|
||||
private Publication publication;
|
||||
|
||||
public PublicationXmlHelper(final Element parent,
|
||||
final Publication publication) {
|
||||
this.parent = parent;
|
||||
this.publication = publication;
|
||||
}
|
||||
|
||||
public void generateXml() {
|
||||
Element publicationElem = parent.newChildElement(
|
||||
"publications");
|
||||
|
||||
generateSystemXml(publicationElem);
|
||||
generatePublicationXml(publicationElem);
|
||||
|
||||
if (publication instanceof PublicationWithPublisher) {
|
||||
generatePublicationWithPublisherXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof ArticleInCollectedVolume) {
|
||||
generateArticleInCollectedVolumeXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof ArticleInJournal) {
|
||||
generateArticleInJournalXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof CollectedVolume) {
|
||||
generateCollectedVolumeXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof Expertise) {
|
||||
generateExpertiseXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof GreyLiterature) {
|
||||
generateGreyLiteratureXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof InProceedings) {
|
||||
generateInProceedingsXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof InternetArticle) {
|
||||
generateInternetArticleXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof Journal) {
|
||||
generateJournalXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof Monograph) {
|
||||
generateMonographXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof Proceedings) {
|
||||
generateProceedingsXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof Review) {
|
||||
generateReviewXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof UnPublished) {
|
||||
generateUnPublishedXml(publicationElem);
|
||||
}
|
||||
|
||||
if (publication instanceof WorkingPaper) {
|
||||
generateWorkingPaperXml(publicationElem);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateXmlElement(final Element parent,
|
||||
final String name,
|
||||
final String value) {
|
||||
if ((value == null) || value.isEmpty()) {
|
||||
return;
|
||||
} else {
|
||||
Element element = parent.newChildElement(name);
|
||||
element.setText(value);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateXmlElement(final Element parent,
|
||||
final String name,
|
||||
final Integer value) {
|
||||
if ((value == null)) {
|
||||
return;
|
||||
} else {
|
||||
generateXmlElement(parent, name, value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void generateXmlElement(final Element parent,
|
||||
final String name,
|
||||
final Boolean value) {
|
||||
if (value == null) {
|
||||
return;
|
||||
} else if (value.booleanValue()) {
|
||||
generateXmlElement(parent, name, "true");
|
||||
} else {
|
||||
generateXmlElement(parent, name, "false");
|
||||
}
|
||||
}
|
||||
|
||||
private void generateSystemXml(final Element publicationElem) {
|
||||
Element objectTypeElem = publicationElem.newChildElement("objectType");
|
||||
objectTypeElem.setText(publication.getObjectType().getQualifiedName());
|
||||
}
|
||||
|
||||
private void generatePublicationXml(final Element publicationElem) {
|
||||
generateXmlElement(publicationElem, "title", publication.getTitle());
|
||||
Element yearElem = publicationElem.newChildElement(
|
||||
"yearOfPublication");
|
||||
yearElem.setText(publication.getYearOfPublication().toString());
|
||||
generateXmlElement(publicationElem,
|
||||
"yearOfPublication",
|
||||
publication.getYearOfPublication());
|
||||
generateXmlElement(publicationElem, "misc", publication.getMisc());
|
||||
generateXmlElement(parent, "abstract", publication.getAbstract());
|
||||
generateAuthorsXml(publicationElem);
|
||||
}
|
||||
|
||||
private void generateAuthorsXml(final Element publicationElem) {
|
||||
AuthorshipCollection authors = publication.getAuthors();
|
||||
|
||||
if ((authors == null) || authors.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (authors.next()) {
|
||||
Element authorsElem = publicationElem.newChildElement(
|
||||
"authors");
|
||||
Element linkElem = authorsElem.newChildElement("link");
|
||||
Element editorElem = linkElem.newChildElement("editor");
|
||||
if (authors.isEditor()) {
|
||||
editorElem.setText("true");
|
||||
} else {
|
||||
editorElem.setText("false");
|
||||
}
|
||||
Element authorOrderElem = linkElem.newChildElement(
|
||||
"authorOrder");
|
||||
authorOrderElem.setText(authors.getAuthorshipOrder().
|
||||
toString());
|
||||
|
||||
GenericPerson author = authors.getAuthor();
|
||||
Element surnameElem = authorsElem.newChildElement("surname");
|
||||
surnameElem.setText(author.getSurname());
|
||||
Element givennameElem = authorsElem.newChildElement(
|
||||
"givenname");
|
||||
givennameElem.setText(author.getGivenName());
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePublicationWithPublisherXml(
|
||||
final Element publicationElem) {
|
||||
PublicationWithPublisher pwp =
|
||||
(PublicationWithPublisher) publication;
|
||||
generatePublisherXml(publicationElem, pwp);
|
||||
|
||||
generateXmlElement(publicationElem, "misc", pwp.getISBN());
|
||||
generateXmlElement(publicationElem, "volume", pwp.getVolume());
|
||||
generateXmlElement(publicationElem,
|
||||
"numberOfVolumes",
|
||||
pwp.getNumberOfVolumes());
|
||||
generateXmlElement(publicationElem,
|
||||
"numberOfPages",
|
||||
pwp.getNumberOfPages());
|
||||
generateXmlElement(publicationElem, "edition", pwp.getEdition());
|
||||
}
|
||||
|
||||
private void generatePublisherXml(final Element publicationElem,
|
||||
final PublicationWithPublisher pwp) {
|
||||
final Publisher publisher = pwp.getPublisher();
|
||||
|
||||
if (publisher == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Element publisherElem = publicationElem.newChildElement(
|
||||
"publisher");
|
||||
Element publisherNameElem = publisherElem.newChildElement(
|
||||
"publisherName");
|
||||
publisherNameElem.setText(publisher.getPublisherName());
|
||||
Element publisherPlaceElem = publisherElem.newChildElement(
|
||||
"place");
|
||||
publisherPlaceElem.setText(publisher.getPlace());
|
||||
}
|
||||
|
||||
private void generateArticleInCollectedVolumeXml(
|
||||
final Element publicationElem) {
|
||||
final ArticleInCollectedVolume article =
|
||||
(ArticleInCollectedVolume) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "pageFrom", article.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pageTo", article.getPagesTo());
|
||||
generateXmlElement(publicationElem, "chapter", article.getChapter());
|
||||
generateXmlElement(publicationElem, "reviewed", article.getReviewed());
|
||||
generateCollectedVolumeLinkXml(publicationElem, article);
|
||||
}
|
||||
|
||||
private void generateCollectedVolumeLinkXml(
|
||||
final Element publicationElem,
|
||||
final ArticleInCollectedVolume article) {
|
||||
CollectedVolume collectedVolume = article.getCollectedVolume();
|
||||
|
||||
if (collectedVolume != null) {
|
||||
Element collectedVolumeElem = publicationElem.newChildElement(
|
||||
"collectedVolume");
|
||||
PublicationXmlHelper xmlHelper =
|
||||
new PublicationXmlHelper(collectedVolumeElem,
|
||||
collectedVolume);
|
||||
xmlHelper.generateXml();
|
||||
}
|
||||
}
|
||||
|
||||
private void generateArticleInJournalXml(final Element publicationElem) {
|
||||
final ArticleInJournal article = (ArticleInJournal) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "volume", article.getVolume());
|
||||
generateXmlElement(publicationElem, "issue", article.getIssue());
|
||||
generateXmlElement(publicationElem, "pageFrom", article.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pageTo", article.getPagesTo());
|
||||
generateXmlElement(publicationElem, "reviewed", article.getReviewed());
|
||||
|
||||
generateJournalLinkXml(publicationElem, article);
|
||||
}
|
||||
|
||||
private void generateJournalLinkXml(final Element publicationElem,
|
||||
ArticleInJournal article) {
|
||||
Journal journal = article.getJournal();
|
||||
|
||||
if (journal != null) {
|
||||
Element journalElem = publicationElem.newChildElement("journal");
|
||||
PublicationXmlHelper xmlHelper = new PublicationXmlHelper(
|
||||
journalElem,
|
||||
journal);
|
||||
xmlHelper.generateXml();
|
||||
}
|
||||
}
|
||||
|
||||
private void generateCollectedVolumeXml(final Element publicationElem) {
|
||||
CollectedVolume collectedVolume = (CollectedVolume) publication;
|
||||
|
||||
generateXmlElement(publicationElem,
|
||||
"reviewed",
|
||||
collectedVolume.getReviewed());
|
||||
}
|
||||
|
||||
private void generateExpertiseXml(final Element publicationElem) {
|
||||
Expertise expertise = (Expertise) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "place", expertise.getPlace());
|
||||
generateXmlElement(publicationElem,
|
||||
"numberOfPages",
|
||||
expertise.getNumberOfPages());
|
||||
|
||||
generateOrganizationXml(publicationElem,
|
||||
"organization",
|
||||
expertise.getOrganization());
|
||||
|
||||
generateOrganizationXml(publicationElem,
|
||||
"orderer",
|
||||
expertise.getOrderer());
|
||||
}
|
||||
|
||||
private void generateGreyLiteratureXml(final Element publicationElem) {
|
||||
GreyLiterature grey = (GreyLiterature) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "pageFrom", grey.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pageTo", grey.getPagesTo());
|
||||
}
|
||||
|
||||
private void generateInProceedingsXml(final Element publicationElem) {
|
||||
InProceedings inProceedings = (InProceedings) publication;
|
||||
|
||||
generateXmlElement(publicationElem,
|
||||
"pageFrom",
|
||||
inProceedings.getPagesFrom());
|
||||
generateXmlElement(publicationElem,
|
||||
"pagesTo",
|
||||
inProceedings.getPagesTo());
|
||||
Element proceedingsElem = publicationElem.newChildElement("proceedings");
|
||||
PublicationXmlHelper xmlHelper = new PublicationXmlHelper(
|
||||
proceedingsElem,
|
||||
inProceedings.getProceedings());
|
||||
xmlHelper.generateXml();
|
||||
}
|
||||
|
||||
private void generateInternetArticleXml(final Element publicationElem) {
|
||||
InternetArticle article = (InternetArticle) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "place", article.getPlace());
|
||||
generateXmlElement(publicationElem, "number", article.getNumber());
|
||||
generateXmlElement(publicationElem,
|
||||
"numberOfPages",
|
||||
article.getNumberOfPages());
|
||||
generateXmlElement(publicationElem, "edition", article.getEdition());
|
||||
generateXmlElement(publicationElem, "issn", article.getISSN());
|
||||
|
||||
generateOrganizationXml(publicationElem,
|
||||
"organization",
|
||||
article.getOrganization());
|
||||
|
||||
}
|
||||
|
||||
private void generateJournalXml(final Element publicationElem) {
|
||||
final Journal journal = (Journal) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "lastYear", journal.getLastYear());
|
||||
generateXmlElement(publicationElem, "issn", journal.getISSN());
|
||||
}
|
||||
|
||||
private void generateMonographXml(final Element publicationElem) {
|
||||
final Monograph monograph = (Monograph) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "reviewed", monograph.getReviewed());
|
||||
}
|
||||
|
||||
private void generateProceedingsXml(final Element publicationElem) {
|
||||
Proceedings proceedings = (Proceedings) publication;
|
||||
|
||||
generateXmlElement(publicationElem,
|
||||
"nameOfConference",
|
||||
proceedings.getNameOfConference());
|
||||
generateXmlElement(publicationElem,
|
||||
"placeOfConference",
|
||||
proceedings.getPlaceOfConference());
|
||||
|
||||
generateOrganizationXml(publicationElem,
|
||||
"organizer",
|
||||
proceedings.getOrganizerOfConference());
|
||||
}
|
||||
|
||||
private void generateReviewXml(final Element publicationElem) {
|
||||
//Nothing for now.
|
||||
}
|
||||
|
||||
private void generateUnPublishedXml(final Element publicationElem) {
|
||||
UnPublished unPublished = (UnPublished) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "place", unPublished.getPlace());
|
||||
generateXmlElement(publicationElem, "number", unPublished.getNumber());
|
||||
generateXmlElement(publicationElem,
|
||||
"numberOfPages",
|
||||
unPublished.getNumberOfPages());
|
||||
|
||||
generateOrganizationXml(publicationElem,
|
||||
"organization",
|
||||
unPublished.getOrganization());
|
||||
}
|
||||
|
||||
private void generateWorkingPaperXml(final Element publicationElem) {
|
||||
WorkingPaper workingPaper = (WorkingPaper) publication;
|
||||
|
||||
generateXmlElement(publicationElem,
|
||||
"reviewed",
|
||||
workingPaper.getReviewed());
|
||||
}
|
||||
|
||||
private void generateOrganizationXml(final Element publicationElem,
|
||||
final String elementName,
|
||||
final GenericOrganizationalUnit orga) {
|
||||
if (orga == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Element organizationElem =
|
||||
publicationElem.newChildElement(elementName);
|
||||
Element orgaTitleElem = organizationElem.newChildElement("title");
|
||||
orgaTitleElem.setText(orga.getTitle());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -22,7 +22,13 @@ package com.arsdigita.cms.contenttypes.ui;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ContentItemXMLRenderer;
|
||||
import com.arsdigita.cms.contentassets.SciOrganizationPublicationCollection;
|
||||
import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;
|
||||
import com.arsdigita.cms.contenttypes.ArticleInJournal;
|
||||
import com.arsdigita.cms.contenttypes.AuthorshipCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
|
||||
import com.arsdigita.cms.contenttypes.Publisher;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
|
||||
|
|
@ -55,7 +61,7 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
|||
public void setDisplayPublications(final boolean displayPublications) {
|
||||
this.displayPublications = displayPublications;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void generateAvailableDataXml(final SciOrganization organization,
|
||||
final Element element,
|
||||
|
|
@ -69,10 +75,14 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
|||
new SciOrganizationWithPublications(
|
||||
organization);
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
if ((orga.hasPublications(config.getOrganizationPublicationsMerge()))
|
||||
&& displayPublications) {
|
||||
&& displayPublications) {
|
||||
element.newChildElement("publications");
|
||||
}
|
||||
System.out.printf(
|
||||
"\n\nNeeded %d ms to determine if organization has publications\n\n",
|
||||
System.currentTimeMillis() - start);
|
||||
}
|
||||
|
||||
protected void mergePublications(
|
||||
|
|
@ -109,6 +119,7 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
|||
|
||||
if (SciOrganizationWithPublications.getConfig().
|
||||
getOrganizationPublicationsMerge()) {
|
||||
long start = System.currentTimeMillis();
|
||||
List<Publication> publications;
|
||||
publications = new LinkedList<Publication>();
|
||||
SciOrganizationPublicationCollection orgaPublications;
|
||||
|
|
@ -143,15 +154,94 @@ public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
|
|||
List<Publication> publicationsToShow = publicationWithoutDoubles.
|
||||
subList((int) begin, (int) end);
|
||||
|
||||
final Element publicationsElem = parent.newChildElement(
|
||||
"publications");
|
||||
final ContentItemXMLRenderer renderer =
|
||||
new ContentItemXMLRenderer(
|
||||
publicationsElem);
|
||||
renderer.setWrapAttributes(true);
|
||||
System.out.printf(
|
||||
"\n\nCreating list of publications to show in %d ms.\n\n",
|
||||
System.currentTimeMillis() - start);
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
|
||||
//final Element publicationsElem = parent.newChildElement(
|
||||
// "publications");
|
||||
|
||||
for (Publication publication : publicationsToShow) {
|
||||
//Element publicationElem = parent.newChildElement(
|
||||
// "publications");
|
||||
/*ContentItemXMLRenderer renderer =
|
||||
new ContentItemXMLRenderer(publicationElem);
|
||||
renderer.setWrapAttributes(true);
|
||||
long walkStart = System.currentTimeMillis();
|
||||
renderer.walk(publication, SimpleXMLGenerator.class.getName());
|
||||
System.out.printf("\n\nRenderer walked %d ms\n\n", System.currentTimeMillis() - walkStart);*/
|
||||
|
||||
/*Element objectTypeElem = publicationElem.newChildElement("objectType");
|
||||
objectTypeElem.setText(publication.getObjectType().getQualifiedName());
|
||||
Element yearElem = publicationElem.newChildElement(
|
||||
"yearOfPublication");
|
||||
yearElem.setText(publication.getYearOfPublication().toString());
|
||||
Element miscElem = publicationElem.newChildElement("misc");
|
||||
miscElem.setText(publication.getMisc());
|
||||
AuthorshipCollection authors = publication.getAuthors();
|
||||
while (authors.next()) {
|
||||
Element authorsElem = publicationElem.newChildElement(
|
||||
"authors");
|
||||
Element linkElem = authorsElem.newChildElement("link");
|
||||
Element editorElem = linkElem.newChildElement("editor");
|
||||
if (authors.isEditor()) {
|
||||
editorElem.setText("true");
|
||||
} else {
|
||||
editorElem.setText("false");
|
||||
}
|
||||
Element authorOrderElem = linkElem.newChildElement(
|
||||
"authorOrder");
|
||||
authorOrderElem.setText(authors.getAuthorshipOrder().
|
||||
toString());
|
||||
|
||||
GenericPerson author = authors.getAuthor();
|
||||
Element surnameElem = authorsElem.newChildElement("surname");
|
||||
surnameElem.setText(author.getSurname());
|
||||
Element givennameElem = authorsElem.newChildElement(
|
||||
"givenname");
|
||||
givennameElem.setText(author.getGivenName());
|
||||
}
|
||||
|
||||
Element abstractElem = publicationElem.newChildElement(
|
||||
"abstract");
|
||||
abstractElem.setText(publication.getAbstract());
|
||||
|
||||
if (publication instanceof PublicationWithPublisher) {
|
||||
PublicationWithPublisher pwp =
|
||||
(PublicationWithPublisher) publication;
|
||||
Publisher publisher = pwp.getPublisher();
|
||||
|
||||
Element publisherElem = publicationElem.newChildElement(
|
||||
"publisher");
|
||||
Element publisherNameElem = publisherElem.newChildElement(
|
||||
"publisherName");
|
||||
publisherNameElem.setText(publisher.getPublisherName());
|
||||
Element publisherPlaceElem = publisherElem.newChildElement(
|
||||
"place");
|
||||
publisherPlaceElem.setText(publisher.getPlace());
|
||||
}
|
||||
|
||||
Element titleElem = publicationElem.newChildElement("title");
|
||||
titleElem.setText(publication.getTitle());
|
||||
|
||||
if (publication instanceof ArticleInJournal) {
|
||||
|
||||
}
|
||||
|
||||
if (publication instanceof ArticleInCollectedVolume) {
|
||||
|
||||
}*/
|
||||
|
||||
PublicationXmlHelper xmlHelper =
|
||||
new PublicationXmlHelper(parent,
|
||||
publication);
|
||||
xmlHelper.generateXml();
|
||||
}
|
||||
|
||||
System.out.printf("\n\nGenerated publications XML in %d ms\n\n",
|
||||
System.currentTimeMillis() - start);
|
||||
} else {
|
||||
SciOrganizationPublicationCollection orgaPublications;
|
||||
orgaPublications = orga.getPublications();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.cms.contenttypes.ui;
|
|||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.contentassets.RelatedLink;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
|
|
|
|||
|
|
@ -518,7 +518,7 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
|||
Element content = generateBaseXML(item, element, state);
|
||||
|
||||
SciOrganization orga = (SciOrganization) item;
|
||||
Element availableData = element.newChildElement("availableData");
|
||||
Element availableData = content.newChildElement("availableData");
|
||||
|
||||
generateAvailableDataXml(orga, availableData, state);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue