diff --git a/livesupport/doc/model/Scheduler/index.html b/livesupport/doc/model/Scheduler/index.html
index 9770f83d5..80b083dbc 100644
--- a/livesupport/doc/model/Scheduler/index.html
+++ b/livesupport/doc/model/Scheduler/index.html
@@ -14,7 +14,7 @@ Development Loan Fund, under the GNU GPL.
- Author: $Author: fgerlits $
- - Version: $Revision: 1.5 $
+ - Version: $Revision: 1.6 $
- Location: $Source:
/home/cvs/livesupport/doc/model/Scheduler/index.html,v $
@@ -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 e46ea0dc2..6a9c218a6 100644
--- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h
+++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.7 $
+ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $
------------------------------------------------------------------------------*/
@@ -71,7 +71,7 @@ using namespace boost::posix_time;
* the playlist.
*
* @author $Author: fgerlits $
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
class Playlist : public Configurable
{
@@ -212,27 +212,26 @@ class Playlist : public Configurable
}
/**
- * Test whether the playlist is locked for editing.
+ * Test whether the playlist is locked for editing or playing.
*
- * @return true if playlist is currently being edited;
- * false if not, or if the editing has been suspended
- * because the playlist is being played
+ * @return true if the playlist is currently being edited or
+ * played; false otherwise
*/
bool
- getIsLockedForEditing() const throw ()
+ isLocked() const throw ()
{
- return isLockedForEditing && !isLockedForPlaying;
+ return isLockedForEditing || isLockedForPlaying;
}
/**
- * Test whether the playlist is locked for playing.
+ * Test whether the playlist is currently available for editing.
*
- * @return true if playlist is locked, false if not
+ * @return true if the playlist is available, false otherwise
*/
bool
- getIsLockedForPlaying() const throw ()
+ canBeEdited() const throw ()
{
- return isLockedForPlaying;
+ return isLockedForEditing && !isLockedForPlaying;
}
/**
diff --git a/livesupport/modules/core/src/PlaylistTest.cxx b/livesupport/modules/core/src/PlaylistTest.cxx
index f452b1098..7faeb63b2 100644
--- a/livesupport/modules/core/src/PlaylistTest.cxx
+++ b/livesupport/modules/core/src/PlaylistTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.7 $
+ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -148,19 +148,25 @@ void
PlaylistTest :: lockTest(void)
throw (CPPUNIT_NS::Exception)
{
+ CPPUNIT_ASSERT(!playlist->isLocked());
+ CPPUNIT_ASSERT(!playlist->canBeEdited());
+
CPPUNIT_ASSERT(playlist->setLockedForEditing(true));
+ CPPUNIT_ASSERT(playlist->isLocked());
+ CPPUNIT_ASSERT(playlist->canBeEdited());
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->isLocked());
+ CPPUNIT_ASSERT(!playlist->canBeEdited());
+ CPPUNIT_ASSERT(!playlist->setLockedForEditing(true));
CPPUNIT_ASSERT(!playlist->setLockedForEditing(false));
+ CPPUNIT_ASSERT(!playlist->setLockedForPlaying(true));
+
CPPUNIT_ASSERT(playlist->setLockedForPlaying(false));
- CPPUNIT_ASSERT(!playlist->setLockedForEditing(true));
+ CPPUNIT_ASSERT(playlist->isLocked());
+ CPPUNIT_ASSERT(playlist->canBeEdited());
+ CPPUNIT_ASSERT(playlist->setLockedForEditing(false));
}
diff --git a/livesupport/products/scheduler/doc/model/SchedulerModel.zuml b/livesupport/products/scheduler/doc/model/SchedulerModel.zuml
index c91d3b208..add36b57c 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/etc/Makefile.in b/livesupport/products/scheduler/etc/Makefile.in
index e070f4eea..367b1cce0 100644
--- a/livesupport/products/scheduler/etc/Makefile.in
+++ b/livesupport/products/scheduler/etc/Makefile.in
@@ -21,7 +21,7 @@
#
#
# Author : $Author: fgerlits $
-# Version : $Revision: 1.15 $
+# Version : $Revision: 1.16 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $
#
# @configure_input@
@@ -127,7 +127,9 @@ SCHEDULER_OBJS = ${TMP_DIR}/SignalDispatcher.o \
${TMP_DIR}/RemoveAudioClipFromPlaylistMethod.o \
${TMP_DIR}/ValidatePlaylistMethod.o \
${TMP_DIR}/DisplayAudioClipMethod.o \
- ${TMP_DIR}/DisplayAudioClipsMethod.o
+ ${TMP_DIR}/DisplayAudioClipsMethod.o \
+ ${TMP_DIR}/RevertEditedPlaylistMethod.o \
+ ${TMP_DIR}/SavePlaylistMethod.o
SCHEDULER_EXE_OBJS = ${SCHEDULER_OBJS} \
${TMP_DIR}/main.o
@@ -158,6 +160,8 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \
${TMP_DIR}/ValidatePlaylistMethodTest.o \
${TMP_DIR}/DisplayAudioClipMethodTest.o \
${TMP_DIR}/DisplayAudioClipsMethodTest.o \
+ ${TMP_DIR}/SavePlaylistMethodTest.o \
+ ${TMP_DIR}/RevertEditedPlaylistMethodTest.o \
${TMP_DIR}/TestRunner.o
TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl
diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx
index 183a485a5..9e6c0a262 100644
--- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx
+++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.3 $
+ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@@ -148,7 +148,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters,
return;
}
- if (!playlist->getIsLockedForEditing()) {
+ if (!playlist->canBeEdited()) {
XmlRpcTools::markError(errorId+6,
"playlist has not been opened for editing",
returnValue);
diff --git a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx
index 945d91d4d..e2edd6a60 100644
--- a/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx
+++ b/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.5 $
+ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -157,6 +157,4 @@ CreatePlaylistMethodTest :: firstTest(void)
// should not allow to open the same playlist for editing again
method->execute(parameter, result);
CPPUNIT_ASSERT((int) result["errorCode"] == 105);
- CPPUNIT_ASSERT((const std::string) result["errorMessage"] ==
- "could not open playlist for editing (already open?)");
}
diff --git a/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx b/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx
index e0568fe4b..dd1a89a4e 100644
--- a/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx
+++ b/livesupport/products/scheduler/src/DeletePlaylistMethod.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.2 $
+ Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/DeletePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@@ -106,7 +106,17 @@ DeletePlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters,
scf = StorageClientFactory::getInstance();
storage = scf->getStorageClient();
- if (!storage->existsPlaylist(id)) {
+ Ptr::Ref playlist;
+ try {
+ playlist = storage->getPlaylist(id);
+ }
+ catch (std::invalid_argument &e) {
+ // TODO: mark error
+ returnValue = XmlRpc::XmlRpcValue(false);
+ return;
+ }
+
+ if (playlist->isLocked()) {
// TODO: mark error
returnValue = XmlRpc::XmlRpcValue(false);
return;
diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx
index e286b6a75..888e4c501 100644
--- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx
+++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.6 $
+ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.cxx,v $
------------------------------------------------------------------------------*/
@@ -122,26 +122,20 @@ OpenPlaylistForEditingMethod :: execute(XmlRpc::XmlRpcValue & parameters,
scf = StorageClientFactory::getInstance();
storage = scf->getStorageClient();
- if (!storage->existsPlaylist(id)) {
- XmlRpcTools::markError(errorId+3, "playlist does not exist",
- returnValue);
- return;
- }
-
Ptr::Ref playlist;
try {
playlist = storage->getPlaylist(id);
}
catch (std::invalid_argument &e) {
- XmlRpcTools::markError(errorId+4, "could not load playlist",
+ XmlRpcTools::markError(errorId+4, "playlist not found",
returnValue);
return;
}
if (!playlist->setLockedForEditing(true)) {
XmlRpcTools::markError(errorId+5,
- "could not open playlist for editing (already open?)",
- returnValue);
+ "could not open playlist",
+ returnValue);
return;
}
diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h
index 6ad846a63..2e1bb175a 100644
--- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h
+++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.4 $
+ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethod.h,v $
------------------------------------------------------------------------------*/
@@ -90,14 +90,13 @@ using namespace LiveSupport::Core;
*
* The possible error codes are:
*
- * - 101 - invalid argument format
- * - 102 - argument is not a playlist ID
- * - 103 - playlist does not exist
- * - 104 - could not load playlist
- * - 105 - could not open playlist for editing (already open?)
+ * - 101 - invalid argument format
+ * - 102 - argument is not a playlist ID
+ * - 104 - playlist not found
+ * - 105 - could not open playlist
*
* @author $Author: fgerlits $
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
class OpenPlaylistForEditingMethod : public XmlRpc::XmlRpcServerMethod
{
diff --git a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx
index dbb31df1d..67d9ca2ed 100644
--- a/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx
+++ b/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx
@@ -22,7 +22,7 @@
Author : $Author: fgerlits $
- Version : $Revision: 1.5 $
+ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/OpenPlaylistForEditingMethodTest.cxx,v $
------------------------------------------------------------------------------*/
@@ -157,9 +157,9 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
// no such playlist
method->execute(parameter, result);
- CPPUNIT_ASSERT((int) result["errorCode"] == 103);
+ CPPUNIT_ASSERT((int) result["errorCode"] == 104);
CPPUNIT_ASSERT((const std::string) result["errorMessage"] ==
- "playlist does not exist");
+ "playlist not found");
parameter.clear();
result.clear();
parameter["playlistId"] = 1;
@@ -168,6 +168,6 @@ OpenPlaylistForEditingMethodTest :: firstTest(void)
method->execute(parameter, result);
CPPUNIT_ASSERT((int) result["errorCode"] == 105);
CPPUNIT_ASSERT((const std::string) result["errorMessage"] ==
- "could not open playlist for editing (already open?)");
+ "could not open playlist");
}
diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx
index cd487cf0e..d767163c8 100644
--- a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx
+++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx
@@ -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/RemoveAudioClipFromPlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@@ -143,7 +143,7 @@ RemoveAudioClipFromPlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters,
return;
}
- if (!playlist->getIsLockedForEditing()) {
+ if (!playlist->canBeEdited()) {
XmlRpcTools::markError(errorId+5,
"playlist has not been opened for editing",
returnValue);
diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx b/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx
index aa9f365b1..b1c410da5 100644
--- a/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx
+++ b/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx
@@ -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/ValidatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/
@@ -132,7 +132,7 @@ ValidatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters,
return;
}
- if (!playlist->getIsLockedForEditing()) {
+ if (!playlist->canBeEdited()) {
XmlRpcTools::markError(errorId+4,
"playlist has not been opened for editing",
returnValue);