114
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <liwcommon.h>
|
|
20 |
|
|
21 |
#include "cpserverdef.h"
|
|
22 |
#include "cpublisherregistrymap.h"
|
|
23 |
#include "cpglobals.h"
|
|
24 |
#include "cpdebug.h"
|
|
25 |
#include "cpssqlcommands.h"
|
|
26 |
#include "cpsecuritypolicy.h"
|
|
27 |
|
|
28 |
// ---------------------------------------------------------------------------
|
|
29 |
//
|
|
30 |
// ---------------------------------------------------------------------------
|
|
31 |
//
|
|
32 |
|
|
33 |
CPublisherRegistryMap::CPublisherRegistryMap()
|
|
34 |
{
|
|
35 |
|
|
36 |
}
|
|
37 |
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
// ---------------------------------------------------------------------------
|
|
41 |
//
|
|
42 |
void CPublisherRegistryMap::ConstructL()
|
|
43 |
{
|
|
44 |
CCPLiwMap::ConstructL( );
|
|
45 |
}
|
|
46 |
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
EXPORT_C CPublisherRegistryMap* CPublisherRegistryMap::NewL( )
|
|
52 |
{
|
|
53 |
CPublisherRegistryMap* self = CPublisherRegistryMap::NewLC( );
|
|
54 |
CleanupStack::Pop( self );
|
|
55 |
return self;
|
|
56 |
}
|
|
57 |
|
|
58 |
// ---------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
EXPORT_C CPublisherRegistryMap* CPublisherRegistryMap::NewLC( )
|
|
63 |
{
|
|
64 |
CPublisherRegistryMap* self = new (ELeave) CPublisherRegistryMap();
|
|
65 |
self->PushL();
|
|
66 |
self->ConstructL( );
|
|
67 |
return self;
|
|
68 |
}
|
|
69 |
|
|
70 |
// ---------------------------------------------------------------------------
|
|
71 |
//
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
CPublisherRegistryMap::~CPublisherRegistryMap()
|
|
75 |
{
|
|
76 |
}
|
|
77 |
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
// ---------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
TInt32 CPublisherRegistryMap::AddL( RSqlDatabase aSqlDb,
|
|
83 |
CLiwDefaultList* aNotificationList ) const
|
|
84 |
{
|
|
85 |
CP_DEBUG( _L8("CPublisherRegistryMap::AddL") );
|
|
86 |
TInt32 id( 0);
|
|
87 |
if ( !GetProperty( KId, id ) )
|
|
88 |
{
|
|
89 |
FetchIdL( aSqlDb, KSQLFetchIdFromRegistry, id );
|
|
90 |
}
|
|
91 |
if ( id )
|
|
92 |
{
|
|
93 |
UpdateL( aSqlDb, id , aNotificationList );
|
|
94 |
}
|
|
95 |
else
|
|
96 |
{
|
|
97 |
id = AddToDbL( aSqlDb , aNotificationList );
|
|
98 |
}
|
|
99 |
return id;
|
|
100 |
|
|
101 |
}
|
|
102 |
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
//
|
|
107 |
TUint CPublisherRegistryMap::GetListL( RSqlDatabase aSqlDb,
|
|
108 |
CLiwGenericParamList* aList, RArray<TInt32>& aItemsToDelete ) const
|
|
109 |
{
|
|
110 |
CP_DEBUG( _L8("CPublisherRegistryMap::GetListL") );
|
|
111 |
aItemsToDelete.Reset( ); //no items to delete
|
|
112 |
return CCPLiwMap::GetListL( aSqlDb, KSQLGetListFromRegistry, aList,
|
|
113 |
aItemsToDelete );
|
|
114 |
}
|
|
115 |
|
|
116 |
// ---------------------------------------------------------------------------
|
|
117 |
//
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
//
|
|
120 |
void CPublisherRegistryMap::RemoveL( RSqlDatabase aSqlDb,
|
|
121 |
CLiwDefaultList* aNotificationList ) const
|
|
122 |
{
|
|
123 |
CP_DEBUG( _L8("CContentMap::RemoveL") );
|
|
124 |
//get ids of items to be deleted
|
|
125 |
GetIdsOfRemovedEntriesL( aSqlDb, KSQLGetIdsRegistry, aNotificationList );
|
|
126 |
CCPLiwMap::RemoveL( aSqlDb, KSQLDeleteFromRegistry );
|
|
127 |
}
|
|
128 |
|
|
129 |
// ---------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void CPublisherRegistryMap::SaveQueryResultsL( RSqlStatement& aStmt,
|
|
134 |
CLiwGenericParamList& aList, RArray<TInt32>& /*aItemsToDelete*/) const
|
|
135 |
{
|
|
136 |
CP_DEBUG( _L8("CPublisherRegistryMap::SaveQueryResultsL") );
|
|
137 |
TInt idIndex = ColumnIndexL( aStmt, KColumnId );
|
|
138 |
TInt publisherIndex = ColumnIndexL( aStmt, KColumnPublisher );
|
|
139 |
TInt contentIndex = ColumnIndexL( aStmt, KColumnContent_type );
|
|
140 |
TInt content_idIndex = ColumnIndexL( aStmt, KColumnContent_id );
|
|
141 |
TInt flagIndex = ColumnIndexL( aStmt, KColumnFlag );
|
|
142 |
TInt acl_Index = ColumnIndexL( aStmt, KColumnAccessList );
|
|
143 |
TInt data_Index = ColumnIndexL( aStmt, KColumnData );
|
|
144 |
TInt action_Index = ColumnIndexL( aStmt, KColumnAction );
|
|
145 |
|
|
146 |
TBool aclCheckFailed( EFalse );
|
|
147 |
while ( aStmt.Next( ) == KSqlAtRow )
|
|
148 |
{
|
|
149 |
TBool securityOk(EFalse);
|
|
150 |
if( iPolicy )
|
|
151 |
{
|
|
152 |
TPtrC8 acl;
|
|
153 |
User::LeaveIfError( aStmt.ColumnBinary( acl_Index, acl ) );
|
|
154 |
securityOk = iPolicy->CheckSecurityL( acl ,
|
|
155 |
CCPSecurityPolicy::ERead );
|
|
156 |
if ( !securityOk )
|
|
157 |
{
|
|
158 |
aclCheckFailed = ETrue;
|
|
159 |
}
|
|
160 |
}
|
|
161 |
|
|
162 |
if( !iPolicy || securityOk )
|
|
163 |
{
|
|
164 |
TInt32 id = aStmt.ColumnInt( idIndex ) ;
|
|
165 |
TPtrC publisher;
|
|
166 |
User::LeaveIfError( aStmt.ColumnText( publisherIndex,
|
|
167 |
publisher ) );
|
|
168 |
TPtrC content_type;
|
|
169 |
User::LeaveIfError( aStmt.ColumnText( contentIndex,
|
|
170 |
content_type ) );
|
|
171 |
TPtrC content_id;
|
|
172 |
User::LeaveIfError( aStmt.ColumnText( content_idIndex,
|
|
173 |
content_id ));
|
|
174 |
TInt32 flag_db = aStmt.ColumnInt( flagIndex );
|
|
175 |
TInt32 flag_map(0);
|
|
176 |
|
|
177 |
TUint filter = GetFilterL();
|
|
178 |
GetProperty( KFlag, flag_map );
|
|
179 |
|
|
180 |
if (!(filter & EFlag) || ( (flag_db & flag_map)==flag_map))
|
|
181 |
{
|
|
182 |
CLiwDefaultMap* targetMap = CLiwDefaultMap::NewLC();
|
|
183 |
targetMap->InsertL( KType, TLiwVariant( KPublisher ) );
|
|
184 |
targetMap->InsertL( KId , TLiwVariant( id ) );
|
|
185 |
targetMap->InsertL( KPublisherId , TLiwVariant( publisher ) );
|
|
186 |
targetMap->InsertL( KContentType , TLiwVariant( content_type ) );
|
|
187 |
targetMap->InsertL( KContentId , TLiwVariant( content_id ) );
|
|
188 |
targetMap->InsertL( KFlag , TLiwVariant( flag_db ) );
|
|
189 |
TPtrC8 data;
|
|
190 |
User::LeaveIfError( aStmt.ColumnBinary( data_Index, data ) );
|
|
191 |
TPtrC8 action;
|
|
192 |
User::LeaveIfError( aStmt.ColumnBinary( action_Index, action ) );
|
|
193 |
if( data.Ptr() )
|
|
194 |
{
|
|
195 |
targetMap->InsertL( KDataMap , TLiwVariant( data ) );
|
|
196 |
}
|
|
197 |
if( action.Ptr() )
|
|
198 |
{
|
|
199 |
targetMap->InsertL( KActionMap , TLiwVariant( action ) );
|
|
200 |
}
|
|
201 |
TLiwGenericParam result( KListMap, TLiwVariant( targetMap ));
|
|
202 |
aList.AppendL( result );
|
|
203 |
CleanupStack::PopAndDestroy( targetMap );
|
|
204 |
}
|
|
205 |
}//if
|
|
206 |
}//while
|
|
207 |
//leave only if ACL security check for all items failed
|
|
208 |
if ( aclCheckFailed && !aList.Count())
|
|
209 |
{
|
|
210 |
User::Leave( KErrPermissionDenied );
|
|
211 |
}
|
|
212 |
}
|
|
213 |
|
|
214 |
|
|
215 |
// ---------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
TInt32 CPublisherRegistryMap::AddToDbL( RSqlDatabase aSqlDb,
|
|
220 |
CLiwDefaultList* aNotificationList ) const
|
|
221 |
{
|
|
222 |
CP_DEBUG( _L8("CPublisherRegistryMap::AddToDbL") );
|
|
223 |
RSqlStatement stmt;
|
|
224 |
CleanupClosePushL( stmt );
|
|
225 |
PrepareStmtforAddL( aSqlDb, stmt, KSQLInsertToRegistry );
|
|
226 |
|
|
227 |
TInt dataIndex = stmt.ParameterIndex( KSQLData );
|
|
228 |
TInt actionIndex = stmt.ParameterIndex( KSQLAction );
|
|
229 |
TInt aclIndex = stmt.ParameterIndex( KSQLAccessList );
|
|
230 |
|
|
231 |
RBuf8 data;
|
|
232 |
data.CleanupClosePushL();
|
|
233 |
GetPropertyL( KDataMap, data ) ;
|
|
234 |
BindBinaryL( stmt, dataIndex, data );
|
|
235 |
RBuf8 action;
|
|
236 |
action.CleanupClosePushL();
|
|
237 |
GetPropertyL( KActionMap, action ) ;
|
|
238 |
BindBinaryL( stmt, actionIndex, action );
|
|
239 |
|
|
240 |
RBuf8 acl;
|
|
241 |
acl.CleanupClosePushL();
|
|
242 |
if( !GetPropertyL( KAccessList , acl ) )
|
|
243 |
{
|
|
244 |
iPolicy->GetDefaultSecurityL( acl );
|
|
245 |
}
|
|
246 |
BindBinaryL( stmt, aclIndex, acl );
|
|
247 |
|
|
248 |
if ( stmt.Exec( ) <= 0 )
|
|
249 |
{
|
|
250 |
User::Leave( KErrGeneral );
|
|
251 |
}
|
|
252 |
|
|
253 |
TSqlScalarFullSelectQuery id_query(aSqlDb);
|
|
254 |
TInt32 ret( 0);
|
|
255 |
ret = id_query.SelectIntL( KSQLGetLastInsertId );
|
|
256 |
|
|
257 |
if ( aNotificationList )
|
|
258 |
{
|
|
259 |
RBuf publisher;
|
|
260 |
publisher.CleanupClosePushL();
|
|
261 |
RBuf contentType;
|
|
262 |
contentType.CleanupClosePushL();
|
|
263 |
RBuf contentId;
|
|
264 |
contentId.CleanupClosePushL();
|
|
265 |
GetPropertyL( KPublisherId, publisher ) ;
|
|
266 |
GetPropertyL( KContentType, contentType );
|
|
267 |
GetPropertyL( KContentId, contentId );
|
|
268 |
CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( );
|
|
269 |
changeInfoMap->InsertL( KId, TLiwVariant( ret ) );
|
|
270 |
changeInfoMap->InsertL( KType, TLiwVariant( KPublisher ) );
|
|
271 |
changeInfoMap->InsertL( KPublisherId, TLiwVariant( publisher ) );
|
|
272 |
changeInfoMap->InsertL( KContentType, TLiwVariant( contentType ) );
|
|
273 |
changeInfoMap->InsertL( KContentId, TLiwVariant( contentId ) );
|
|
274 |
changeInfoMap->InsertL( KOperation, TLiwVariant( KOperationAdd ) );
|
|
275 |
TInt32 flag( 0 );
|
|
276 |
GetProperty( KFlag, flag );
|
|
277 |
changeInfoMap->InsertL( KFlag, TLiwVariant( flag ) );
|
|
278 |
aNotificationList->AppendL( TLiwVariant( changeInfoMap ) );
|
|
279 |
CleanupStack::PopAndDestroy( changeInfoMap ) ;
|
|
280 |
CleanupStack::PopAndDestroy( &contentId ) ;
|
|
281 |
CleanupStack::PopAndDestroy( &contentType ) ;
|
|
282 |
CleanupStack::PopAndDestroy( &publisher ) ;
|
|
283 |
}
|
|
284 |
|
|
285 |
CleanupStack::PopAndDestroy( &acl );
|
|
286 |
CleanupStack::PopAndDestroy( &action );
|
|
287 |
CleanupStack::PopAndDestroy( &data );
|
|
288 |
CleanupStack::PopAndDestroy( &stmt ) ;
|
|
289 |
|
|
290 |
return ret;
|
|
291 |
}
|
|
292 |
|
|
293 |
// ---------------------------------------------------------------------------
|
|
294 |
//
|
|
295 |
// ---------------------------------------------------------------------------
|
|
296 |
//
|
|
297 |
void CPublisherRegistryMap::AppendFilterL( RBuf& aQuery,
|
|
298 |
TUint& aFilter ) const
|
|
299 |
{
|
|
300 |
CP_DEBUG( _L8("CPublisherRegistryMap::AppendFilterL") );
|
|
301 |
if( aFilter & EFlag )
|
|
302 |
{
|
|
303 |
aQuery.ReAllocL( aQuery.Length() + KSQLGetFlag().Length() +
|
|
304 |
KWhere().Length() );
|
|
305 |
aQuery.Append( KWhere );
|
|
306 |
aQuery.Append( KSQLGetFlag );
|
|
307 |
}
|
|
308 |
else
|
|
309 |
{
|
|
310 |
CCPLiwMap::AppendFilterL( aQuery, aFilter );
|
|
311 |
}
|
|
312 |
}
|
|
313 |
|
|
314 |
// ---------------------------------------------------------------------------
|
|
315 |
//
|
|
316 |
// ---------------------------------------------------------------------------
|
|
317 |
//
|
|
318 |
void CPublisherRegistryMap::AppendSortL( RBuf& aQuery,
|
|
319 |
const TCPSortOrder& aSort ) const
|
|
320 |
{
|
|
321 |
CP_DEBUG( _L8("CPublisherRegistryMap::AppendSortL") );
|
|
322 |
switch ( aSort )
|
|
323 |
{
|
|
324 |
case ECPContentId:
|
|
325 |
aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderContentId().Length( ) );
|
|
326 |
aQuery.Append( KSQLOrderContentId );
|
|
327 |
break;
|
|
328 |
case ECPContent:
|
|
329 |
aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderContent().Length( ) );
|
|
330 |
aQuery.Append( KSQLOrderContent );
|
|
331 |
break;
|
|
332 |
case ECPPublisher:
|
|
333 |
aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderPublisher().Length( ) );
|
|
334 |
aQuery.Append( KSQLOrderPublisher );
|
|
335 |
break;
|
|
336 |
default:
|
|
337 |
aQuery.ReAllocL( aQuery.Length( ) + KSQLOrderRecent().Length( ) );
|
|
338 |
aQuery.Append( KSQLOrderRecent );
|
|
339 |
break;
|
|
340 |
}
|
|
341 |
}
|
|
342 |
|
|
343 |
// ---------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
// ---------------------------------------------------------------------------
|
|
346 |
//
|
|
347 |
void CPublisherRegistryMap::PrepareStmtforAddL( RSqlDatabase aSqlDb,
|
|
348 |
RSqlStatement& aStmt ,
|
|
349 |
const TDesC& aQuery ) const
|
|
350 |
{
|
|
351 |
CP_DEBUG( _L8("CPublisherRegistryMap::PrepareStmtforAddL") );
|
|
352 |
CCPLiwMap::PrepareStmtforAddL( aSqlDb,aStmt,aQuery);
|
|
353 |
TInt32 flag( 0x00000000 );
|
|
354 |
GetProperty( KFlag, flag );
|
|
355 |
TInt flagIndex = aStmt.ParameterIndex( KSQLFlag );
|
|
356 |
if (flagIndex != KErrNotFound)
|
|
357 |
{
|
|
358 |
BindIntL( aStmt, flagIndex , flag );
|
|
359 |
}
|
|
360 |
}
|
|
361 |
|
|
362 |
// ---------------------------------------------------------------------------
|
|
363 |
//
|
|
364 |
// ---------------------------------------------------------------------------
|
|
365 |
//
|
|
366 |
void CPublisherRegistryMap::PrepareStmtforUpdateL( RSqlDatabase aSqlDb,
|
|
367 |
RSqlStatement& aStmt, TInt32 aId ) const
|
|
368 |
{
|
|
369 |
CP_DEBUG( _L8("CPublisherRegistryMap::PrepareStmtforUpdateL") );
|
|
370 |
TInt32 flag;
|
|
371 |
TBool isFlagInfo = GetProperty( KFlag, flag );
|
|
372 |
|
|
373 |
TBool isParameter(EFalse);
|
|
374 |
RBuf query;
|
|
375 |
query.CleanupClosePushL();
|
|
376 |
query.CreateL( KSQLUpdateRegistry().Length( ) );
|
|
377 |
query.Append( KSQLUpdateRegistry );
|
|
378 |
RBuf8 data;
|
|
379 |
data.CleanupClosePushL();
|
|
380 |
if ( GetPropertyL( KDataMap, data ) )
|
|
381 |
{
|
|
382 |
query.ReAllocL( query.Length( ) + KSQLUpdateData().Length( ) );
|
|
383 |
query.Append( KSQLUpdateData );
|
|
384 |
isParameter = ETrue;
|
|
385 |
}
|
|
386 |
RBuf8 action;
|
|
387 |
action.CleanupClosePushL();
|
|
388 |
if ( GetPropertyL( KActionMap, action ) )
|
|
389 |
{
|
|
390 |
if ( isParameter )
|
|
391 |
{
|
|
392 |
query.ReAllocL( query.Length( ) + KComma().Length( ) );
|
|
393 |
query.Append( KComma );
|
|
394 |
}
|
|
395 |
query.ReAllocL( query.Length( ) + KSQLUpdateAction().Length( ) );
|
|
396 |
query.Append( KSQLUpdateAction );
|
|
397 |
isParameter = ETrue;
|
|
398 |
}
|
|
399 |
if( isFlagInfo )
|
|
400 |
{
|
|
401 |
if(isParameter)
|
|
402 |
{
|
|
403 |
query.ReAllocL( query.Length() + KComma().Length());
|
|
404 |
query.Append( KComma );
|
|
405 |
}
|
|
406 |
query.ReAllocL( query.Length() + KSQLUpdateFlag().Length());
|
|
407 |
query.Append( KSQLUpdateFlag );
|
|
408 |
isParameter = ETrue;
|
|
409 |
}
|
|
410 |
if( !isParameter ) User::Leave( KErrPathNotFound );
|
|
411 |
query.ReAllocL( query.Length( ) + KSQLUpdateWhere().Length( ) );
|
|
412 |
query.Append( KSQLUpdateWhere );
|
|
413 |
User::LeaveIfError( aStmt.Prepare( aSqlDb, query ) );
|
|
414 |
TInt dataId = aStmt.ParameterIndex( KSQLId );
|
|
415 |
BindIntL( aStmt, dataId, aId );
|
|
416 |
|
|
417 |
if ( data.Length( ) )
|
|
418 |
{
|
|
419 |
TInt dataIndex = aStmt.ParameterIndex( KSQLData );
|
|
420 |
BindBinaryL( aStmt,dataIndex, data );
|
|
421 |
}
|
|
422 |
if ( action.Length( ) )
|
|
423 |
{
|
|
424 |
TInt actionIndex = aStmt.ParameterIndex( KSQLAction );
|
|
425 |
BindBinaryL( aStmt, actionIndex, action );
|
|
426 |
}
|
|
427 |
if( isFlagInfo )
|
|
428 |
{
|
|
429 |
TInt flagIndex = aStmt.ParameterIndex( KSQLFlag );
|
|
430 |
BindIntL( aStmt, flagIndex , flag );
|
|
431 |
}
|
|
432 |
CleanupStack::PopAndDestroy( &action );
|
|
433 |
CleanupStack::PopAndDestroy( &data );
|
|
434 |
CleanupStack::PopAndDestroy( &query );
|
|
435 |
}
|
|
436 |
|
|
437 |
// ---------------------------------------------------------------------------
|
|
438 |
//
|
|
439 |
// ---------------------------------------------------------------------------
|
|
440 |
//
|
|
441 |
void CPublisherRegistryMap::UpdateL( RSqlDatabase aSqlDb, TInt32 aId,
|
|
442 |
CLiwDefaultList* aNotificationList) const
|
|
443 |
{
|
|
444 |
CP_DEBUG( _L8("CPublisherRegistryMap::UpdateL") );
|
|
445 |
RSqlStatement stmt;
|
|
446 |
CleanupClosePushL( stmt );
|
|
447 |
CLiwDefaultMap* changeInfoMap = CLiwDefaultMap::NewLC( );
|
|
448 |
FetchIdsL( aId, KSQLFetchIdsFromRegistry, changeInfoMap, aSqlDb );
|
|
449 |
if ( aNotificationList )
|
|
450 |
{
|
|
451 |
changeInfoMap->InsertL( KType, TLiwVariant( KPublisher ) );
|
|
452 |
TInt32 flag( 0 );
|
|
453 |
GetProperty( KFlag, flag );
|
|
454 |
changeInfoMap->InsertL( KFlag, TLiwVariant( flag ) );
|
|
455 |
aNotificationList->AppendL( TLiwVariant( changeInfoMap ) );
|
|
456 |
}
|
|
457 |
CleanupStack::PopAndDestroy( changeInfoMap ) ;
|
|
458 |
PrepareStmtforUpdateL( aSqlDb, stmt, aId );
|
|
459 |
if ( stmt.Exec( ) <= 0 )
|
|
460 |
{
|
|
461 |
User::Leave( KErrNotFound );
|
|
462 |
}
|
|
463 |
CleanupStack::PopAndDestroy( &stmt ) ;
|
|
464 |
}
|
|
465 |
|
|
466 |
// ---------------------------------------------------------------------------
|
|
467 |
//
|
|
468 |
// ---------------------------------------------------------------------------
|
|
469 |
//
|
|
470 |
void CPublisherRegistryMap::IsValidForDeleteL() const
|
|
471 |
{
|
|
472 |
TInt err( KErrNone );
|
|
473 |
TInt32 id( 0 );
|
|
474 |
if( GetProperty( KId, id ) && ( id < 1 ) )
|
|
475 |
{
|
|
476 |
err = KErrArgument;
|
|
477 |
}
|
|
478 |
else if( !IsId() && PropertyExists( KId ) )
|
|
479 |
{
|
|
480 |
err = KErrBadName;
|
|
481 |
}
|
|
482 |
|
|
483 |
if( err == KErrNone && !IsFlag() && !IsId( ) && !( IsPublisherNameL( )
|
|
484 |
|| IsContentTypeL( ) || IsContentIdL() ) )
|
|
485 |
{
|
|
486 |
err = KErrPathNotFound;
|
|
487 |
}
|
|
488 |
|
|
489 |
if( err != KErrNone )
|
|
490 |
{
|
|
491 |
User::Leave( err );
|
|
492 |
}
|
|
493 |
}
|
|
494 |
|
|
495 |
// ---------------------------------------------------------------------------
|
|
496 |
//
|
|
497 |
// ---------------------------------------------------------------------------
|
|
498 |
//
|
|
499 |
void CPublisherRegistryMap::IsValidForGetListL() const
|
|
500 |
{
|
|
501 |
TInt err( KErrNone );
|
|
502 |
TInt32 id( 0 );
|
|
503 |
if( GetProperty( KId, id ) && ( id < 1 ) )
|
|
504 |
{
|
|
505 |
err = KErrArgument;
|
|
506 |
}
|
|
507 |
else if( !IsId() && PropertyExists( KId ) )
|
|
508 |
{
|
|
509 |
err = KErrBadName;
|
|
510 |
}
|
|
511 |
|
|
512 |
if( err != KErrNone )
|
|
513 |
{
|
|
514 |
User::Leave( err );
|
|
515 |
}
|
|
516 |
}
|
|
517 |
// ---------------------------------------------------------------------------
|
|
518 |
//
|
|
519 |
// ---------------------------------------------------------------------------
|
|
520 |
//
|
|
521 |
TBool CPublisherRegistryMap::ActivateActionSupport( ) const
|
|
522 |
{
|
|
523 |
return ETrue;
|
|
524 |
}
|
|
525 |
|
|
526 |
// ---------------------------------------------------------------------------
|
|
527 |
//
|
|
528 |
// ---------------------------------------------------------------------------
|
|
529 |
//
|
|
530 |
TBool CPublisherRegistryMap::GetActivateInfo( ) const
|
|
531 |
{
|
|
532 |
TInt32 flag;
|
|
533 |
GetProperty( KFlag, flag );
|
|
534 |
TBool activate = flag & EActivate;
|
|
535 |
return activate;
|
|
536 |
}
|
|
537 |
|
|
538 |
|
|
539 |
// ---------------------------------------------------------------------------
|
|
540 |
//
|
|
541 |
// ---------------------------------------------------------------------------
|
|
542 |
//
|
|
543 |
void CPublisherRegistryMap::FillChangeInfoMapL( RSqlStatement& aStmt,
|
|
544 |
CLiwDefaultMap* aMap )const
|
|
545 |
{
|
|
546 |
CCPLiwMap::FillChangeInfoMapL(aStmt, aMap);
|
|
547 |
TInt flagIndex = ColumnIndexL( aStmt, KColumnFlag );
|
|
548 |
TInt32 flag_db = aStmt.ColumnInt( flagIndex );
|
|
549 |
aMap->InsertL( KFlag , TLiwVariant( flag_db ) );
|
|
550 |
}
|
|
551 |
|