Search in sources :

Example 1 with JCoParameterList

use of com.sap.conn.jco.JCoParameterList in project iaf by ibissource.

the class SapFunctionFacade method getCorrelationIdFromField.

public String getCorrelationIdFromField(JCoFunction function) {
    JCoParameterList input = function.getImportParameterList();
    int correlationIdFieldIndex = findFieldIndex(input, getCorrelationIdFieldIndex(), getCorrelationIdFieldName());
    if (correlationIdFieldIndex > 0 && input != null) {
        return input.getString(correlationIdFieldIndex - 1);
    }
    return null;
}
Also used : JCoParameterList(com.sap.conn.jco.JCoParameterList)

Example 2 with JCoParameterList

use of com.sap.conn.jco.JCoParameterList in project iaf by ibissource.

the class RootHandler method startElement.

protected void startElement(String localName) {
    if (!parsedRequestRoot) {
        parsedRequestRoot = true;
    } else {
        Iterator<JCoParameterList> iterator = parameterLists.iterator();
        while (iterator.hasNext()) {
            JCoParameterList jcoParameterList = (JCoParameterList) iterator.next();
            if (jcoParameterList.getMetaData().getName().equals(localName)) {
                childHandler = new ParameterListHandler(jcoParameterList);
            }
        }
        if (childHandler == null) {
            log.warn("parameter list '" + localName + "' does not exist");
            unknownElementDepth = 1;
        }
    }
}
Also used : JCoParameterList(com.sap.conn.jco.JCoParameterList)

Example 3 with JCoParameterList

use of com.sap.conn.jco.JCoParameterList in project iaf by ibissource.

the class SapFunctionFacade method message2FunctionCall.

public void message2FunctionCall(JCoFunction function, String request, String correlationId, ParameterValueList pvl) throws SapException {
    JCoParameterList input = function.getImportParameterList();
    int requestFieldIndex = findFieldIndex(input, getRequestFieldIndex(), getRequestFieldName());
    setParameters(input, function.getTableParameterList(), request, requestFieldIndex);
    if (pvl != null) {
        for (int i = 0; i < pvl.size(); i++) {
            ParameterValue pv = pvl.getParameterValue(i);
            String name = pv.getDefinition().getName();
            String value = pv.asStringValue("");
            int slashPos = name.indexOf('/');
            if (slashPos < 0) {
                input.setValue(name, value);
            } else {
                String structName = name.substring(0, slashPos);
                String elemName = name.substring(slashPos + 1);
                JCoStructure struct = input.getStructure(structName);
                struct.setValue(elemName, value);
            }
        }
    }
    int correlationIdFieldIndex = findFieldIndex(input, getCorrelationIdFieldIndex(), getCorrelationIdFieldName());
    if (correlationIdFieldIndex > 0 && input != null) {
        input.setValue(correlationIdFieldIndex - 1, correlationId);
    }
}
Also used : ParameterValue(nl.nn.adapterframework.parameters.ParameterValue) JCoStructure(com.sap.conn.jco.JCoStructure) JCoParameterList(com.sap.conn.jco.JCoParameterList)

Example 4 with JCoParameterList

use of com.sap.conn.jco.JCoParameterList in project iaf by ibissource.

the class SapFunctionFacade method functionCall2message.

public String functionCall2message(JCoFunction function) {
    JCoParameterList input = function.getImportParameterList();
    int messageFieldIndex = findFieldIndex(input, getRequestFieldIndex(), getRequestFieldName());
    String result = null;
    if (messageFieldIndex > 0) {
        if (input != null) {
            result = input.getString(messageFieldIndex - 1);
        }
    } else {
        result = "<request function=\"" + function.getName() + "\">";
        JCoParameterList tables = function.getTableParameterList();
        if (input != null) {
            result += input.toXML();
        }
        if (tables != null) {
            result += tables.toXML();
        }
        result += "</request>";
    }
    return result;
}
Also used : JCoParameterList(com.sap.conn.jco.JCoParameterList)

Example 5 with JCoParameterList

use of com.sap.conn.jco.JCoParameterList in project iaf by ibissource.

the class SapFunctionFacade method message2FunctionResult.

public void message2FunctionResult(JCoFunction function, String result) throws SapException {
    JCoParameterList output = function.getExportParameterList();
    int replyFieldIndex = findFieldIndex(output, getReplyFieldIndex(), getReplyFieldName());
    setParameters(output, function.getTableParameterList(), result, replyFieldIndex);
}
Also used : JCoParameterList(com.sap.conn.jco.JCoParameterList)

Aggregations

JCoParameterList (com.sap.conn.jco.JCoParameterList)6 JCoStructure (com.sap.conn.jco.JCoStructure)1 ParameterValue (nl.nn.adapterframework.parameters.ParameterValue)1