org.apache.axiom.om.OMFactory Java Examples

The following examples show how to use org.apache.axiom.om.OMFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StockQuoteHandler.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new order for a quantiry of a stock at a given price
 * <m:placeOrder xmlns:m="http://services.samples">
 *	  <m:order>
 *	      <m:price>3.141593E0</m:price>
 *	      <m:quantity>4</m:quantity>
 *	      <m:symbol>IBM</m:symbol>
 *    </m:order>
 * 	</m:placeOrder>
 *
 * @param purchPrice the purchase price
 * @param qty the quantiry
 * @param symbol the stock
 * @return an OMElement payload for the order
 */
public static OMElement createPlaceOrderRequest(double purchPrice, int qty, String symbol) {
    OMFactory factory   = OMAbstractFactory.getOMFactory();
    OMNamespace ns      = factory.createOMNamespace("http://services.samples", "m0");
    OMElement placeOrder= factory.createOMElement("placeOrder", ns);
    OMElement order     = factory.createOMElement("order", ns);
    OMElement price     = factory.createOMElement("price", ns);
    OMElement quantity  = factory.createOMElement("quantity", ns);
    OMElement symb      = factory.createOMElement("symbol", ns);
    price.setText(Double.toString(purchPrice));
    quantity.setText(Integer.toString(qty));
    symb.setText(symbol);
    order.addChild(price);
    order.addChild(quantity);
    order.addChild(symb);
    placeOrder.addChild(order);        
    return placeOrder;
}
 
Example #2
Source File: StockQuoteHandler.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Create a new market activity request with a body as follows
 *  <m:getMarketActivity xmlns:m="http://services.samples">
 *      <m:request>
 *          <m:symbol>IBM</m:symbol>
 *          ...
 *          <m:symbol>MSFT</m:symbol>
 *      </m:request>
 *  </m:getMarketActivity>
 * @return OMElement for SOAP body
 */
public static OMElement createMarketActivityRequest() {
    OMFactory factory   = OMAbstractFactory.getOMFactory();
    OMNamespace ns      = factory.createOMNamespace("http://services.samples", "m0");
    OMElement getQuote  = factory.createOMElement("getMarketActivity", ns);
    OMElement request   = factory.createOMElement("request", ns);

    OMElement symb = null;
    for (int i=0; i<100; i++) {
        symb = factory.createOMElement("symbols", ns);
        symb.setText(randomString(3));
        request.addChild(symb);
    }

    getQuote.addChild(request);
    return getQuote;
}
 
Example #3
Source File: Sample701TestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
private OMElement createPayload() {   // creation of payload for placeOrder

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://services.samples", "urn");
        OMNamespace xsdNs = fac.createOMNamespace("http://services.samples", "xsd");
        OMElement payload = fac.createOMElement("placeOrder", omNs);
        OMElement order = fac.createOMElement("order", omNs);

        OMElement price = fac.createOMElement("price", xsdNs);
        price.setText("10");
        OMElement quantity = fac.createOMElement("quantity", xsdNs);
        quantity.setText("100");
        OMElement symbol = fac.createOMElement("symbol", xsdNs);
        symbol.setText("WSO2");

        order.addChild(price);
        order.addChild(quantity);
        order.addChild(symbol);
        payload.addChild(order);
        return payload;
    }
 
Example #4
Source File: ESBJAVA_4239_AccessHTTPSCAfterCallout.java    From product-ei with Apache License 2.0 6 votes vote down vote up
public static OMElement createPlaceOrderRequest(double purchPrice, int qty, String symbol) {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
    OMElement placeOrder = factory.createOMElement("placeOrder", ns);
    OMElement order = factory.createOMElement("order", ns);
    OMElement price = factory.createOMElement("price", ns);
    OMElement quantity = factory.createOMElement("quantity", ns);
    OMElement symb = factory.createOMElement("symbol", ns);
    price.setText(Double.toString(purchPrice));
    quantity.setText(Integer.toString(qty));
    symb.setText(symbol);
    order.addChild(price);
    order.addChild(quantity);
    order.addChild(symb);
    placeOrder.addChild(order);
    return placeOrder;
}
 
Example #5
Source File: SOAPClient.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * Sends a SOAP message with MTOM attachment and returns response as a OMElement.
 *
 * @param fileName   name of file to be sent as an attachment
 * @param targetEPR  service url
 * @param soapAction SOAP Action to set. Specify with "urn:"
 * @return OMElement response from BE service
 * @throws AxisFault in case of an invocation failure
 */
public OMElement sendSOAPMessageWithAttachment(String fileName, String targetEPR, String soapAction) throws AxisFault {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
    OMElement payload = factory.createOMElement("uploadFileUsingMTOM", ns);
    OMElement request = factory.createOMElement("request", ns);
    OMElement image = factory.createOMElement("image", ns);

    FileDataSource fileDataSource = new FileDataSource(new File(fileName));
    DataHandler dataHandler = new DataHandler(fileDataSource);
    OMText textData = factory.createOMText(dataHandler, true);
    image.addChild(textData);
    request.addChild(image);
    payload.addChild(request);

    ServiceClient serviceClient = new ServiceClient();
    Options options = new Options();
    options.setTo(new EndpointReference(targetEPR));
    options.setAction(soapAction);
    options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
    options.setCallTransportCleanup(true);
    serviceClient.setOptions(options);
    return serviceClient.sendReceive(payload);
}
 
Example #6
Source File: QuerySerializer.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public static void serializeCallQuery(CallQuery callQuery,
                                         OMElement parentEl, OMFactory fac) {
	OMElement callQueryEl, withParamEl;
	Set<String> requiredRoles;
       callQueryEl = fac.createOMElement(new QName(DBSFields.CALL_QUERY));
       callQueryEl.addAttribute(DBSFields.HREF, callQuery.getQueryId(), null);
       requiredRoles = callQuery.getRequiredRoles();
       if (requiredRoles != null && requiredRoles.size() > 0) {
           callQueryEl.addAttribute(DBSFields.REQUIRED_ROLES,
                   getRequiredRolesString(requiredRoles), null);
       }
       for (WithParam withParam : callQuery.getWithParams().values()) {
           withParamEl = fac.createOMElement(new QName(DBSFields.WITH_PARAM));
           withParamEl.addAttribute(DBSFields.NAME, withParam.getName(), null);
           withParamEl.addAttribute(withParam.getParamType(), withParam.getParam(), null);
           callQueryEl.addChild(withParamEl);
       }
       parentEl.addChild(callQueryEl);
}
 
Example #7
Source File: DeactivatedCappMPBehaviourOnRestartTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private OMElement createPlaceOrderRequest(double purchPrice, int qty, String symbol) {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
    OMElement placeOrder = factory.createOMElement("placeOrder", ns);
    OMElement order = factory.createOMElement("order", ns);
    OMElement price = factory.createOMElement("price", ns);
    OMElement quantity = factory.createOMElement("quantity", ns);
    OMElement symb = factory.createOMElement("symbol", ns);
    price.setText(Double.toString(purchPrice));
    quantity.setText(Integer.toString(qty));
    symb.setText(symbol);
    order.addChild(price);
    order.addChild(quantity);
    order.addChild(symb);
    placeOrder.addChild(order);
    return placeOrder;
}
 
Example #8
Source File: StockQuoteClient.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Create place order request
 *
 * @param purchasePrice purchase price
 * @param qty           quantity
 * @param symbol        symbol
 * @return OMElement of request
 */
public OMElement createPlaceOrderRequest(double purchasePrice, int qty, String symbol) {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
    OMElement placeOrder = factory.createOMElement("placeOrder", ns);
    OMElement order = factory.createOMElement("order", ns);
    OMElement price = factory.createOMElement("price", ns);
    OMElement quantity = factory.createOMElement("quantity", ns);
    OMElement symb = factory.createOMElement("symbol", ns);
    price.setText(Double.toString(purchasePrice));
    quantity.setText(Integer.toString(qty));
    symb.setText(symbol);
    order.addChild(price);
    order.addChild(quantity);
    order.addChild(symb);
    placeOrder.addChild(order);
    return placeOrder;
}
 
