This discussion is archived
2 Replies Latest reply: Dec 28, 2012 5:19 AM by 975124 RSS

calling java method for OrderItemSpecification item?

867442 Newbie
Currently Being Moderated
Hi,

Is there any way to call java method directly for OrderItemSpecification item?

Appreciate your comments in this regards.

Regards,
Rutvej
  • 1. Re: calling java method for OrderItemSpecification item?
    user491422 - oracle Journeyer
    Currently Being Moderated
    Rutjev;

    OSM uses the Saxon xquery processor which does provide an extensibility mechanism allowing Java to be invoked. You will need to ensure the classes you are depending upon are accessible on the classpath. The way to do this with OSM is to put the classes in a jar file and out the jar in your cartridge's resource folder.

    Hope this helps.

    Brian.
  • 2. Re: calling java method for OrderItemSpecification item?
    975124 Newbie
    Currently Being Moderated
    Yes can use.
    As Brian said, through xquery.
    #################
    Create java class in your catridge src folder.
    Example
    package com;
    class Util
    {
    //should be static methos
    public static String getValue(String data)
    {
    return data+" received";
    }

    }
    #################
    select property in Order Item Spec and put xquery to access java

    declare namespace customJava="java:com.Util";
    let $result:=customJava:getValue('data')
    return $result

    enjoy

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points