Skip to Content

Extending a Java function

As far as i know i can extend a function by using @pluginAt if i used a POSITION = Before i can trigger a function just before the target function.

So what i want to do is to use this way so i can edit the bar code readed from the bar code reader before it goes to the database but, still i don't know which function or which class is responsible for fetching data from database.
***************
TEST CASE : Bar code readed : 1234567890

Item Real Bar Code : 1234567
Quantity : 890
i just need to change the barcode from 1234567890 to 1234567 before searching in the database.

******************

And if i am going the wrong way please tell me

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Mar 06 at 08:05 AM

    The right method is "readMaterialByExternalID", which you can find in the MaterialManager.
    Please use the POSITION.BEFORE posibility to inject your code, before the method will be executed.

    Example:

    @PluginAt(pluginClass = IMaterialManager.class, method = "readMaterialByExternalID", where = PluginAt.POSITION.BEFORE)
    public void beforeReadMaterialByExternalID(Object proxy, Object[] args, StackTraceElement caller) {
    
    
    }
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bilal,

      Currently we have a small bug inside the PluginManager, which will be fixed in the next PL.
      As quick fix till the next PL, please use IMappingManager instead of IMaterialManager in the PluginAt annotation.

      Please excuse this inconvenience.