Example #9
Source File: RahasUtil.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
public static Parameter getTokenCancelerConfigParameter() {

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMElement paramElem = fac.createOMElement(new QName("parameter"), null);
        paramElem.addAttribute(fac.createOMAttribute("name",
                null,
                TokenCancelerConfig.TOKEN_CANCELER_CONFIG.
                        getLocalPart()));
        paramElem.addAttribute(fac.createOMAttribute("type",
                null, Integer.toString(Parameter.OM_PARAMETER).
                        toString()));

        fac.createOMElement(TokenCancelerConfig.TOKEN_CANCELER_CONFIG,
                paramElem);
        Parameter param = new Parameter();
        param.setName(TokenCancelerConfig.TOKEN_CANCELER_CONFIG.getLocalPart());
        param.setParameterElement(paramElem);
        param.setValue(paramElem);
        param.setParameterType(Parameter.OM_PARAMETER);
        return param;
    }
 
Example #10
Source File: DiscoveryOMUtils.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private static OMElement serializeQNamesList(QName[] qnames, QName topElement,
                                            OMFactory factory) {

    OMElement wrapperElement = factory.createOMElement(topElement);
    StringBuffer qnamesTxt = new StringBuffer();
    boolean firstEntry = true;
    for (QName qname : qnames) {
        if (!firstEntry) {
            qnamesTxt.append(" ");
        }

        OMNamespace ns = wrapperElement.declareNamespace(qname.getNamespaceURI(),
                qname.getPrefix());
        qnamesTxt.append(ns.getPrefix() + ":" + qname.getLocalPart());
        firstEntry = false;
    }
    wrapperElement.setText(qnamesTxt.toString());
    return wrapperElement;
}
 
Example #11
Source File: APIThrottleHandler.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
private OMElement getFaultPayload(int throttleErrorCode, String message, String description) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace ns = fac.createOMNamespace(APIThrottleConstants.API_THROTTLE_NS,
                                           APIThrottleConstants.API_THROTTLE_NS_PREFIX);
    OMElement payload = fac.createOMElement("fault", ns);

    OMElement errorCode = fac.createOMElement("code", ns);
    errorCode.setText(String.valueOf(throttleErrorCode));
    OMElement errorMessage = fac.createOMElement("message", ns);
    errorMessage.setText(message);
    OMElement errorDetail = fac.createOMElement("description", ns);
    errorDetail.setText(description);

    payload.addChild(errorCode);
    payload.addChild(errorMessage);
    payload.addChild(errorDetail);
    return payload;
}
 
Example #12
Source File: ESBJAVA_4239_AccessHTTPSCAfterCallout.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
public static OMElement createPlaceOrderRequest(double purchPrice, int qty, String symbol) {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("http://services.samples", "m0");
    OMElement placeOrder = factory.createOMElement("placeOrder", ns);
    OMElement order = factory.createOMElement("order", ns);
    OMElement price = factory.createOMElement("price", ns);
    OMElement quantity = factory.createOMElement("quantity", ns);
    OMElement symb = factory.createOMElement("symbol", ns);
    price.setText(Double.toString(purchPrice));
    quantity.setText(Integer.toString(qty));
    symb.setText(symbol);
    order.addChild(price);
    order.addChild(quantity);
    order.addChild(symb);
    placeOrder.addChild(order);
    return placeOrder;
}
 
Example #13
Source File: Sample702TestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private OMElement createPayload() {   // creation of payload for placeOrder

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ser");
        OMNamespace xsdNs = fac.createOMNamespace("http://services.samples", "xsd");
        OMElement payload = fac.createOMElement("placeOrder", omNs);
        OMElement order = fac.createOMElement("order", omNs);

        OMElement price = fac.createOMElement("price", xsdNs);
        price.setText("10");
        OMElement quantity = fac.createOMElement("quantity", xsdNs);
        quantity.setText("100");
        OMElement symbol = fac.createOMElement("symbol", xsdNs);
        symbol.setText("WSO2");

        order.addChild(price);
        order.addChild(quantity);
        order.addChild(symbol);
        payload.addChild(order);
        return payload;
    }
 
