mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/csetobjectreferences.h
changeset 0 a2952bb97e68
child 17 780c925249c1
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Set object references operation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSETOBJECTREFERENCES_H
       
    20 #define CSETOBJECTREFERENCES_H
       
    21 
       
    22 #include <badesca.h>
       
    23 
       
    24 #include "crequestprocessor.h"
       
    25 
       
    26 // forward declaration
       
    27 class CMTPTypeArray;
       
    28 class CMmMtpDpMetadataAccessWrapper;
       
    29 class MMmMtpDpConfig;
       
    30 
       
    31 /**
       
    32 * Defines SetObjectReferences request processor
       
    33 */
       
    34 class CSetObjectReferences : public CRequestProcessor
       
    35     {
       
    36 public:
       
    37     /**
       
    38     * Two-phase construction method
       
    39     * @param aFramework    The data provider framework
       
    40     * @param aConnection    The connection from which the request comes
       
    41     * @param aWrapper    medadata access interface
       
    42     * @return a pointer to the created request processor object
       
    43     */
       
    44     IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework,
       
    45         MMTPConnection& aConnection,
       
    46         MMmMtpDpConfig& aDpConfig );
       
    47 
       
    48     /**
       
    49     * Destructor
       
    50     */
       
    51     IMPORT_C virtual ~CSetObjectReferences();
       
    52 
       
    53 protected:
       
    54     /**
       
    55     * Standard c++ constructor
       
    56     * @param aFramework    The data provider framework
       
    57     * @param aConnection    The connection from which the request comes
       
    58     * @param aWrapper    medadata access interface
       
    59     */
       
    60     IMPORT_C CSetObjectReferences( MMTPDataProviderFramework& aFramework,
       
    61         MMTPConnection& aConnection,
       
    62         MMmMtpDpConfig& aDpConfig );
       
    63 
       
    64 protected:
       
    65     /**
       
    66     * set references to DB
       
    67     * @param aWrapper          medadata access interface
       
    68     * @param aObjectFormat     the format of the file
       
    69     * @param aSrcFileName      file name, from
       
    70     * @param aRefFileArray     the array of file names, to
       
    71     */
       
    72     IMPORT_C virtual void
       
    73         DoSetObjectReferencesL( CMmMtpDpMetadataAccessWrapper& aWrapper,
       
    74             TUint16 aObjectFormat,
       
    75             const TDesC& aSrcFileName,
       
    76             CDesCArray& aRefFileArray );
       
    77 
       
    78 private:
       
    79     //from CRequestProcessor
       
    80     /**
       
    81     * SetReferences request handler
       
    82     * start receiving reference data from the initiator
       
    83     */
       
    84     IMPORT_C void ServiceL();
       
    85 
       
    86     /**
       
    87     * Apply the references to the specified object
       
    88     * @return EFalse
       
    89     */
       
    90     IMPORT_C TBool DoHandleResponsePhaseL();
       
    91 
       
    92     /**
       
    93     * Derived from CRequestProcessor, can not be neglected
       
    94     * @return ETrue
       
    95     */
       
    96     IMPORT_C TBool HasDataphase() const;
       
    97 
       
    98 private:
       
    99     /**
       
   100     * Verify if the references are valid handles to objects
       
   101     * @return ETrue if all the references are good, otherwise, EFalse
       
   102     */
       
   103     TBool VerifyReferenceHandlesL() const;
       
   104 
       
   105     /**
       
   106     * Two-phase construction
       
   107     */
       
   108     void ConstructL();
       
   109 
       
   110 private:
       
   111     // Array to store the references to set to the object
       
   112     CMTPTypeArray* iReferences;
       
   113     MMmMtpDpConfig& iDpConfig;
       
   114     CDesCArray* iReferenceSuids;
       
   115 
       
   116     };
       
   117 
       
   118 #endif // CSETOBJECTREFERENCES_H