simpleengine/xdmrlspres/src/prescondidentitymany.cpp
changeset 0 c8caa15ef882
equal deleted inserted replaced
-1:000000000000 0:c8caa15ef882
       
     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:    RLS and Presence XDM, This class represents 'many' identity 
       
    15 *                 part of a Presence Condition in a rule
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // Includes
       
    23 #include <XdmDocumentNode.h>
       
    24 #include <XdmNodeAttribute.h>
       
    25 #include <xcapappusagedef.h>
       
    26 #include <utf.h>
       
    27 
       
    28 #include "prescondidentitymany.h"
       
    29 #include "cpresencexdm.h"
       
    30 #include "rlspresxdmlogger.h"
       
    31 #include "rlspresxdmconstsint.h"
       
    32 
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // TPresCondIdentityMany::TPresCondIdentityMany()
       
    36 // ---------------------------------------------------------------------------
       
    37 //	
       
    38 EXPORT_C TPresCondIdentityMany::TPresCondIdentityMany(): iPresXDM(NULL)
       
    39     {
       
    40     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::TPresCondIdentityMany()" ));
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // TPresCondIdentityMany::Init()
       
    45 // ---------------------------------------------------------------------------
       
    46 //    
       
    47 EXPORT_C void TPresCondIdentityMany::Init(CPresenceXDM* const aPresXDM)
       
    48     {
       
    49     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::Init(%d)" ), aPresXDM);
       
    50     iPresXDM = aPresXDM;
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // TPresCondIdentityMany::AddManyIdentityL()
       
    55 // ---------------------------------------------------------------------------
       
    56 //    
       
    57 EXPORT_C TInt TPresCondIdentityMany::AddManyIdentityL(const TDesC& aRuleID, 
       
    58                                             const TDesC& aDomain)
       
    59     {
       
    60     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::AddManyIdentityL()" ) );
       
    61     OPENG_DP(D_OPENG_LIT( "     aRuleID = %S, aDomain = %S"),&aRuleID, &aDomain);
       
    62     
       
    63     TInt err(KErrAlreadyExists);
       
    64     
       
    65     if(!(IsManyExistsL(aRuleID,aDomain)))
       
    66         {
       
    67     	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, ETrue, aDomain);
       
    68     	if(manyNode==NULL)
       
    69     	    err = KErrNotFound;
       
    70     	else
       
    71     	    err = KErrNone;
       
    72         }
       
    73 	
       
    74     OPENG_DP(D_OPENG_LIT( "     return: %d"),err);
       
    75     return err;
       
    76     }
       
    77         
       
    78 // ---------------------------------------------------------------------------
       
    79 // TPresCondIdentityMany::IsManyExistsL()
       
    80 // ---------------------------------------------------------------------------
       
    81 //    
       
    82 EXPORT_C TBool TPresCondIdentityMany::IsManyExistsL(const TDesC& aRuleID, 
       
    83                                             const TDesC& aDomain)
       
    84     {
       
    85     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::IsManyExists()" ) );
       
    86     OPENG_DP(D_OPENG_LIT( "     aRuleID = %S, aDomain = %S"),&aRuleID, &aDomain);
       
    87     
       
    88     TBool ret(ETrue);
       
    89 	
       
    90 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
    91 	if(manyNode==NULL)
       
    92 	    ret = EFalse;
       
    93 	
       
    94 	OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
       
    95 	return ret;
       
    96     }
       
    97         
       
    98 // ---------------------------------------------------------------------------
       
    99 // TPresCondIdentityMany::RemoveManyIdentityL()
       
   100 // ---------------------------------------------------------------------------
       
   101 //    
       
   102 EXPORT_C TInt TPresCondIdentityMany::RemoveManyIdentityL(const TDesC& aRuleID, 
       
   103                                             const TDesC& aDomain)
       
   104     {
       
   105     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::RemoveManyIdentityL()" ) );
       
   106     OPENG_DP(D_OPENG_LIT( "     aRuleID = %S, aDomain = %S"),&aRuleID, &aDomain);
       
   107     
       
   108     __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
       
   109     
       
   110     TInt ret(KErrNotFound);
       
   111 	
       
   112 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
   113 	if(manyNode!=NULL)
       
   114 	    {
       
   115         OPENG_DP(D_OPENG_LIT( "     Removed"));
       
   116         iPresXDM->RemoveFromModelL(manyNode);
       
   117         ret = KErrNone;     
       
   118 	    }
       
   119 	
       
   120 	OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
       
   121 	return ret;
       
   122     }
       
   123                                             
       
   124 // ---------------------------------------------------------------------------
       
   125 // TPresCondIdentityMany::GetManyIdentityElementsL()
       
   126 // ---------------------------------------------------------------------------
       
   127 //    
       
   128 EXPORT_C TInt TPresCondIdentityMany::GetManyIdentityElementsL(const TDesC& aRuleID, 
       
   129                                                     CDesCArray& aDomains)
       
   130     {
       
   131     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::GetManyIdentityElementsL()" ) );
       
   132     OPENG_DP(D_OPENG_LIT( "     aRuleID = %S" ),&aRuleID);
       
   133     
       
   134     __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
       
   135     
       
   136 	CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID, 
       
   137 	                                                KXdmIdentity, EFalse);
       
   138 	if(identityNode==NULL)
       
   139 	    return 0;
       
   140 	
       
   141 	RPointerArray<CXdmDocumentNode> nodes;
       
   142     CXdmNodeAttribute* domainAttr(NULL);
       
   143 	
       
   144 	// finding 'many' nodes
       
   145     TInt err = identityNode->Find(KXdmMany, nodes);
       
   146 
       
   147     // extracting entities from id nodes
       
   148     TInt manyCountInNode = nodes.Count();
       
   149 
       
   150     OPENG_DP(D_OPENG_LIT( "     manyCountInNode = %d" ),manyCountInNode);
       
   151 
       
   152     for (TInt i=0;i<manyCountInNode;i++)
       
   153         { // get the domain attribute
       
   154         domainAttr = (nodes[i])->Attribute(KXdmDomain);
       
   155         if(domainAttr)
       
   156             // push it to given discriptor array
       
   157             aDomains.AppendL(domainAttr->AttributeValue());
       
   158         }
       
   159 
       
   160     nodes.Close();    
       
   161     return manyCountInNode;
       
   162     }
       
   163         
       
   164 // ---------------------------------------------------------------------------
       
   165 // TPresCondIdentityMany::AddIdentityInManyExceptL()
       
   166 // ---------------------------------------------------------------------------
       
   167 //    
       
   168 EXPORT_C TInt TPresCondIdentityMany::AddIdentityInManyExceptL(const TDesC& aRuleID,
       
   169                     const TDesC& aId, const TDesC& aDomain)
       
   170     {
       
   171     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::AddIdentityInManyExceptL()" ) );
       
   172     OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S,aId:%S"),
       
   173                                                     &aRuleID, &aDomain, &aId);
       
   174     
       
   175     TInt ret(KErrAlreadyExists);
       
   176 
       
   177 	RPointerArray<CXdmDocumentNode> nodes;
       
   178 	CXdmDocumentNode* exceptNode(NULL);
       
   179 	CXdmNodeAttribute* idattr(NULL);
       
   180     
       
   181     
       
   182 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
   183 	if(manyNode!=NULL)
       
   184 	    {
       
   185         // if id doesnt exists in except
       
   186         if (!(IsIdentityExistsInManyExceptL(aRuleID, aId, aDomain)))
       
   187             {
       
   188             exceptNode = manyNode->CreateChileNodeL(KXdmExcept);
       
   189             idattr = exceptNode->CreateAttributeL(KXdmId);
       
   190             idattr->SetAttributeValueL(aId);
       
   191             ret = KErrNone;
       
   192             }
       
   193 	    }
       
   194 	else
       
   195 	    ret = KErrNotFound;
       
   196 	
       
   197 	OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
       
   198 	nodes.Close();
       
   199 	return ret;
       
   200     }
       
   201                     
       
   202 // ---------------------------------------------------------------------------
       
   203 // TPresCondIdentityMany::AddIdentitiesInManyExceptL()
       
   204 // ---------------------------------------------------------------------------
       
   205 //    
       
   206 EXPORT_C TInt TPresCondIdentityMany::AddIdentitiesInManyExceptL(const TDesC& aRuleID,
       
   207                 const CDesCArray& aIds, const TDesC& aDomain)
       
   208     {
       
   209     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::AddIdentitiesInManyExceptL()" ) );
       
   210     OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S"),
       
   211                                                     &aRuleID, &aDomain);
       
   212     
       
   213     TInt ret(KErrNotFound);
       
   214 
       
   215 	RPointerArray<CXdmDocumentNode> nodes;
       
   216 	CXdmDocumentNode* exceptNode(NULL);
       
   217 	CXdmNodeAttribute* idattr(NULL);
       
   218     
       
   219 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
   220 	TInt entitiesCount = aIds.MdcaCount();
       
   221 	if(manyNode!=NULL)
       
   222 	    {
       
   223         for (TInt i = 0; i<entitiesCount; i++)
       
   224             {
       
   225             // if id doesnt exists in except
       
   226             if (!(IsIdentityExistsInManyExceptL(aRuleID, aIds.MdcaPoint(i), aDomain)))
       
   227                 {
       
   228                 exceptNode = manyNode->CreateChileNodeL(KXdmExcept);
       
   229                 idattr = exceptNode->CreateAttributeL(KXdmId);
       
   230                 idattr->SetAttributeValueL(aIds.MdcaPoint(i));
       
   231                 ret = KErrNone;
       
   232                 }
       
   233             }
       
   234         ret = KErrNone;
       
   235 	    }
       
   236 
       
   237 	OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
       
   238 	nodes.Close();
       
   239 	return ret;
       
   240     }
       
   241                                         
       
   242 // ---------------------------------------------------------------------------
       
   243 // TPresCondIdentityMany::GetIdentitiesFromManyExceptL()
       
   244 // ---------------------------------------------------------------------------
       
   245 //    
       
   246 EXPORT_C TInt TPresCondIdentityMany::GetIdentitiesFromManyExceptL(const TDesC& aRuleID,
       
   247                     CDesCArray& aIds, const TDesC& aDomain)
       
   248     {
       
   249     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::GetIdentitiesFromManyExceptL()" ) );
       
   250     OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S"),&aRuleID, &aDomain);
       
   251     
       
   252     TInt ret(KErrNotFound);
       
   253 
       
   254 	RPointerArray<CXdmDocumentNode> nodes;
       
   255 	CXdmNodeAttribute* attrId(NULL);
       
   256     
       
   257 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
   258 	if(manyNode!=NULL)
       
   259 	    {
       
   260         TInt err = manyNode->Find(KXdmExcept, nodes);
       
   261         TInt exceptNodeCount = nodes.Count();
       
   262         
       
   263         // go through all 'except' nodes
       
   264         for(TInt i=0;i<exceptNodeCount;i++)
       
   265             {
       
   266             attrId = (nodes[i])->Attribute(KXdmId);
       
   267             
       
   268             // for now we are supposing that except has only 1 id
       
   269             if(attrId!=NULL)
       
   270                 {
       
   271                 aIds.AppendL(attrId->AttributeValue());
       
   272                 }
       
   273             attrId = NULL;
       
   274             }
       
   275         ret = KErrNone;
       
   276 	    }
       
   277 
       
   278 	OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
       
   279 	nodes.Close();
       
   280 	return ret;
       
   281     }
       
   282     
       
   283 // ---------------------------------------------------------------------------
       
   284 // TPresCondIdentityMany::RemoveIdentityFromManyExceptL()
       
   285 // ---------------------------------------------------------------------------
       
   286 //    
       
   287 EXPORT_C TInt TPresCondIdentityMany::RemoveIdentityFromManyExceptL(
       
   288         const TDesC& aRuleID, const TDesC& aId, const TDesC& aDomain)
       
   289     {
       
   290     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::RemoveIdentityFromManyExceptL()" ) );
       
   291     OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S,aId:%S"),
       
   292                                                     &aRuleID, &aDomain, &aId);
       
   293     
       
   294     __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));                                                
       
   295     
       
   296     TInt ret(KErrNotFound);
       
   297 
       
   298 	RPointerArray<CXdmDocumentNode> nodes;
       
   299     CXdmNodeAttribute* attrId(NULL);
       
   300     
       
   301     
       
   302 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
   303 	if(manyNode!=NULL)
       
   304 	    {
       
   305         TInt err = manyNode->Find(KXdmExcept, nodes);
       
   306         TInt exceptNodeCount = nodes.Count();
       
   307         
       
   308         //go through all except nodes
       
   309         for (TInt i=0;i<exceptNodeCount;i++)
       
   310             {
       
   311             attrId = (nodes[i])->Attribute(KXdmId);
       
   312             
       
   313             // for now we are supposing that except has only 1 id
       
   314             if(attrId!=NULL)
       
   315                 {
       
   316                 if (aId==(attrId->AttributeValue()))
       
   317                     {
       
   318                     OPENG_DP(D_OPENG_LIT( "     RemoveFromModelL: i=%d" ),i);
       
   319                     iPresXDM->RemoveFromModelL(attrId);
       
   320                     
       
   321                     //if except node is empty after this
       
   322                     if( (nodes[i])->AttributeCount() == 0)
       
   323                         {
       
   324                         // remove except node also
       
   325                         iPresXDM->RemoveFromModelL(nodes[i]);
       
   326                         }
       
   327                     ret = KErrNone;
       
   328                     break;               
       
   329                     }
       
   330                 }
       
   331             attrId = NULL;
       
   332             }
       
   333 	    }
       
   334 	
       
   335 	OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
       
   336 	nodes.Close();
       
   337 	return ret;
       
   338     }
       
   339     
       
   340                                         
       
   341 // ---------------------------------------------------------------------------
       
   342 // TPresCondIdentityMany::DeleteAllIdentitiesFromManyExceptL()
       
   343 // ---------------------------------------------------------------------------
       
   344 //    
       
   345 EXPORT_C TInt TPresCondIdentityMany::DeleteAllIdentitiesFromManyExceptL(
       
   346                                 const TDesC& aRuleID, const TDesC& aDomain)
       
   347     {
       
   348     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::DeleteAllIdentitiesFromManyExceptL()" ) );
       
   349     OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S"),&aRuleID, &aDomain);
       
   350     
       
   351     __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
       
   352     
       
   353     TInt ret(KErrNotFound);
       
   354 
       
   355 	RPointerArray<CXdmDocumentNode> nodes;
       
   356 	CXdmNodeAttribute* attrId(NULL);
       
   357     
       
   358 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
   359 	if(manyNode!=NULL)
       
   360 	    {
       
   361         TInt err = manyNode->Find(KXdmExcept, nodes);
       
   362         TInt exceptNodeCount = nodes.Count();
       
   363         
       
   364         //go through all except nodes
       
   365         for (TInt i=0;i<exceptNodeCount;i++)
       
   366             {
       
   367             attrId = (nodes[i])->Attribute(KXdmId);
       
   368             
       
   369             // for now we are supposing that except has only 1 id
       
   370             if(attrId!=NULL)
       
   371                 {
       
   372                 OPENG_DP(D_OPENG_LIT( "     RemoveFromModelL: i=%d" ),i);
       
   373                 iPresXDM->RemoveFromModelL(attrId);
       
   374                     
       
   375                 //if except node is empty after this
       
   376                 if( (nodes[i])->AttributeCount() == 0)
       
   377                     {
       
   378                     // remove except node also
       
   379                     iPresXDM->RemoveFromModelL(nodes[i]);
       
   380                     }
       
   381                 }
       
   382             attrId = NULL;
       
   383             }
       
   384         ret = KErrNone;
       
   385 	    }
       
   386 
       
   387 	OPENG_DP(D_OPENG_LIT( "     return: %d"),ret);
       
   388 	nodes.Close();
       
   389 	return ret;
       
   390     }
       
   391                                                
       
   392 // ---------------------------------------------------------------------------
       
   393 // TPresCondIdentityMany::IsIdentityExistsInManyExceptL()
       
   394 // ---------------------------------------------------------------------------
       
   395 //    
       
   396 EXPORT_C TBool TPresCondIdentityMany::IsIdentityExistsInManyExceptL(const TDesC& aRuleID, 
       
   397                                         const TDesC& aId, const TDesC& aDomain)
       
   398     {
       
   399     OPENG_DP(D_OPENG_LIT( "TPresCondIdentityMany::IsIdentityExistsInManyExcept()" ) );
       
   400     OPENG_DP(D_OPENG_LIT( "     aRuleID:%S,aDomain:%S,aId:%S"),
       
   401                                                     &aRuleID, &aDomain, &aId);
       
   402     
       
   403     TBool ret(EFalse);
       
   404 	RPointerArray<CXdmDocumentNode> nodes;
       
   405     CXdmNodeAttribute* attrId(NULL);
       
   406 	
       
   407 	CXdmDocumentNode* manyNode = GetManyNodeL(aRuleID, EFalse, aDomain);
       
   408 	if(manyNode!=NULL)
       
   409 	    {
       
   410         TInt err = manyNode->Find(KXdmExcept, nodes);
       
   411         TInt exceptNodeCount = nodes.Count();
       
   412         
       
   413         //go through all except nodes
       
   414         for (TInt i=0;i<exceptNodeCount;i++)
       
   415             {
       
   416             attrId = (nodes[i])->Attribute(KXdmId);
       
   417             
       
   418             // for now we are supposing that except has only 1 id
       
   419             if(attrId!=NULL)
       
   420                 {
       
   421                 if (aId==(attrId->AttributeValue()))
       
   422                     {
       
   423                     OPENG_DP(D_OPENG_LIT( "     Found: i=%d" ),i);
       
   424                     ret = ETrue;
       
   425                     break;               
       
   426                     }
       
   427                 }
       
   428             attrId = NULL;
       
   429             }
       
   430 	    }
       
   431 
       
   432     nodes.Close();    
       
   433     return ret;
       
   434     }
       
   435 	
       
   436 // ---------------------------------------------------------------------------
       
   437 // TPresCondIdentityMany::GetManyNodeL()
       
   438 // ---------------------------------------------------------------------------
       
   439 //   
       
   440 CXdmDocumentNode* TPresCondIdentityMany::GetManyNodeL(const TDesC& aRuleID,  
       
   441                                     TBool aCreate, const TDesC& aDomain)
       
   442     {
       
   443     OPENG_DP(D_OPENG_LIT( " TPresCondIdentityMany::GetManyNodeL()" ) );
       
   444     OPENG_DP(D_OPENG_LIT( "     GetManyNodeL aRuleID:%S, aDomain:%S, aCreate:%d"),
       
   445                                                      &aRuleID, &aDomain, aCreate);
       
   446                                                      
       
   447     __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));                                                 
       
   448                                                      
       
   449     CXdmDocumentNode* identityNode = iPresXDM->GetConditionChildNodeL(aRuleID, 
       
   450 	                                                KXdmIdentity, aCreate);
       
   451     if (identityNode==NULL)
       
   452         return NULL;
       
   453     
       
   454     RPointerArray<CXdmDocumentNode> nodes;
       
   455     CXdmDocumentNode* manyNode(NULL);
       
   456     CXdmNodeAttribute* domainNameAttr(NULL);
       
   457 
       
   458     // Finding many node
       
   459 	identityNode->Find(KXdmMany, nodes);
       
   460 	TInt manyNodesCount = nodes.Count();
       
   461     OPENG_DP(D_OPENG_LIT( "     manyNodesCount = %d"), manyNodesCount);
       
   462     TBool found(EFalse);
       
   463 	if(manyNodesCount) // if some nodes exists
       
   464 	    {
       
   465 	    for (TInt i=0;i<manyNodesCount;i++)
       
   466 	        {
       
   467 	        domainNameAttr = (nodes[i])->Attribute(KXdmDomain);
       
   468 	        // for the case when no domain specified
       
   469 	        if (aDomain==KNullDesC)
       
   470 	            {
       
   471 	            if(domainNameAttr == NULL)
       
   472 	                {
       
   473 	                found = ETrue;
       
   474 	                manyNode = nodes[i];
       
   475 	                break;
       
   476 	                }
       
   477 	            }
       
   478 	        // for the case when domain is specified
       
   479 	        else if(domainNameAttr!=NULL)
       
   480 	            {
       
   481 	            if( (domainNameAttr->AttributeValue()) == aDomain)
       
   482 	                {
       
   483 	                found = ETrue;
       
   484 	                manyNode = nodes[i];
       
   485 	                break;
       
   486 	                }
       
   487 	            }
       
   488 	        }
       
   489 	    }
       
   490 	
       
   491 	if (aCreate && (!found)) // if asked to create and still doesnt found
       
   492 	    {
       
   493 	    manyNode = identityNode->CreateChileNodeL(KXdmMany);
       
   494 	    if(aDomain!=KNullDesC)
       
   495 	        {
       
   496             domainNameAttr = manyNode->CreateAttributeL(KXdmDomain);
       
   497             domainNameAttr->SetAttributeValueL(aDomain);
       
   498 	        }
       
   499 	    }
       
   500 
       
   501     nodes.Close();        
       
   502     return manyNode;   
       
   503     }
       
   504     
       
   505 // ---------------------------------------------------------------------------
       
   506 // TPresCondIdentityMany::IsEntityExistInNodeArray()
       
   507 // ---------------------------------------------------------------------------
       
   508 //
       
   509 TBool TPresCondIdentityMany::IsEntityExistInNodeArray(
       
   510                         const RPointerArray<CXdmDocumentNode>& nodes, 
       
   511                                                     const TDesC& aId)
       
   512     {
       
   513     OPENG_DP(D_OPENG_LIT( " TPresCondIdentityMany::IsEntityExistInNodeArray()" ) );
       
   514     OPENG_DP(D_OPENG_LIT( "     IsEntityExistInNodeArray aId = %S"), &aId);
       
   515 
       
   516     TInt idsCountInNode = nodes.Count();
       
   517     CXdmNodeAttribute* idAttr(NULL);
       
   518     for (TInt i=0;i<idsCountInNode;i++)
       
   519         { // get the id attribute
       
   520         idAttr = (nodes[i])->Attribute(KXdmEntity);
       
   521         if (aId==(idAttr->AttributeValue()))
       
   522             {
       
   523             OPENG_DP(D_OPENG_LIT( "     IsEntityExistInNodeArray True"));
       
   524             return ETrue;               
       
   525             }
       
   526         }
       
   527     return EFalse;  
       
   528     }
       
   529     
       
   530 
       
   531 // end of file
       
   532