ncdengine/provider/server/inc/ncdsearchoperationimpl.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCDSEARCHOPERATIONIMPL_H
       
    20 #define C_NCDSEARCHOPERATIONIMPL_H
       
    21 
       
    22 #include "ncdloadnodeoperationimpl.h"
       
    23 #include "ncdnodefactory.h"
       
    24 
       
    25 class CNcdSearchFilter;
       
    26 
       
    27 /**
       
    28  *  Search operation implementation.
       
    29  *
       
    30  *
       
    31  *  @lib ?library
       
    32  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    33  */
       
    34 class CNcdSearchOperation : public CNcdLoadNodeOperationImpl
       
    35     {
       
    36     
       
    37 public:
       
    38     
       
    39     /*
       
    40      * @param aRecursionLevel Determines the number of remote folder levels
       
    41      * the search request is made to. Negative number means unlimited levels.
       
    42      */
       
    43     static CNcdSearchOperation* NewL(
       
    44         const CNcdNodeIdentifier& aNodeIdentifier,
       
    45         const CNcdNodeIdentifier& aParentIdentifier,
       
    46         const CNcdSearchFilter& aFilter,
       
    47         TNcdResponseFilterParams aFilterParams,
       
    48         CNcdGeneralManager& aGeneralManager,
       
    49         MCatalogsHttpSession& aHttpSession,
       
    50         MNcdOperationRemoveHandler* aRemoveHandler,
       
    51         MNcdOperationQueue* aOperationQueue,
       
    52         MCatalogsSession& aSession,
       
    53         TBool aLoadChildren = EFalse,
       
    54         TNcdChildLoadMode aMode = ELoadStructure,
       
    55         TInt aRecursionLevels = -1,
       
    56         TBool iIsSubOperation = EFalse );
       
    57 
       
    58     /*
       
    59      * @param aRecursionLevel Determines the number of remote folder levels
       
    60      * the search request is made to. Negative number means unlimited levels.
       
    61      */
       
    62     static CNcdSearchOperation* NewLC(
       
    63         const CNcdNodeIdentifier& aNodeIdentifier,
       
    64         const CNcdNodeIdentifier& aParentIdentifier,
       
    65         const CNcdSearchFilter& aFilter,
       
    66         TNcdResponseFilterParams aFilterParams,        
       
    67         CNcdGeneralManager& aGeneralManager,
       
    68         MCatalogsHttpSession& aHttpSession,
       
    69         MNcdOperationRemoveHandler* aRemoveHandler,
       
    70         MNcdOperationQueue* aOperationQueue,
       
    71         MCatalogsSession& aSession,
       
    72         TBool aLoadChildren = EFalse,
       
    73         TNcdChildLoadMode aMode = ELoadStructure,
       
    74         TInt aRecursionLevels = -1,
       
    75         TBool aIsSubOperation = EFalse );
       
    76         
       
    77     virtual ~CNcdSearchOperation();
       
    78     
       
    79 public: // from  MNcdParserEntityObserver
       
    80 
       
    81     /**
       
    82      * @see MNcdParserEntityObserver
       
    83      */
       
    84     virtual void FolderRefL( MNcdPreminetProtocolFolderRef* aData );
       
    85     
       
    86     /**
       
    87      * @see MNcdParserEntityObserver
       
    88      */
       
    89     virtual void FolderDataL( MNcdPreminetProtocolDataEntity* aData );
       
    90     
       
    91     /**
       
    92      * @see MNcdParserEntityObserver
       
    93      */
       
    94     virtual void ItemRefL( MNcdPreminetProtocolItemRef* aData );
       
    95     
       
    96     /**
       
    97      * @see MNcdParserEntityObserver
       
    98      */
       
    99     virtual void ItemDataL( MNcdPreminetProtocolDataEntity* aData );
       
   100     
       
   101 public: // from MNcdParserErrorObserver
       
   102 
       
   103     virtual void ErrorL( MNcdPreminetProtocolError* aData );
       
   104     
       
   105 protected:
       
   106 
       
   107     CNcdSearchOperation( TNcdResponseFilterParams aFilterParams,
       
   108         TNcdChildLoadMode aMode,
       
   109         TBool aLoadChildren,
       
   110         CNcdGeneralManager& aGeneralManager,
       
   111         MCatalogsHttpSession& aHttpSession,
       
   112         MNcdOperationRemoveHandler* aRemoveHandler,
       
   113         MNcdOperationQueue* aOperationQueue,
       
   114         MCatalogsSession& aSession,
       
   115         TInt aRecursionLevels,
       
   116         TBool aIsSubOperation = EFalse );
       
   117     
       
   118     void ConstructL( const CNcdNodeIdentifier& aNodeIdentifier,
       
   119         const CNcdNodeIdentifier& aParentIdentifier,
       
   120         const CNcdSearchFilter& aFilter );
       
   121 
       
   122 protected: // From CNcdLoadNodeOperationImpl
       
   123 
       
   124     virtual HBufC8* CreateRequestLC( CNcdNodeIdentifier* aNodeIdentifier,
       
   125         TNcdResponseFilterParams aFilterParams,
       
   126         const TDesC& aUri );
       
   127         
       
   128     virtual void CreateSubOperationsL();
       
   129     
       
   130     
       
   131     /**
       
   132      * @see CNcdLoadNodeOperationImpl::IsLoadingNecessaryL
       
   133      */
       
   134     TBool IsLoadingNecessaryL();
       
   135     
       
   136     /**
       
   137      * @see CNcdLoadNodeOperationImpl::IsChildClearingNecessaryL
       
   138      */
       
   139     virtual TBool IsChildClearingNecessaryL();
       
   140     
       
   141     /**
       
   142      * @see CNcdLoadNodeOperationImpl::RemoteFolderCount
       
   143      */    
       
   144     virtual TInt RemoteFolderCount() const;
       
   145     
       
   146 
       
   147     /**
       
   148      * @see CNcdLoadNodeOperationImpl::RemoveChildrenL
       
   149      */    
       
   150     virtual void RemoveChildrenL( CNcdNodeFolder& aFolder );
       
   151     
       
   152     
       
   153 protected:
       
   154 
       
   155     void DetermineParentTypeL( const TUid& aUid );
       
   156     
       
   157     /**
       
   158      * Creates a skeleton node that contains all needed info to
       
   159      * conduct search for a bundle.
       
   160      *
       
   161      * @return The created search folder.
       
   162      */
       
   163     CNcdNode& CreateSearchBundleSkeletonL();
       
   164     
       
   165     /**
       
   166      * Creates a skeleton node that contains all needed info to
       
   167      * conduct search for a regular folder.
       
   168      *
       
   169      * @return The created search folder.
       
   170      */
       
   171     CNcdNode& CreateSearchFolderSkeletonL();
       
   172     
       
   173     /**
       
   174      * Actual implementation for FolderRefL
       
   175      */
       
   176     void DoFolderRefL( MNcdPreminetProtocolFolderRef* aData );
       
   177     
       
   178     /**
       
   179      * Actual implementation for ItemRefL
       
   180      */
       
   181     void DoItemRefL( MNcdPreminetProtocolItemRef* aData );
       
   182     
       
   183     /**
       
   184      * Actual implementation for ItemDataL
       
   185      */
       
   186     void DoItemDataL( MNcdPreminetProtocolDataEntity* aData );
       
   187     
       
   188 private: // data
       
   189     
       
   190     CNcdSearchFilter* iSearchFilter;
       
   191     
       
   192     CNcdNodeFactory::TNcdNodeType iParentType;
       
   193     
       
   194     // Recursion levels left
       
   195     TInt iRecursionLeft;
       
   196     
       
   197     // Remote folders that are children of transparent will be here.
       
   198     RPointerArray<CNcdNodeIdentifier> iRemoteFoldersChildOfTransparent;
       
   199 
       
   200     };
       
   201 
       
   202 #endif // C_NCDSEARCHOPERATIONIMPL_H