Some Bugfixes for Publication Export
git-svn-id: https://svn.libreccm.org/ccm/trunk@5817 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
234c11af0f
commit
8d2060ec0e
|
|
@ -7,10 +7,11 @@
|
||||||
webapp="ROOT">
|
webapp="ROOT">
|
||||||
|
|
||||||
<ccm:dependencies>
|
<ccm:dependencies>
|
||||||
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
|
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge" />
|
||||||
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
|
<ccm:requires name="ccm-core" version="6.6.0" relation="ge" />
|
||||||
<ccm:requires name="ccm-subsite" version="6.6.0" relation="ge"/>
|
<ccm:requires name="ccm-ldn-terms" version="6.6.0" relation="ge" />
|
||||||
<ccm:requires name="ccm-ldn-terms" version="6.6.0" relation="ge"/>
|
<ccm:requires name="ccm-subsite" version="6.6.0" relation="ge" />
|
||||||
|
<ccm:requires name="ccm-themedirector" version="6.6.0" relation="ge" />
|
||||||
</ccm:dependencies>
|
</ccm:dependencies>
|
||||||
|
|
||||||
<ccm:contacts>
|
<ccm:contacts>
|
||||||
|
|
|
||||||
|
|
@ -29,33 +29,33 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* This is the base class for all other Publication Content types. The
|
* This is the base class for all other Publication Content types. The following
|
||||||
* following UML class diagram shows an overview of the classes of the
|
* UML class diagram shows an overview of the classes of the Publications
|
||||||
* Publications module. Please note that the UML diagram shown an general
|
* module. Please note that the UML diagram shown an general overview of the
|
||||||
* overview of the classes/object types of the publications module. It shows
|
* classes/object types of the publications module. It shows the attributes of
|
||||||
* the attributes of the content types and theirs associations between them. Not
|
* the content types and theirs associations between them. Not all classes shown
|
||||||
* all classes shown in the UML have a Java counterpart. These classes are
|
* in the UML have a Java counterpart. These classes are representing
|
||||||
* representing associations <em>with</em> extra attributes. The associations
|
* associations <em>with</em> extra attributes. The associations are defined in
|
||||||
* are defined in the PDL files of this module.
|
* the PDL files of this module.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* <img src="doc-files/PublicationModule.png" width="100%">
|
* <img src="doc-files/PublicationModule.png" width="100%">
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* This class is not a directly usable Content type. Its is only used to
|
* This class is not a directly usable Content type. Its is only used to define
|
||||||
* define some common attributes needed for all kinds of publications.
|
* some common attributes needed for all kinds of publications.
|
||||||
* </p>
|
* </p>
|
||||||
* <p>
|
* <p>
|
||||||
* As of version 6.6.1 of this module, the reviewed property has been moved
|
* As of version 6.6.1 of this module, the reviewed property has been moved from
|
||||||
* from the types {@link ArticleInCollectedVolume}, {@link ArticleInJournal},
|
* the types {@link ArticleInCollectedVolume}, {@link ArticleInJournal},
|
||||||
* {@link CollectedVolume}, {@link Monograph} and {@link WorkingPaper} to this
|
* {@link CollectedVolume}, {@link Monograph} and {@link WorkingPaper} to this
|
||||||
* class. This has been done for performance reasons. Several use cases demanded
|
* class. This has been done for performance reasons. Several use cases demanded
|
||||||
* the use of a data query (for performance reasons) over all publications with
|
* the use of a data query (for performance reasons) over all publications with
|
||||||
* the option to filter for reviewed publications. Since the reviewed property
|
* the option to filter for reviewed publications. Since the reviewed property
|
||||||
* was only available for some types this was not possible, even with joins.
|
* was only available for some types this was not possible, even with joins. The
|
||||||
* The publications types which do not need the reviewed property will not show
|
* publications types which do not need the reviewed property will not show this
|
||||||
* this property in their forms. Also, the reviewed property was excluded from
|
* property in their forms. Also, the reviewed property was excluded from the
|
||||||
* the XML of these types using their traversal adapters.
|
* XML of these types using their traversal adapters.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
@ -76,8 +76,8 @@ public class Publication extends ContentPage {
|
||||||
public static final String REVIEWED = "reviewed";
|
public static final String REVIEWED = "reviewed";
|
||||||
public static final String FIRST_PUBLISHED = "yearFirstPublished";
|
public static final String FIRST_PUBLISHED = "yearFirstPublished";
|
||||||
public static final String LANG = "languageOfPublication";
|
public static final String LANG = "languageOfPublication";
|
||||||
public final static String BASE_DATA_OBJECT_TYPE =
|
public final static String BASE_DATA_OBJECT_TYPE
|
||||||
"com.arsdigita.cms.contenttypes.Publication";
|
= "com.arsdigita.cms.contenttypes.Publication";
|
||||||
private final static PublicationsConfig config = new PublicationsConfig();
|
private final static PublicationsConfig config = new PublicationsConfig();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
@ -151,8 +151,8 @@ public class Publication extends ContentPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the contents of the misc field. This field can be used for
|
* Retrieves the contents of the misc field. This field can be used for all
|
||||||
* all sorts of remarks etc. which do not fit in the other fields.
|
* sorts of remarks etc. which do not fit in the other fields.
|
||||||
*
|
*
|
||||||
* @return Contents of the misc field.
|
* @return Contents of the misc field.
|
||||||
*/
|
*/
|
||||||
|
|
@ -170,8 +170,13 @@ public class Publication extends ContentPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getReviewed() {
|
public Boolean getReviewed() {
|
||||||
|
final Object value = get(REVIEWED);
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
return (Boolean) get(REVIEWED);
|
return (Boolean) get(REVIEWED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setReviewed(final Boolean reviewed) {
|
public void setReviewed(final Boolean reviewed) {
|
||||||
set(REVIEWED, reviewed);
|
set(REVIEWED, reviewed);
|
||||||
|
|
@ -198,12 +203,9 @@ public class Publication extends ContentPage {
|
||||||
//Assert.exists(author, GenericPerson.class);
|
//Assert.exists(author, GenericPerson.class);
|
||||||
|
|
||||||
//DataObject link = add(AUTHORS, author);
|
//DataObject link = add(AUTHORS, author);
|
||||||
|
|
||||||
//link.set(EDITOR, editor);
|
//link.set(EDITOR, editor);
|
||||||
//link.set(AUTHOR_ORDER, Integer.valueOf((int) getAuthors().size()));
|
//link.set(AUTHOR_ORDER, Integer.valueOf((int) getAuthors().size()));
|
||||||
|
|
||||||
//updateAuthorsStr();
|
//updateAuthorsStr();
|
||||||
|
|
||||||
getPublicationBundle().addAuthor(author, editor);
|
getPublicationBundle().addAuthor(author, editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -271,7 +273,6 @@ public class Publication extends ContentPage {
|
||||||
//Assert.exists(series, Series.class);
|
//Assert.exists(series, Series.class);
|
||||||
|
|
||||||
//remove(SERIES, series);
|
//remove(SERIES, series);
|
||||||
|
|
||||||
getPublicationBundle().removeSeries(series);
|
getPublicationBundle().removeSeries(series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -289,7 +290,6 @@ public class Publication extends ContentPage {
|
||||||
//Assert.exists(orgaunit, GenericOrganizationalUnit.class);
|
//Assert.exists(orgaunit, GenericOrganizationalUnit.class);
|
||||||
|
|
||||||
//add(ORGAUNITS, orgaunit);
|
//add(ORGAUNITS, orgaunit);
|
||||||
|
|
||||||
getPublicationBundle().addOrganizationalUnit(orgaunit);
|
getPublicationBundle().addOrganizationalUnit(orgaunit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -305,7 +305,8 @@ public class Publication extends ContentPage {
|
||||||
return !getOrganizationalUnits().isEmpty();
|
return !getOrganizationalUnits().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PublicationBundleCollection getPublications(final GenericPerson person) {
|
public static PublicationBundleCollection getPublications(
|
||||||
|
final GenericPerson person) {
|
||||||
return PublicationBundle.getPublications(person);
|
return PublicationBundle.getPublications(person);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,7 +317,6 @@ public class Publication extends ContentPage {
|
||||||
|
|
||||||
//return new GenericOrganizationalUnitPublicationsCollection(
|
//return new GenericOrganizationalUnitPublicationsCollection(
|
||||||
// dataCollection);
|
// dataCollection);
|
||||||
|
|
||||||
return PublicationBundle.getPublications(orgaunit);
|
return PublicationBundle.getPublications(orgaunit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -372,14 +372,16 @@ public class Publication extends ContentPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
||||||
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
final List<ExtraXMLGenerator> generators = super
|
||||||
|
.getExtraListXMLGenerators();
|
||||||
generators.add(new PublicationExtraXmlGenerator());
|
generators.add(new PublicationExtraXmlGenerator());
|
||||||
return generators;
|
return generators;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSearchSummary() {
|
public String getSearchSummary() {
|
||||||
String summary = String.format("%s %s %s", getTitle(), (String)get(AUTHORS_STR), getAbstract());
|
String summary = String.format("%s %s %s", getTitle(), (String) get(
|
||||||
|
AUTHORS_STR), getAbstract());
|
||||||
if (summary.length() > 4000) {
|
if (summary.length() > 4000) {
|
||||||
summary = summary.substring(0, 4000);
|
summary = summary.substring(0, 4000);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,8 @@ public class ExportAllPublications extends Program {
|
||||||
getNegotiatedLocale().getLanguage());
|
getNegotiatedLocale().getLanguage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publications.addEqualsFilter("version", "live");
|
||||||
|
|
||||||
publications.addOrder("yearOfPublication desc");
|
publications.addOrder("yearOfPublication desc");
|
||||||
publications.addOrder("authorsStr");
|
publications.addOrder("authorsStr");
|
||||||
publications.addOrder("title");
|
publications.addOrder("title");
|
||||||
|
|
@ -109,13 +111,18 @@ public class ExportAllPublications extends Program {
|
||||||
long index = 1;
|
long index = 1;
|
||||||
while (publications.next()) {
|
while (publications.next()) {
|
||||||
|
|
||||||
System.out.printf("Exporting publication %d of %d...%n",
|
System.out.printf("Exporting publication %d of %d... ",
|
||||||
index,
|
index,
|
||||||
publications.size());
|
publications.size());
|
||||||
|
|
||||||
final Publication publication
|
final Publication publication
|
||||||
= (Publication) DomainObjectFactory
|
= (Publication) DomainObjectFactory
|
||||||
.newInstance(publications.getDataObject());
|
.newInstance(publications.getDataObject());
|
||||||
|
|
||||||
|
System.out.printf("oid = \"%s\", name = \"%s\"%n",
|
||||||
|
publication.getOID().toString(),
|
||||||
|
publication.getName());
|
||||||
|
|
||||||
writer.append(exporter.exportPublication(publication));
|
writer.append(exporter.exportPublication(publication));
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,9 @@ public abstract class AbstractRisConverter implements RisConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void convertYear(final Publication publication) {
|
protected void convertYear(final Publication publication) {
|
||||||
getRisBuilder().addField(RisField.PY, String.format("%d///", publication.getYearOfPublication()));
|
if (publication.getYearOfPublication() != null) {
|
||||||
|
getRisBuilder().addField(RisField.PY, String.format("%d", publication.getYearOfPublication()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void convertPublisher(final PublicationWithPublisher publication) {
|
protected void convertPublisher(final PublicationWithPublisher publication) {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ import com.arsdigita.cms.scipublications.imexporter.ris.RisField;
|
||||||
import com.arsdigita.cms.contenttypes.InternetArticle;
|
import com.arsdigita.cms.contenttypes.InternetArticle;
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a {@link InternetArticle} to a RIS reference.
|
* Converts a {@link InternetArticle} to a RIS reference.
|
||||||
*
|
*
|
||||||
|
|
@ -35,6 +37,9 @@ public class InternetArticleConverter extends AbstractRisConverter {
|
||||||
public String convert(final Publication publication) {
|
public String convert(final Publication publication) {
|
||||||
InternetArticle article;
|
InternetArticle article;
|
||||||
|
|
||||||
|
System.err.printf("Converting publication %s as InternetArticle to RIS...%n",
|
||||||
|
Objects.toString(publication));
|
||||||
|
|
||||||
if (!(publication instanceof InternetArticle)) {
|
if (!(publication instanceof InternetArticle)) {
|
||||||
throw new UnsupportedCcmTypeException(
|
throw new UnsupportedCcmTypeException(
|
||||||
String.format("The InternetArticleConverter only "
|
String.format("The InternetArticleConverter only "
|
||||||
|
|
@ -49,21 +54,29 @@ public class InternetArticleConverter extends AbstractRisConverter {
|
||||||
publication.getClass().getName()));
|
publication.getClass().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.err.printf("Casting to InternetArticle%n");
|
||||||
article = (InternetArticle) publication;
|
article = (InternetArticle) publication;
|
||||||
|
|
||||||
|
System.err.printf("Setting RIS type to EJOUR...%n");
|
||||||
getRisBuilder().setType(RisType.EJOUR);
|
getRisBuilder().setType(RisType.EJOUR);
|
||||||
|
System.err.printf("Converting authors...%n");
|
||||||
convertAuthors(publication);
|
convertAuthors(publication);
|
||||||
|
System.err.printf("Converting title...%n");
|
||||||
convertTitle(publication);
|
convertTitle(publication);
|
||||||
|
System.err.printf("Converting year...%n");
|
||||||
convertYear(publication);
|
convertYear(publication);
|
||||||
|
|
||||||
if (article.getReviewed()) {
|
System.err.printf("Converting reviewed...%n");
|
||||||
|
if (article.getReviewed() != null && article.getReviewed()) {
|
||||||
getRisBuilder().addField(RisField.RI, "");
|
getRisBuilder().addField(RisField.RI, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.err.printf("Converting URL...%n");
|
||||||
if (article.getUrl() != null) {
|
if (article.getUrl() != null) {
|
||||||
getRisBuilder().addField(RisField.UR, article.getUrl());
|
getRisBuilder().addField(RisField.UR, article.getUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.err.printf("Building String%n");
|
||||||
return getRisBuilder().toRis();
|
return getRisBuilder().toRis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.subsite;
|
package com.arsdigita.subsite;
|
||||||
|
|
||||||
import com.arsdigita.categorization.Category;
|
import com.arsdigita.categorization.Category;
|
||||||
|
|
@ -38,16 +37,24 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public class Site extends ACSObject {
|
public class Site extends ACSObject {
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE
|
||||||
"com.arsdigita.subsite.Site";
|
= "com.arsdigita.subsite.Site";
|
||||||
|
|
||||||
/** Title for a subsite, text field. */
|
/**
|
||||||
|
* Title for a subsite, text field.
|
||||||
|
*/
|
||||||
public static final String TITLE = "title";
|
public static final String TITLE = "title";
|
||||||
/** Description for a subsite, text field. */
|
/**
|
||||||
|
* Description for a subsite, text field.
|
||||||
|
*/
|
||||||
public static final String DESCRIPTION = "description";
|
public static final String DESCRIPTION = "description";
|
||||||
/** Subsite host name, text field, must be unique. */
|
/**
|
||||||
|
* Subsite host name, text field, must be unique.
|
||||||
|
*/
|
||||||
public static final String HOSTNAME = "hostname";
|
public static final String HOSTNAME = "hostname";
|
||||||
/** Directory containin the theme to be used for the subsite. */
|
/**
|
||||||
|
* Directory containin the theme to be used for the subsite.
|
||||||
|
*/
|
||||||
public static final String STYLE_DIRECTORY = "styleDirectory";
|
public static final String STYLE_DIRECTORY = "styleDirectory";
|
||||||
public static final String FRONT_PAGE = "frontPage";
|
public static final String FRONT_PAGE = "frontPage";
|
||||||
public static final String TEMPLATE_CONTEXT = "templateContext";
|
public static final String TEMPLATE_CONTEXT = "templateContext";
|
||||||
|
|
@ -61,6 +68,7 @@ public class Site extends ACSObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
*
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
public Site(String type) {
|
public Site(String type) {
|
||||||
|
|
@ -141,19 +149,21 @@ public class Site extends ACSObject {
|
||||||
public static Site retrieve(BigDecimal id)
|
public static Site retrieve(BigDecimal id)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
|
|
||||||
return (Site)DomainObjectFactory.newInstance(
|
return (Site) DomainObjectFactory.newInstance(
|
||||||
new OID(BASE_DATA_OBJECT_TYPE, id)
|
new OID(BASE_DATA_OBJECT_TYPE, id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Site retrieve(DataObject obj) {
|
public static Site retrieve(DataObject obj) {
|
||||||
return (Site)DomainObjectFactory.newInstance(obj);
|
return (Site) DomainObjectFactory.newInstance(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param hostname
|
* @param hostname
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
|
*
|
||||||
* @throws DataObjectNotFoundException
|
* @throws DataObjectNotFoundException
|
||||||
*/
|
*/
|
||||||
public static Site findByHostname(String hostname)
|
public static Site findByHostname(String hostname)
|
||||||
|
|
@ -178,8 +188,8 @@ public class Site extends ACSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TemplateContext getTemplateContext() {
|
public TemplateContext getTemplateContext() {
|
||||||
return (TemplateContext)DomainObjectFactory
|
return (TemplateContext) DomainObjectFactory
|
||||||
.newInstance((DataObject)get(TEMPLATE_CONTEXT));
|
.newInstance((DataObject) get(TEMPLATE_CONTEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
|
|
@ -188,7 +198,7 @@ public class Site extends ACSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return(String)get(TITLE);
|
return (String) get(TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
|
|
@ -197,7 +207,7 @@ public class Site extends ACSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return(String)get(DESCRIPTION);
|
return (String) get(DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHostname(String hostname) {
|
public void setHostname(String hostname) {
|
||||||
|
|
@ -205,7 +215,7 @@ public class Site extends ACSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHostname() {
|
public String getHostname() {
|
||||||
return(String)get(HOSTNAME);
|
return (String) get(HOSTNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStyleDirectory(String styleDirectory) {
|
public void setStyleDirectory(String styleDirectory) {
|
||||||
|
|
@ -213,7 +223,7 @@ public class Site extends ACSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStyleDirectory() {
|
public String getStyleDirectory() {
|
||||||
return(String)get(STYLE_DIRECTORY);
|
return (String) get(STYLE_DIRECTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRootCategory(Category rootCategory) {
|
public void setRootCategory(Category rootCategory) {
|
||||||
|
|
@ -229,8 +239,8 @@ public class Site extends ACSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Application getFrontPage() {
|
public Application getFrontPage() {
|
||||||
return (Application)DomainObjectFactory
|
return (Application) DomainObjectFactory
|
||||||
.newInstance((DataObject)get(FRONT_PAGE));
|
.newInstance((DataObject) get(FRONT_PAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue