Example usage for javax.xml.bind JAXBElement setValue

List of usage examples for javax.xml.bind JAXBElement setValue

Introduction

In this page you can find the example usage for javax.xml.bind JAXBElement setValue.

Prototype

public void setValue(T t) 

Source Link

Document

Set the content model and attributes of this xml element.

When this property is set to null , isNil() must by true .

Usage

From source file:de.extra.extraClientLight.helper.BuildExtraTransport.java

/**
 * Baut die Query zusammen//from  w  w  w  . j ava 2  s.  c o m
 * 
 * @param requestBean
 * @return DataRequestType
 */

private static DataRequestType buildQuery(RequestExtraBean requestBean) {

    DataRequestType dataRequest = new DataRequestType();
    DataRequestQueryType dataQuery = new DataRequestQueryType();
    DataRequestArgumentType requestIdArgument = new DataRequestArgumentType();
    DataRequestArgumentType procedureArgument = new DataRequestArgumentType();
    DataRequestArgumentType dataTypeArgument = new DataRequestArgumentType();

    requestIdArgument.setProperty(ClientConstants.QUERY_REQUESTID);

    OperandType operand = new OperandType();
    operand.setValue("1234");

    final JAXBElement<OperandType> jaxbOperand = new JAXBElement<OperandType>(
            new QName("http://www.extra-standard.de/namespace/message/1", "GT"), OperandType.class, operand);
    jaxbOperand.setValue(operand);

    requestIdArgument.getContent().add(jaxbOperand);
    dataQuery.getArgument().add(requestIdArgument);

    procedureArgument.setProperty(ClientConstants.QUERY_PROCEDURE);

    dataQuery.getArgument().add(procedureArgument);

    dataTypeArgument.setProperty(ClientConstants.QUERY_DATATYPE);
    dataQuery.getArgument().add(dataTypeArgument);

    dataRequest.setQuery(dataQuery);

    return dataRequest;
}

From source file:com.evolveum.midpoint.web.util.ExpressionUtil.java

public static void updateShadowRefEvaluatorValue(ExpressionType expression, String value,
        PrismContext prismContext) {//  w ww . j a v  a  2s  . co  m
    JAXBElement<RawType> element = findFirstEvaluatorByName(expression, SchemaConstants.C_VALUE);
    if (element == null) {
        element = new JAXBElement(SchemaConstants.C_VALUE, RawType.class, new RawType(prismContext));
    }
    element.setValue(new RawType(new PrimitiveXNode<>(value), prismContext));
    expression.getExpressionEvaluator().add(element);
}

From source file:com.evolveum.midpoint.web.util.ExpressionUtil.java

public static void createShadowRefEvaluatorValue(ExpressionType expression, String oid,
        PrismContext prismContext) {/* w w  w  . j  a  v a2s  .co  m*/
    if (expression == null) {
        expression = new ExpressionType();
    }
    JAXBElement element = new JAXBElement(SchemaConstants.C_VALUE, RawType.class, new RawType(prismContext));

    MapXNode shadowRefNode = new MapXNode();
    shadowRefNode.put(SHADOW_OID_KEY, new PrimitiveXNode<>(oid));
    shadowRefNode.put(SHADOW_TYPE_KEY, new PrimitiveXNode<>(ShadowType.COMPLEX_TYPE.getLocalPart()));

    MapXNode valueNode = new MapXNode();
    valueNode.put(SHADOW_REF_KEY, shadowRefNode);

    RawType expressionValue = new RawType(valueNode, prismContext);
    element.setValue(expressionValue);

    removeEvaluatorByName(expression, SchemaConstants.C_VALUE);
    expression.getExpressionEvaluator().add(element);
}

From source file:com.evolveum.midpoint.web.util.ExpressionUtil.java

public static JAXBElement createAssociationTargetSearchElement() {
    JAXBElement evaluator = new JAXBElement(SchemaConstantsGenerated.C_ASSOCIATION_TARGET_SEARCH,
            JAXBElement.GlobalScope.class, new JAXBElement.GlobalScope());
    SearchObjectExpressionEvaluatorType searchObjectExpressionEvaluatorType = new SearchObjectExpressionEvaluatorType();
    SearchFilterType filterType = new SearchFilterType();
    MapXNode filterClauseNode = new MapXNode();
    MapXNode values = new MapXNode();
    values.put(new QName("path"), new PrimitiveXNode<ItemPathType>());
    values.put(new QName("value"), new PrimitiveXNode());
    filterClauseNode.put(new QName("equal"), values);
    filterType.setFilterClauseXNode(filterClauseNode);
    searchObjectExpressionEvaluatorType.setFilter(filterType);

    evaluator.setValue(searchObjectExpressionEvaluatorType);
    return evaluator;
}

From source file:com.evolveum.midpoint.provisioning.test.impl.TestCsvFile.java

@Test
public void test500ExeucuteScript() throws Exception {
    final String TEST_NAME = "test500ExeucuteScript";
    TestUtil.displayTestTile(TEST_NAME);

    String osName = System.getProperty("os.name");
    IntegrationTestTools.display("OS", osName);
    if (!"Linux".equals(osName)) {
        display("SKIPPING test, cannot execute on " + osName);
        return;/* ww w.  j  a va2  s .  c  o m*/
    }

    // GIVEN
    Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();

    ProvisioningScriptType script = new ProvisioningScriptType();
    script.setHost(ProvisioningScriptHostType.RESOURCE);
    script.setLanguage("exec");
    script.setCode("src/test/script/csvscript.sh");
    ProvisioningScriptArgumentType argument = new ProvisioningScriptArgumentType();
    argument.setName("NAME");
    JAXBElement<RawType> valueEvaluator = (JAXBElement) new ObjectFactory().createValue(null);
    RawType value = new RawType(new PrimitiveXNode<String>("World"), prismContext);
    valueEvaluator.setValue(value);
    argument.getExpressionEvaluator().add(valueEvaluator);
    script.getArgument().add(argument);

    // WHEN
    provisioningService.executeScript(RESOURCE_CSV_OID, script, task, result);

    // THEN
    result.computeStatus();
    display("executeScript result", result);
    TestUtil.assertSuccess("executeScript has failed (result)", result);

    File scriptOutFile = new File("target/hello.txt");
    assertTrue("Script haven't created the file", scriptOutFile.exists());
    String fileContent = MiscUtil.readFile(scriptOutFile);
    assertEquals("Wrong script output", "Hello World", fileContent);

}

