Overriding core modules scripts..

Options
Hello Experts,I would like to overrride some of the scripts from $WebNode.WebNodeCmds from my custom module.Can anybody tell me how to do that.Any help ASAP will be appreciated.Thanks in advance.

Comments

  • As the WebnodeCmds subsystem is built during runtime, you can't use the standard mechanisms.That is, if you don't want to modify all the subsystems in you Livelink installation :-)You could do it this way:;...;object cmdsys = $WebNode.WebNodeCmds;OS.AddFeature( cmdsys, "TheScript_orig" );cmdsys.TheScript_orig = cmdsys.TheScript;cmdsys.TheScript = .MyNewScript;...example for .MyNewScript;function Assoc TheScript( assoc p1 ); if wantToOverride; //do something here; end; return .TheScript_orig( p1 );endIf you want duplicate the original function, you don't need to call the original code...
  • I am not sure what your intention isWouldn't orphaning do you no good?Typically the use of htmlmap,otoverride and customizations_RT are the ones I have seen in OT assignmnets being used.This is way above my head.Some of these modules are free some licensed.Perhaps Howard,Chris or Donna could comment better
  • Thanks for reply...Appu,Klauas.Actually I wanted to override a Script "Link" into my module.When I orphan WebNodeCmd it run into "Link" method of overriden object.But if I override "Link" script it takes control to parent and modified script in my module does not come into picture.What could be the way to make it happen?
  • I'm not sure why you want to override the standard module feature.However, the other way of overriding a standard feature is to patch the module or the feature you are after.you can find the steps to patch in the following posthttps://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=7002073&objAction=view&show=2Hope this helps
  • Message from Chris Webster <cwebster@opentext.com> via eLink

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">eLink
    The typical way to implement the change you're wanting to do is to take advantage of the run-time nature of Oscript objects.  As you know, when you change the value of a feature of an object in Builder this change becomes permanent and part of the ospace. Builder only lets you make such changes to ospaces that are unlocked.  However such changes can be applied to objects in locked ospaces by using oscript code.  Such changes are not permanent but do become part of the running system.
     
    So basically you need to have some oscript in your custom module that runs when the system is starting up that references the object you want to override and makes the changes. There are several possible approaches.  To run code at system startup time you can insert code into your module's Startup script, or you can put code into __Init scripts of objects. To refer to the object to be overridden you can create a reference to the object using Builder, use an existing reference that another ospace has defined as one of its Globals, or create an orphan to the object and refer to it through its parentage.
     
    Further, depending on how often you want to perform these kinds of overrides it might be worthwhile to use or develop a system to manage such overrides.  Appu has mentioned some of the ones out in the field; developers might also develop their own solutions as part of their toolbox.
     
     
    To make the above more concrete I'll describe what I would do as the simplest way to implement exactly what you want:
     
    Orphan WebNodeCmd into your ospace as a new object
    Override its Link method as you need
    Override the __Init method and replace it completely by the code:   .OSParent.Link= this.Link
    Run BuildOspace()
     
     
    Again, there are several methods to implement this and it will be up to each developer or to the organization's coding standards to decide what is appropriate.  Note also that you are relying on the system's run-time behavior in making changes to objects that are "read-only".  As such it is a good idea for your code to mention the change it is making in your system log (using echo), and to be aware of this situation during debugging sessions.  And of course the usual support considerations about changing core objects must be taken into account.
     
     
    Hope this helps,
     
    -chris
     


    From: eLink Discussion: Livelink Builder Discussion [mailto:componentbuilder@elinkkc.opentext.com]
    Sent: Thursday, February 12, 2009 3:59 AM
    To: eLink Recipient
    Subject: Thanks for reply...Appu,Klauas.

     

    Thanks for reply...Appu,Klauas.   Posted by lloydsuser2 (Kashelkar, Vishal) on 2009/02/12 04:57
    In reply to: I am not sure what your intention is   Posted by anair@alitek.com (Nair, Appu) on 2009/02/11 09:56
     
    Thanks for reply...Appu,Klauas.
    Actually I wanted to override a Script "Link" into my module.
    When I orphan WebNodeCmd it run into "Link" method of overriden object.
    But if I override "Link" script it takes control to parent and modified script in my module does not come into picture.
    What could be the way to make it happen?
  • Hi ,

    We want to traverse to Level 5 in the below specified hierarchy of the Folder structure depending upon an attribute value filled at run time in webreport.

    Level  1-->

                Level 2-->

                          Level 3-->

                                    Level 4-->

                                             Level 5-->

                                                       Level 6

    We would need to create level 6 folder through the report. To achieve this we need the object id (item reference ) of level 5 folder. Is there a way to get the item reference dynamically to create level 6 folder . We have have a UserInput of Level 3 folder name in the form of attribute value.

    We have made changes in Report of the Webreport and written the following Oscript code -

    [LL_WEBREPORT_STARTSCRIPT NAME:test /]
    function String test(Dynamic c, List args)


    List kmtypes = { "policy" , "procedure" , "training" , "control" }
    String kmtype
    Dynamic root
    String path, msg

    for kmtype in kmtypes
     root = OS.Root( kmtype )
     path = OS.FileSpec( root )

    return path

    end

    [LL_WEBREPORT_ENDSCRIPT /]

     

     

    The above script gives an error may be the OS.Name and OS.FileSpec is not working during the runtime.

    How to go about it using the WebReport?