From ef2b13fb2db76fbaa4b1c82e5cfae1a42d8421d7 Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 26 Jun 2014 07:12:42 +0000 Subject: [PATCH] Some documententation (JavaDoc) for the ccm-sci-publications-dramaticarts module. git-svn-id: https://svn.libreccm.org/ccm/trunk@2726 8810af33-2d31-482b-a856-94f89814c4df --- ...ompoundContentItemPanel.java.nolongerused} | 0 .../cms/portlet/ContentItemJSRPortlet.java | 84 ++++++----- ccm-sci-bundle/bundles/devel/cfg/project.xml | 2 +- .../SciPublicationsDirectorCollection.java | 3 +- ...icationsDramaticArtsGlobalisationUtil.java | 3 +- .../contenttypes/SciPublicationsMovie.java | 109 +++++++++++++- .../SciPublicationsMovieBundle.java | 138 ++++++++++++++++-- .../SciPublicationsMovieInitializer.java | 3 +- .../SciPublicationsMovieLoader.java | 3 +- .../cms/contenttypes/SciPublicationsPlay.java | 65 ++++++++- .../SciPublicationsPlayBundle.java | 101 +++++++++++-- .../SciPublicationsPlayInitializer.java | 3 +- .../SciPublicationsPlayLoader.java | 3 +- ...blicationsProductionCompanyCollection.java | 3 +- .../ui/SciPublicationsMovieCreate.java | 3 +- .../ui/SciPublicationsPlayCreate.java | 3 +- 16 files changed, 448 insertions(+), 78 deletions(-) rename ccm-cms/src/com/arsdigita/cms/contenttypes/ui/{CompoundContentItemPanel.java => CompoundContentItemPanel.java.nolongerused} (100%) diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/CompoundContentItemPanel.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/CompoundContentItemPanel.java.nolongerused similarity index 100% rename from ccm-cms/src/com/arsdigita/cms/contenttypes/ui/CompoundContentItemPanel.java rename to ccm-cms/src/com/arsdigita/cms/contenttypes/ui/CompoundContentItemPanel.java.nolongerused diff --git a/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemJSRPortlet.java b/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemJSRPortlet.java index 88e1a1b1c..0c0593b2b 100644 --- a/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemJSRPortlet.java +++ b/ccm-cms/src/com/arsdigita/cms/portlet/ContentItemJSRPortlet.java @@ -16,13 +16,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - package com.arsdigita.cms.portlet; import com.arsdigita.portal.JSRPortlet; import java.io.IOException; import java.io.PrintWriter; +import javax.portlet.ActionRequest; +import javax.portlet.ActionResponse; import javax.portlet.PortletException; import javax.portlet.PortletRequestDispatcher; import javax.portlet.RenderRequest; @@ -30,69 +31,78 @@ import javax.portlet.RenderResponse; import org.apache.log4j.Logger; - /** - * Currently a wrapper for ContentItemPortlet to deliver content to an JSR - * compliant portal server. - * + * Currently a wrapper for ContentItemPortlet to deliver content to an JSR compliant portal server. + * * WORK IN PROGRESS! - * + * * @author pb */ public class ContentItemJSRPortlet extends JSRPortlet { - /** Internal logger instance to faciliate debugging. Enable logging output - * by editing /WEB-INF/conf/log4j.properties int the runtime environment - * and set com.arsdigita.portal.JSRPortlet=DEBUG - * by uncommenting or adding the line. */ + /** + * Internal logger instance to faciliate debugging. Enable logging output by editing + * /WEB-INF/conf/log4j.properties int the runtime environment and set + * com.arsdigita.portal.JSRPortlet=DEBUG by uncommenting or adding the line. + */ private static final Logger s_log = Logger.getLogger(ContentItemJSRPortlet.class); - /** - * + * * @param request * @param response + * * @throws PortletException - * @throws IOException + * @throws IOException */ @Override - protected void doEdit(RenderRequest request, RenderResponse response) - throws PortletException, IOException { + protected void doEdit(RenderRequest request, RenderResponse response) + throws PortletException, IOException { //response.setContentType("text/html"); //PrintWriter writer = new PrintWriter(response.getWriter()); //writer.println("You're now in Edit mode."); - PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/templates/portlets/ContentItemJSRPortletAdmin.jsp"); + PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher( + "/templates/portlets/ContentItemJSRPortletAdmin.jsp"); dispatcher.include(request, response); } - /** - * - * @param request - * @param response - * @throws PortletException - * @throws IOException - */ - @Override - protected void doHelp(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - response.setContentType("text/html"); - PrintWriter writer = new PrintWriter(response.getWriter()); - writer.println("You're now in Help mode."); - } - /** * * @param request * @param response + * * @throws PortletException * @throws IOException */ @Override - protected void doView(RenderRequest request, RenderResponse response) - throws PortletException, IOException { - response.setContentType("text/html"); - PrintWriter writer = new PrintWriter(response.getWriter()); - writer.println("Hello world! You're in View mode."); + protected void doHelp(RenderRequest request, RenderResponse response) + throws PortletException, IOException { + response.setContentType("text/html"); + PrintWriter writer = new PrintWriter(response.getWriter()); + writer.println("You're now in Help mode."); } - + + /** + * + * @param request + * @param response + * + * @throws PortletException + * @throws IOException + */ + @Override + protected void doView(RenderRequest request, RenderResponse response) + throws PortletException, IOException { + response.setContentType("text/html"); + PrintWriter writer = new PrintWriter(response.getWriter()); + writer.println("Hello world! You're in View mode."); + } + + @Override + public void processAction(final ActionRequest actionRequest, + final ActionResponse actionResponse) + throws PortletException, IOException { + + } + } diff --git a/ccm-sci-bundle/bundles/devel/cfg/project.xml b/ccm-sci-bundle/bundles/devel/cfg/project.xml index 1afb31311..1525212cb 100644 --- a/ccm-sci-bundle/bundles/devel/cfg/project.xml +++ b/ccm-sci-bundle/bundles/devel/cfg/project.xml @@ -9,7 +9,7 @@ name="ScientificCMS" prettyName="Scientific CMS" version="2.3.0" - release="devel-SNAPSHOT-r2719" + release="devel-SNAPSHOT-r2721" webxml="sci-web.xml" portletxml="sci-portlet.xml" webapp="libreccm" 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 index 51c9755e1..d0b8ec25d 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDirectorCollection.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDirectorCollection.java @@ -26,7 +26,8 @@ import com.arsdigita.persistence.DataObject; import org.apache.log4j.Logger; /** - * + * Used only internally. + * * @author Jens Pelzetter * @version $Id$ */ diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDramaticArtsGlobalisationUtil.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDramaticArtsGlobalisationUtil.java index 6a11726c8..d6798ecea 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDramaticArtsGlobalisationUtil.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsDramaticArtsGlobalisationUtil.java @@ -3,7 +3,8 @@ package com.arsdigita.cms.contenttypes; import com.arsdigita.toolbox.GlobalisationUtil; /** - * + * Globalisation util for the the dramatic arts module. + * * @author Jens Pelzetter * @version $Id$ */ 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 index e62103a09..b63fa0407 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java @@ -27,7 +27,15 @@ import java.math.BigDecimal; import java.util.List; /** - * + * Domain class for the the SciPublications/Movie content type. The content type represents a movie + * which can be managed like other publication types. Most of the properties are inherited from + * {@link Publication}. The only properties added by this content type are the director of the movie + * and the production company of the movie. + * + * Note: The authors of (the script of the) movie are usually called writers and not authors, but + * the keep this implementation and the inheritance hierarchy clean we don't define a writers + * property here. + * * @author Jens Pelzetter * @version $Id$ */ @@ -57,10 +65,21 @@ public class SciPublicationsMovie extends Publication { super(type); } + /** + * Get the special content bundle of this instance. + * + * @return + */ public SciPublicationsMovieBundle getSciPublicationsMovieBundle() { return (SciPublicationsMovieBundle) getContentBundle(); } + /** + * Retrieves the director of the movie from the bundle. The method will return the primary + * instance of person item which represents the director. + * + * @return + */ public GenericPerson getDirector() { final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector(); if (bundle == null) { @@ -70,6 +89,15 @@ public class SciPublicationsMovie extends Publication { } } + /** + * Retrieves the director of the movie from the bundle. This method returns the instance + * of the person item which represents the director for a specific language. + * + * @see ContentBundle#getInstance(String) + * + * @param language + * @return + */ public GenericPerson getDirector(final String language) { final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector(); if (bundle == null) { @@ -79,10 +107,19 @@ public class SciPublicationsMovie extends Publication { } } + /** + * Convenient method for setting the director. + */ public void setDirector(final GenericPerson director) { getSciPublicationsMovieBundle().setDirector(director); } + /** + * Retrieves the production of the movie from the bundle. The method will return the primary + * instance of generic organizational unit item which represents the producation company. + * + * @return + */ public GenericOrganizationalUnit getProductionCompany() { final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle() .getProductionCompany(); @@ -95,6 +132,16 @@ public class SciPublicationsMovie extends Publication { } + /** + * Retrieves the producation company of the movie from the bundle. This method returns the + * instance of the generic organizational unit item which represents the production company for + * a specific language. + * + * @see ContentBundle#getInstance(String) + * + * @param language + * @return + */ public GenericOrganizationalUnit getProductionCompany(final String language) { final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle() .getProductionCompany(); @@ -107,22 +154,51 @@ public class SciPublicationsMovie extends Publication { } + /** + * Convenient method for setting the production company. + * + * @param company + */ public void setProductionCompany(final GenericOrganizationalUnit company) { getSciPublicationsMovieBundle().setProductionCompany(company); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * + * @return + */ private SciPublicationsDirectorCollection getDirectors() { return getSciPublicationsMovieBundle().getDirectors(); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * + * @param director + */ private void addDirector(final GenericPerson director) { getSciPublicationsMovieBundle().addDirector(director); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * + * @param director + */ private void removeDirector(final GenericPerson director) { getSciPublicationsMovieBundle().removeDirector(director); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * + * @param director + */ private void swapWithPreviousDirector(final GenericPerson director) { getDirectors().swapWithPrevious(director); @@ -130,6 +206,12 @@ public class SciPublicationsMovie extends Publication { } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * + * @param director + */ private void swapWithNextDirector(final GenericPerson director) { getDirectors().swapWithNext(director); @@ -137,22 +219,47 @@ public class SciPublicationsMovie extends Publication { } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + */ private boolean hasDirectors() { return !getDirectors().isEmpty(); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + */ private SciPublicationsProductionCompanyCollection getProductionCompanies() { return getSciPublicationsMovieBundle().getProductionCompanies(); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * + * @param company + */ private void addProductionCompany(final GenericOrganizationalUnit company) { getSciPublicationsMovieBundle().addProductionCompany(company); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * + * @param company + */ private void removeProductionCompany(final GenericOrganizationalUnit company) { getSciPublicationsMovieBundle().removeProductionCompany(company); } + /** + * Internal method. Using a collection even for the 1:1 association is necessary due to a + * bug in PDL. + * @return + */ private boolean hasProductionCompanies() { return !getProductionCompanies().isEmpty(); } 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 index c217f0f39..cf4e6a07a 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java @@ -33,6 +33,8 @@ import com.arsdigita.util.Assert; import java.math.BigDecimal; /** + * Special {@link ContentBundle} adding the associations of the Movie content type. + * * * @author Jens Pelzetter * @version $Id$ @@ -76,6 +78,15 @@ public class SciPublicationsMovieBundle extends PublicationBundle { super(type); } + /** + * Used for publishing the item. Takes care of the special associations. + * + * @param source + * @param property + * @param copier + * + * @return + */ @Override public boolean copyProperty(final CustomCopy source, final Property property, @@ -114,6 +125,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } } + /** + * Internal method used in the publication process. + * + * @param directors + */ private void createDirectorAssoc(final DataCollection directors) { final GenericPersonBundle draftDirector = (GenericPersonBundle) DomainObjectFactory @@ -132,6 +148,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Internal method used in the publication process. + * + * @param companies + */ private void createProductionCompanyAssoc(final DataCollection companies) { final GenericOrganizationalUnitBundle draftCompany @@ -153,6 +174,16 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Used in the publication process. + * + * @param source + * @param liveItem + * @param property + * @param copier + * + * @return + */ @Override public boolean copyReverseProperty(final CustomCopy source, final ContentItem liveItem, @@ -230,6 +261,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Get the director of the movie. + * + * @return + */ public GenericPersonBundle getDirector() { final DataCollection collection = (DataCollection) get(DIRECTOR); @@ -246,27 +282,44 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } } + /** + * Set the director of the movie. + * + * @param director + */ public void setDirector(final GenericPerson director) { final GenericPersonBundle oldDirector = getDirector(); - + if (oldDirector != null) { remove(DIRECTOR, oldDirector); } - + if (director != null) { Assert.exists(director, GenericPerson.class); - + final DataObject link = add(DIRECTOR, director.getGenericPersonBundle()); link.set(DIRECTOR_ORDER, Integer.valueOf(1)); link.save(); } } - + + /** + * Internal method. It is necessary to work with a collection even for a 1:1 association due to + * a bug in PDL. + * + * @return + */ protected SciPublicationsDirectorCollection getDirectors() { return new SciPublicationsDirectorCollection((DataCollection) get(DIRECTOR)); } + /** + * Internal method. It is necessary to work with a collection even for a 1:1 association due to + * a bug in PDL. + * + * @param director + */ protected void addDirector(final GenericPerson director) { Assert.exists(director, GenericPerson.class); @@ -277,6 +330,12 @@ public class SciPublicationsMovieBundle extends PublicationBundle { updateDirectorsStr(); } + /** + * Internal method. It is necessary to work with a collection even for a 1:1 association due to + * a bug in PDL. + * + * @param director + */ protected void removeDirector(final GenericPerson director) { Assert.exists(director, GenericPerson.class); @@ -285,6 +344,10 @@ public class SciPublicationsMovieBundle extends PublicationBundle { updateDirectorsStr(); } + /** + * Updates the directorStr property in all instances which contains a string with the names of + * all directors for easy filtering. + */ protected void updateDirectorsStr() { final SciPublicationsDirectorCollection directors = getDirectors(); @@ -310,39 +373,55 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Retrieves the production company of a movie. + * + * @return + */ public GenericOrganizationalUnitBundle getProductionCompany() { final DataCollection collection = (DataCollection) get(PRODUCTION_COMPANY); - + if (collection.size() == 0) { return null; } else { final DataObject dataObject; - + collection.next(); dataObject = collection.getDataObject(); collection.close(); - + return (GenericOrganizationalUnitBundle) DomainObjectFactory.newInstance(dataObject); } } - + + /** + * Sets the production company of a movie. + * + * @param productionCompany + */ public void setProductionCompany(final GenericOrganizationalUnit productionCompany) { final GenericOrganizationalUnitBundle oldCompany = getProductionCompany(); - + if (oldCompany != null) { remove(PRODUCTION_COMPANY, oldCompany); } - + if (productionCompany != null) { Assert.exists(productionCompany, GenericOrganizationalUnit.class); - - final DataObject link = add(PRODUCTION_COMPANY, + + final DataObject link = add(PRODUCTION_COMPANY, productionCompany.getGenericOrganizationalUnitBundle()); link.set(PRODUCTION_COMPANY_ORDER, Integer.valueOf(1)); link.save(); } } - + + /** + * Internal method. It is necessary to work with a collection even for a 1:1 association due to + * a bug in PDL. + * + * @return + */ protected SciPublicationsProductionCompanyCollection getProductionCompanies() { return new SciPublicationsProductionCompanyCollection((DataCollection) get( @@ -350,6 +429,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Internal method. It is necessary to work with a collection even for a 1:1 association due + * to a bug in PDL. + * @param company + */ protected void addProductionCompany(final GenericOrganizationalUnit company) { Assert.exists(company, GenericOrganizationalUnit.class); @@ -361,6 +445,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Internal method. It is necessary to work with a collection even for a 1:1 association due + * to a bug in PDL. + * @param company + */ protected void removeProductionCompany(final GenericOrganizationalUnit company) { Assert.exists(company, GenericOrganizationalUnit.class); @@ -369,6 +458,12 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Helper method for retrieving all movies directed by a person. + * + * @param director The director (person) which movies shall be retrieved. + * @return A collection of a movies directed by the person. + */ public static PublicationBundleCollection getDirectedMovies(final GenericPerson director) { final GenericPersonBundle directorBundle = director.getGenericPersonBundle(); @@ -379,6 +474,12 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Helper method for retrieving all movies produced a company. + * + * @param company The company + * @return A collection of all movies produced by the company/organisation. + */ public static PublicationBundleCollection getProducedMovies( final GenericOrganizationalUnit company) { @@ -391,10 +492,21 @@ public class SciPublicationsMovieBundle extends PublicationBundle { } + /** + * Gets the primary instance of the movie. + * + * @return + */ public SciPublicationsMovie getMovie() { return (SciPublicationsMovie) getPrimaryInstance(); } + /** + * Gets a specific language variant of the movie. + * + * @param language + * @return + */ public SciPublicationsMovie getMovie(final String language) { SciPublicationsMovie result = (SciPublicationsMovie) getInstance(language); 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 index 22c0c297d..6fdf92304 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java @@ -21,7 +21,8 @@ package com.arsdigita.cms.contenttypes; /** - * + * Initializer for the movie content type. + * * @author Jens Pelzetter * @version $Id$ */ 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 index de73f2ef0..1fb675333 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieLoader.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieLoader.java @@ -20,7 +20,8 @@ package com.arsdigita.cms.contenttypes; /** - * + * Loader for the movie content type. + * * @author Jens Pelzetter * @version $Id$ */ 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 index 87555215f..6ca2997d1 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java @@ -27,6 +27,18 @@ import java.math.BigDecimal; import java.util.List; /** + * Domain class for the play content type. The content is derived from + * {@link PublicationWithPublisher} because a play itself is maybe published by publisher and than + * produced by numerous theatres. + * + * The following properties are added by this content type: + *
+ *
firstProducationYear
+ *
The year in which the play as first shown at a theatre.
+ *
firstProducationTheater
+ *
The theatre which has shown the play first.
+ *
+ *
* * @author Jens Pelzetter * @version $Id$ @@ -69,46 +81,87 @@ public class SciPublicationsPlay extends PublicationWithPublisher { set(FIRST_PRODUCTION_YEAR, year); } + /** + * Retrieve the first production theatre from the bundle. This method will return the primary + * instance of the generic organizational unit item representing the theatre. + * + * @return + */ public GenericOrganizationalUnit getProductionTheater() { final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle() .getProductionTheater(); - + if (bundle == null) { return null; } else { return (GenericOrganizationalUnit) bundle.getPrimaryInstance(); } - + } - + + /** + * Retrieve the first production theatre from the bundle. This method will return the instance + * for a specific language. + * + * @return + */ public GenericOrganizationalUnit getProductionTheater(final String language) { final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle() .getProductionTheater(); - + if (bundle == null) { return null; } else { return (GenericOrganizationalUnit) bundle.getInstance(language); } - + } - + + /** + * Sets the first production theatre + * + * @param theater + */ public void setProductionTheater(final GenericOrganizationalUnit theater) { getSciPublicationsPlayBundle().setProductionTheater(theater); } + /** + * Internal method. It is necessary to work with an n:m association internally even for a 1:n + * association due to a bug in PDL. + * + * @return + */ private DomainCollection getProductionTheateres() { return getSciPublicationsPlayBundle().getProductionTheateres(); } + /** + * Internal method. It is necessary to work with an n:m association internally even for a 1:n + * association due to a bug in PDL. + * + * @param theater + */ private void addProductionTheater(final GenericOrganizationalUnit theater) { getSciPublicationsPlayBundle().addProductionTheater(theater); } + /** + * Internal method. It is necessary to work with an n:m association internally even for a 1:n + * association due to a bug in PDL. + * + * @param theater + */ private void removeProductionTheater(final GenericOrganizationalUnit theater) { getSciPublicationsPlayBundle().removeProductionTheater(theater); } + /** + * Internal method. It is necessary to work with an n:m association internally even for a 1:n + * association due to a bug in PDL. + * + * @return + */ private boolean hasProductionTheaters() { return !getProductionTheateres().isEmpty(); } 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 index ce2613c14..98012e54a 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java @@ -33,6 +33,8 @@ import com.arsdigita.util.Assert; import java.math.BigDecimal; /** + * Special content bundle for the play content type encapsulating the associcatio to the first + * production theatre. * * @author Jens Pelzetter * @version $Id$ @@ -42,7 +44,7 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.SciPublicationsPlayBundle"; public static final String PRODUCTION_THEATER = "productionTheatre"; - public static final String PRODUCTION_THEATER_ORDER = "theatreOrder"; + public static final String PRODUCTION_THEATER_ORDER = "theatreOrder"; public SciPublicationsPlayBundle(final ContentItem primary) { @@ -73,6 +75,16 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { super(type); } + /** + * Used by the publication process, needs to be overwritten here for publishing the producation + * theatre association. + * + * @param source + * @param property + * @param copier + * + * @return + */ @Override public boolean copyProperty(final CustomCopy source, final Property property, @@ -103,6 +115,11 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { } + /** + * Internal method used in the publications process. + * + * @param theatres + */ private void createProductionTheaterAssoc(final DataCollection theatres) { final GenericOrganizationalUnitBundle draftTheater @@ -122,6 +139,16 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { } + /** + * Used in the publication process. + * + * @param source + * @param liveItem + * @param property + * @param copier + * + * @return + */ @Override public boolean copyReverseProperty(final CustomCopy source, final ContentItem liveItem, @@ -154,6 +181,12 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { } + /** + * Internal method used in the publication process. + * + * @param plays + * @param theater + */ private void createTheaterPlayAssoc(final DataCollection plays, final GenericOrganizationalUnitBundle theater) { @@ -172,46 +205,68 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { } + /** + * Retrieves the first production theatre of a play. + * + * @return + */ public GenericOrganizationalUnitBundle getProductionTheater() { final DataCollection collection = (DataCollection) get(PRODUCTION_THEATER); - + if (collection.size() == 0) { return null; } else { final DataObject dataObject; - + collection.next(); dataObject = collection.getDataObject(); collection.close(); - + return (GenericOrganizationalUnitBundle) DomainObjectFactory.newInstance(dataObject); } - + } - + + /** + * Sets the first producation theatre. + * + * @param theater + */ public void setProductionTheater(final GenericOrganizationalUnit theater) { final GenericOrganizationalUnitBundle oldTheater = getProductionTheater(); - + if (oldTheater != null) { remove(PRODUCTION_THEATER, oldTheater); } - + if (theater != null) { Assert.exists(theater, GenericOrganizationalUnit.class); - + final DataObject link = add(PRODUCTION_THEATER, theater.getGenericOrganizationalUnitBundle()); link.set(PRODUCTION_THEATER_ORDER, Integer.valueOf(1)); link.save(); } } - + + /** + * Internal method. It is necessary to work with an n:m association internally even for a 1:n + * association due to a bug in PDL. + * + * @return + */ protected DomainCollection getProductionTheateres() { return new DomainCollection((DataCollection) get(PRODUCTION_THEATER)); } + /** + * Internal method. It is necessary to work with an n:m association internally even for a 1:n + * association due to a bug in PDL. + * + * @param theater + */ protected void addProductionTheater(final GenericOrganizationalUnit theater) { Assert.exists(theater, GenericOrganizationalUnit.class); @@ -222,6 +277,12 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { link.save(); } + /** + * Internal method. It is necessary to work with an n:m association internally even for a 1:n + * association due to a bug in PDL. + * + * @param theater + */ protected void removeProductionTheater(final GenericOrganizationalUnit theater) { Assert.exists(theater, GenericOrganizationalUnit.class); @@ -230,6 +291,13 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { } + /** + * Helper method for retrieving all plays for the theatre. + * + * @param theater + * + * @return + */ public static PublicationBundleCollection getProducedPlays( final GenericOrganizationalUnit theater) { @@ -242,10 +310,21 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle { } + /** + * Gets the primary instance of the play. + * + * @return + */ public SciPublicationsPlay getPlay() { return (SciPublicationsPlay) getPrimaryInstance(); } - + + /** + * Gets a specific language instance of the play. + * + * @param language + * @return + */ public SciPublicationsPlay getPlay(final String language) { SciPublicationsPlay result = (SciPublicationsPlay) getInstance(language); 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 index 28fea3916..033e5ac27 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayInitializer.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayInitializer.java @@ -21,7 +21,8 @@ package com.arsdigita.cms.contenttypes; /** - * + * Initializer for the play content type. + * * @author Jens Pelzetter * @version $Id$ */ 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 index 2c5121f3e..717c48353 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayLoader.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayLoader.java @@ -20,7 +20,8 @@ package com.arsdigita.cms.contenttypes; /** - * + * Loader for the play content type. + * * @author Jens Pelzetter * @version $Id$ */ 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 index 7514c96c2..3c344c229 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsProductionCompanyCollection.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsProductionCompanyCollection.java @@ -25,7 +25,8 @@ import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataObject; /** - * + * Used only internally. + * * @author Jens Pelzetter * @version $Id$ */ diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieCreate.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieCreate.java index da40e8cf3..d8de57f34 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieCreate.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieCreate.java @@ -26,7 +26,8 @@ import com.arsdigita.cms.contenttypes.SciPublicationsMovieBundle; import com.arsdigita.cms.ui.authoring.CreationSelector; /** - * + * Create step for the movie content type. + * * @author Jens Pelzetter * @version $Id$ */ diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayCreate.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayCreate.java index 375e8f356..aa6c5996e 100644 --- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayCreate.java +++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayCreate.java @@ -25,7 +25,8 @@ import com.arsdigita.cms.contenttypes.SciPublicationsPlayBundle; import com.arsdigita.cms.ui.authoring.CreationSelector; /** - * + * Create step for the play content type. + * * @author Jens Pelzetter * @version $Id$ */