cancel
Showing results for 
Search instead for 
Did you mean: 

Search for complex EJB Mapping function example

Former Member
0 Kudos

Hi guys,

i have some problem regarding my ejb mapping function in bpm process. I want to know how i can access within the ejb function.

I want to give two strings into the mapping function and want to return a article from type ArticleType (defined in BPM as XSD Schema)

<?xml version="1.0" encoding="UTF-8"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Article" xmlns:tns="http://www.example.org/Article" elementFormDefault="qualified">

    <complexType name="ArticleType">

        <sequence>

            <element name="artName" type="string"></element>

            <element name="artPI" type="string"></element>

        </sequence>

    </complexType>

</schema>

The function looks like above but is not working, how can i access the ArticleType defined in BPM to use it in the java class ?

Maybe someone knows a good example ?

public class ConcatFunctionComplex implements ConcatFunctionComplexLocal {

    private static final String PARAMETER1 = "parameter1";

    private static final String PARAMETER2 = "parameter2";

    private static final String RESULT = "result";

    private static final String NAME_PROPERTY_INPUT_PARAMETER1 = SdoRenamingHelper

            .renameXsdElementToSdoProperty(new QName(PARAMETER1), false);

    private static final String NAME_PROPERTY_INPUT_PARAMETER2 = SdoRenamingHelper

            .renameXsdElementToSdoProperty(new QName(PARAMETER2), false);

    private static final String NAME_PROPERTY_OUTPUT_RESULT = SdoRenamingHelper

            .renameXsdElementToSdoProperty(new QName(RESULT), false);

   

    /**

     * Default constructor.

     */

    public ConcatFunctionComplex() {

        // TODO Auto-generated constructor stub

    }

    @Override

    public DataObject invokeSdo(DataObject inputDO, InvocationContext invocationContext) {

        // input

        Type typeInput = inputDO.getType();

        String parameter1 = inputDO.getString(typeInput.getProperty(NAME_PROPERTY_INPUT_PARAMETER1));

        String parameter2 = inputDO.getString(typeInput.getProperty(NAME_PROPERTY_INPUT_PARAMETER2));

       

         DataObject outputD1 = invocationContext.createOutputDataObject();

         Property resultProperty = outputD1.getType().getProperty(NAME_PROPERTY_OUTPUT_RESULT);

         DataObject article = outputD1.createDataObject(resultProperty);

       

         article.set("artName", parameter1);

         article.set("artPI", parameter2);

         return article;       

    }

}

thanks in advanance for your help.

Mike

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

i had solved the problem, the problem was the namespace in SdoRenamingHelper.

The namespace itself was ok but, the second parameter bust be true(qualified) to access the xsd defined data object.

Answers (3)

Answers (3)

Former Member
0 Kudos

so still hanging on the element to access. So to change a simple attribute(attr1) is no problem within the ejb, but if i try to read the property for artName it is always null.

How should the property ID should look like ??

I use

String artNameId = SdoRenamingHelper.renameXsdElementToSdoProperty(new QName("http://demo.marquardt.com/CustomDataTypes", "artName"), false);

and with this ID i try to read

article.getType.getProperty(artNameId).

and the corresponding DataObject in BPM looks like

<schema targetNamespace="http://demo.marquardt.com/CustomDataTypes" xmls:tns="http://demo.marquardt.com/CustomDataTypes"

     <complexType name="ArticleType">

        <sequence>

            <element name="artName" type="string"></element>

            <element name="artPI" type="string"></element>

        </sequence>

        <attribute name="attr1" type="string"></attribute>

    </complexType>

any idea or maybe a good example where they use not only attributes also elements in the XSD.

stefan_grube
Active Contributor
0 Kudos

You cannot access EJBs from mapping. This is not possible.

MichalKrawczyk
Active Contributor
0 Kudos

Hi Stefan,

I believe he meant ejb mapping in BPM (those where OM mappings were not possible in BPM yet - sp0 I believe for 7.31) but why not use OM in BPM and do it in normal mapping,

Regards,

Michal Krawczyk

stefan_grube
Active Contributor
0 Kudos

Hi Michal,

You are right. I was confused.

Regards

Stefan

Former Member
0 Kudos

so any example to use a complex Type in bpm within the ejb mapping function ?

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

just a question - why don't you use operation mapping in the BPM and then any kind of PI mapping for that ? (more configurable, more mapping options, less deplyment)

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi Michael,

I'm talking from a mapping in BPM. That means i call in the mapping activity a function called ComplexMappingFunction( parameter1, parameter2 ) and as result the ArticleType should be returned. Thats all i want to do.

So in my understanding this is a "normal" EJB mapping in BPM.

regards

Michael