Example #14
Source File: TableReportMetaDataHandler.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private void createTableReportColumnData(int id, ColumnDTO column) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMElement columnElement = fac.createOMElement(new QName(COLUMN));

    OMElement columnId = fac.createOMElement(new QName(COLUMN_ID));
    columnId.setText(String.valueOf(id));
    columnElement.addChild(columnId);

    OMElement columnTable = fac.createOMElement(new QName(COLUMN_DATA_TABLE));
    columnTable.setText(column.getColumnFamilyName());
    columnElement.addChild(columnTable);

    OMElement columnField = fac.createOMElement(new QName(COLUMN_DATA_FIELD));
    columnField.setText(column.getColumnName());
    columnElement.addChild(columnField);

    OMElement primaryColElement = fac.createOMElement(new QName(PRIMARY_COLUMN));
    if (column.isPrimaryColumn()) {
        primaryColElement.setText(PRIMARY_COLUMN_TRUE);
    } else {
        primaryColElement.setText(PRIMARY_COLUMN_FALSE);
    }
    columnElement.addChild(primaryColElement);

    tableReportElement.addChild(columnElement);
}
 
Example #15
Source File: Sample700TestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private OMElement createPayload() {   // creation of payload for placeOrder

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ser");
        OMNamespace xsdNs = fac.createOMNamespace("http://services.samples", "xsd");
        OMElement payload = fac.createOMElement("placeOrder", omNs);
        OMElement order = fac.createOMElement("order", omNs);

        OMElement price = fac.createOMElement("price", xsdNs);
        price.setText("10");
        OMElement quantity = fac.createOMElement("quantity", xsdNs);
        quantity.setText("100");
        OMElement symbol = fac.createOMElement("symbol", xsdNs);
        symbol.setText("WSO2");

        order.addChild(price);
        order.addChild(quantity);
        order.addChild(symbol);
        payload.addChild(order);
        return payload;
    }
 
Example #16
Source File: Sample705TestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private OMElement createPayload() {   // creation of payload for placeOrder

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ser");
        OMNamespace xsdNs = fac.createOMNamespace("http://services.samples", "xsd");
        OMElement payload = fac.createOMElement("placeOrder", omNs);
        OMElement order = fac.createOMElement("order", omNs);

        OMElement price = fac.createOMElement("price", xsdNs);
        price.setText("10");
        OMElement quantity = fac.createOMElement("quantity", xsdNs);
        quantity.setText("100");
        OMElement symbol = fac.createOMElement("symbol", xsdNs);
        symbol.setText("WSO2");

        order.addChild(price);
        order.addChild(quantity);
        order.addChild(symbol);
        payload.addChild(order);
        return payload;
    }
 
Example #17
Source File: TestUtils.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private static OMElement getPayload(String opName,
		List<List<String>> params) {
	OMFactory omFac = OMAbstractFactory.getOMFactory();
	OMNamespace omNs = omFac.createOMNamespace(
			"http://example1.org/example1", "example1");
	OMElement method = omFac.createOMElement(opName, omNs);

	if (params != null) {
		OMElement paramEl = null;
		for (List<String> list : params) {
			paramEl = omFac.createOMElement(list.get(0), omNs);
			paramEl.setText(list.get(1));
			method.addChild(paramEl);
		}
	}
	return method;
}
 
Example #18
Source File: GSpreadDataServiceTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.dss" }, invocationCount = 5, enabled = true)
public void selectOperation() throws AxisFault, XPathExpressionException {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac
            .createOMNamespace("http://ws.wso2.org/dataservice/samples/gspread_sample_service", "ns1");
    OMElement payload = fac.createOMElement("getCustomers", omNs);

    OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName), "getcustomers");
    log.info("Response : " + result);
    Assert.assertTrue((result.toString().indexOf("Customers") == 1),
            "Expected Result not found on response message");
    Assert.assertTrue(result.toString().contains("<customerNumber>"),
            "Expected Result not found on response message");
    Assert.assertTrue(result.toString().contains("</Customer>"), "Expected Result not found on response message");

    log.info("Service Invocation success");
}
 
