activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp
changeset 103 b99b84bcd2d1
parent 83 156f692b1687
child 104 9b022b1f357c
--- a/activityfw/activitydatabase/hsactivitydbserver/src/activitystoragesynctask.cpp	Fri Jun 11 13:58:37 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-#include "activitystoragesynctask.h"
-#include "activitycmd.h"
-
-_LIT(KUnsupportedStorageSyncTask, "Unsupported sync storage task");
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::ExecuteL(MActivityTaskStorage& observers,
-                                       CActivityStorage& dataStorage, 
-                                       const RMessage2& msg)
-{
-    switch (msg.Function()) {
-    case AddActivity: 
-        AddActivityL(dataStorage, msg);
-        break;
-    case UpdateActivity:
-        UpdateActivityL(dataStorage, msg);
-        break;
-    case RemoveActivity:
-        DeleteActivityL(dataStorage, msg);
-        break;
-    case RemoveApplicationActivities:
-        DeleteApplicationActivitiesL(dataStorage, msg);
-        break;
-    default:
-        //this code shouldn't be called. fatal error: means wrong session implementation 
-        User::Panic(KUnsupportedStorageSyncTask, KErrGeneral);
-    };
-    msg.Complete(KErrNone);
-    NotifyChangeL(observers, msg);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::AddActivityL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    
-    RBuf8 actId;
-    CleanupClosePushL(actId);
-    actId.CreateL(msg.GetDesLengthL(KRequestActOffset));
-    msg.ReadL(KRequestActOffset, actId, 0);
-    
-    RBuf8 data;
-    CleanupClosePushL(data);
-    data.CreateL(msg.GetDesLengthL(KRequestData));
-    msg.ReadL(KRequestData, data, 0);
-    
-    dataStorage.AddActivityL(appId(), actId, data);
-    
-    CleanupStack::PopAndDestroy(&data);
-    CleanupStack::PopAndDestroy(&actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::UpdateActivityL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    
-    RBuf8 actId;
-    CleanupClosePushL(actId);
-    actId.CreateL(msg.GetDesLengthL(KRequestActOffset));
-    msg.ReadL(KRequestActOffset, actId, 0);
-    
-    RBuf8 data;
-    CleanupClosePushL(data);
-    data.CreateL(msg.GetDesLengthL(KRequestData));
-    msg.ReadL(KRequestData, data, 0);
-    
-    dataStorage.UpdateActivityL(appId(), actId, data);
-    
-    CleanupStack::PopAndDestroy(&data);
-    CleanupStack::PopAndDestroy(&actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::DeleteActivityL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    
-    RBuf8 actId;
-    CleanupClosePushL(actId);
-    actId.CreateL(msg.GetDesLengthL(KRequestActOffset));
-    msg.ReadL(KRequestActOffset, actId, 0);
-    
-    dataStorage.DeleteActivityL(appId(), actId);
-    
-    CleanupStack::PopAndDestroy(&actId);
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::DeleteApplicationActivitiesL(CActivityStorage& dataStorage, const RMessage2& msg)
-{
-    TPckgBuf<TInt> appId;
-    msg.ReadL(KRequestAppIdOffset, appId);
-    dataStorage.DeleteActivitiesL(appId());
-}
-
-// -----------------------------------------------------------------------------
-//
-// -----------------------------------------------------------------------------
-//
-void ActivityStorageSyncTask::NotifyChangeL(MActivityTaskStorage& observers,
-                          const RMessage2& msg)
-{
-    const RPointerArray<CActivityTask> &table(observers.StorageData());
-    for (TInt iter(table.Count() - 1); 0 <= iter; --iter) {
-        table[iter]->BroadcastReceivedL(msg);
-    }
-}