diff --git a/ccm-sci-publications-dramaticarts/application.xml b/ccm-sci-publications-dramaticarts/application.xml new file mode 100644 index 000000000..7c638cf23 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/application.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + Additional content types for the ccm-sci-publications for storing informations about movies + and plays. Developed for the Fiction Meets Science project + (http://www.fictionmeetsscience.org). + + \ No newline at end of file diff --git a/ccm-sci-publications-dramaticarts/pdl/com/arsdigita/content-types/SciPublicationsMovie.pdl b/ccm-sci-publications-dramaticarts/pdl/com/arsdigita/content-types/SciPublicationsMovie.pdl new file mode 100644 index 000000000..9a4db6638 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/pdl/com/arsdigita/content-types/SciPublicationsMovie.pdl @@ -0,0 +1,64 @@ +// +// Copyright (C) 2014 Jens Pelzetter +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// + +model com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.ContentPage; + +object type SciPublicationsMovie extends Publication { + + reference key (ct_scipublications_movie.movie_id); +} + +object type SciPublicationMovieBundle extends PublicationBundle { + + reference key (ct_scipublications_movie_bundles.bundle_id); +} + +//Association for director(s) +association { + + PublicationBundle[0..n] directedMovie = join cms_person_bundles.bundle_id + to ct_scipublications_movie_directorship.person_id, + join ct_scipublications_movie_directorship.movie_id + to ct_scipublications_movie_bundles.bundle_id; + + GenericPersonBundle[0..n] director = join ct_scipublications_movie_bundles.bundle_id + to ct_scipublications_movie_directorship.movie_id, + join ct_scipublications_movie_directorship.person_id + to cms_person_bundles.bundle_id; + + Integer[0..1] directorOrder = ct_scipublications_movie_directorship.director_order INTEGER; +} + +//Association for production companies +association { + + PublicationBundle[0..n] producedMovie = join cms_orgaunit_bundles.bundle_id + to ct_scipublications_movie_productioncompanies.producationcompany_id, + join ct_scipublications_movie_productioncompanies.movie_id + to ct_scipublications_movie_bundles.bundle_id; + + GenericOrganizationalUnitBundle[0..n] productionCompany = join ct_scipublications_movie_bundles.bundle_id + to ct_scipublications_movie_productioncompanies.movie_id, + join ct_scipublications_movie_productioncompanies.producationcompany_id + to cms_orgaunit_bundles.bundle_id; + + Integer[0..1] companyOrder = ct_scipublications_movie_productioncompanies.company_order INTEGER; +} diff --git a/ccm-sci-publications-dramaticarts/pdl/com/arsdigita/content-types/SciPublicationsPlay.pdl b/ccm-sci-publications-dramaticarts/pdl/com/arsdigita/content-types/SciPublicationsPlay.pdl new file mode 100644 index 000000000..5c734538d --- /dev/null +++ b/ccm-sci-publications-dramaticarts/pdl/com/arsdigita/content-types/SciPublicationsPlay.pdl @@ -0,0 +1,49 @@ +// +// Copyright (C) 2014 Jens Pelzetter +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// + +model com.arsdigita.cms.contenttypes; + +import com.arsdigita.cms.ContentPage; + +object type SciPublicationsPlay extends PublicationWithPublisher { + + Integer[0..1] firstProductionYear = ct_scipublications_plays.first_production_year INTEGER; + reference key (ct_scipublications_plays.play_id); +} + +object type SciPublicationPlayBundle extends PublicationWithPublisherBundle { + + reference key (ct_scipublications_play_bundles.bundle_id); +} + +//Association for first production theater +association { + + PublicationBundle[0..n] producedPlay = join cms_orgaunit_bundles.bundle_id + to ct_scipublications_play_firstproductiontheather.theater_id, + join ct_scipublications_play_firstproductiontheather.play_id + to ct_scipublications_play_bundles.bundle_id; + + GenericOrganizationalUnitBundle[0..n] productionTheater = join ct_scipublications_play_bundles.bundle_id + to ct_scipublications_play_firstproductiontheather.play_id, + join ct_scipublications_play_firstproductiontheather.theather_id + to cms_orgaunit_bundles.bundle_id; + + Integer[0..1] theaterOrder = ct_scipublications_play_productiontheater.theater_order INTEGER; +} diff --git a/ccm-sci-publications-researchreport/oracle-se-create.sql b/ccm-sci-publications-dramaticarts/sql/ccm-sci-publications-dramaticarts/oracle-se-create.sql similarity index 100% rename from ccm-sci-publications-researchreport/oracle-se-create.sql rename to ccm-sci-publications-dramaticarts/sql/ccm-sci-publications-dramaticarts/oracle-se-create.sql diff --git a/ccm-sci-publications-dramaticarts/sql/ccm-sci-publications-dramaticarts/postgres-create.sql b/ccm-sci-publications-dramaticarts/sql/ccm-sci-publications-dramaticarts/postgres-create.sql new file mode 100644 index 000000000..38209a696 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/sql/ccm-sci-publications-dramaticarts/postgres-create.sql @@ -0,0 +1,4 @@ +begin; +\i ddl/postgres/create.sql +\i ddl/postgres/deferred.sql +end; diff --git a/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.config b/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.config new file mode 100644 index 000000000..916b8c9e9 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.load b/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.load new file mode 100644 index 000000000..110caa9df --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.load @@ -0,0 +1,23 @@ + + + + +
+
+
+ + + + +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDirectorCollection.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDirectorCollection.java new file mode 100644 index 000000000..48483bb93 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDirectorCollection.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2014 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +import com.arsdigita.cms.ContentBundle; +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.sun.istack.internal.logging.Logger; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsDirectorCollection extends DomainCollection { + + private final static Logger LOGGER = Logger.getLogger(SciPublicationsDirectorCollection.class); + public static final String ORDER = "directorOrder"; + public static final String LINK_ORDER = "link.directorOrder"; + + public SciPublicationsDirectorCollection(final DataCollection dataCollection) { + + super(dataCollection); + m_dataCollection.addOrder(LINK_ORDER); + } + + public Integer getDirectorOrder() { + return (Integer) m_dataCollection.get(LINK_ORDER); + } + + public void setDirectorOrder(final Integer order) { + final DataObject link = (DataObject) get("link"); + link.set(ORDER, order); + } + + public GenericPerson getDirector() { + final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance( + m_dataCollection.getDataObject()); + return (GenericPerson) bundle.getPrimaryInstance(); + } + + public String getSurname() { + return getDirector().getSurname(); + } + + public String getGivenName() { + return getDirector().getGivenName(); + } + + public void swapWithNext(final GenericPerson director) { + + int currentPos = 0; + int currentIndex = 0; + int nextIndex = 0; + + rewind(); + while (next()) { + currentPos = getPosition(); + currentIndex = getDirectorOrder(); + if (getDirector().equals(director)) { + break; + } + } + + if (currentPos == 0) { + throw new IllegalArgumentException( + String.format("The provided person is not a director " + + "of this movie.")); + } + + if (next()) { + nextIndex = getDirectorOrder(); + } else { + throw new IllegalArgumentException( + String.format("The provided person is the last in the" + + "collection, so threre is no next object to swap with.")); + } + + this.rewind(); + + while (getPosition() != currentPos) { + next(); + } + + setDirectorOrder(nextIndex); + next(); + setDirectorOrder(currentIndex); + rewind(); + + normalizeOrder(); + + } + + public void swapWithPrevious(GenericPerson director) { + + int previousPos = 0; + int previousIndex = 0; + int currentPos = 0; + int currentIndex = 0; + + this.rewind(); + while (next()) { + currentPos = getPosition(); + currentIndex = getDirectorOrder(); + if (this.getDirector().equals(director)) { + break; + } + + previousPos = currentPos; + previousIndex = currentIndex; + } + + if (currentPos == 0) { + throw new IllegalArgumentException( + String.format("The provided person is not an director " + + "of this movie.")); + } + + if (previousPos == 0) { + throw new IllegalArgumentException( + String.format( + "The provided author is the first one in this " + + "collection, so there is no previous one to switch " + + "with.")); + } + + this.rewind(); + while (this.getPosition() != previousPos) { + this.next(); + } + + this.setDirectorOrder(currentIndex); + this.next(); + this.setDirectorOrder(previousIndex); + this.rewind(); + + normalizeOrder(); + } + + private void normalizeOrder() { + this.rewind(); + + int i = 1; + while (this.next()) { + setDirectorOrder(i); + i++; + } + this.rewind(); + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java new file mode 100644 index 000000000..eab9c90dd --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2014 Jens Pelzetter, + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +import com.arsdigita.cms.contenttypes.ui.SciPublicationsMovieExtraXMLGenerator; +import com.arsdigita.cms.ExtraXMLGenerator; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsMovie extends Publication { + + public static final String BASE_DATA_OBJECT_TYPE + = "com.arsdigita.cms.contenttypes.SciPublicationsMovie"; + public static final String DIRECTORS_STR = "directorsStr"; + + public SciPublicationsMovie() { + super(BASE_DATA_OBJECT_TYPE); + } + + public SciPublicationsMovie(final BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public SciPublicationsMovie(final OID oid) throws DataObjectNotFoundException { + super(oid); + } + + public SciPublicationsMovie(final DataObject obj) { + super(obj); + } + + public SciPublicationsMovie(final String type) { + super(type); + } + + public SciPublicationsMovieBundle getSciPublicationsMovieBundle() { + return (SciPublicationsMovieBundle) getContentBundle(); + } + + public SciPublicationsDirectorCollection getDirectors() { + return getSciPublicationsMovieBundle().getDirectors(); + } + + public void addDirector(final GenericPerson director) { + getSciPublicationsMovieBundle().addDirector(director); + } + + public void removeDirector(final GenericPerson director) { + getSciPublicationsMovieBundle().removeDirector(director); + } + + public void swapWithPreviousDirector(final GenericPerson director) { + + getDirectors().swapWithPrevious(director); + getSciPublicationsMovieBundle().updateDirectorsStr(); + + } + + public void swapWithNextDirector(final GenericPerson director) { + + getDirectors().swapWithNext(director); + getSciPublicationsMovieBundle().updateDirectorsStr(); + + } + + public boolean hasDirectors() { + return !getDirectors().isEmpty(); + } + + public SciPublicationsProductionCompanyCollection getProductionCompanies() { + return getSciPublicationsMovieBundle().getProductionCompanies(); + } + + public void addProductionCompany(final GenericOrganizationalUnit company) { + getSciPublicationsMovieBundle().addProducationCompany(company); + } + + public void removeProductionCompany(final GenericOrganizationalUnit company) { + getSciPublicationsMovieBundle().removeProductionCompany(company); + } + + public boolean hasProductionCompanies() { + return !getProductionCompanies().isEmpty(); + } + + @Override + public List getExtraXMLGenerators() { + final List generators = super.getExtraXMLGenerators(); + generators.add(new SciPublicationsMovieExtraXMLGenerator()); + return generators; + } + + @Override + public List getExtraListXMLGenerators() { + final List generators = super.getExtraListXMLGenerators(); + generators.add(new SciPublicationsMovieExtraXMLGenerator()); + return generators; + } + + @Override + public String getSearchSummary() { + return String.format("%s %s", super.getSearchSummary(), get(DIRECTORS_STR)); + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java new file mode 100644 index 000000000..38eca49c4 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2014 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.CustomCopy; +import com.arsdigita.cms.ItemCollection; +import com.arsdigita.cms.ItemCopier; +import com.arsdigita.cms.XMLDeliveryCache; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.metadata.Property; +import com.arsdigita.util.Assert; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsMovieBundle extends PublicationBundle { + + public static final String BASE_BASE_OBJECT_TYPE + = "com.arsdigita.cms.contenttypes.SciPublicationsMovieBundle"; + public static final String DIRECTOR = "director"; + public static final String DIRECTOR_ORDER = "directorOrder"; + public static final String PRODUCATION_COMPANY + = "producationCompany"; + public static final String PRODUCATION_COMPANY_ORDER = "companyOrder"; + + public SciPublicationsMovieBundle(final ContentItem primary) { + + super(BASE_DATA_OBJECT_TYPE); + + Assert.exists(primary, ContentItem.class); + + setDefaultLanguage(primary.getLanguage()); + setContentType(primary.getContentType()); + addInstance(primary); + + setName(primary.getName()); + } + + public SciPublicationsMovieBundle(final OID oid) throws DataObjectNotFoundException { + super(oid); + } + + public SciPublicationsMovieBundle(final BigDecimal id) { + this(new OID(BASE_BASE_OBJECT_TYPE, id)); + } + + public SciPublicationsMovieBundle(final DataObject dataObject) { + super(dataObject); + } + + public SciPublicationsMovieBundle(final String type) { + super(type); + } + + @Override + public boolean copyProperty(final CustomCopy source, + final Property property, + final ItemCopier copier) { + + final String attribute = property.getName(); + if (copier.getCopyType() == ItemCopier.VERSION_COPY) { + + final PublicationBundle pubBundle = (PublicationBundle) source; + + if (DIRECTOR.equals(attribute)) { + + final DataCollection directors = (DataCollection) pubBundle.get(DIRECTOR); + + while (directors.next()) { + createDirectorAssoc(directors); + } + + return true; + + } else if (PRODUCATION_COMPANY.equals(attribute)) { + + final DataCollection companies = (DataCollection) pubBundle.get(PRODUCATION_COMPANY); + + while (companies.next()) { + createProductionCompanyAssoc(companies); + } + + return true; + + } else { + return super.copyProperty(source, null, copier); + } + } else { + return super.copyProperty(source, null, copier); + } + } + + private void createDirectorAssoc(final DataCollection directors) { + + final GenericPersonBundle draftDirector = (GenericPersonBundle) DomainObjectFactory + .newInstance( + directors.getDataObject()); + final GenericPersonBundle liveDirector = (GenericPersonBundle) draftDirector + .getLiveVersion(); + + if (liveDirector != null) { + final DataObject link = add(DIRECTOR, liveDirector); + + link.set(DIRECTOR_ORDER, directors.get(SciPublicationsDirectorCollection.LINK_ORDER)); + + link.save(); + } + + } + + private void createProductionCompanyAssoc(final DataCollection companies) { + + final GenericOrganizationalUnitBundle draftCompany + = (GenericOrganizationalUnitBundle) DomainObjectFactory + .newInstance( + companies.getDataObject()); + final GenericOrganizationalUnitBundle liveCompany + = (GenericOrganizationalUnitBundle) draftCompany + .getLiveVersion(); + + if (liveCompany != null) { + final DataObject link = add(PRODUCATION_COMPANY, liveCompany); + + link.set(PRODUCATION_COMPANY_ORDER, companies.get( + SciPublicationsProductionCompanyCollection.LINK_ORDER)); + + link.save(); + } + + } + + @Override + public boolean copyReverseProperty(final CustomCopy source, + final ContentItem liveItem, + final Property property, + final ItemCopier copier) { + + final String attribute = property.getName(); + if (copier.getCopyType() == ItemCopier.VERSION_COPY) { + + if (("directedMovie".equals(attribute)) && (source instanceof GenericPersonBundle)) { + + final GenericPersonBundle directorBundle = (GenericPersonBundle) source; + final DataCollection movies = (DataCollection) directorBundle.get("directedMovie"); + + while (movies.next()) { + createDirectorMovieAssociation(movies, (GenericPersonBundle) liveItem); + } + + return true; + } else if (("producedMovie".equals(attribute)) + && (source instanceof GenericOrganizationalUnitBundle)) { + + final GenericOrganizationalUnitBundle companyBundle + = (GenericOrganizationalUnitBundle) source; + final DataCollection movies = (DataCollection) companyBundle.get("producedMovie"); + + while (movies.next()) { + createCompanyMovieAssociation(movies, (GenericOrganizationalUnitBundle) liveItem); + } + + return true; + } else { + return super.copyReverseProperty(source, liveItem, property, copier); + } + + } else { + return super.copyReverseProperty(source, liveItem, property, copier); + } + + } + + private void createDirectorMovieAssociation(final DataCollection movies, + final GenericPersonBundle director) { + + final PublicationBundle draftMovie = (PublicationBundle) DomainObjectFactory.newInstance( + movies.getDataObject()); + final PublicationBundle liveMovie = (PublicationBundle) draftMovie.getLiveVersion(); + + if (liveMovie != null) { + final DataObject link = director.add("directedMovie", liveMovie); + link.set("directorOrder", movies.get("link.directorOrder")); + link.save(); + + XMLDeliveryCache.getInstance().removeFromCache(liveMovie.getOID()); + } + + } + + private void createCompanyMovieAssociation(final DataCollection movies, + final GenericOrganizationalUnitBundle company) { + + final PublicationBundle draftMovie = (PublicationBundle) DomainObjectFactory + .newInstance(movies.getDataObject()); + final PublicationBundle liveMovie = (PublicationBundle) draftMovie + .getLiveVersion(); + + if (liveMovie != null) { + + final DataObject link = company.add("producedMovie", liveMovie); + link.set("companyOrder", movies.get("link.companyOrder")); + link.save(); + + XMLDeliveryCache.getInstance().removeFromCache(liveMovie.getOID()); + } + + } + + public SciPublicationsDirectorCollection getDirectors() { + return new SciPublicationsDirectorCollection((DataCollection) get(DIRECTOR)); + } + + public void addDirector(final GenericPerson director) { + Assert.exists(director, GenericPerson.class); + + final DataObject link = add(DIRECTOR, director.getGenericPersonBundle()); + + link.set(DIRECTOR_ORDER, Integer.valueOf((int) getDirectors().size())); + + updateDirectorsStr(); + } + + public void removeDirector(final GenericPerson director) { + Assert.exists(director, GenericPerson.class); + + remove(DIRECTOR, director.getContentBundle()); + + updateDirectorsStr(); + } + + protected void updateDirectorsStr() { + + final SciPublicationsDirectorCollection directors = getDirectors(); + final StringBuilder builder = new StringBuilder(); + while(directors.next()) { + if (builder.length() > 0) { + builder.append("; "); + } + builder.append(directors.getSurname()); + builder.append(", "); + builder.append(directors.getGivenName()); + } + + final String directorStr = builder.toString(); + + final ItemCollection instances = getInstances(); + + SciPublicationsMovie movie; + while(instances.next()) { + movie = (SciPublicationsMovie) instances.getDomainObject(); + movie.set(SciPublicationsMovie.DIRECTORS_STR, directorStr); + } + + + } + + public SciPublicationsProductionCompanyCollection getProductionCompanies() { + + return new SciPublicationsProductionCompanyCollection((DataCollection) get(PRODUCATION_COMPANY)); + + } + + public void addProducationCompany(final GenericOrganizationalUnit company) { + + Assert.exists(company, GenericOrganizationalUnit.class); + + final DataObject link = add(PRODUCATION_COMPANY, + company.getGenericOrganizationalUnitBundle()); + link.set(PRODUCATION_COMPANY, Integer.valueOf((int) getProductionCompanies().size())); + link.save(); + + } + + public void removeProductionCompany(final GenericOrganizationalUnit company) { + + Assert.exists(company, GenericOrganizationalUnit.class); + + remove(PRODUCATION_COMPANY, company.getGenericOrganizationalUnitBundle()); + + } + + public static PublicationBundleCollection getDirectedMovies(final GenericPerson director) { + + final GenericPersonBundle directorBundle = director.getGenericPersonBundle(); + + final DataCollection collection = (DataCollection) directorBundle.get("directedMovie"); + + return new PublicationBundleCollection(collection); + + } + + public static PublicationBundleCollection getProducedMovies( + final GenericOrganizationalUnit company) { + + final GenericOrganizationalUnitBundle companyBundle = company.getGenericOrganizationalUnitBundle(); + + final DataCollection collection = (DataCollection) companyBundle.get("producedMovie"); + + return new PublicationBundleCollection(collection); + + } + + public SciPublicationsMovie getMovie() { + return (SciPublicationsMovie) getPrimaryInstance(); + } + + public SciPublicationsMovie getMovie(final String language) { + + SciPublicationsMovie result = (SciPublicationsMovie) getInstance(language); + if (result == null) { + result = getMovie(); + } + + return result; + + } +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java new file mode 100644 index 000000000..8ffafa6d1 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014 Jens Pelzetter, + * ScientificCMS Team, http://www.scientificcms.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsMovieInitializer extends ContentTypeInitializer { + + public SciPublicationsMovieInitializer() { + super("empty.pdl.mf", SciPublicationsMovie.BASE_DATA_OBJECT_TYPE); + } + + @Override + public String[] getStylesheets() { + return new String[]{INTERNAL_THEME_TYPES_DIR + "sci/SciPublicationsMovie.xsl"}; + } + + @Override + public String getTraversalXML() { + return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml"; + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieLoader.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieLoader.java new file mode 100644 index 000000000..de73f2ef0 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieLoader.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2014 Jens Pelzetter, + * ScientificCMS Team, http://www.scientificcms.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsMovieLoader extends AbstractContentTypeLoader { + + private static final String[] TYPES = { + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml"}; + + public SciPublicationsMovieLoader() { + super(); + } + + @Override + public String[] getTypes() { + return TYPES; + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java new file mode 100644 index 000000000..023c2732b --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2014 Jens Pelzetter, + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +import com.arsdigita.cms.ExtraXMLGenerator; +import com.arsdigita.cms.contenttypes.ui.SciPublicationsPlayExtraXMLGenerator; +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsPlay extends PublicationWithPublisher { + + public static final String BASE_DATA_OBJECT_TYPE + = "com.arsdigita.cms.contenttypes.SciPublicationsPlay"; + public static final String FIRST_PRODUCTION_YEAR = "firstProductionYear"; + + public SciPublicationsPlay() { + super(BASE_DATA_OBJECT_TYPE); + } + + public SciPublicationsPlay(final BigDecimal id) { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public SciPublicationsPlay(final OID oid) { + super(oid); + } + + public SciPublicationsPlay(final DataObject obj) { + super(obj); + } + + public SciPublicationsPlay(final String type) { + super(type); + } + + public SciPublicationsPlayBundle getSciPublicationsPlayBundle() { + return (SciPublicationsPlayBundle) getContentBundle(); + } + + public Integer getFirstProductionYear() { + return (Integer) get(FIRST_PRODUCTION_YEAR); + } + + public void setFirstProductionYear(final Integer year) { + set(FIRST_PRODUCTION_YEAR, year); + } + + public DomainCollection getProductionTheateres() { + return getSciPublicationsPlayBundle().getProductionTheateres(); + } + + public void addProductionTheater(final GenericOrganizationalUnit theater) { + getSciPublicationsPlayBundle().addProducationTheater(theater); + } + + public void removeProductionTheater(final GenericOrganizationalUnit theater) { + getSciPublicationsPlayBundle().removeProductionTheater(theater); + } + + public boolean hasProductionTheaters() { + return !getProductionTheateres().isEmpty(); + } + + @Override + public List getExtraXMLGenerators() { + final List generators = super.getExtraXMLGenerators(); + generators.add(new SciPublicationsPlayExtraXMLGenerator()); + return generators; + } + + @Override + public List getExtraListXMLGenerators() { + final List generators = super.getExtraListXMLGenerators(); + generators.add(new SciPublicationsPlayExtraXMLGenerator()); + return generators; + } +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java new file mode 100644 index 000000000..4417eadbb --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2014 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.CustomCopy; +import com.arsdigita.cms.ItemCopier; +import com.arsdigita.cms.XMLDeliveryCache; +import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.metadata.Property; +import com.arsdigita.util.Assert; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { + + public static final String BASE_BASE_OBJECT_TYPE + = "com.arsdigita.cms.contenttypes.SciPublicationsPlayBundle"; + public static final String PRODUCTION_THEATER = "productionTheater"; + public static final String PRODUCTION_THEATER_ORDER = "theaterOrder"; + + public SciPublicationsPlayBundle(final ContentItem primary) { + + super(BASE_BASE_OBJECT_TYPE); + + Assert.exists(primary, ContentItem.class); + + setDefaultLanguage(primary.getLanguage()); + setContentType(primary.getContentType()); + addInstance(primary); + + setName(primary.getName()); + } + + public SciPublicationsPlayBundle(final OID oid) throws DataObjectNotFoundException { + super(oid); + } + + public SciPublicationsPlayBundle(final BigDecimal id) throws DataObjectNotFoundException { + this(new OID(BASE_BASE_OBJECT_TYPE, id)); + } + + public SciPublicationsPlayBundle(final DataObject dataObject) { + super(dataObject); + } + + public SciPublicationsPlayBundle(final String type) { + super(type); + } + + @Override + public boolean copyProperty(final CustomCopy source, + final Property property, + final ItemCopier copier) { + + final String attribute = property.getName(); + if (copier.getCopyType() == ItemCopier.VERSION_COPY) { + + final PublicationBundle pubBundle = (PublicationBundle) source; + + if (PRODUCTION_THEATER.equals(attribute)) { + + final DataCollection theatres = (DataCollection) pubBundle.get(PRODUCTION_THEATER); + + while (theatres.next()) { + createProductionTheaterAssoc(theatres); + } + + return true; + + } else { + return super.copyProperty(source, property, copier); + } + + } else { + return super.copyProperty(source, property, copier); + } + + } + + private void createProductionTheaterAssoc(final DataCollection theatres) { + + final GenericOrganizationalUnitBundle draftTheater + = (GenericOrganizationalUnitBundle) DomainObjectFactory + .newInstance(theatres.getDataObject()); + final GenericOrganizationalUnitBundle liveTheater + = (GenericOrganizationalUnitBundle) draftTheater + .getLiveVersion(); + + if (liveTheater != null) { + final DataObject link = add(PRODUCTION_THEATER, liveTheater); + + link.set(PRODUCTION_THEATER_ORDER, theatres.get("link." + PRODUCTION_THEATER_ORDER)); + + link.save(); + } + + } + + @Override + public boolean copyReverseProperty(final CustomCopy source, + final ContentItem liveItem, + final Property property, + final ItemCopier copier) { + + final String attribute = property.getName(); + if (copier.getCopyType() == ItemCopier.VERSION_COPY) { + + if ("producedPlay".equals(attribute) + && (source instanceof GenericOrganizationalUnitBundle)) { + + final GenericOrganizationalUnitBundle theaterBundle + = (GenericOrganizationalUnitBundle) source; + final DataCollection plays = (DataCollection) theaterBundle.get("producedPlay"); + + while (plays.next()) { + createTheaterPlayAssoc(plays, (GenericOrganizationalUnitBundle) liveItem); + } + + return true; + + } else { + return super.copyReverseProperty(source, liveItem, property, copier); + } + + } else { + return super.copyReverseProperty(source, liveItem, property, copier); + } + + } + + private void createTheaterPlayAssoc(final DataCollection plays, + final GenericOrganizationalUnitBundle theater) { + + final PublicationBundle draftPlay = (PublicationBundle) DomainObjectFactory.newInstance( + plays.getDataObject()); + final PublicationBundle livePlay = (PublicationBundle) draftPlay.getLiveVersion(); + + if (livePlay != null) { + + final DataObject link = theater.add("producedPlay", livePlay); + link.set(PRODUCTION_THEATER_ORDER, plays.get("link." + PRODUCTION_THEATER_ORDER)); + link.save(); + + XMLDeliveryCache.getInstance().removeFromCache(livePlay.getOID()); + } + + } + + public DomainCollection getProductionTheateres() { + + return new DomainCollection((DataCollection) get(PRODUCTION_THEATER)); + + } + + public void addProducationTheater(final GenericOrganizationalUnit theater) { + + Assert.exists(theater, GenericOrganizationalUnit.class); + + final DataObject link = add(PRODUCTION_THEATER, + theater.getGenericOrganizationalUnitBundle()); + link.set(PRODUCTION_THEATER, Integer.valueOf((int) getProductionTheateres().size())); + link.save(); + } + + public void removeProductionTheater(final GenericOrganizationalUnit theater) { + + Assert.exists(theater, GenericOrganizationalUnit.class); + + remove(PRODUCTION_THEATER, theater.getContentBundle()); + + } + + public static PublicationBundleCollection getProducedPlays( + final GenericOrganizationalUnit theater) { + + final GenericOrganizationalUnitBundle theaterBundle = theater + .getGenericOrganizationalUnitBundle(); + + final DataCollection collection = (DataCollection) theaterBundle.get("producedPlay"); + + return new PublicationBundleCollection(collection); + + } + + public SciPublicationsPlay getPlay() { + return (SciPublicationsPlay) getPrimaryInstance(); + } + + public SciPublicationsPlay getPlay(final String language) { + + SciPublicationsPlay result = (SciPublicationsPlay) getInstance(language); + if (result == null) { + result = getPlay(); + } + + return result; + + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayInitializer.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayInitializer.java new file mode 100644 index 000000000..28fea3916 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayInitializer.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014 Jens Pelzetter, + * ScientificCMS Team, http://www.scientificcms.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsPlayInitializer extends ContentTypeInitializer { + + public SciPublicationsPlayInitializer() { + super("empty.pdl.mf", SciPublicationsPlay.BASE_DATA_OBJECT_TYPE); + } + + @Override + public String[] getStylesheets() { + return new String[]{INTERNAL_THEME_TYPES_DIR + "sci/SciPublicationsPlay.xsl"}; + } + + @Override + public String getTraversalXML() { + return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml"; + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayLoader.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayLoader.java new file mode 100644 index 000000000..2c5121f3e --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayLoader.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2014 Jens Pelzetter, + * ScientificCMS Team, http://www.scientificcms.org + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsPlayLoader extends AbstractContentTypeLoader { + + private static final String[] TYPES = { + "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml"}; + + public SciPublicationsPlayLoader() { + super(); + } + + @Override + public String[] getTypes() { + return TYPES; + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsProductionCompanyCollection.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsProductionCompanyCollection.java new file mode 100644 index 000000000..2c6345068 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsProductionCompanyCollection.java @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2014 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes; + +import com.arsdigita.cms.ContentBundle; +import com.arsdigita.domain.DomainCollection; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.DataObject; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsProductionCompanyCollection extends DomainCollection { + + public static final String ORDER = "companyOrder"; + public static final String LINK_ORDER = "link.companyOrder"; + + public SciPublicationsProductionCompanyCollection(final DataCollection dataCollection) { + + super(dataCollection); + m_dataCollection.addOrder(LINK_ORDER); + + } + + public Integer getCompanyOrder() { + return (Integer) m_dataCollection.get(LINK_ORDER); + } + + public void setCompanyOrder(final Integer order) { + final DataObject link = (DataObject) get("link"); + link.set(ORDER, order); + } + + public GenericOrganizationalUnit getCompany() { + final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance( + m_dataCollection.getDataObject()); + return (GenericOrganizationalUnit) bundle.getPrimaryInstance(); + } + + public String getCompanyName() { + return getCompany().getTitle(); + } + + public void swapWithNext(final GenericOrganizationalUnit company) { + + int currentPos = 0; + int currentIndex = 0; + int nextIndex = 0; + + rewind(); + while (next()) { + currentPos = getPosition(); + currentIndex = getCompanyOrder(); + if (getCompany().equals(company)) { + break; + } + } + + if (currentPos == 0) { + throw new IllegalArgumentException( + String.format("The provided organisation is not a producation company " + + "of this movie.")); + } + + if (next()) { + nextIndex = getCompanyOrder(); + } else { + throw new IllegalArgumentException( + String.format("The provided organisation is the last in the" + + "collection, so threre is no next object to swap with.")); + } + + this.rewind(); + + while (getPosition() != currentPos) { + rewind(); + } + + setCompanyOrder(nextIndex); + next(); + setCompanyOrder(currentIndex); + rewind(); + + normalizeOrder(); + + } + + public void swapWithPrevious(final GenericOrganizationalUnit company) { + + int previousPos = 0; + int previousIndex = 0; + int currentPos = 0; + int currentIndex = 0; + + this.rewind(); + while (next()) { + currentPos = getPosition(); + currentIndex = getCompanyOrder(); + if (this.getCompany().equals(company)) { + break; + } + + previousPos = currentPos; + previousIndex = currentIndex; + } + + if (currentPos == 0) { + throw new IllegalArgumentException( + String.format("The provided organisation is not an production company " + + "of this movie.")); + } + + if (previousPos == 0) { + throw new IllegalArgumentException( + String.format( + "The provided organisation is the first one in this " + + "collection, so there is no previous one to switch " + + "with.")); + } + + this.rewind(); + while (this.getPosition() != previousPos) { + this.next(); + } + + this.setCompanyOrder(currentIndex); + this.next(); + this.setCompanyOrder(previousIndex); + this.rewind(); + + normalizeOrder(); + + } + + private void normalizeOrder() { + this.rewind(); + + int i = 1; + while (this.next()) { + setCompanyOrder(i); + i++; + } + this.rewind(); + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieExtraXMLGenerator.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieExtraXMLGenerator.java new file mode 100644 index 000000000..86134b34d --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieExtraXMLGenerator.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes.ui; + +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ExtraXMLGenerator; +import com.arsdigita.xml.Element; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsMovieExtraXMLGenerator implements ExtraXMLGenerator { + + private boolean listMode; + + @Override + public void generateXML(final ContentItem item, + final Element element, + final PageState state) { + + } + + public void addGlobalStateParams(final Page page) { + //nothing + } + + @Override + public void setListMode(final boolean listMode) { + this.listMode = listMode; + } + +} diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayExtraXMLGenerator.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayExtraXMLGenerator.java new file mode 100644 index 000000000..3035d0e38 --- /dev/null +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayExtraXMLGenerator.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2014 Jens Pelzetter + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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.cms.contenttypes.ui; + +import com.arsdigita.bebop.Page; +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ExtraXMLGenerator; +import com.arsdigita.xml.Element; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciPublicationsPlayExtraXMLGenerator implements ExtraXMLGenerator { + + private boolean listMode; + + @Override + public void generateXML(final ContentItem item, + final Element element, + final PageState state) { + + } + + public void addGlobalStateParams(final Page page) { + //nothing + } + + @Override + public void setListMode(final boolean listMode) { + this.listMode = listMode; + } + +} diff --git a/ccm-sci-publications-researchreport/application.xml b/ccm-sci-publications-researchreport/application.xml index 853be1069..3d615aadd 100644 --- a/ccm-sci-publications-researchreport/application.xml +++ b/ccm-sci-publications-researchreport/application.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - Additional content type Research Report for the ccm-sci-publications module. - + name="ccm-sci-publications-researchreport" + prettyName="SciPublications ResearchReport" + version="6.6.3" + release="1" + webapp="ROOT"> + + + + + + + + + + + + + + + + Additional content type Research Report for the ccm-sci-publications module. + \ No newline at end of file diff --git a/ccm-sci-publications-researchreport/sql/ccm-sci-publications-researchreport/oracle-se-create.sql b/ccm-sci-publications-researchreport/sql/ccm-sci-publications-researchreport/oracle-se-create.sql new file mode 100644 index 000000000..b0de6e153 --- /dev/null +++ b/ccm-sci-publications-researchreport/sql/ccm-sci-publications-researchreport/oracle-se-create.sql @@ -0,0 +1,3 @@ +@ ddl/oracle-se/create.sql + +@ ddl/oracle-se/deferred.sql diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherExtraXmlGenerator.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherExtraXmlGenerator.java index e9eefc3a5..b89950bc4 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherExtraXmlGenerator.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherExtraXmlGenerator.java @@ -36,6 +36,7 @@ import com.arsdigita.xml.Element; public class PublicationWithPublisherExtraXmlGenerator implements ExtraXMLGenerator { + @Override public void generateXML(final ContentItem item, final Element element, final PageState state) {