From source file:fr.fastconnect.factory.tibco.bw.maven.packaging.ApplicationManagement.java

/**
 * This method sets "isFt" property in Bw.getRest() objects
 *//*www  . j a  v  a2  s. co m*/
private void setIsFt(Bw bw, Boolean value) {
    for (Object o : bw.getRest()) {
        if (o.getClass().equals(JAXBElement.class)) {
            //  should never be other than Boolean according to
            // com.tibco.xmlns.applicationmanagement.BWServiceType
            @SuppressWarnings("unchecked")
            JAXBElement<Boolean> e = (JAXBElement<Boolean>) o;
            e.setValue(value);
        }
    }
}

From source file:br.com.upic.camel.openedge.OpenEdgeEndpoint.java

@Override
protected void onExchange(final Exchange exchange) throws Exception {

    try {//  w  w  w.j a  va 2s  .c  o  m
        LOG.info("Unmarshalling the request");

        final Request req = (Request) unmarshaller.unmarshal(exchange.getIn().getBody(Document.class));

        LOG.info("Setting the input params");

        final List<JAXBElement<? extends Serializable>> reqParamElementList = req.getParamElementList();

        final ParamArray proParams = new ParamArray(reqParamElementList.size());

        for (final JAXBElement<? extends Serializable> reqParamElement : reqParamElementList) {
            final Serializable reqParam = reqParamElement.getValue();

            if (reqParam instanceof CharArrayParam) {
                final CharArrayParam charArrayParam = (CharArrayParam) reqParam;

                final ParamMode mode = charArrayParam.getMode();

                final int id = charArrayParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final List<String> value = new ArrayList<String>();

                    for (final JAXBElement<String> valueElement : charArrayParam.getValueElementList()) {

                        if (!valueElement.isNil())
                            value.add(DatatypeConverter.parseString(valueElement.getValue()));
                        else
                            value.add(null);

                    }

                    proParams.addCharacterArray(id, value.toArray(new String[] {}), mode.value(), value.size());
                } else {
                    proParams.addCharacterArray(id, null, mode.value(), 0);
                }

            } else if (reqParam instanceof CharParam) {
                final CharParam charParam = (CharParam) reqParam;

                final ParamMode mode = charParam.getMode();

                final int id = charParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil()))
                    proParams.addCharacter(id, DatatypeConverter.parseString(charParam.getContent()),
                            mode.value());
                else
                    proParams.addCharacter(id, null, mode.value());

            } else if (reqParam instanceof DateArrayParam) {
                final DateArrayParam dateArrayParam = (DateArrayParam) reqParam;

                final ParamMode mode = dateArrayParam.getMode();

                final int id = dateArrayParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final List<GregorianCalendar> value = new ArrayList<GregorianCalendar>();

                    for (final JAXBElement<String> valueElement : dateArrayParam.getValueElementList()) {

                        if (!valueElement.isNil()) {
                            final GregorianCalendar cal = new GregorianCalendar();

                            cal.setTime(DatatypeConverter.parseDate(valueElement.getValue()).getTime());

                            value.add(cal);
                        } else {
                            value.add(null);
                        }

                    }

                    proParams.addDateArray(id, value.toArray(new GregorianCalendar[] {}), mode.value(),
                            value.size());
                } else {
                    proParams.addDateArray(id, null, mode.value(), 0);
                }

            } else if (reqParam instanceof DateParam) {
                final DateParam dateParam = (DateParam) reqParam;

                final ParamMode mode = dateParam.getMode();

                final int id = dateParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final GregorianCalendar cal = new GregorianCalendar();

                    cal.setTime(DatatypeConverter.parseDate(dateParam.getContent()).getTime());

                    proParams.addDate(id, cal, mode.value());
                } else {
                    proParams.addDate(id, null, mode.value());
                }

            } else if (reqParam instanceof DateTimeArrayParam) {
                final DateTimeArrayParam dateTimeArrayParam = (DateTimeArrayParam) reqParam;

                final ParamMode mode = dateTimeArrayParam.getMode();

                final int id = dateTimeArrayParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final List<GregorianCalendar> value = new ArrayList<GregorianCalendar>();

                    for (final JAXBElement<String> valueElement : dateTimeArrayParam.getValueElementList()) {

                        if (!valueElement.isNil()) {
                            final GregorianCalendar cal = new GregorianCalendar();

                            cal.setTime(DatatypeConverter.parseDateTime(valueElement.getValue()).getTime());

                            value.add(cal);
                        } else {
                            value.add(null);
                        }

                    }

                    proParams.addDatetimeArray(id, value.toArray(new GregorianCalendar[] {}), mode.value(),
                            value.size());
                } else {
                    proParams.addDatetimeArray(id, null, mode.value(), 0);
                }

            } else if (reqParam instanceof DateTimeParam) {
                final DateTimeParam dateTimeParam = (DateTimeParam) reqParam;

                final ParamMode mode = dateTimeParam.getMode();

                final int id = dateTimeParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final GregorianCalendar cal = new GregorianCalendar();

                    cal.setTime(DatatypeConverter.parseDateTime(dateTimeParam.getContent()).getTime());

                    proParams.addDatetime(id, cal, mode.value());
                } else {
                    proParams.addDatetime(id, null, mode.value());
                }

            } else if (reqParam instanceof DateTimeTZArrayParam) {
                final DateTimeTZArrayParam dateTimeTZArrayParam = (DateTimeTZArrayParam) reqParam;

                final ParamMode mode = dateTimeTZArrayParam.getMode();

                final int id = dateTimeTZArrayParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final List<GregorianCalendar> value = new ArrayList<GregorianCalendar>();

                    for (final JAXBElement<String> valueElement : dateTimeTZArrayParam.getValueElementList()) {

                        if (!valueElement.isNil()) {
                            final GregorianCalendar cal = new GregorianCalendar();

                            cal.setTime(DatatypeConverter.parseDateTime(valueElement.getValue()).getTime());

                            value.add(cal);
                        } else {
                            value.add(null);
                        }

                    }

                    proParams.addDatetimeTZArray(id, value.toArray(new GregorianCalendar[] {}), mode.value(),
                            value.size());
                } else {
                    proParams.addDatetimeTZArray(id, null, mode.value(), 0);
                }

            } else if (reqParam instanceof DateTimeTZParam) {
                final DateTimeTZParam dateTimeTZParam = (DateTimeTZParam) reqParam;

                final ParamMode mode = dateTimeTZParam.getMode();

                final int id = dateTimeTZParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final GregorianCalendar cal = new GregorianCalendar();

                    cal.setTime(DatatypeConverter.parseDateTime(dateTimeTZParam.getContent()).getTime());

                    proParams.addDatetimeTZ(id, cal, mode.value());
                } else {
                    proParams.addDatetimeTZ(id, null, mode.value());
                }

            } else if (reqParam instanceof DecArrayParam) {
                final DecArrayParam decArrayParam = (DecArrayParam) reqParam;

                final ParamMode mode = decArrayParam.getMode();

                final int id = decArrayParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final List<BigDecimal> value = new ArrayList<BigDecimal>();

                    for (final JAXBElement<String> valueElement : decArrayParam.getValueElementList()) {

                        if (!valueElement.isNil())
                            value.add(DatatypeConverter.parseDecimal(valueElement.getValue()));
                        else
                            value.add(null);

                    }

                    proParams.addDecimalArray(id, value.toArray(new BigDecimal[] {}), mode.value(),
                            value.size());
                } else {
                    proParams.addDecimalArray(id, null, mode.value(), 0);
                }

            } else if (reqParam instanceof DecParam) {
                final DecParam decParam = (DecParam) reqParam;

                final ParamMode mode = decParam.getMode();

                final int id = decParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil()))
                    proParams.addDecimal(id, DatatypeConverter.parseDecimal(decParam.getContent()),
                            mode.value());
                else
                    proParams.addDecimal(id, null, mode.value());

            } else if (reqParam instanceof IntArrayParam) {
                final IntArrayParam intArrayParam = (IntArrayParam) reqParam;

                final ParamMode mode = intArrayParam.getMode();

                final int id = intArrayParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final List<Integer> value = new ArrayList<Integer>();

                    for (final JAXBElement<String> valueElement : intArrayParam.getValueElementList()) {

                        if (!valueElement.isNil())
                            value.add(DatatypeConverter.parseInt(valueElement.getValue()));
                        else
                            value.add(null);

                    }

                    proParams.addIntegerArray(id, value.toArray(new Integer[] {}), mode.value(), value.size());
                } else {
                    proParams.addIntegerArray(id, (Integer[]) null, mode.value(), 0);
                }

            } else if (reqParam instanceof IntParam) {
                final IntParam intParam = (IntParam) reqParam;

                final ParamMode mode = intParam.getMode();

                final int id = intParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil()))
                    proParams.addInteger(id, new Integer(DatatypeConverter.parseInt(intParam.getContent())),
                            mode.value());
                else
                    proParams.addInteger(id, null, mode.value());

            } else if (reqParam instanceof LogArrayParam) {
                final LogArrayParam logArrayParam = (LogArrayParam) reqParam;

                final ParamMode mode = logArrayParam.getMode();

                final int id = logArrayParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil())) {
                    final List<Boolean> value = new ArrayList<Boolean>();

                    for (final JAXBElement<String> valueElement : logArrayParam.getValueElementList()) {

                        if (!valueElement.isNil())
                            value.add(DatatypeConverter.parseBoolean(valueElement.getValue()));
                        else
                            value.add(null);

                    }

                    proParams.addLogicalArray(id, value.toArray(new Boolean[] {}), mode.value(), value.size());
                } else {
                    proParams.addLogicalArray(id, (Boolean[]) null, mode.value(), 0);
                }

            } else if (reqParam instanceof LogParam) {
                final LogParam logParam = (LogParam) reqParam;

                final ParamMode mode = logParam.getMode();

                final int id = logParam.getId();

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil()))
                    proParams.addLogical(id, new Boolean(DatatypeConverter.parseBoolean(logParam.getContent())),
                            mode.value());
                else
                    proParams.addLogical(id, null, mode.value());

            } else if (reqParam instanceof ResultSetParam) {
                final ResultSetParam rsParam = (ResultSetParam) reqParam;

                final ParamMode mode = rsParam.getMode();

                final int id = rsParam.getId();

                final ResultSetMetaData rsMetaData = rsParam.getResultSetMetaData();

                final List<Serializable> fieldMetaDataList = rsMetaData.getFieldMetaDataList();

                final ProResultSetMetaDataImpl proRsMetaData = new ProResultSetMetaDataImpl(
                        fieldMetaDataList.size());

                for (final Serializable fieldMetaData : fieldMetaDataList) {

                    if (fieldMetaData instanceof CharFieldMetaData) {
                        final CharFieldMetaData charFieldMetaData = (CharFieldMetaData) fieldMetaData;

                        proRsMetaData.setFieldMetaData(charFieldMetaData.getId(), charFieldMetaData.getName(),
                                charFieldMetaData.getExtent(), Parameter.PRO_CHARACTER);
                    } else if (fieldMetaData instanceof DateFieldMetaData) {
                        final DateFieldMetaData dateFieldMetaData = (DateFieldMetaData) fieldMetaData;

                        proRsMetaData.setFieldMetaData(dateFieldMetaData.getId(), dateFieldMetaData.getName(),
                                dateFieldMetaData.getExtent(), Parameter.PRO_DATE);
                    } else if (fieldMetaData instanceof DateTimeFieldMetaData) {
                        final DateTimeFieldMetaData dateTimeFieldMetaData = (DateTimeFieldMetaData) fieldMetaData;

                        proRsMetaData.setFieldMetaData(dateTimeFieldMetaData.getId(),
                                dateTimeFieldMetaData.getName(), dateTimeFieldMetaData.getExtent(),
                                Parameter.PRO_DATETIME);
                    } else if (fieldMetaData instanceof DateTimeTZFieldMetaData) {
                        final DateTimeTZFieldMetaData dateTimeTZFieldMetaData = (DateTimeTZFieldMetaData) fieldMetaData;

                        proRsMetaData.setFieldMetaData(dateTimeTZFieldMetaData.getId(),
                                dateTimeTZFieldMetaData.getName(), dateTimeTZFieldMetaData.getExtent(),
                                Parameter.PRO_DATETIMETZ);
                    } else if (fieldMetaData instanceof DecFieldMetaData) {
                        final DecFieldMetaData decFieldMetaData = (DecFieldMetaData) fieldMetaData;

                        proRsMetaData.setFieldMetaData(decFieldMetaData.getId(), decFieldMetaData.getName(),
                                decFieldMetaData.getExtent(), Parameter.PRO_DECIMAL);
                    } else if (fieldMetaData instanceof IntFieldMetaData) {
                        final IntFieldMetaData intFieldMetaData = (IntFieldMetaData) fieldMetaData;

                        proRsMetaData.setFieldMetaData(intFieldMetaData.getId(), intFieldMetaData.getName(),
                                intFieldMetaData.getExtent(), Parameter.PRO_INTEGER);
                    } else if (fieldMetaData instanceof LogFieldMetaData) {
                        final LogFieldMetaData logFieldMetaData = (LogFieldMetaData) fieldMetaData;

                        proRsMetaData.setFieldMetaData(logFieldMetaData.getId(), logFieldMetaData.getName(),
                                logFieldMetaData.getExtent(), Parameter.PRO_LOGICAL);
                    }

                }

                if (((ParamMode.INPUT == mode) || (ParamMode.INPUT_OUTPUT == mode))
                        && (!reqParamElement.isNil()))
                    proParams.addTable(id, new OpenEdgeResultSet(rsParam.getRowList().iterator()), mode.value(),
                            proRsMetaData);
                else
                    proParams.addTable(id, null, mode.value(), proRsMetaData);

            }

        }

        LOG.info("Connecting to the AppServer");

        if (SESSION_MODEL_MANAGED == sessionModel)
            RunTimeProperties.setSessionModel(0);
        else if (SESSION_MODEL_FREE == sessionModel)
            RunTimeProperties.setSessionModel(1);

        final OpenAppObject proAppObject = new OpenAppObject(url, user, password, null, null);

        proAppObject.runProc(req.getProgram(), proParams);

        LOG.info("Marshalling the response");

        final Response res = OBJECT_FACTORY.createResponse();

        res.setResult(proParams.getProcReturnString());

        LOG.info("Setting the output params");

        for (final JAXBElement<? extends Serializable> reqParamElement : reqParamElementList) {
            final Serializable reqParam = reqParamElement.getValue();

            if (reqParam instanceof CharArrayParam) {
                final CharArrayParam reqCharArrayParam = (CharArrayParam) reqParam;

                if (ParamMode.INPUT != reqCharArrayParam.getMode()) {
                    final JAXBElement<CharArrayParam> resParamElement = new JAXBElement<CharArrayParam>(
                            new QName(NS, "CharArray"), CharArrayParam.class, null);

                    final CharArrayParam resParam = OBJECT_FACTORY.createCharArrayParam();

                    resParam.setId(reqCharArrayParam.getId());

                    resParam.setName(reqCharArrayParam.getName());

                    final String[] proParam = (String[]) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        for (int i = 0; i < proParam.length; i++) {
                            final JAXBElement<String> valueElement = new JAXBElement<String>(
                                    new QName(NS, "Value"), String.class, null);

                            if (proParam[i] != null)
                                valueElement.setValue(DatatypeConverter.printString(proParam[i]));
                            else
                                valueElement.setNil(true);

                            resParam.getValueElementList().add(valueElement);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof CharParam) {
                final CharParam reqCharParam = (CharParam) reqParam;

                if (ParamMode.INPUT != reqCharParam.getMode()) {
                    final JAXBElement<CharParam> resParamElement = new JAXBElement<CharParam>(
                            new QName(NS, "Char"), CharParam.class, null);

                    final CharParam resParam = OBJECT_FACTORY.createCharParam();

                    resParam.setId(reqCharParam.getId());

                    resParam.setName(reqCharParam.getName());

                    final String proParam = (String) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {
                        resParam.setContent(DatatypeConverter.printString(proParam));

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DateArrayParam) {
                final DateArrayParam reqDateArrayParam = (DateArrayParam) reqParam;

                if (ParamMode.INPUT != reqDateArrayParam.getMode()) {
                    final JAXBElement<DateArrayParam> resParamElement = new JAXBElement<DateArrayParam>(
                            new QName(NS, "DateArray"), DateArrayParam.class, null);

                    final DateArrayParam resParam = OBJECT_FACTORY.createDateArrayParam();

                    resParam.setId(reqDateArrayParam.getId());

                    resParam.setName(reqDateArrayParam.getName());

                    final Date[] proParam = (Date[]) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        for (int i = 0; i < proParam.length; i++) {
                            final JAXBElement<String> valueElement = new JAXBElement<String>(
                                    new QName(NS, "Value"), String.class, null);

                            if (proParam[i] != null) {
                                final Calendar cal = Calendar.getInstance();

                                cal.setTime(proParam[i]);

                                valueElement.setValue(DatatypeConverter.printDate(cal));
                            } else {
                                valueElement.setNil(true);
                            }

                            resParam.getValueElementList().add(valueElement);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DateParam) {
                final DateParam reqDateParam = (DateParam) reqParam;

                if (ParamMode.INPUT != reqDateParam.getMode()) {
                    final JAXBElement<DateParam> resParamElement = new JAXBElement<DateParam>(
                            new QName(NS, "Date"), DateParam.class, null);

                    final DateParam resParam = OBJECT_FACTORY.createDateParam();

                    resParam.setId(reqDateParam.getId());

                    resParam.setName(reqDateParam.getName());

                    final Date proParam = (Date) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {
                        final Calendar cal = Calendar.getInstance();

                        cal.setTime(proParam);

                        resParam.setContent(DatatypeConverter.printDate(cal));

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DateTimeArrayParam) {
                final DateTimeArrayParam reqDateTimeArrayParam = (DateTimeArrayParam) reqParam;

                if (ParamMode.INPUT != reqDateTimeArrayParam.getMode()) {
                    final JAXBElement<DateTimeArrayParam> resParamElement = new JAXBElement<DateTimeArrayParam>(
                            new QName(NS, "DateTimeArray"), DateTimeArrayParam.class, null);

                    final DateTimeArrayParam resParam = OBJECT_FACTORY.createDateTimeArrayParam();

                    resParam.setId(reqDateTimeArrayParam.getId());

                    resParam.setName(reqDateTimeArrayParam.getName());

                    final GregorianCalendar[] proParam = (GregorianCalendar[]) proParams
                            .getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        for (int i = 0; i < proParam.length; i++) {
                            final JAXBElement<String> valueElement = new JAXBElement<String>(
                                    new QName(NS, "Value"), String.class, null);

                            if (proParam[i] != null)
                                valueElement.setValue(DatatypeConverter.printDateTime(proParam[i]));
                            else
                                valueElement.setNil(true);

                            resParam.getValueElementList().add(valueElement);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DateTimeParam) {
                final DateTimeParam reqDateTimeParam = (DateTimeParam) reqParam;

                if (ParamMode.INPUT != reqDateTimeParam.getMode()) {
                    final JAXBElement<DateTimeParam> resParamElement = new JAXBElement<DateTimeParam>(
                            new QName(NS, "DateTime"), DateTimeParam.class, null);

                    final DateTimeParam resParam = OBJECT_FACTORY.createDateTimeParam();

                    resParam.setId(reqDateTimeParam.getId());

                    resParam.setName(reqDateTimeParam.getName());

                    final GregorianCalendar proParam = (GregorianCalendar) proParams
                            .getOutputParameter(resParam.getId());

                    if (proParam != null) {
                        resParam.setContent(DatatypeConverter.printDateTime(proParam));

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DateTimeTZArrayParam) {
                final DateTimeTZArrayParam reqDateTimeTZArrayParam = (DateTimeTZArrayParam) reqParam;

                if (ParamMode.INPUT != reqDateTimeTZArrayParam.getMode()) {
                    final JAXBElement<DateTimeTZArrayParam> resParamElement = new JAXBElement<DateTimeTZArrayParam>(
                            new QName(NS, "DateTimeTZArray"), DateTimeTZArrayParam.class, null);

                    final DateTimeTZArrayParam resParam = OBJECT_FACTORY.createDateTimeTZArrayParam();

                    resParam.setId(reqDateTimeTZArrayParam.getId());

                    resParam.setName(reqDateTimeTZArrayParam.getName());

                    final GregorianCalendar[] proParam = (GregorianCalendar[]) proParams
                            .getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        for (int i = 0; i < proParam.length; i++) {
                            final JAXBElement<String> valueElement = new JAXBElement<String>(
                                    new QName(NS, "Value"), String.class, null);

                            if (proParam[i] != null)
                                valueElement.setValue(DatatypeConverter.printDateTime(proParam[i]));
                            else
                                valueElement.setNil(true);

                            resParam.getValueElementList().add(valueElement);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DateTimeTZParam) {
                final DateTimeTZParam reqDateTimeTZParam = (DateTimeTZParam) reqParam;

                if (ParamMode.INPUT != reqDateTimeTZParam.getMode()) {
                    final JAXBElement<DateTimeTZParam> resParamElement = new JAXBElement<DateTimeTZParam>(
                            new QName(NS, "DateTimeTZ"), DateTimeTZParam.class, null);

                    final DateTimeTZParam resParam = OBJECT_FACTORY.createDateTimeTZParam();

                    resParam.setId(reqDateTimeTZParam.getId());

                    resParam.setName(reqDateTimeTZParam.getName());

                    final GregorianCalendar proParam = (GregorianCalendar) proParams
                            .getOutputParameter(resParam.getId());

                    if (proParam != null) {
                        resParam.setContent(DatatypeConverter.printDateTime(proParam));

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DecArrayParam) {
                final DecArrayParam reqDecArrayParam = (DecArrayParam) reqParam;

                if (ParamMode.INPUT != reqDecArrayParam.getMode()) {
                    final JAXBElement<DecArrayParam> resParamElement = new JAXBElement<DecArrayParam>(
                            new QName(NS, "DecArray"), DecArrayParam.class, null);

                    final DecArrayParam resParam = OBJECT_FACTORY.createDecArrayParam();

                    resParam.setId(reqDecArrayParam.getId());

                    resParam.setName(reqDecArrayParam.getName());

                    final BigDecimal[] proParam = (BigDecimal[]) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        for (int i = 0; i < proParam.length; i++) {
                            final JAXBElement<String> valueElement = new JAXBElement<String>(
                                    new QName(NS, "Value"), String.class, null);

                            if (proParam[i] != null)
                                valueElement.setValue(DatatypeConverter.printDecimal(proParam[i]));
                            else
                                valueElement.setNil(true);

                            resParam.getValueElementList().add(valueElement);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof DecParam) {
                final DecParam reqDecParam = (DecParam) reqParam;

                if (ParamMode.INPUT != reqDecParam.getMode()) {
                    final JAXBElement<DecParam> resParamElement = new JAXBElement<DecParam>(
                            new QName(NS, "Dec"), DecParam.class, null);

                    final DecParam resParam = OBJECT_FACTORY.createDecParam();

                    resParam.setId(reqDecParam.getId());

                    resParam.setName(reqDecParam.getName());

                    final BigDecimal proParam = (BigDecimal) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {
                        resParam.setContent(DatatypeConverter.printDecimal(proParam));

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof IntArrayParam) {
                final IntArrayParam reqIntArrayParam = (IntArrayParam) reqParam;

                if (ParamMode.INPUT != reqIntArrayParam.getMode()) {
                    final JAXBElement<IntArrayParam> resParamElement = new JAXBElement<IntArrayParam>(
                            new QName(NS, "IntArray"), IntArrayParam.class, null);

                    final IntArrayParam resParam = OBJECT_FACTORY.createIntArrayParam();

                    resParam.setId(reqIntArrayParam.getId());

                    resParam.setName(reqIntArrayParam.getName());

                    final Integer[] proParam = (Integer[]) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        for (int i = 0; i < proParam.length; i++) {
                            final JAXBElement<String> valueElement = new JAXBElement<String>(
                                    new QName(NS, "Value"), String.class, null);

                            if (proParam[i] != null)
                                valueElement.setValue(DatatypeConverter.printInt(proParam[i]));
                            else
                                valueElement.setNil(true);

                            resParam.getValueElementList().add(valueElement);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof IntParam) {
                final IntParam reqIntParam = (IntParam) reqParam;

                if (ParamMode.INPUT != reqIntParam.getMode()) {
                    final JAXBElement<IntParam> resParamElement = new JAXBElement<IntParam>(
                            new QName(NS, "Int"), IntParam.class, null);

                    final IntParam resParam = OBJECT_FACTORY.createIntParam();

                    resParam.setId(reqIntParam.getId());

                    resParam.setName(reqIntParam.getName());

                    final Integer proParam = (Integer) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {
                        resParam.setContent(DatatypeConverter.printInt(proParam));

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof LogArrayParam) {
                final LogArrayParam reqLogArrayParam = (LogArrayParam) reqParam;

                if (ParamMode.INPUT != reqLogArrayParam.getMode()) {
                    final JAXBElement<LogArrayParam> resParamElement = new JAXBElement<LogArrayParam>(
                            new QName(NS, "LogArray"), LogArrayParam.class, null);

                    final LogArrayParam resParam = OBJECT_FACTORY.createLogArrayParam();

                    resParam.setId(reqLogArrayParam.getId());

                    resParam.setName(reqLogArrayParam.getName());

                    final Boolean[] proParam = (Boolean[]) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        for (int i = 0; i < proParam.length; i++) {
                            final JAXBElement<String> valueElement = new JAXBElement<String>(
                                    new QName(NS, "Value"), String.class, null);

                            if (proParam[i] != null)
                                valueElement.setValue(DatatypeConverter.printBoolean(proParam[i]));
                            else
                                valueElement.setNil(true);

                            resParam.getValueElementList().add(valueElement);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof LogParam) {
                final LogParam reqLogParam = (LogParam) reqParam;

                if (ParamMode.INPUT != reqLogParam.getMode()) {
                    final JAXBElement<LogParam> resParamElement = new JAXBElement<LogParam>(
                            new QName(NS, "Log"), LogParam.class, null);

                    final LogParam resParam = OBJECT_FACTORY.createLogParam();

                    resParam.setId(reqLogParam.getId());

                    resParam.setName(reqLogParam.getName());

                    final Boolean proParam = (Boolean) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {
                        resParam.setContent(DatatypeConverter.printBoolean(proParam));

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            } else if (reqParam instanceof ResultSetParam) {
                final ResultSetParam reqResultSetParam = (ResultSetParam) reqParam;

                if (ParamMode.INPUT != reqResultSetParam.getMode()) {
                    final JAXBElement<ResultSetParam> resParamElement = new JAXBElement<ResultSetParam>(
                            new QName(NS, "ResultSet"), ResultSetParam.class, null);

                    final ResultSetParam resParam = OBJECT_FACTORY.createResultSetParam();

                    resParam.setId(reqResultSetParam.getId());

                    resParam.setName(reqResultSetParam.getName());

                    final ProResultSet proParam = (ProResultSet) proParams.getOutputParameter(resParam.getId());

                    if (proParam != null) {

                        while (proParam.next()) {
                            final Row row = OBJECT_FACTORY.createRow();

                            final ResultSetMetaData rsMetaData = reqResultSetParam.getResultSetMetaData();

                            for (final Serializable fieldMetaData : rsMetaData.getFieldMetaDataList()) {

                                if (fieldMetaData instanceof CharFieldMetaData) {
                                    final CharFieldMetaData charFieldMetaData = (CharFieldMetaData) fieldMetaData;

                                    final int extent = charFieldMetaData.getExtent();

                                    if (extent < 1) {
                                        final JAXBElement<CharField> fieldElement = new JAXBElement<CharField>(
                                                new QName(NS, "Char"), CharField.class, null);

                                        final CharField field = OBJECT_FACTORY.createCharField();

                                        field.setId(charFieldMetaData.getId());

                                        field.setName(charFieldMetaData.getName());

                                        final String value = proParam.getString(field.getId());

                                        if (value != null) {
                                            field.setContent(DatatypeConverter.printString(value));

                                            fieldElement.setValue(field);
                                        } else {
                                            fieldElement.setNil(true);
                                        }

                                        row.getFieldElementList().add(fieldElement);
                                    } else {

                                        for (int i = 1; i <= extent; i++) {
                                            final JAXBElement<CharField> fieldElement = new JAXBElement<CharField>(
                                                    new QName(NS, "Char"), CharField.class, null);

                                            final CharField field = OBJECT_FACTORY.createCharField();

                                            field.setId(charFieldMetaData.getId());

                                            field.setName(charFieldMetaData.getName());

                                            final String value = proParam.getString(field.getId(), i);

                                            if (value != null) {
                                                field.setContent(DatatypeConverter.printString(value));

                                                fieldElement.setValue(field);
                                            } else {
                                                fieldElement.setNil(true);
                                            }

                                            row.getFieldElementList().add(fieldElement);
                                        }

                                    }

                                } else if (fieldMetaData instanceof DateFieldMetaData) {
                                    final DateFieldMetaData dateFieldMetaData = (DateFieldMetaData) fieldMetaData;

                                    final int extent = dateFieldMetaData.getExtent();

                                    if (extent < 1) {
                                        final JAXBElement<DateField> fieldElement = new JAXBElement<DateField>(
                                                new QName(NS, "Date"), DateField.class, null);

                                        final DateField field = OBJECT_FACTORY.createDateField();

                                        field.setId(dateFieldMetaData.getId());

                                        field.setName(dateFieldMetaData.getName());

                                        final Date value = proParam.getDate(field.getId());

                                        if (value != null) {
                                            final Calendar cal = Calendar.getInstance();

                                            cal.setTime(value);

                                            field.setContent(DatatypeConverter.printDate(cal));

                                            fieldElement.setValue(field);
                                        } else {
                                            fieldElement.setNil(true);
                                        }

                                        row.getFieldElementList().add(fieldElement);
                                    } else {

                                        for (int i = 1; i <= extent; i++) {
                                            final JAXBElement<DateField> fieldElement = new JAXBElement<DateField>(
                                                    new QName(NS, "Date"), DateField.class, null);

                                            final DateField field = OBJECT_FACTORY.createDateField();

                                            field.setId(dateFieldMetaData.getId());

                                            field.setName(dateFieldMetaData.getName());

                                            final Date value = proParam.getDate(field.getId(), i);

                                            if (value != null) {
                                                final Calendar cal = Calendar.getInstance();

                                                cal.setTime(value);

                                                field.setContent(DatatypeConverter.printDate(cal));

                                                fieldElement.setValue(field);
                                            } else {
                                                fieldElement.setNil(true);
                                            }

                                            row.getFieldElementList().add(fieldElement);
                                        }

                                    }

                                } else if (fieldMetaData instanceof DateTimeFieldMetaData) {
                                    final DateTimeFieldMetaData dateTimeFieldMetaData = (DateTimeFieldMetaData) fieldMetaData;

                                    final int extent = dateTimeFieldMetaData.getExtent();

                                    if (extent < 1) {
                                        final JAXBElement<DateTimeField> fieldElement = new JAXBElement<DateTimeField>(
                                                new QName(NS, "DateTime"), DateTimeField.class, null);

                                        final DateTimeField field = OBJECT_FACTORY.createDateTimeField();

                                        field.setId(dateTimeFieldMetaData.getId());

                                        field.setName(dateTimeFieldMetaData.getName());

                                        final GregorianCalendar value = (GregorianCalendar) proParam
                                                .getObject(field.getId());

                                        if (value != null) {
                                            field.setContent(DatatypeConverter.printDateTime(value));

                                            fieldElement.setValue(field);
                                        } else {
                                            fieldElement.setNil(true);
                                        }

                                        row.getFieldElementList().add(fieldElement);
                                    } else {

                                        for (int i = 1; i <= extent; i++) {
                                            final JAXBElement<DateTimeField> fieldElement = new JAXBElement<DateTimeField>(
                                                    new QName(NS, "DateTime"), DateTimeField.class, null);

                                            final DateTimeField field = OBJECT_FACTORY.createDateTimeField();

                                            field.setId(dateTimeFieldMetaData.getId());

                                            field.setName(dateTimeFieldMetaData.getName());

                                            final GregorianCalendar value = (GregorianCalendar) proParam
                                                    .getObject(field.getId(), i);

                                            if (value != null) {
                                                field.setContent(DatatypeConverter.printDateTime(value));

                                                fieldElement.setValue(field);
                                            } else {
                                                fieldElement.setNil(true);
                                            }

                                            row.getFieldElementList().add(fieldElement);
                                        }

                                    }

                                } else if (fieldMetaData instanceof DateTimeTZFieldMetaData) {
                                    final DateTimeTZFieldMetaData dateTimeTZFieldMetaData = (DateTimeTZFieldMetaData) fieldMetaData;

                                    final int extent = dateTimeTZFieldMetaData.getExtent();

                                    if (extent < 1) {
                                        final JAXBElement<DateTimeTZField> fieldElement = new JAXBElement<DateTimeTZField>(
                                                new QName(NS, "DateTimeTZ"), DateTimeTZField.class, null);

                                        final DateTimeTZField field = OBJECT_FACTORY.createDateTimeTZField();

                                        field.setId(dateTimeTZFieldMetaData.getId());

                                        field.setName(dateTimeTZFieldMetaData.getName());

                                        final GregorianCalendar value = (GregorianCalendar) proParam
                                                .getObject(field.getId());

                                        if (value != null) {
                                            field.setContent(DatatypeConverter.printDateTime(value));

                                            fieldElement.setValue(field);
                                        } else {
                                            fieldElement.setNil(true);
                                        }

                                        row.getFieldElementList().add(fieldElement);
                                    } else {

                                        for (int i = 1; i <= extent; i++) {
                                            final JAXBElement<DateTimeTZField> fieldElement = new JAXBElement<DateTimeTZField>(
                                                    new QName(NS, "DateTimeTZ"), DateTimeTZField.class, null);

                                            final DateTimeTZField field = OBJECT_FACTORY
                                                    .createDateTimeTZField();

                                            field.setId(dateTimeTZFieldMetaData.getId());

                                            field.setName(dateTimeTZFieldMetaData.getName());

                                            final GregorianCalendar value = (GregorianCalendar) proParam
                                                    .getObject(field.getId(), i);

                                            if (value != null) {
                                                field.setContent(DatatypeConverter.printDateTime(value));

                                                fieldElement.setValue(field);
                                            } else {
                                                fieldElement.setNil(true);
                                            }

                                            row.getFieldElementList().add(fieldElement);
                                        }

                                    }

                                } else if (fieldMetaData instanceof DecFieldMetaData) {
                                    final DecFieldMetaData decFieldMetaData = (DecFieldMetaData) fieldMetaData;

                                    final int extent = decFieldMetaData.getExtent();

                                    if (extent < 1) {
                                        final JAXBElement<DecField> fieldElement = new JAXBElement<DecField>(
                                                new QName(NS, "Dec"), DecField.class, null);

                                        final DecField field = OBJECT_FACTORY.createDecField();

                                        field.setId(decFieldMetaData.getId());

                                        field.setName(decFieldMetaData.getName());

                                        final BigDecimal value = proParam.getBigDecimal(field.getId());

                                        if (value != null) {
                                            field.setContent(DatatypeConverter.printDecimal(value));

                                            fieldElement.setValue(field);
                                        } else {
                                            fieldElement.setNil(true);
                                        }

                                        row.getFieldElementList().add(fieldElement);
                                    } else {

                                        for (int i = 1; i <= extent; i++) {
                                            final JAXBElement<DecField> fieldElement = new JAXBElement<DecField>(
                                                    new QName(NS, "Dec"), DecField.class, null);

                                            final DecField field = OBJECT_FACTORY.createDecField();

                                            field.setId(decFieldMetaData.getId());

                                            field.setName(decFieldMetaData.getName());

                                            final BigDecimal value = proParam.getBigDecimal(field.getId(), i,
                                                    0);

                                            if (value != null) {
                                                field.setContent(DatatypeConverter.printDecimal(value));

                                                fieldElement.setValue(field);
                                            } else {
                                                fieldElement.setNil(true);
                                            }

                                            row.getFieldElementList().add(fieldElement);
                                        }

                                    }

                                } else if (fieldMetaData instanceof IntFieldMetaData) {
                                    final IntFieldMetaData intFieldMetaData = (IntFieldMetaData) fieldMetaData;

                                    final int extent = intFieldMetaData.getExtent();

                                    if (extent < 1) {
                                        final JAXBElement<IntField> fieldElement = new JAXBElement<IntField>(
                                                new QName(NS, "Int"), IntField.class, null);

                                        final IntField field = OBJECT_FACTORY.createIntField();

                                        field.setId(intFieldMetaData.getId());

                                        field.setName(intFieldMetaData.getName());

                                        final String value = proParam.getString(field.getId());

                                        if (value != null) {
                                            field.setContent(
                                                    DatatypeConverter.printInt(Integer.parseInt(value)));

                                            fieldElement.setValue(field);
                                        } else {
                                            fieldElement.setNil(true);
                                        }

                                        row.getFieldElementList().add(fieldElement);
                                    } else {

                                        for (int i = 1; i <= extent; i++) {
                                            final JAXBElement<IntField> fieldElement = new JAXBElement<IntField>(
                                                    new QName(NS, "Int"), IntField.class, null);

                                            final IntField field = OBJECT_FACTORY.createIntField();

                                            field.setId(intFieldMetaData.getId());

                                            field.setName(intFieldMetaData.getName());

                                            final String value = proParam.getString(field.getId(), i);

                                            if (value != null) {
                                                field.setContent(
                                                        DatatypeConverter.printInt(Integer.parseInt(value)));

                                                fieldElement.setValue(field);
                                            } else {
                                                fieldElement.setNil(true);
                                            }

                                            row.getFieldElementList().add(fieldElement);
                                        }

                                    }

                                } else if (fieldMetaData instanceof LogFieldMetaData) {
                                    final LogFieldMetaData logFieldMetaData = (LogFieldMetaData) fieldMetaData;

                                    final int extent = logFieldMetaData.getExtent();

                                    if (extent < 1) {
                                        final JAXBElement<LogField> fieldElement = new JAXBElement<LogField>(
                                                new QName(NS, "Log"), LogField.class, null);

                                        final LogField field = OBJECT_FACTORY.createLogField();

                                        field.setId(logFieldMetaData.getId());

                                        field.setName(logFieldMetaData.getName());

                                        final String value = proParam.getString(field.getId());

                                        if (value != null) {
                                            field.setContent(
                                                    DatatypeConverter.printBoolean(Boolean.valueOf(value)));

                                            fieldElement.setValue(field);
                                        } else {
                                            fieldElement.setNil(true);
                                        }

                                        row.getFieldElementList().add(fieldElement);
                                    } else {

                                        for (int i = 1; i <= extent; i++) {
                                            final JAXBElement<LogField> fieldElement = new JAXBElement<LogField>(
                                                    new QName(NS, "Log"), LogField.class, null);

                                            final LogField field = OBJECT_FACTORY.createLogField();

                                            field.setId(logFieldMetaData.getId());

                                            field.setName(logFieldMetaData.getName());

                                            final String value = proParam.getString(field.getId(), i);

                                            if (value != null) {
                                                field.setContent(
                                                        DatatypeConverter.printBoolean(Boolean.valueOf(value)));

                                                fieldElement.setValue(field);
                                            } else {
                                                fieldElement.setNil(true);
                                            }

                                            row.getFieldElementList().add(fieldElement);
                                        }

                                    }

                                }

                            }

                            resParam.getRowList().add(row);
                        }

                        resParamElement.setValue(resParam);
                    } else {
                        resParamElement.setNil(true);
                    }

                    res.getParamElementList().add(resParamElement);
                }

            }

        }

        final Document doc = builder.newDocument();

        marshaller.marshal(res, doc);

        exchange.getOut().setBody(doc);
    } catch (final RunTime4GLErrorException e) {
        LOG.error(e.getProcReturnString(), e);

        throw new OpenEdgeException(e.getProcReturnString(), e);
    }

}

From source file:org.openhie.openempi.openpixpdq.v3.util.HL7PatientTransforms.java

public static org.hl7.v3.PRPAMT201301UV02Patient create201301Patient(PRPAMT201306UV02ParameterList paramList,
        String aaId) {/*from   w w w.j  ava  2s  . c  o m*/
    PRPAMT201301UV02Patient result = new PRPAMT201301UV02Patient();

    PRPAMT201301UV02Person person = new PRPAMT201301UV02Person();

    if (paramList == null) {
        return null;
    }
    // Set the Subject Gender Code
    if (paramList.getLivingSubjectAdministrativeGender() != null
            && paramList.getLivingSubjectAdministrativeGender().size() > 0) {
        CE genderCode = paramList.getLivingSubjectAdministrativeGender().get(0).getValue().get(0);

        person.setAdministrativeGenderCode(genderCode);
    }

    // Set the Subject Birth Time
    if (paramList.getLivingSubjectBirthTime() != null && paramList.getLivingSubjectBirthTime().size() > 0) {

        person.setBirthTime(createBirthTime(paramList.getLivingSubjectBirthTime().get(0)));
    }
    // Set the address
    if (paramList.getPatientAddress() != null && paramList.getPatientAddress().size() > 0) {
        for (PRPAMT201306UV02PatientAddress patAdd : paramList.getPatientAddress()) {
            for (ADExplicit newAdd : patAdd.getValue()) {
                person.getAddr().add(newAdd);
            }
        }
    }
    //Set the telcom
    if (paramList.getPatientTelecom() != null && paramList.getPatientTelecom().size() > 0) {
        for (PRPAMT201306UV02PatientTelecom telcom : paramList.getPatientTelecom()) {
            if (telcom != null) {
                for (TELExplicit newTelcom : telcom.getValue()) {
                    person.getTelecom().add(newTelcom);
                }
            }

        }
    }

    // Set the Subject Name
    if (paramList.getLivingSubjectName() != null && paramList.getLivingSubjectName().size() > 0) {
        for (PRPAMT201306UV02LivingSubjectName subjName : paramList.getLivingSubjectName()) {

            for (ENExplicit name : subjName.getValue()) {
                PNExplicit newName = HL7DataTransformHelper.convertENtoPN(name);
                newName = HL7ArrayTransforms.copyNullFlavors(name, newName);
                person.getName().add(newName);
            }
        }
        //paramList.getLivingSubjectName().get(index)
    }

    // Set the subject Id
    if (paramList.getLivingSubjectId() != null && paramList.getLivingSubjectId().size() > 0) {
        for (PRPAMT201306UV02LivingSubjectId subjId : paramList.getLivingSubjectId()) {
            for (II id : subjId.getValue()) {
                if (id.getRoot().equalsIgnoreCase(aaId)) {
                    result.getId().add(id);
                } else {
                    PRPAMT201301UV02OtherIDs otherId = new PRPAMT201301UV02OtherIDs();
                    otherId.getId().add(id);
                    person.getAsOtherIDs().add(otherId);
                }
            }
        }
    }

    person = HL7ArrayTransforms.copyNullFlavors(paramList, person);

    javax.xml.namespace.QName xmlqname = new javax.xml.namespace.QName("urn:hl7-org:v3", "patientPerson");
    JAXBElement<PRPAMT201301UV02Person> jaxbPerson = new JAXBElement<PRPAMT201301UV02Person>(xmlqname,
            PRPAMT201301UV02Person.class, person);

    jaxbPerson.setValue(person);

    result.setPatientPerson(jaxbPerson);

    return result;
}