diff --git a/livesupport/doc/model/Scheduler/index.html b/livesupport/doc/model/Scheduler/index.html index 6979fe90a..f8ea22bfd 100644 --- a/livesupport/doc/model/Scheduler/index.html +++ b/livesupport/doc/model/Scheduler/index.html @@ -13,8 +13,8 @@ project, Copyright © 2004 Media Development Loan Fund, under the GNU GPL.
@@ -2205,7 +2205,7 @@ for the specified playlistId, indicate as an error.
Name
- displayPlaylist
+ deletePlaylist
(playlist : Playlist)
: void
@@ -2558,7 +2558,7 @@ in the Playlist store.
Name
- displayPlaylists
+ displayPlayLog
()
: Play log
diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index a1f6e5087..a180eabe5 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -68,8 +68,8 @@ using namespace boost::posix_time; * information of when and how each audio clip is played inside * the playlist. * - * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.2 $ */ class Playlist : public Configurable { @@ -89,6 +89,16 @@ class Playlist : public Configurable */ Ptr::Ref playlength; + /** + * Flag set if playlist is currently playing. + */ + bool isLockedForPlaying; + + /** + * Flag set if playlist is currently being edited. + */ + bool isLockedForEditing; + public: /** @@ -96,6 +106,8 @@ class Playlist : public Configurable */ Playlist(void) throw () { + this->isLockedForPlaying = false; + this->isLockedForEditing = false; } /** @@ -110,6 +122,8 @@ class Playlist : public Configurable { this->id = id; this->playlength = playlength; + this->isLockedForPlaying = false; + this->isLockedForEditing = false; } /** @@ -169,6 +183,27 @@ class Playlist : public Configurable { return playlength; } + + /** + * Lock or unlock the playlist for editing. + * + * @return true if successfully obtained or releasedlock; + * false otherwise. + */ + bool + setLockedForEditing(bool lockStatus) + throw (); + + /** + * Lock or unlock the playlist for playing. + * + * @return true if successfully obtained or releasedlock; + * false otherwise. + */ + bool + setLockedForPlaying(bool lockStatus) + throw (); + }; diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index 998d3bc74..428c4a255 100644 --- a/livesupport/modules/core/src/Playlist.cxx +++ b/livesupport/modules/core/src/Playlist.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -103,3 +103,54 @@ Playlist :: configure(const xmlpp::Element & element) duration_from_string(attribute->get_value()))); } + +/*------------------------------------------------------------------------------ + * Lock or unlock the playlist for editing. + *----------------------------------------------------------------------------*/ +bool +Playlist::setLockedForEditing(bool lockStatus) + throw () +{ + if (lockStatus == true) { + if (isLockedForPlaying || isLockedForEditing) { + return false; + } + else { + isLockedForEditing = true; + return true; + } + } + else { + if (isLockedForPlaying) { + return false; + } + else { + isLockedForEditing = false; + return true; // returns true also if playlist + } // was already unlocked! + } +} + + +/*------------------------------------------------------------------------------ + * Lock or unlock the playlist for playing. + *----------------------------------------------------------------------------*/ +bool +Playlist::setLockedForPlaying(bool lockStatus) + throw () +{ + if (lockStatus == true) { + if (isLockedForPlaying) { + return false; + } + else { + isLockedForPlaying = true; // preserve LockedForEditing state + return true; + } + } + else { + isLockedForPlaying = false; // restore LockedForEditing state; + return true; // returns true also if playlist + } // was already unlocked! +} + diff --git a/livesupport/modules/core/src/PlaylistTest.cxx b/livesupport/modules/core/src/PlaylistTest.cxx index 5a429b677..01fe50cbf 100644 --- a/livesupport/modules/core/src/PlaylistTest.cxx +++ b/livesupport/modules/core/src/PlaylistTest.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -114,3 +114,27 @@ PlaylistTest :: firstTest(void) } } + +/*------------------------------------------------------------------------------ + * Test to see if locking works + *----------------------------------------------------------------------------*/ +void +PlaylistTest :: lockTest(void) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref playlist(new Playlist()); + + CPPUNIT_ASSERT(playlist->setLockedForEditing(true)); + CPPUNIT_ASSERT(!playlist->setLockedForEditing(true)); + CPPUNIT_ASSERT(playlist->setLockedForEditing(false)); + + CPPUNIT_ASSERT(playlist->setLockedForPlaying(true)); + CPPUNIT_ASSERT(!playlist->setLockedForPlaying(true)); + CPPUNIT_ASSERT(playlist->setLockedForPlaying(false)); + + CPPUNIT_ASSERT(playlist->setLockedForEditing(true)); + CPPUNIT_ASSERT(playlist->setLockedForPlaying(true)); + CPPUNIT_ASSERT(!playlist->setLockedForEditing(false)); + CPPUNIT_ASSERT(playlist->setLockedForPlaying(false)); + CPPUNIT_ASSERT(!playlist->setLockedForEditing(true)); +} diff --git a/livesupport/modules/core/src/PlaylistTest.h b/livesupport/modules/core/src/PlaylistTest.h index e4292b1ae..f576ddfe2 100644 --- a/livesupport/modules/core/src/PlaylistTest.h +++ b/livesupport/modules/core/src/PlaylistTest.h @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -57,14 +57,15 @@ namespace Core { /** * Unit test for the UploadPlaylistMetohd class. * - * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.2 $ * @see Playlist */ class PlaylistTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE(PlaylistTest); CPPUNIT_TEST(firstTest); + CPPUNIT_TEST(lockTest); CPPUNIT_TEST_SUITE_END(); protected: @@ -77,6 +78,15 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture void firstTest(void) throw (CPPUNIT_NS::Exception); + /** + * Testing the locks. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + lockTest(void) throw (CPPUNIT_NS::Exception); + + public: /** diff --git a/livesupport/products/scheduler/doc/model/SchedulerModel.zuml b/livesupport/products/scheduler/doc/model/SchedulerModel.zuml index 9d195b47c..75fbc75fe 100644 Binary files a/livesupport/products/scheduler/doc/model/SchedulerModel.zuml and b/livesupport/products/scheduler/doc/model/SchedulerModel.zuml differ diff --git a/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h b/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h index e38b8f468..e2b3f4641 100644 --- a/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h +++ b/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/DisplayPlaylistsMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -81,10 +81,9 @@ using namespace LiveSupport::Core; *
  • playlength - int - the playlist length of the playlist, in seconds *
  • * - * In case of an error, a simple false value is returned. * * @author $Author: fgerlits $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class DisplayPlaylistsMethod : public XmlRpc::XmlRpcServerMethod {