Example #19
Source File: AGSpreadDataServiceTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@Test(groups = { "wso2.dss" }, invocationCount = 5, enabled = false)
public void selectOperation() throws AxisFault, XPathExpressionException {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac
            .createOMNamespace("http://ws.wso2.org/dataservice/samples/gspread_sample_service", "ns1");
    OMElement payload = fac.createOMElement("getCustomers", omNs);

    OMElement result = new AxisServiceClient().sendReceive(payload, getServiceUrlHttp(serviceName), "getcustomers");
    log.info("Response : " + result);
    Assert.assertTrue((result.toString().indexOf("Customers") == 1),
            "Expected Result not found on response message");
    Assert.assertTrue(result.toString().contains("<customerNumber>"),
            "Expected Result not found on response message");
    Assert.assertTrue(result.toString().contains("</Customer>"), "Expected Result not found on response message");

    log.info("Service Invocation success");
}
 
Example #20
Source File: GraphQLQueryAnalysisHandler.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * @param errorCodeValue error code
 * @param message        fault message
 * @param description    description of the fault message
 * @return the OMElement
 */
private OMElement getFaultPayload(int errorCodeValue, String message, String description) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace ns = fac.createOMNamespace(APISecurityConstants.API_SECURITY_NS,
            APISecurityConstants.API_SECURITY_NS_PREFIX);
    OMElement payload = fac.createOMElement("fault", ns);

    OMElement errorCode = fac.createOMElement("code", ns);
    errorCode.setText(errorCodeValue + "");
    OMElement errorMessage = fac.createOMElement("message", ns);
    errorMessage.setText(message);
    OMElement errorDetail = fac.createOMElement("description", ns);
    errorDetail.setText(description);

    payload.addChild(errorCode);
    payload.addChild(errorMessage);
    payload.addChild(errorDetail);
    return payload;
}
 
Example #21
Source File: AbstractChartJrxmlHandler.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private void setValueAxisLabel(String chartText, String chartPlotText, ChartReportDTO chartReport)
        throws JaxenException {
    AXIOMXPath xpathExpression = new AXIOMXPath("//a:title//a:" + chartText + "//a:" + chartPlotText +
            "//a:valueAxisLabelExpression");
    xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
    OMElement documentElement = document.getOMDocumentElement();
    List nodeList = xpathExpression.selectNodes(documentElement);
    OMElement label = (OMElement) nodeList.get(0);

    label.setText("");
    OMFactory factory = document.getOMFactory();
    OMText cdataField = factory.createOMText(label, "\"" + chartReport.getyAxisLabel() + "\"",
            OMText.CDATA_SECTION_NODE);
    label.addChild(cdataField);

}
 
Example #22
Source File: GraphQLAPIHandler.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * @param description description of the error
 * @return the OMElement
 */
private OMElement getFaultPayload(String description) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace ns = fac.createOMNamespace(APISecurityConstants.API_SECURITY_NS,
            APISecurityConstants.API_SECURITY_NS_PREFIX);
    OMElement payload = fac.createOMElement("fault", ns);

    OMElement errorCode = fac.createOMElement("code", ns);
    errorCode.setText(APISecurityConstants.GRAPHQL_INVALID_QUERY + "");
    OMElement errorMessage = fac.createOMElement("message", ns);
    errorMessage.setText(APISecurityConstants.GRAPHQL_INVALID_QUERY_MESSAGE);
    OMElement errorDetail = fac.createOMElement("description", ns);
    errorDetail.setText(description);

    payload.addChild(errorCode);
    payload.addChild(errorMessage);
    payload.addChild(errorDetail);
    return payload;
}
 
Example #23
Source File: DataServiceSqlDriverTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private OMElement updateRecord(String idNum) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "dat");
    OMElement payload = fac.createOMElement("Update", omNs);

    OMElement id = fac.createOMElement("id", omNs);
    OMElement mod = fac.createOMElement("mod", omNs);
    OMElement classname = fac.createOMElement("classname", omNs);
    id.setText(idNum);
    mod.setText("mod1112" + idNum);
    classname.setText("org.wso2.carbon.dss.test2");
    payload.addChild(id);
    payload.addChild(mod);
    payload.addChild(classname);

    return payload;
}
 
