harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
changeset 0 ccd0fd43f247
child 2 208a4ba3894c
equal deleted inserted replaced
-1:000000000000 0:ccd0fd43f247
       
     1 /*
       
     2 * Copyright (c) 2010 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:  MDS to CPIX Audio Document fetcher 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "cpixmediaaudiodoc.h"
       
    20 #include <mdeobject.h>
       
    21 #include <mdccommon.h>
       
    22 #include <mdeitem.h>
       
    23 #include <mdeconstants.h>
       
    24 #include <mdeobjectdef.h>
       
    25 #include "harvesterserverlogger.h"
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CCPIXDocFetcher::NewL()
       
    29 // -----------------------------------------------------------------------------
       
    30 //
       
    31 CCPIXMediaAudioDoc* CCPIXMediaAudioDoc::NewL()
       
    32     {
       
    33     CCPIXMediaAudioDoc* self = CCPIXMediaAudioDoc::NewLC();
       
    34     CleanupStack::Pop(self);
       
    35     return self;
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CCPIXDocFetcher::NewLC()
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CCPIXMediaAudioDoc* CCPIXMediaAudioDoc::NewLC()
       
    43     {
       
    44     CCPIXMediaAudioDoc* self = new (ELeave) CCPIXMediaAudioDoc();
       
    45     CleanupStack::PushL(self);
       
    46     self->ConstructL();
       
    47     return self;
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CCPIXDocFetcher::~CCPIXMediaAudioDoc()
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CCPIXMediaAudioDoc::~CCPIXMediaAudioDoc()
       
    55     {
       
    56     
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CCPIXDocFetcher::CCPIXMediaAudioDoc()
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CCPIXMediaAudioDoc::CCPIXMediaAudioDoc()
       
    64     {
       
    65     
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CCPIXDocFetcher::ConstructL()
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 void CCPIXMediaAudioDoc::ConstructL()
       
    73     {
       
    74     CCPIXDocFetcher::ConstructL();//Must have
       
    75     
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CCPIXDocFetcher::GetCpixDocumentL()
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 CSearchDocument* CCPIXMediaAudioDoc::GetCpixDocumentL(const CMdEObject& aObject, 
       
    83                                               const TDesC& aAppClass,
       
    84                                               CMdEObjectDef& aObjectDef)
       
    85     {
       
    86     CPIXLOGSTRING("START CCPIXMediaAudioDoc::GetCpixDocumentL");
       
    87     //Get basic document
       
    88     CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef);
       
    89     //URI and Excerpt is done add additional properties here 
       
    90     CMdEProperty* property(NULL);
       
    91     CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty );
       
    92     if(aObject.Property( albumPropDef, property )!= KErrNotFound)
       
    93        {
       
    94        //Add field to document
       
    95        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
    96        AddFiledtoDocumentL(*index_item,
       
    97                            MdeConstants::Audio::KAlbumProperty,
       
    98                            textProperty->Value());
       
    99        }
       
   100     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumArtistProperty );
       
   101     if(aObject.Property( artistPropDef, property ) != KErrNotFound)
       
   102       {
       
   103       //Add field to document
       
   104       CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   105       AddFiledtoDocumentL(*index_item,
       
   106                          MdeConstants::Audio::KAlbumArtistProperty,
       
   107                          textProperty->Value());
       
   108       }
       
   109     CMdEPropertyDef& origartistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KOriginalArtistProperty );
       
   110     if(aObject.Property( origartistPropDef, property ) != KErrNotFound)
       
   111      {
       
   112      //Add field to document
       
   113      CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   114      AddFiledtoDocumentL(*index_item,
       
   115                       MdeConstants::Audio::KOriginalArtistProperty,
       
   116                       textProperty->Value());
       
   117      }   
       
   118     CMdEPropertyDef& composerPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KComposerProperty );
       
   119     if(aObject.Property( composerPropDef, property ) != KErrNotFound)
       
   120     {
       
   121     //Add field to document
       
   122     CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   123     AddFiledtoDocumentL(*index_item,
       
   124                   MdeConstants::Audio::KComposerProperty,
       
   125                   textProperty->Value());
       
   126     }
       
   127     CMdEPropertyDef& artistPropDef1 = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
       
   128     if(aObject.Property( artistPropDef1, property ) != KErrNotFound)
       
   129        {
       
   130        //Add field to document
       
   131        CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
       
   132        AddFiledtoDocumentL(*index_item,
       
   133                              MdeConstants::MediaObject::KArtistProperty,
       
   134                              textProperty->Value());
       
   135        }   
       
   136     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
       
   137     return index_item;
       
   138     }
       
   139 //End of life