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