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
master
jensp 2014-06-26 07:12:42 +00:00
parent 15406ba679
commit ef2b13fb2d
16 changed files with 448 additions and 78 deletions

View File

@ -16,13 +16,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.cms.portlet; package com.arsdigita.cms.portlet;
import com.arsdigita.portal.JSRPortlet; import com.arsdigita.portal.JSRPortlet;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException; import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher; import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest; import javax.portlet.RenderRequest;
@ -30,10 +31,8 @@ import javax.portlet.RenderResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Currently a wrapper for ContentItemPortlet to deliver content to an JSR * Currently a wrapper for ContentItemPortlet to deliver content to an JSR compliant portal server.
* compliant portal server.
* *
* WORK IN PROGRESS! * WORK IN PROGRESS!
* *
@ -41,27 +40,29 @@ import org.apache.log4j.Logger;
*/ */
public class ContentItemJSRPortlet extends JSRPortlet { 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 * Internal logger instance to faciliate debugging. Enable logging output by editing
* and set com.arsdigita.portal.JSRPortlet=DEBUG * /WEB-INF/conf/log4j.properties int the runtime environment and set
* by uncommenting or adding the line. */ * com.arsdigita.portal.JSRPortlet=DEBUG by uncommenting or adding the line.
*/
private static final Logger s_log = Logger.getLogger(ContentItemJSRPortlet.class); private static final Logger s_log = Logger.getLogger(ContentItemJSRPortlet.class);
/** /**
* *
* @param request * @param request
* @param response * @param response
*
* @throws PortletException * @throws PortletException
* @throws IOException * @throws IOException
*/ */
@Override @Override
protected void doEdit(RenderRequest request, RenderResponse response) protected void doEdit(RenderRequest request, RenderResponse response)
throws PortletException, IOException { throws PortletException, IOException {
//response.setContentType("text/html"); //response.setContentType("text/html");
//PrintWriter writer = new PrintWriter(response.getWriter()); //PrintWriter writer = new PrintWriter(response.getWriter());
//writer.println("You're now in Edit mode."); //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); dispatcher.include(request, response);
} }
@ -69,12 +70,13 @@ public class ContentItemJSRPortlet extends JSRPortlet {
* *
* @param request * @param request
* @param response * @param response
*
* @throws PortletException * @throws PortletException
* @throws IOException * @throws IOException
*/ */
@Override @Override
protected void doHelp(RenderRequest request, RenderResponse response) protected void doHelp(RenderRequest request, RenderResponse response)
throws PortletException, IOException { throws PortletException, IOException {
response.setContentType("text/html"); response.setContentType("text/html");
PrintWriter writer = new PrintWriter(response.getWriter()); PrintWriter writer = new PrintWriter(response.getWriter());
writer.println("You're now in Help mode."); writer.println("You're now in Help mode.");
@ -84,15 +86,23 @@ public class ContentItemJSRPortlet extends JSRPortlet {
* *
* @param request * @param request
* @param response * @param response
*
* @throws PortletException * @throws PortletException
* @throws IOException * @throws IOException
*/ */
@Override @Override
protected void doView(RenderRequest request, RenderResponse response) protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException { throws PortletException, IOException {
response.setContentType("text/html"); response.setContentType("text/html");
PrintWriter writer = new PrintWriter(response.getWriter()); PrintWriter writer = new PrintWriter(response.getWriter());
writer.println("Hello world! You're in View mode."); writer.println("Hello world! You're in View mode.");
}
@Override
public void processAction(final ActionRequest actionRequest,
final ActionResponse actionResponse)
throws PortletException, IOException {
} }
} }

View File

@ -9,7 +9,7 @@
name="ScientificCMS" name="ScientificCMS"
prettyName="Scientific CMS" prettyName="Scientific CMS"
version="2.3.0" version="2.3.0"
release="devel-SNAPSHOT-r2719" release="devel-SNAPSHOT-r2721"
webxml="sci-web.xml" webxml="sci-web.xml"
portletxml="sci-portlet.xml" portletxml="sci-portlet.xml"
webapp="libreccm" webapp="libreccm"

View File

@ -26,6 +26,7 @@ import com.arsdigita.persistence.DataObject;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Used only internally.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes;
import com.arsdigita.toolbox.GlobalisationUtil; import com.arsdigita.toolbox.GlobalisationUtil;
/** /**
* Globalisation util for the the dramatic arts module.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
* @version $Id$ * @version $Id$

View File

@ -27,6 +27,14 @@ import java.math.BigDecimal;
import java.util.List; 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 <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$
@ -57,10 +65,21 @@ public class SciPublicationsMovie extends Publication {
super(type); super(type);
} }
/**
* Get the special content bundle of this instance.
*
* @return
*/
public SciPublicationsMovieBundle getSciPublicationsMovieBundle() { public SciPublicationsMovieBundle getSciPublicationsMovieBundle() {
return (SciPublicationsMovieBundle) getContentBundle(); 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() { public GenericPerson getDirector() {
final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector(); final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector();
if (bundle == null) { 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) { public GenericPerson getDirector(final String language) {
final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector(); final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector();
if (bundle == null) { if (bundle == null) {
@ -79,10 +107,19 @@ public class SciPublicationsMovie extends Publication {
} }
} }
/**
* Convenient method for setting the director.
*/
public void setDirector(final GenericPerson director) { public void setDirector(final GenericPerson director) {
getSciPublicationsMovieBundle().setDirector(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() { public GenericOrganizationalUnit getProductionCompany() {
final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle() final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle()
.getProductionCompany(); .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) { public GenericOrganizationalUnit getProductionCompany(final String language) {
final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle() final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle()
.getProductionCompany(); .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) { public void setProductionCompany(final GenericOrganizationalUnit company) {
getSciPublicationsMovieBundle().setProductionCompany(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() { private SciPublicationsDirectorCollection getDirectors() {
return getSciPublicationsMovieBundle().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) { private void addDirector(final GenericPerson director) {
getSciPublicationsMovieBundle().addDirector(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) { private void removeDirector(final GenericPerson director) {
getSciPublicationsMovieBundle().removeDirector(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) { private void swapWithPreviousDirector(final GenericPerson director) {
getDirectors().swapWithPrevious(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) { private void swapWithNextDirector(final GenericPerson director) {
getDirectors().swapWithNext(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() { private boolean hasDirectors() {
return !getDirectors().isEmpty(); 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() { private SciPublicationsProductionCompanyCollection getProductionCompanies() {
return getSciPublicationsMovieBundle().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) { private void addProductionCompany(final GenericOrganizationalUnit company) {
getSciPublicationsMovieBundle().addProductionCompany(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) { private void removeProductionCompany(final GenericOrganizationalUnit company) {
getSciPublicationsMovieBundle().removeProductionCompany(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() { private boolean hasProductionCompanies() {
return !getProductionCompanies().isEmpty(); return !getProductionCompanies().isEmpty();
} }

View File

@ -33,6 +33,8 @@ import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* Special {@link ContentBundle} adding the associations of the Movie content type.
*
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$
@ -76,6 +78,15 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
super(type); super(type);
} }
/**
* Used for publishing the item. Takes care of the special associations.
*
* @param source
* @param property
* @param copier
*
* @return
*/
@Override @Override
public boolean copyProperty(final CustomCopy source, public boolean copyProperty(final CustomCopy source,
final Property property, 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) { private void createDirectorAssoc(final DataCollection directors) {
final GenericPersonBundle draftDirector = (GenericPersonBundle) DomainObjectFactory 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) { private void createProductionCompanyAssoc(final DataCollection companies) {
final GenericOrganizationalUnitBundle draftCompany 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 @Override
public boolean copyReverseProperty(final CustomCopy source, public boolean copyReverseProperty(final CustomCopy source,
final ContentItem liveItem, final ContentItem liveItem,
@ -230,6 +261,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
} }
/**
* Get the director of the movie.
*
* @return
*/
public GenericPersonBundle getDirector() { public GenericPersonBundle getDirector() {
final DataCollection collection = (DataCollection) get(DIRECTOR); final DataCollection collection = (DataCollection) get(DIRECTOR);
@ -246,6 +282,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
} }
} }
/**
* Set the director of the movie.
*
* @param director
*/
public void setDirector(final GenericPerson director) { public void setDirector(final GenericPerson director) {
final GenericPersonBundle oldDirector = getDirector(); final GenericPersonBundle oldDirector = getDirector();
@ -263,10 +304,22 @@ 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.
*
* @return
*/
protected SciPublicationsDirectorCollection getDirectors() { protected SciPublicationsDirectorCollection getDirectors() {
return new SciPublicationsDirectorCollection((DataCollection) get(DIRECTOR)); 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) { protected void addDirector(final GenericPerson director) {
Assert.exists(director, GenericPerson.class); Assert.exists(director, GenericPerson.class);
@ -277,6 +330,12 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
updateDirectorsStr(); 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) { protected void removeDirector(final GenericPerson director) {
Assert.exists(director, GenericPerson.class); Assert.exists(director, GenericPerson.class);
@ -285,6 +344,10 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
updateDirectorsStr(); updateDirectorsStr();
} }
/**
* Updates the directorStr property in all instances which contains a string with the names of
* all directors for easy filtering.
*/
protected void updateDirectorsStr() { protected void updateDirectorsStr() {
final SciPublicationsDirectorCollection directors = getDirectors(); final SciPublicationsDirectorCollection directors = getDirectors();
@ -310,6 +373,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
} }
/**
* Retrieves the production company of a movie.
*
* @return
*/
public GenericOrganizationalUnitBundle getProductionCompany() { public GenericOrganizationalUnitBundle getProductionCompany() {
final DataCollection collection = (DataCollection) get(PRODUCTION_COMPANY); final DataCollection collection = (DataCollection) get(PRODUCTION_COMPANY);
@ -326,6 +394,11 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
} }
} }
/**
* Sets the production company of a movie.
*
* @param productionCompany
*/
public void setProductionCompany(final GenericOrganizationalUnit productionCompany) { public void setProductionCompany(final GenericOrganizationalUnit productionCompany) {
final GenericOrganizationalUnitBundle oldCompany = getProductionCompany(); final GenericOrganizationalUnitBundle oldCompany = getProductionCompany();
@ -343,6 +416,12 @@ 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.
*
* @return
*/
protected SciPublicationsProductionCompanyCollection getProductionCompanies() { protected SciPublicationsProductionCompanyCollection getProductionCompanies() {
return new SciPublicationsProductionCompanyCollection((DataCollection) get( 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) { protected void addProductionCompany(final GenericOrganizationalUnit company) {
Assert.exists(company, GenericOrganizationalUnit.class); 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) { protected void removeProductionCompany(final GenericOrganizationalUnit company) {
Assert.exists(company, GenericOrganizationalUnit.class); 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) { public static PublicationBundleCollection getDirectedMovies(final GenericPerson director) {
final GenericPersonBundle directorBundle = director.getGenericPersonBundle(); 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( public static PublicationBundleCollection getProducedMovies(
final GenericOrganizationalUnit company) { final GenericOrganizationalUnit company) {
@ -391,10 +492,21 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
} }
/**
* Gets the primary instance of the movie.
*
* @return
*/
public SciPublicationsMovie getMovie() { public SciPublicationsMovie getMovie() {
return (SciPublicationsMovie) getPrimaryInstance(); return (SciPublicationsMovie) getPrimaryInstance();
} }
/**
* Gets a specific language variant of the movie.
*
* @param language
* @return
*/
public SciPublicationsMovie getMovie(final String language) { public SciPublicationsMovie getMovie(final String language) {
SciPublicationsMovie result = (SciPublicationsMovie) getInstance(language); SciPublicationsMovie result = (SciPublicationsMovie) getInstance(language);

View File

@ -21,6 +21,7 @@
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
/** /**
* Initializer for the movie content type.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$

View File

@ -20,6 +20,7 @@
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
/** /**
* Loader for the movie content type.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$

View File

@ -27,6 +27,18 @@ import java.math.BigDecimal;
import java.util.List; 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:
* <dl>
* <dt>firstProducationYear</dt>
* <dd>The year in which the play as first shown at a theatre.</dd>
* <dt>firstProducationTheater</dt>
* <dd>The theatre which has shown the play first.</dd>
* <dd></dd>
* </dl>
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$
@ -69,6 +81,12 @@ public class SciPublicationsPlay extends PublicationWithPublisher {
set(FIRST_PRODUCTION_YEAR, year); 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() { public GenericOrganizationalUnit getProductionTheater() {
final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle() final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle()
.getProductionTheater(); .getProductionTheater();
@ -81,6 +99,12 @@ public class SciPublicationsPlay extends PublicationWithPublisher {
} }
/**
* 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) { public GenericOrganizationalUnit getProductionTheater(final String language) {
final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle() final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle()
.getProductionTheater(); .getProductionTheater();
@ -93,22 +117,51 @@ public class SciPublicationsPlay extends PublicationWithPublisher {
} }
/**
* Sets the first production theatre
*
* @param theater
*/
public void setProductionTheater(final GenericOrganizationalUnit theater) { public void setProductionTheater(final GenericOrganizationalUnit theater) {
getSciPublicationsPlayBundle().setProductionTheater(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() { private DomainCollection getProductionTheateres() {
return getSciPublicationsPlayBundle().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) { private void addProductionTheater(final GenericOrganizationalUnit theater) {
getSciPublicationsPlayBundle().addProductionTheater(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) { private void removeProductionTheater(final GenericOrganizationalUnit theater) {
getSciPublicationsPlayBundle().removeProductionTheater(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() { private boolean hasProductionTheaters() {
return !getProductionTheateres().isEmpty(); return !getProductionTheateres().isEmpty();
} }

View File

@ -33,6 +33,8 @@ import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* Special content bundle for the play content type encapsulating the associcatio to the first
* production theatre.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$
@ -42,7 +44,7 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.cms.contenttypes.SciPublicationsPlayBundle"; = "com.arsdigita.cms.contenttypes.SciPublicationsPlayBundle";
public static final String PRODUCTION_THEATER = "productionTheatre"; 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) { public SciPublicationsPlayBundle(final ContentItem primary) {
@ -73,6 +75,16 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
super(type); 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 @Override
public boolean copyProperty(final CustomCopy source, public boolean copyProperty(final CustomCopy source,
final Property property, 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) { private void createProductionTheaterAssoc(final DataCollection theatres) {
final GenericOrganizationalUnitBundle draftTheater 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 @Override
public boolean copyReverseProperty(final CustomCopy source, public boolean copyReverseProperty(final CustomCopy source,
final ContentItem liveItem, 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, private void createTheaterPlayAssoc(final DataCollection plays,
final GenericOrganizationalUnitBundle theater) { final GenericOrganizationalUnitBundle theater) {
@ -172,6 +205,11 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
} }
/**
* Retrieves the first production theatre of a play.
*
* @return
*/
public GenericOrganizationalUnitBundle getProductionTheater() { public GenericOrganizationalUnitBundle getProductionTheater() {
final DataCollection collection = (DataCollection) get(PRODUCTION_THEATER); final DataCollection collection = (DataCollection) get(PRODUCTION_THEATER);
@ -189,6 +227,11 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
} }
/**
* Sets the first producation theatre.
*
* @param theater
*/
public void setProductionTheater(final GenericOrganizationalUnit theater) { public void setProductionTheater(final GenericOrganizationalUnit theater) {
final GenericOrganizationalUnitBundle oldTheater = getProductionTheater(); final GenericOrganizationalUnitBundle oldTheater = getProductionTheater();
@ -206,12 +249,24 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
} }
} }
/**
* 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() { protected DomainCollection getProductionTheateres() {
return new DomainCollection((DataCollection) get(PRODUCTION_THEATER)); 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) { protected void addProductionTheater(final GenericOrganizationalUnit theater) {
Assert.exists(theater, GenericOrganizationalUnit.class); Assert.exists(theater, GenericOrganizationalUnit.class);
@ -222,6 +277,12 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
link.save(); 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) { protected void removeProductionTheater(final GenericOrganizationalUnit theater) {
Assert.exists(theater, GenericOrganizationalUnit.class); 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( public static PublicationBundleCollection getProducedPlays(
final GenericOrganizationalUnit theater) { final GenericOrganizationalUnit theater) {
@ -242,10 +310,21 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
} }
/**
* Gets the primary instance of the play.
*
* @return
*/
public SciPublicationsPlay getPlay() { public SciPublicationsPlay getPlay() {
return (SciPublicationsPlay) getPrimaryInstance(); return (SciPublicationsPlay) getPrimaryInstance();
} }
/**
* Gets a specific language instance of the play.
*
* @param language
* @return
*/
public SciPublicationsPlay getPlay(final String language) { public SciPublicationsPlay getPlay(final String language) {
SciPublicationsPlay result = (SciPublicationsPlay) getInstance(language); SciPublicationsPlay result = (SciPublicationsPlay) getInstance(language);

View File

@ -21,6 +21,7 @@
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
/** /**
* Initializer for the play content type.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$

View File

@ -20,6 +20,7 @@
package com.arsdigita.cms.contenttypes; package com.arsdigita.cms.contenttypes;
/** /**
* Loader for the play content type.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$

View File

@ -25,6 +25,7 @@ import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
/** /**
* Used only internally.
* *
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$

View File

@ -26,6 +26,7 @@ import com.arsdigita.cms.contenttypes.SciPublicationsMovieBundle;
import com.arsdigita.cms.ui.authoring.CreationSelector; import com.arsdigita.cms.ui.authoring.CreationSelector;
/** /**
* Create step for the movie content type.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
* @version $Id$ * @version $Id$

View File

@ -25,6 +25,7 @@ import com.arsdigita.cms.contenttypes.SciPublicationsPlayBundle;
import com.arsdigita.cms.ui.authoring.CreationSelector; import com.arsdigita.cms.ui.authoring.CreationSelector;
/** /**
* Create step for the play content type.
* *
* @author Jens Pelzetter * @author Jens Pelzetter
* @version $Id$ * @version $Id$