diff --git a/ccm-pages/application.xml b/ccm-pages/application.xml index aa1105f0a..f9c89ae51 100644 --- a/ccm-pages/application.xml +++ b/ccm-pages/application.xml @@ -1,21 +1,22 @@ + name="ccm-pages" + prettyName="Pages" + version="6.0.0" + release="2" + webapp="ROOT"> - - - - + + + + + - + diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java index 0b8788b4d..8b312a429 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/Publication.java @@ -29,33 +29,33 @@ import java.util.List; /** *

- * 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 with 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 with extra attributes. The associations are defined in + * the PDL files of this module. *

*

* *

*

- * 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. *

*

- * 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. *

* * @@ -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 { @@ -89,7 +89,7 @@ public class Publication extends ContentPage { } public Publication(final BigDecimal id) throws - DataObjectNotFoundException { + DataObjectNotFoundException { this(new OID(BASE_DATA_OBJECT_TYPE, id)); } @@ -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,7 +170,12 @@ public class Publication extends ContentPage { } public Boolean getReviewed() { - return (Boolean) get(REVIEWED); + final Object value = get(REVIEWED); + if (value == null) { + return null; + } else { + return (Boolean) get(REVIEWED); + } } public void setReviewed(final Boolean reviewed) { @@ -191,19 +196,16 @@ public class Publication extends ContentPage { * Adds an author to the publication * * @param author The author to add. This can an instance of any content type - * which is derivated from the {@link GenericPerson} type. + * which is derivated from the {@link GenericPerson} type. * @param editor Is the author an editor? */ public void addAuthor(final GenericPerson author, final Boolean editor) { //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); } @@ -249,7 +251,7 @@ public class Publication extends ContentPage { * Method to check if the publication has authors. * * @return {@code true} if the publications has authors, {@code false} - * otherwise. + * otherwise. */ public boolean hasAuthors() { return !getAuthors().isEmpty(); @@ -271,7 +273,6 @@ public class Publication extends ContentPage { //Assert.exists(series, Series.class); //remove(SERIES, series); - getPublicationBundle().removeSeries(series); } @@ -289,12 +290,11 @@ public class Publication extends ContentPage { //Assert.exists(orgaunit, GenericOrganizationalUnit.class); //add(ORGAUNITS, orgaunit); - getPublicationBundle().addOrganizationalUnit(orgaunit); } public void removeOrganizationalUnit( - final GenericOrganizationalUnit orgaunit) { + final GenericOrganizationalUnit orgaunit) { //Assert.exists(orgaunit, GenericOrganizationalUnit.class); //remove(ORGAUNITS, orgaunit); @@ -305,18 +305,18 @@ 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); } - + public static GenericOrganizationalUnitPublicationsCollection getPublications( - final GenericOrganizationalUnit orgaunit) { + final GenericOrganizationalUnit orgaunit) { //final DataCollection dataCollection = (DataCollection) orgaunit.get( // ORGAUNIT_PUBLICATIONS); //return new GenericOrganizationalUnitPublicationsCollection( // dataCollection); - return PublicationBundle.getPublications(orgaunit); } @@ -329,36 +329,36 @@ public class Publication extends ContentPage { } public static void removePublication( - final GenericOrganizationalUnit orgaunit, - final Publication publication) { + final GenericOrganizationalUnit orgaunit, + final Publication publication) { //Assert.exists(publication); //orgaunit.remove(ORGAUNIT_PUBLICATIONS, publication); PublicationBundle.removePublication(orgaunit, publication); } - + /** * The year when the first edition of the publication was published. - * - * @return + * + * @return */ public Integer getYearFirstPublished() { return (Integer) get(FIRST_PUBLISHED); } - + public void setYearFirstPublished(final Integer value) { set(FIRST_PUBLISHED, value); } - + /** * The language the publication is written in. - * - * @return + * + * @return */ public String getLanguageOfPublication() { return (String) get(LANG); } - + public void setLanguageOfPublication(final String value) { set(LANG, value); } @@ -372,14 +372,16 @@ public class Publication extends ContentPage { @Override public List getExtraListXMLGenerators() { - final List generators = super.getExtraListXMLGenerators(); + final List 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); } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/ExportAllPublications.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/ExportAllPublications.java index d273976b8..b6fa2c11c 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/ExportAllPublications.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/ExportAllPublications.java @@ -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++; } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java index 6bc8021f4..7b6d7f413 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/AbstractRisConverter.java @@ -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) { diff --git a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java index 689badf58..21de6eec3 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/scipublications/exporter/ris/InternetArticleConverter.java @@ -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(); } diff --git a/ccm-subsite/src/com/arsdigita/subsite/Site.java b/ccm-subsite/src/com/arsdigita/subsite/Site.java index a483df92b..e26f2d005 100755 --- a/ccm-subsite/src/com/arsdigita/subsite/Site.java +++ b/ccm-subsite/src/com/arsdigita/subsite/Site.java @@ -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; @@ -37,30 +36,39 @@ import java.math.BigDecimal; * */ public class Site extends ACSObject { - - public static final String BASE_DATA_OBJECT_TYPE = - "com.arsdigita.subsite.Site"; - /** Title for a subsite, text field. */ + public static final String BASE_DATA_OBJECT_TYPE + = "com.arsdigita.subsite.Site"; + + /** + * 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"; /** - * + * */ public Site() { this(BASE_DATA_OBJECT_TYPE); } - - /** + + /** * Constructor + * * @param type */ public Site(String type) { @@ -70,7 +78,7 @@ public class Site extends ACSObject { public Site(DataObject obj) { super(obj); } - + public Site(final OID oid) { super(oid); } @@ -82,7 +90,7 @@ public class Site extends ACSObject { Category root, Application frontPage) { Site site = new Site(); - site.setup(title, + site.setup(title, description, hostname, styleDir, @@ -91,8 +99,8 @@ public class Site extends ACSObject { return site; } - /** - * + /** + * * @param title * @param description * @param hostname @@ -133,7 +141,7 @@ public class Site extends ACSObject { @Override public void beforeDelete() { super.beforeDelete(); - + TemplateContext ctx = getTemplateContext(); ctx.delete(); } @@ -141,28 +149,30 @@ 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) throws DataObjectNotFoundException { DataCollection sites = SessionManager.getSession() .retrieve(BASE_DATA_OBJECT_TYPE); - + sites.addEqualsFilter(HOSTNAME, hostname); - + if (sites.next()) { DataObject obj = sites.getDataObject(); if (sites.next()) { @@ -171,15 +181,15 @@ public class Site extends ACSObject { } return retrieve(obj); } - + throw new DataObjectNotFoundException( "cannot find site for hostname" + hostname ); } 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)); } }