simpleengine/xdmrlspres/src/presencetransformxdm.cpp
changeset 0 c8caa15ef882
child 14 e53c01f160bc
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 Presence Transform
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 //Includes
       
    22 #include <utf.h>
       
    23 #include <XdmDocumentNode.h>
       
    24 #include <XdmNodeAttribute.h>
       
    25 #include <xcapappusagedef.h>
       
    26 
       
    27 #include "cpresencexdm.h"
       
    28 #include "presencetransformxdm.h"
       
    29 #include "rlspresxdmlogger.h"
       
    30 #include "rlspresxdmconstsint.h"
       
    31 
       
    32 
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // TPresenceTransformXDM::TPresenceTransformXDM()
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 EXPORT_C TPresenceTransformXDM::TPresenceTransformXDM():iPresXDM(NULL)
       
    39     {
       
    40     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::TPresenceTransformXDM()" ) );
       
    41     }
       
    42     
       
    43 // ---------------------------------------------------------------------------
       
    44 // TPresenceTransformXDM::Init()
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C void TPresenceTransformXDM::Init(CPresenceXDM* const aPresXDM)
       
    48     {
       
    49     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::Init(%d)"),aPresXDM);
       
    50     iPresXDM = aPresXDM;
       
    51     }
       
    52     
       
    53 // ---------------------------------------------------------------------------
       
    54 // TPresenceTransformXDM::~TPresenceTransformXDM()
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C TInt TPresenceTransformXDM::AddTransComplexL(const TDesC& aRuleID, 
       
    58                                const TDesC& aComplexChild, 
       
    59                                const RArray<TTransDataCompo>& aTypeAndValues)
       
    60 	{
       
    61     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddTransComplexL" ) );
       
    62     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aComplexChild(%S), aTypeAndValuesCount(%d)"),
       
    63                             &aRuleID, &aComplexChild,  aTypeAndValues.Count());
       
    64 	
       
    65 	// check validity of input data
       
    66 	if (!((aComplexChild==KXdmProvidePersons)||(aComplexChild==KXdmProvideServices)||
       
    67 	                                        (aComplexChild==KXdmProvideDevices)))
       
    68 	    return KErrArgument;
       
    69 	    
       
    70     if(!AreNodeNamesValid(aComplexChild, aTypeAndValues))
       
    71         return KErrArgument;
       
    72 	
       
    73 	CXdmDocumentNode* complexChildNode = GetTransformChildNodeL(aRuleID, 
       
    74 	                                                    aComplexChild, ETrue);
       
    75 	if(complexChildNode==NULL)
       
    76 	    return KErrNotFound;
       
    77 	                                                    
       
    78     // delete the provide all if they exist
       
    79     if (IsProvideAllExistL(aRuleID, aComplexChild))
       
    80         {
       
    81     	complexChildNode->SetEmptyNode(ETrue);
       
    82     	complexChildNode->SetEmptyNode(EFalse);
       
    83         }
       
    84 	 
       
    85 	CXdmDocumentNode* childNode(NULL);
       
    86 	TInt childCount = aTypeAndValues.Count();
       
    87 	TBuf<KNodeNameMaxLength> nodeName;
       
    88 	for(TInt i=0;i<childCount;i++)
       
    89 	    {
       
    90 	    nodeName = (aTypeAndValues[i]).nodeName;
       
    91 	    childNode = complexChildNode->CreateChileNodeL(nodeName);
       
    92 	    childNode->SetLeafNode(ETrue);
       
    93 	    childNode->SetLeafNodeContentL((aTypeAndValues[i]).nodeContent);
       
    94         OPENG_DP(D_OPENG_LIT( "		i(%d), nodeName(%S)"), i, &nodeName);	    
       
    95 	    }
       
    96 	
       
    97 	return KErrNone;
       
    98 	}
       
    99 	
       
   100 // ---------------------------------------------------------------------------
       
   101 // TPresenceTransformXDM::AddOrRepProvideAllTransComplexL()
       
   102 // ---------------------------------------------------------------------------
       
   103 //
       
   104 EXPORT_C TInt TPresenceTransformXDM::AddOrRepProvideAllTransComplexL(
       
   105                     const TDesC& aRuleID, const TDesC& aComplexChild)
       
   106     {
       
   107     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddOrRepProvideAllTransComplexL" ) );
       
   108     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aComplexChild(%S)"),
       
   109                                                     &aRuleID, &aComplexChild);
       
   110 
       
   111     TBuf<KNodeContentMaxLength> nodeName;
       
   112 	if (aComplexChild==KXdmProvideServices)
       
   113 	    nodeName = KPresAllServices;
       
   114 	else if (aComplexChild==KXdmProvidePersons)
       
   115 	    nodeName = KPresAllPersons;
       
   116 	else if (aComplexChild==KXdmProvideDevices)
       
   117 	    nodeName = KPresAllDevices;
       
   118 	else if (aComplexChild==KPresProvideAllAttributes)
       
   119 	    nodeName = KPresProvideAllAttributes;
       
   120 	else
       
   121 	    return KErrArgument;
       
   122 
       
   123 	CXdmDocumentNode* complexChildNode = GetTransformChildNodeL(aRuleID, 
       
   124 	                                                    aComplexChild, ETrue);
       
   125 	if(complexChildNode==NULL)
       
   126 	    return KErrNotFound;
       
   127 	                                                    
       
   128 	if (aComplexChild!=KPresProvideAllAttributes)
       
   129 	    {
       
   130 	// delete all children from this node
       
   131 	complexChildNode->SetEmptyNode(ETrue);
       
   132 	complexChildNode->SetEmptyNode(EFalse);
       
   133 	
       
   134 	CXdmDocumentNode* emptyNode = complexChildNode->CreateChileNodeL(nodeName);
       
   135 	emptyNode->SetEmptyNode(ETrue);
       
   136 	    }
       
   137 	else
       
   138 	    complexChildNode->SetEmptyNode(ETrue);
       
   139 	
       
   140 	return KErrNone;
       
   141 	}
       
   142                                
       
   143 // ---------------------------------------------------------------------------
       
   144 // TPresenceTransformXDM::GetTransComplexL()
       
   145 // ---------------------------------------------------------------------------
       
   146 //
       
   147 EXPORT_C TInt TPresenceTransformXDM::GetTransComplexL(const TDesC& aRuleID, 
       
   148                                const TDesC& aComplexChild, 
       
   149                                RArray<TTransDataCompo>& aTypeAndValues)
       
   150 	{
       
   151     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::GetTransComplexL" ) );
       
   152     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aComplexChild(%S)"),
       
   153                                                     &aRuleID, &aComplexChild);
       
   154 	
       
   155 	// check validity of input data
       
   156 	if (!((aComplexChild==KXdmProvidePersons)||(aComplexChild==KXdmProvideServices)||
       
   157 	                                        (aComplexChild==KXdmProvideDevices)))
       
   158 	    return KErrArgument;
       
   159 
       
   160 	CXdmDocumentNode* complexChildNode = GetTransformChildNodeL(aRuleID, 
       
   161 	                                                    aComplexChild, EFalse);
       
   162 	                                                    
       
   163     if (complexChildNode==NULL)
       
   164         return KErrNotFound;
       
   165     
       
   166     CXdmDocumentNode* childNode(NULL);
       
   167     TBuf<KNodeNameMaxLength> nodeName;
       
   168     HBufC* nodeContents(NULL);
       
   169     TTransDataCompo myDataCompo;
       
   170     
       
   171     TInt childCount = complexChildNode->NodeCount();
       
   172     OPENG_DP(D_OPENG_LIT( "     childCount(%d)" ),childCount );
       
   173     
       
   174     for (TInt i=0; i<childCount; i++)
       
   175         {
       
   176         childNode = complexChildNode->ChileNode(i);
       
   177         nodeName.Copy(childNode->NodeName());
       
   178         (myDataCompo.nodeName).Copy(nodeName);
       
   179         
       
   180         // get attribute if nodeType support attribute
       
   181         if ((nodeName==KPresAllDevices)||(nodeName==KPresAllPersons)||
       
   182                                                     (nodeName==KPresAllServices))
       
   183             {
       
   184             aTypeAndValues.Append(myDataCompo);
       
   185             break;
       
   186             }
       
   187        
       
   188         childNode->SetLeafNode(ETrue);
       
   189         nodeContents = CnvUtfConverter::ConvertToUnicodeFromUtf8L
       
   190                                             (childNode->LeafNodeContent());
       
   191         (myDataCompo.nodeContent).Copy(nodeContents->Des());
       
   192         aTypeAndValues.Append(myDataCompo);
       
   193         delete nodeContents;
       
   194         }
       
   195     
       
   196     return KErrNone;		
       
   197 	}
       
   198 	
       
   199 // ---------------------------------------------------------------------------
       
   200 // TPresenceTransformXDM::AddOrRepTransKnownBoolL()
       
   201 // ---------------------------------------------------------------------------
       
   202 //
       
   203 EXPORT_C TInt TPresenceTransformXDM::AddOrRepTransKnownBoolL(const TDesC& aRuleID, 
       
   204                                 const TDesC& aBoolChild, TBool aValue)
       
   205  	{
       
   206     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddOrRepTransKnownBoolL" ) );
       
   207     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aBoolChild(%S)"),
       
   208                                                     &aRuleID, &aBoolChild);
       
   209  	if (!IsBoolChildSupported(aBoolChild))
       
   210  	    return KErrArgument;
       
   211  	
       
   212  	return AddOrRepTransBoolL(aRuleID, aBoolChild, aValue);
       
   213  	}
       
   214  	
       
   215 // ---------------------------------------------------------------------------
       
   216 // TPresenceTransformXDM::GetTransKnownBoolL()
       
   217 // ---------------------------------------------------------------------------
       
   218 //
       
   219 EXPORT_C TInt TPresenceTransformXDM::GetTransKnownBoolL(const TDesC& aRuleID, 
       
   220                                         const TDesC& aBoolChild, TBool& aValue)
       
   221 	{
       
   222     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::GetTransKnownBoolL" ) );
       
   223     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S)"), &aRuleID);
       
   224  	if (!IsBoolChildSupported(aBoolChild))
       
   225  	    return KErrArgument;
       
   226  	
       
   227  	return GetTransBoolL(aRuleID, aBoolChild, aValue);
       
   228 	}
       
   229 
       
   230 // ---------------------------------------------------------------------------
       
   231 // TPresenceTransformXDM::AddOrRepTransUnknownBoolL()
       
   232 // ---------------------------------------------------------------------------
       
   233 //
       
   234 EXPORT_C TInt TPresenceTransformXDM::AddOrRepTransUnknownBoolL(
       
   235             const TDesC& aRuleID, const TDesC& aChildName, TBool aValue)
       
   236 	{
       
   237     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::AddOrRepTransUnknownBoolL" ) );
       
   238     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aChildName(%S)"), &aRuleID, &aChildName);
       
   239  	return AddOrRepTransBoolL(aRuleID, aChildName, aValue);
       
   240 	}
       
   241 
       
   242 // ---------------------------------------------------------------------------
       
   243 // TPresenceTransformXDM::GetTransUnknownBoolL()
       
   244 // ---------------------------------------------------------------------------
       
   245 //
       
   246 EXPORT_C TInt TPresenceTransformXDM::GetTransUnknownBoolL(const TDesC& aRuleID, 
       
   247                                             const TDesC& aChildName, TBool& aValue)
       
   248 	{
       
   249     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::GetTransUnknownBoolL" ) );
       
   250     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aChildName(%S)"), &aRuleID, &aChildName);
       
   251  	return GetTransBoolL(aRuleID, aChildName, aValue);
       
   252 	}
       
   253 
       
   254 // ---------------------------------------------------------------------------
       
   255 // TPresenceTransformXDM::RemoveTransformL()
       
   256 // ---------------------------------------------------------------------------
       
   257 //
       
   258 EXPORT_C TInt TPresenceTransformXDM::RemoveTransformL(const TDesC& aRuleID, 
       
   259                                                 const TDesC& aChildElement)
       
   260 	{
       
   261     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::RemoveTransformL" ) );
       
   262     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aChildElement(%S)"), &aRuleID, 
       
   263                                                                 &aChildElement);
       
   264 	
       
   265 	__ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
       
   266 	
       
   267 	CXdmDocumentNode* myNode(NULL);
       
   268 	if(aChildElement==KNullDesC) // remove whole transform
       
   269 	    {
       
   270 	    myNode = iPresXDM->GetRuleChildNodeL(aRuleID, KXdmTransformations, EFalse);
       
   271 	    }
       
   272 	else
       
   273 	    {
       
   274 	    myNode = GetTransformChildNodeL(aRuleID, aChildElement, EFalse);
       
   275 	    }
       
   276 	if(myNode==NULL)
       
   277 	    return KErrNotFound;
       
   278 	iPresXDM->RemoveFromModelL(myNode);
       
   279 	OPENG_DP(D_OPENG_LIT( " removed" ) );
       
   280 	return KErrNone;
       
   281 	}
       
   282 
       
   283 // ---------------------------------------------------------------------------
       
   284 // TPresenceTransformXDM::IsTransformExistL()
       
   285 // ---------------------------------------------------------------------------
       
   286 //
       
   287 EXPORT_C TBool TPresenceTransformXDM::IsTransformExistL(const TDesC& aRuleID, 
       
   288                                                     const TDesC& aChildElement)
       
   289 	{
       
   290     OPENG_DP(D_OPENG_LIT( "TPresenceTransformXDM::IsTransformExist" ) );
       
   291     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aChildElement(%S)"), &aRuleID, 
       
   292                                                                 &aChildElement);
       
   293 
       
   294 	CXdmDocumentNode* myNode = GetTransformChildNodeL(aRuleID, aChildElement, EFalse);
       
   295 	if(myNode)
       
   296 	    {
       
   297 	    OPENG_DP(D_OPENG_LIT( " True" ) );
       
   298 	    return ETrue;
       
   299 	    }
       
   300 	return EFalse;		
       
   301 	}
       
   302 
       
   303 // ---------------------------------------------------------------------------
       
   304 // TPresenceTransformXDM::GetTransformChildNodeL()
       
   305 // ---------------------------------------------------------------------------
       
   306 //
       
   307 CXdmDocumentNode* TPresenceTransformXDM::GetTransformChildNodeL( const TDesC& aRuleID,
       
   308                                         const TDesC& aChild, TBool aCreate)
       
   309     {
       
   310     OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::GetTransformChildNodeL" ) );
       
   311     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aChild(%S), aCreate(%d)"), &aRuleID, 
       
   312                                                                 &aChild, aCreate);
       
   313                                                                 
       
   314     __ASSERT_ALWAYS(iPresXDM, User::Leave(KErrNotReady));
       
   315                                                                 
       
   316     CXdmDocumentNode* transformNode = iPresXDM->GetRuleChildNodeL(aRuleID, 
       
   317                                                 KXdmTransformations, aCreate);
       
   318     if ( (!aCreate) && (transformNode==NULL))
       
   319         return NULL;
       
   320 
       
   321     RPointerArray<CXdmDocumentNode> nodes;
       
   322     CXdmDocumentNode* childNode(NULL);
       
   323 
       
   324     // Finding transform node
       
   325 	transformNode->Find(aChild, nodes);
       
   326 	OPENG_DP(D_OPENG_LIT( "     nodeCount(%d)" ), nodes.Count());
       
   327 	if(nodes.Count()) // if transform node exist
       
   328 	    {
       
   329 	    childNode = nodes[0]; // only one complex child node can exist
       
   330 	    }
       
   331 	else if (aCreate) // if asked to create
       
   332 	    {
       
   333 	    childNode = transformNode->CreateChileNodeL(aChild);
       
   334 	    }
       
   335 
       
   336     nodes.Close();        
       
   337     return childNode;   
       
   338     }
       
   339 
       
   340 // ---------------------------------------------------------------------------
       
   341 // TPresenceTransformXDM::AreNodeNamesValid()
       
   342 // ---------------------------------------------------------------------------
       
   343 //
       
   344 TBool TPresenceTransformXDM::AreNodeNamesValid(const TDesC& aComplexChild, 
       
   345                             const RArray<TTransDataCompo>& aTypeAndValues)
       
   346     {
       
   347     OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::AreNodeNamesValid" ) );
       
   348     OPENG_DP(D_OPENG_LIT( "		aComplexChild(%S)"), &aComplexChild);
       
   349 
       
   350     TInt nodeCount = aTypeAndValues.Count();
       
   351     TBuf<KNodeNameMaxLength> myNodeName;
       
   352     TInt i(0);
       
   353 
       
   354     if(aComplexChild == KXdmProvideDevices)
       
   355         {
       
   356         for(i=0;i<nodeCount;i++)
       
   357             {
       
   358             myNodeName = (aTypeAndValues[i]).nodeName;
       
   359             if( (myNodeName!=KPresClass)&&(myNodeName!=KPresOccurenceID)&&
       
   360                                                     (myNodeName!=KPresDeviceID))
       
   361                 return EFalse;
       
   362             }
       
   363         }
       
   364         
       
   365     else if (aComplexChild == KXdmProvidePersons)
       
   366         {
       
   367         for(i=0;i<nodeCount;i++)
       
   368             {
       
   369             myNodeName = (aTypeAndValues[i]).nodeName;
       
   370             if( (myNodeName!=KPresClass)&&(myNodeName!=KPresOccurenceID))
       
   371                 return EFalse;
       
   372             }
       
   373         }
       
   374         
       
   375     else if (aComplexChild == KXdmProvideServices)
       
   376         {
       
   377         for(i=0;i<nodeCount;i++)
       
   378             {
       
   379             myNodeName = (aTypeAndValues[i]).nodeName;
       
   380             if( (myNodeName!=KPresClass)&&(myNodeName!=KPresOccurenceID)
       
   381                 &&(myNodeName!=KPresServiceUri)&&(myNodeName!=KPresServiceUriScheme)
       
   382                 &&(myNodeName!=KPresServiceId) )
       
   383                 return EFalse;
       
   384             }
       
   385         }
       
   386         
       
   387     else
       
   388         return EFalse;
       
   389     
       
   390     OPENG_DP(D_OPENG_LIT( "		True"));
       
   391     return ETrue;
       
   392     }
       
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 // TPresenceTransformXDM::IsProvideAllExistL()
       
   396 // ---------------------------------------------------------------------------
       
   397 //
       
   398 TBool TPresenceTransformXDM::IsProvideAllExistL(const TDesC& aRuleID,
       
   399                                         const TDesC& aComplexChild)
       
   400     {
       
   401     OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::IsProvideAllExist" ) );
       
   402     OPENG_DP(D_OPENG_LIT( "		aRuleID(%S), aComplexChild(%S)"), 
       
   403                                                     &aRuleID, &aComplexChild);
       
   404 
       
   405     CXdmDocumentNode* myComplexChild = GetTransformChildNodeL(aRuleID,
       
   406                                                aComplexChild, EFalse);
       
   407     if(myComplexChild==NULL)
       
   408         return EFalse;
       
   409     
       
   410     TBuf<KNodeNameMaxLength> nodeName;
       
   411 	if (aComplexChild==KXdmProvideServices)
       
   412 	    nodeName = KPresAllServices;
       
   413 	else if (aComplexChild==KXdmProvidePersons)
       
   414 	    nodeName = KPresAllPersons;
       
   415 	else if (aComplexChild==KXdmProvideDevices)
       
   416 	    nodeName = KPresAllDevices;
       
   417 	else
       
   418 	    return EFalse;
       
   419 	
       
   420 	if ((myComplexChild->NodeCount()) == 1)
       
   421 	    {
       
   422 	    CXdmDocumentNode* provideAllNode = myComplexChild->ChileNode(0);
       
   423 	    if ((provideAllNode->NodeName()) == nodeName)
       
   424 	        {
       
   425 	        OPENG_DP(D_OPENG_LIT( "		True"));
       
   426 	        return ETrue;  
       
   427 	        }
       
   428 	    }
       
   429     
       
   430     return EFalse;
       
   431     }
       
   432 
       
   433 // ---------------------------------------------------------------------------
       
   434 // TPresenceTransformXDM::IsBoolChildSupported()
       
   435 // ---------------------------------------------------------------------------
       
   436 //
       
   437 TBool TPresenceTransformXDM::IsBoolChildSupported(const TDesC& aBoolChild)
       
   438     {
       
   439     OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::IsBoolChildSupported" ) );
       
   440 
       
   441     if( (aBoolChild==KPresProvideActivities)||
       
   442         (aBoolChild==KPresProvideClass)||
       
   443         (aBoolChild==KPresProvideDeviceID)||
       
   444         (aBoolChild==KPresProvideMood)||
       
   445         (aBoolChild==KPresProvidePlaceIs)||
       
   446         (aBoolChild==KPresProvidePlaceType)||
       
   447         (aBoolChild==KPresProvidePrivacy)||
       
   448         (aBoolChild==KPresProvideRelationship)||
       
   449         (aBoolChild==KPresProvideSphere)||
       
   450         (aBoolChild==KPresProvideStatusIcon)||
       
   451         (aBoolChild==KPresProvideTimeOffset)||
       
   452         (aBoolChild==KPresProvideNote)||
       
   453         (aBoolChild==KPresProvideUnknownAttribute)||
       
   454     
       
   455         (aBoolChild==KPresProvideWillingness)||
       
   456         (aBoolChild==KPresProvideNetworkAvailability)||
       
   457         (aBoolChild==KPresProvideSessionParticipation)||
       
   458         (aBoolChild==KPresProvideGeoPriv)||
       
   459         (aBoolChild==KPresProvideRegistrationState)||
       
   460         (aBoolChild==KPresProvideBarringState) )
       
   461         return ETrue;
       
   462     return EFalse;
       
   463     }
       
   464 
       
   465 // ---------------------------------------------------------------------------
       
   466 // TPresenceTransformXDM::AddOrRepTransBoolL()
       
   467 // ---------------------------------------------------------------------------
       
   468 //
       
   469 TInt TPresenceTransformXDM::AddOrRepTransBoolL(const TDesC& aRuleID, 
       
   470                                 const TDesC& aBoolChild, TBool aValue)
       
   471     {
       
   472     OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::AddOrRepTransBoolL" ) );
       
   473 
       
   474 	CXdmDocumentNode* childNode = GetTransformChildNodeL(aRuleID, 
       
   475 	                                                    aBoolChild, ETrue);
       
   476 	if(childNode==NULL)
       
   477 	    return KErrNotFound;
       
   478 	                                                    
       
   479 	TBuf8<KPresRLSChildConstBufLen> childContents;
       
   480 	if(aValue)
       
   481 	    childContents = KXdmTrue;
       
   482 	else
       
   483 	    childContents = KXdmFalse;       
       
   484 	                                   
       
   485 	childNode->SetLeafNode(ETrue);
       
   486 	childNode->SetLeafNodeContentL(childContents);
       
   487 	
       
   488 	return KErrNone;		
       
   489     }
       
   490 
       
   491 // ---------------------------------------------------------------------------
       
   492 // TPresenceTransformXDM::GetTransBoolL()
       
   493 // ---------------------------------------------------------------------------
       
   494 //
       
   495 TInt TPresenceTransformXDM::GetTransBoolL(const TDesC& aRuleID, 
       
   496                                     const TDesC& aBoolChild, TBool& aValue)
       
   497     {
       
   498     OPENG_DP(D_OPENG_LIT( " TPresenceTransformXDM::GetTransBoolL" ) );
       
   499 
       
   500 	CXdmDocumentNode* childNode = GetTransformChildNodeL(aRuleID, 
       
   501 	                                                    aBoolChild, EFalse);
       
   502 	if (childNode==NULL)
       
   503 	    return KErrNotFound;                                                   
       
   504 	
       
   505 	TInt err(KErrNone);
       
   506 
       
   507     childNode->SetLeafNode(ETrue);
       
   508 
       
   509     TPtrC8 nodeContents = childNode->LeafNodeContent();
       
   510 
       
   511     if(nodeContents == KXdmTrue)
       
   512         aValue = ETrue;
       
   513     else if (nodeContents == KXdmFalse)
       
   514         aValue = EFalse;
       
   515     else
       
   516         err = KErrNotFound;
       
   517 	    
       
   518 	return err;		
       
   519     }
       
   520     
       
   521 //end of file