Example #24
Source File: OutputMappingAsAttributeDataServiceTestCase.java    From product-ei with Apache License 2.0 6 votes vote down vote up
private OMElement getPayloadAddOffice(String officeCode, String city, String state,
                                      String territory) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1");
    OMElement payload = fac.createOMElement("addOffice", omNs);

    OMElement officeCodeOme = fac.createOMElement("officeCode", omNs);
    officeCodeOme.setText(officeCode);
    payload.addChild(officeCodeOme);

    OMElement cityOme = fac.createOMElement("city", omNs);
    cityOme.setText(city);
    payload.addChild(cityOme);

    OMElement stateOme = fac.createOMElement("state", omNs);
    stateOme.setText(state);
    payload.addChild(stateOme);

    OMElement territoryOme = fac.createOMElement("territory", omNs);
    territoryOme.setText(territory);
    payload.addChild(territoryOme);

    return payload;
}
 
Example #25
Source File: AbstractChartJrxmlHandler.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
private void setCategoryExpr(String XField, OMElement categorySeriesElement, String xExpressionText)
        throws JaxenException {
    Iterator iter = categorySeriesElement.getChildrenWithName(new QName(xExpressionText));
    OMElement aCatExpr = (OMElement) iter.next();

    aCatExpr.setText("");
    OMFactory factory = document.getOMFactory();
    OMText cdataField = factory.createOMText(aCatExpr, "$F{" + XField + "}", OMText.CDATA_SECTION_NODE);
    aCatExpr.addChild(cdataField);

}
 
Example #26
Source File: TcpClient.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private OMElement createStandardRequest(String symbol) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);
    OMElement value1 = fac.createOMElement("request", omNs);
    OMElement value2 = fac.createOMElement("symbol", omNs);

    value2.addChild(fac.createOMText(value1, symbol));
    value1.addChild(value2);
    method.addChild(value1);

    return method;
}
 
Example #27
Source File: SecureStockQuoteClient.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private OMElement createStandardRequest(String symbol) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace("http://services.samples", "ns");
    OMElement method = fac.createOMElement("getQuote", omNs);
    OMElement value1 = fac.createOMElement("request", omNs);
    OMElement value2 = fac.createOMElement("symbol", omNs);

    value2.addChild(fac.createOMText(value1, symbol));
    value1.addChild(value2);
    method.addChild(value1);

    return method;
}
 
Example #28
Source File: FIXClient.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private static OMElement getHeader(OMFactory factory) {
    OMElement header = factory.createOMElement("header", null);

    OMElement msgType = factory.createOMElement("field", null);
    msgType.addAttribute(factory.createOMAttribute("id", null, "35"));
    factory.createOMText(msgType, "D");
    header.addChild(msgType);

    OMElement sendingTime  = factory.createOMElement("field", null);
    sendingTime.addAttribute(factory.createOMAttribute("id", null, "52"));
    factory.createOMText(sendingTime, new Date().toString());
    header.addChild(sendingTime);

    return header;
}
 
Example #29
Source File: ScheduleRemoveEvents.java    From garoon-google with MIT License 5 votes vote down vote up
@Override
public OMElement getParameters() {
       OMFactory omFactory = OMAbstractFactory.getOMFactory();
       OMElement parameters = omFactory.createOMElement("parameters", null);
       for( Integer id : ids ){
       	OMElement eventIdNode = omFactory.createOMElement("event_id", null);
       	eventIdNode.setText(id.toString());
       	parameters.addChild(eventIdNode);
       }
	return parameters;
}
 
Example #30
Source File: FIXClient.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private static OMElement getHeader(OMFactory factory) {
    OMElement header = factory.createOMElement("header", null);

    OMElement msgType = factory.createOMElement("field", null);
    msgType.addAttribute(factory.createOMAttribute("id", null, "35"));
    factory.createOMText(msgType, "D");
    header.addChild(msgType);

    OMElement sendingTime  = factory.createOMElement("field", null);
    sendingTime.addAttribute(factory.createOMAttribute("id", null, "52"));
    factory.createOMText(sendingTime, new Date().toString());
    header.addChild(sendingTime);

    return header;
}