changed the return value of createPlaylist() to Ptr<UniqueId>::Ref

This commit is contained in:
fgerlits 2005-01-14 12:29:05 +00:00
parent bb3b36e45a
commit 72387302c0
9 changed files with 38 additions and 39 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/include/LiveSupport/Storage/StorageClientInterface.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/include/LiveSupport/Storage/StorageClientInterface.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -65,7 +65,7 @@ using namespace Core;
* An interface for storage clients. * An interface for storage clients.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.5 $ * @version $Revision: 1.6 $
*/ */
class StorageClientInterface class StorageClientInterface
{ {
@ -76,11 +76,11 @@ class StorageClientInterface
* savePlaylist(). * savePlaylist().
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return the newly created playlist. * @return the ID of the newly created playlist.
* @exception XmlRpcException if there is a problem with the XML-RPC * @exception XmlRpcException if there is a problem with the XML-RPC
* call. * call.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<UniqueId>::Ref
createPlaylist(Ptr<SessionId>::Ref sessionId) createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (XmlRpcException) throw (XmlRpcException)
= 0; = 0;

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.29 $ Version : $Revision: 1.30 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -197,7 +197,7 @@ TestStorageClient :: configure(const xmlpp::Element & element)
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Create a new playlist. * Create a new playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<Playlist>::Ref Ptr<UniqueId>::Ref
TestStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId) TestStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId)
throw () throw ()
{ {
@ -214,7 +214,7 @@ TestStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId)
playlistMap[playlistId->getId()] = playlist; playlistMap[playlistId->getId()] = playlist;
return getPlaylist(sessionId, playlistId); // return a copy of the playlist return playlist->getId();
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.24 $ Version : $Revision: 1.25 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClient.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -90,7 +90,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.24 $ * @version $Revision: 1.25 $
*/ */
class TestStorageClient : class TestStorageClient :
virtual public Configurable, virtual public Configurable,
@ -191,9 +191,9 @@ class TestStorageClient :
* savePlaylist(). * savePlaylist().
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return the newly created playlist. * @return the ID of the newly created playlist.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<UniqueId>::Ref
createPlaylist(Ptr<SessionId>::Ref sessionId) createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (); throw ();

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.21 $ Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/TestStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -198,15 +198,15 @@ void
TestStorageClientTest :: createPlaylistTest(void) TestStorageClientTest :: createPlaylistTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
Ptr<Playlist>::Ref playlist; Ptr<UniqueId>::Ref playlistId;
try { try {
playlist = tsc->createPlaylist(dummySessionId); playlistId = tsc->createPlaylist(dummySessionId);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
try { try {
CPPUNIT_ASSERT(tsc->existsPlaylist(dummySessionId, playlist->getId())); CPPUNIT_ASSERT(tsc->existsPlaylist(dummySessionId, playlistId));
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.25 $ Version : $Revision: 1.26 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -1180,7 +1180,7 @@ WebStorageClient :: getAllPlaylists(Ptr<SessionId>::Ref sessionId) const
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Create a new playlist. * Create a new playlist.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<Playlist>::Ref Ptr<UniqueId>::Ref
WebStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId) WebStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (Core::XmlRpcException) throw (Core::XmlRpcException)
{ {
@ -1243,7 +1243,7 @@ WebStorageClient :: createPlaylist(Ptr<SessionId>::Ref sessionId)
token.reset(); token.reset();
playlist->setToken(token); playlist->setToken(token);
return playlist; return playlist->getId();
} }

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.17 $ Version : $Revision: 1.18 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClient.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -99,7 +99,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.17 $ * @version $Revision: 1.18 $
*/ */
class WebStorageClient : class WebStorageClient :
virtual public Configurable, virtual public Configurable,
@ -190,11 +190,11 @@ class WebStorageClient :
* savePlaylist(). * savePlaylist().
* *
* @param sessionId the session ID from the authentication client * @param sessionId the session ID from the authentication client
* @return the newly created playlist. * @return the ID of the newly created playlist.
* @exception XmlRpcException if there is a problem with the XML-RPC * @exception XmlRpcException if there is a problem with the XML-RPC
* call. * call.
*/ */
virtual Ptr<Playlist>::Ref virtual Ptr<UniqueId>::Ref
createPlaylist(Ptr<SessionId>::Ref sessionId) createPlaylist(Ptr<SessionId>::Ref sessionId)
throw (XmlRpcException); throw (XmlRpcException);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.27 $ Version : $Revision: 1.28 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storage/src/WebStorageClientTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -200,14 +200,13 @@ WebStorageClientTest :: playlistTest(void)
// test createPlaylist() // test createPlaylist()
Ptr<Playlist>::Ref playlist; Ptr<UniqueId>::Ref playlistIdxx;
try{ try{
playlist = wsc->createPlaylist(sessionId); playlistIdxx = wsc->createPlaylist(sessionId);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
CPPUNIT_ASSERT(playlist); CPPUNIT_ASSERT(playlistIdxx);
Ptr<UniqueId>::Ref playlistIdxx = playlist->getId();
// test existsPlaylist() // test existsPlaylist()
@ -229,6 +228,7 @@ WebStorageClientTest :: playlistTest(void)
// test editPlaylist() // test editPlaylist()
Ptr<Playlist>::Ref playlist;
try { try {
playlist = wsc->editPlaylist(sessionId, playlistIdxx); playlist = wsc->editPlaylist(sessionId, playlistIdxx);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
@ -507,16 +507,16 @@ WebStorageClientTest :: simplePlaylistTest(void)
// test createPlaylist() // test createPlaylist()
Ptr<Playlist>::Ref playlist; Ptr<UniqueId>::Ref playlistId;
try{ try{
playlist = wsc->createPlaylist(sessionId); playlistId = wsc->createPlaylist(sessionId);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
CPPUNIT_FAIL(e.what()); CPPUNIT_FAIL(e.what());
} }
CPPUNIT_ASSERT(playlist); CPPUNIT_ASSERT(playlistId);
Ptr<UniqueId>::Ref playlistId = playlist->getId();
// test editPlaylist() // test editPlaylist()
Ptr<Playlist>::Ref playlist;
try { try {
playlist = wsc->editPlaylist(sessionId, playlistId); playlist = wsc->editPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {

View File

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $ Author : $Author: fgerlits $
Version : $Revision: 1.16 $ Version : $Revision: 1.17 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -431,8 +431,7 @@ GLiveSupport :: openPlaylistForEditing(Ptr<UniqueId>::Ref playlistId)
releaseEditedPlaylist(); releaseEditedPlaylist();
if (!playlistId.get()) { if (!playlistId.get()) {
editedPlaylist = storage->createPlaylist(sessionId); playlistId = storage->createPlaylist(sessionId);
playlistId = editedPlaylist->getId();
} }
editedPlaylist = storage->editPlaylist(sessionId, playlistId); editedPlaylist = storage->editPlaylist(sessionId, playlistId);

View File

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.11 $ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/CreatePlaylistMethod.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -122,9 +122,9 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
scf = StorageClientFactory::getInstance(); scf = StorageClientFactory::getInstance();
storage = scf->getStorageClient(); storage = scf->getStorageClient();
Ptr<Playlist>::Ref playlist; Ptr<UniqueId>::Ref playlistId;
try { try {
playlist = storage->createPlaylist(sessionId); playlistId = storage->createPlaylist(sessionId);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
std::string eMsg = "could not create playlist:\n"; std::string eMsg = "could not create playlist:\n";
eMsg += e.what(); eMsg += e.what();
@ -134,7 +134,7 @@ CreatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & rootParameter,
return; return;
} }
Ptr<UniqueId>::Ref playlistId = playlist->getId(); Ptr<Playlist>::Ref playlist;
try { try {
playlist = storage->editPlaylist(sessionId, playlistId); playlist = storage->editPlaylist(sessionId, playlistId);
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {