Consultor Eletrônico



Kbase P106607: ADM2: How to make the getUserProperty & setUserProperty dynamic functions work across AppServer?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/10/2008
Status: Verified

GOAL:

How to make the getUserProperty and setUserProperty dynamic functions work across AppServer?

FACT(s) (Environment):

OpenEdge 10.x
Progress 9.1x

FIX:

Override setUserProperty in your Smart Data Object to force the user property being pushed on the server side.
FUNCTION setUserProperty RETURNS LOGICAL
( INPUT pcPropName AS CHARACTER,
INPUT pcPropValue AS CHARACTER) :
/*------------------------------------------------------------------------------
Purpose: Super Override
Notes:
------------------------------------------------------------------------------*/
/* Code placed here will execute PRIOR to standard behavior. */
DEF VAR lres AS LOGICAL.
DEF VAR h AS HANDLE.
lres = SUPER( INPUT pcPropName, INPUT pcPropValue ).
h = DYNAMIC-FUNCTION( 'getASHandle' ).
IF VALID-HANDLE( h ) THEN
DO:
DYNAMIC-FUNCTION( 'setUserProperty' IN h, pcPropName, pcPropValue ).
END.
RETURN lres.
END FUNCTION.
Also let getUserProperty retrieve the value from the server side when appropiate:
FUNCTION getUserProperty RETURNS CHARACTER
( INPUT pcPropName AS CHARACTER) :
/*------------------------------------------------------------------------------
Purpose: Super Override
Notes:
------------------------------------------------------------------------------*/
/* Code placed here will execute PRIOR to standard behavior. */
DEF VAR h AS HANDLE.
DEF VAR cval AS CHAR.
cval = SUPER( INPUT pcPropName ).
h = DYNAMIC-FUNCTION( 'getASHandle' ).
IF VALID-HANDLE( h ) THEN DO:
cval = DYNAMIC-FUNCTION( 'getUserProperty' IN h, pcPropName ).
END.
RETURN cval.
END FUNCTION.