1//------------------------------------------------------------------------ 2// 3// Module Name: dm_tree_default_leaf_node_class.cpp 4// 5// General Description:Contains the implementations of the methods of 6// DMDefaultLeafNode class. 7//------------------------------------------------------------------------ 8// Revision History: 9// Modification Tracking 10// Author (core ID) Date Number Description of Changes 11// ----------------- ---- 12// 2003-2007 refactoring 13// cdp180 03/16/2007 LIBll55345 Removing ACL check for internal calls 14// Portability: This module is portable to other compilers. 15//------------------------------------------------------------------------ 16// INCLUDE FILES 17//------------------------------------------------------------------------ 18#include "dmdefs.h" 19#include "dm_tree_default_leaf_node_class.H" 20#include "dm_tree_util.h" 21 22//------------------------------------------------------------------------ 23// LOCAL FUNCTION PROTOTYPES 24//------------------------------------------------------------------------ 25//------------------------------------------------------------------------ 26// LOCAL CONSTANTS 27//------------------------------------------------------------------------ 28//------------------------------------------------------------------------ 29// LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS) 30//------------------------------------------------------------------------ 31 32//------------------------------------------------------------------------ 33// LOCAL MACROS 34//------------------------------------------------------------------------ 35//------------------------------------------------------------------------ 36// LOCAL VARIABLES 37//------------------------------------------------------------------------ 38 39//------------------------------------------------------------------------ 40// GLOBAL VARIABLES 41//------------------------------------------------------------------------ 42//------------------------------------------------------------------------ 43// LOCAL FUNCTIONS 44//------------------------------------------------------------------------ 45//------------------------------------------------------------------------ 46// GLOBAL FUNCTIONS 47//------------------------------------------------------------------------ 48//------------------------------------------------------------------------ 49 50//------------------------------------------------------------------------ 51// FUNCTION : Add 52// DESCRIPTION : This function sets the ACCESS type and format 53// properties for an Interior node added in the tree. 54// No data involved ,so synchronous Non-blocking call 55// callback function pointers will be ignored 56// ARGUMENTS PASSED: *psAdd, 57// RETURN VALUE : SYNCML_DM_RET_STATUS_T : status code 58// PRE-CONDITIONS : 1.URI has already been validated 59// 2.The node object of the plug-in class has been 60// created and a reference has been given to DMTNM 61// POST-CONDITIONS : Following property values are set by the function 62// Format = SYNCML_DM_FORMAT_NODE 63// IMPORTANT NOTES : The default Leaf node class grants all Access 64// rights to the Node in Add 65// If a Plug-in needs to implement a class for interior 66// nodes in which the access type needs to be plug-in 67// specific Ex: that plug-in does not want to give 68// delete access type, then the plug-in SHALL implement 69// it's own Add accordingly. 70// REQUIREMENT # : ESR-DMTNM0042-m 71//------------------------------------------------------------------------ 72SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::Add(DMAddData & oAddData) 73{ 74 return set(&oAddData); 75} 76 77//------------------------------------------------------------------------ 78// FUNCTION : Delete 79// DESCRIPTION : This function should not actually not get called. 80// since DMTNM deletes the node object.It is a pure 81// virtual function in DMNode,hence is implemented and 82// returns SYNCML_DM_SUCCESS 83// ARGUMENTS PASSED: waitMsgForStatus 84// replyStatusCback 85// dwCommandId, 86// bItemNumber, 87// *pbUri, 88// oIsThisAtomic, 89// RETURN VALUE : SYNCML_DM_RET_STATUS_T : ALWAYS returns 90// SYNCML_DM_COMMAND_NOT_ALLOWED 91// PRE-CONDITIONS : 1.URI has already been validated 92// POST-CONDITIONS : DMTNM actually deletes the node object 93// IMPORTANT NOTES : 94// REQUIREMENT # : ESR-DMTNM0025-m to ESR-DMTNM0027-m 95//------------------------------------------------------------------------ 96SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::Delete(CPCHAR pbUri) 97{ 98 return(SYNCML_DM_SUCCESS); 99} 100 101 102//------------------------------------------------------------------------ 103// FUNCTION : Get 104// DESCRIPTION : 105// ARGUMENTS PASSED: waitMsgForGetdata 106// waitMsgForGetdata 107// dwCommandId, 108// bItemNumber, 109// *pbUri, 110// dwStartByte, 111// dwNBytes 112// **ppsReturnData 113// RETURN VALUE : SYNCML_DM_RET_STATUS_T : ALWAYS returns 114// SYNCML_DM_COMMAND_NOT_ALLOWED 115// PRE-CONDITIONS : 1.URI has already been validated 116// POST-CONDITIONS : 117// IMPORTANT NOTES : The DMTNM will return the list of child names(if 118// the interior node has no children it will return 119// an empty list 120// REQUIREMENT # : ESR-DMTNM0028-m 121//------------------------------------------------------------------------ 122SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::Get(CPCHAR pbUri, DMGetData & oReturnData) 123{ 124#ifdef LOB_SUPPORT 125 oReturnData.SetESN(IsESN()); 126#endif 127 return oReturnData.set(bFormat,(CPCHAR)psData.getBuffer(),psData.getSize(),getType()); 128} 129 130 131//------------------------------------------------------------------------ 132// FUNCTION : GetFormat 133// 134// DESCRIPTION : This function returns FORMAT of the node 135// ARGUMENTS PASSED: waitMsgForGetFormat, 136// replyGetFormatCback, 137// *pbUri, 138// **pRetPropertyData 139// RETURN VALUE : ALWAYS returns SYNCML_DM_FORMAT_NODE 140// PRE-CONDITIONS : 1.URI has already been validated 141// POST-CONDITIONS : 142// IMPORTANT NOTES : 143// REQUIREMENT # : ESR-DMTNM0033-m 144//------------------------------------------------------------------------ 145SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::GetFormat(CPCHAR pbUri, 146 SYNCML_DM_FORMAT_T *dwpRetPropertyData) 147{ 148 *dwpRetPropertyData = this->bFormat; 149 return(SYNCML_DM_SUCCESS); 150} 151 152//------------------------------------------------------------------------ 153// FUNCTION : GetType 154// DESCRIPTION : This function returns MIME type 155// ARGUMENTS PASSED: waitMsgForGetFormat, 156// replyGetFormatCback, 157// *pbUri, 158// **pRetPropertyData 159// RETURN VALUE : status code,type is NULL for interior nodes 160// PRE-CONDITIONS : 1.URI has already been validated 161// POST-CONDITIONS : 162// IMPORTANT NOTES : 163// REQUIREMENT # : ESR-DMTNM0033-m 164//------------------------------------------------------------------------ 165SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::GetType(CPCHAR pbUri, 166 DMString& strType) 167{ 168 strType = this->getType(); 169 return SYNCML_DM_SUCCESS; 170} 171 172//------------------------------------------------------------------------ 173// FUNCTION : GetSize 174// DESCRIPTION : This function returns SIZE of the node. 175// ARGUMENTS PASSED: waitMsgForGetFormat, 176// replyGetFormatCback, 177// *pbUri, 178// **pRetPropertyData 179// RETURN VALUE : 180// PRE-CONDITIONS : 1.URI has already been validated 181// POST-CONDITIONS : 182// IMPORTANT NOTES : 183// REQUIREMENT # : 184//------------------------------------------------------------------------ 185SYNCML_DM_RET_STATUS_T DMDefaultLeafNode ::GetSize(CPCHAR pbUri, 186 UINT32 *dwpRetPropertyData) 187{ 188 *dwpRetPropertyData=psData.getSize(); 189 return(SYNCML_DM_SUCCESS); 190} 191 192//------------------------------------------------------------------------ 193// FUNCTION : Rename 194// DESCRIPTION : This function is called when a node's name has 195// been changed 196// ARGUMENTS PASSED: *pbUri, 197// pNewNodeName 198// RETURN VALUE : ALWAYS returns SYNCML_DM_SUCCESS 199// PRE-CONDITIONS : 1.URI has already been validated 200// POST-CONDITIONS : 201// IMPORTANT NOTES : The node Name will be renamed by the DMTNM.It informs 202// the plug-in about this to allow the plug-in to change 203// the name in the data-base correspondingly.Since 204// Interior nodes in this class have no database this 205// method simply returns SYNCML_DM_SUCCESS.This means that 206// name of node will be renamed by DMTNM,and plug-in 207// does not have anything specific to do. 208// REQUIREMENT # : 209//------------------------------------------------------------------------ 210SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::Rename(CPCHAR pbUri, 211 CPCHAR pNewNodeName) 212{ 213 return(SYNCML_DM_SUCCESS); 214} 215//------------------------------------------------------------------------ 216// FUNCTION : Replace 217// 218// DESCRIPTION : This function is called when a node's value has 219// to be replaced. 220// ARGUMENTS PASSED: waitMsgForStatus, 221// replyStatusCback, 222// dwCommandId, 223// bItemNumber, 224// *pReplace, 225// oMoreData 226// oIsThisAtomic 227// RETURN VALUE : 228// PRE-CONDITIONS : 1.URI has already been validated 229// POST-CONDITIONS : 230// IMPORTANT NOTES : 231// REQUIREMENT # : ESR-DMTNM0024-m 232//------------------------------------------------------------------------ 233SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::Replace(DMAddData & oReplace) 234{ 235 return set(&oReplace); 236} 237 238//------------------------------------------------------------------------ 239// FUNCTION : Rollback 240// 241// DESCRIPTION : This function is called when a node's value has 242// needs to be rolledback. NOT SUPPORTED FOR PHASE 1 243// ARGUMENTS PASSED: waitMsgForStatus, 244// replyStatusCback, 245// dwCommandId, 246// bItemNumber, 247// dmCommand 248// *pbUri, 249// RETURN VALUE : returns SYNCML_DM_FEATURE_NOT_SUPPORTED 250// PRE-CONDITIONS : 1.URI has already been validated 251// POST-CONDITIONS : 252// IMPORTANT NOTES : 253// REQUIREMENT # : ESR-DMTNM0037-m 254//------------------------------------------------------------------------ 255SYNCML_DM_RET_STATUS_T DMDefaultLeafNode::Rollback(SYNCML_DM_COMMAND_T dmCommand, 256 CPCHAR pbUri) 257{ 258 return(SYNCML_DM_FEATURE_NOT_SUPPORTED); 259} 260 261