/
XML コネクタでの動的属性の定義方法
XML コネクタでの動的属性の定義方法
ここでは、XML バックエンドに属性を動的に送信する方法を示します。
java
<FieldName Currency="<VALUE>">0</FieldName>
SDK プロジェクトに新しいクラスを作成します。
このクラスで名前が値と異なるすべてのフィールドは、動的属性として生成されます。
例、動的属性として「通貨」 がある XmlEntityMeasuresRequest.java ファイル
package com.test_sdk.openlegacy;
import java.math.BigDecimal;
import org.openlegacy.core.annotations.common.Attribute;
import org.openlegacy.core.annotations.common.FieldAttributes;
import org.openlegacy.core.annotations.rpc.Direction;
import org.openlegacy.core.annotations.rpc.RpcField;
import org.openlegacy.core.annotations.rpc.RpcNumericField;
import org.openlegacy.core.annotations.rpc.RpcPart;
import org.openlegacy.core.rest.RestConst;
@RpcPart(name = "XmlEntityMeasuresRequest")
public class XmlEntityMeasuresRequest {
@FieldAttributes(attributes = {
@Attribute(key = RestConst.XML_ATTRIBUTE, value = "true")
})
@RpcField(originalName = "Currency")
private String currency;
@FieldAttributes(attributes = {
@Attribute(key = RestConst.XML_PARENT_VALUE, value = "true")
})
@RpcField(direction = Direction.INPUT, originalName = "value")
@RpcNumericField(decimalPlaces = 0)
private BigDecimal value;
}
フィールドには、以下の動的属性が必要です。
「DataType」属性を除く、すべての属性を削除します。
「DataType」属性名は、ol-xml.yml
ファイルの「typeAttribute: データ型」で説明されています。
削除された属性はクラスに追加する必要があります。
b.数値フィールドの @RpcNumericField
アノテーション(注釈)を削除します。
例、BigDecimal
データ型の measures
フィールドは以下から変更されました。
java
@FieldAttributes(attributes = {
@Attribute(key = "Currency", value = "2"),
@Attribute(key = "DataType", value = "Numeric")
})
@RpcField(direction = Direction.INPUT, originalName = "Measures")
@RpcNumericField(decimalPlaces = 0)
private BigDecimal measures;
以下へ変更:
java
@FieldAttributes(attributes = {
@Attribute(key = "DataType", value = "Numeric")
})
@RpcField(direction = Direction.INPUT, originalName = "Measures")
private XmlEntityMeasuresRequest measures;
結果 - 通貨属性は動的となりました。
java
<Measures DataType="Numeric" Currency="<VALUE>">0</Measures>
, multiple selections available,
Related content
動的リストとの連係方法 - 自動化方法
動的リストとの連係方法 - 自動化方法
More like this
CICS ヘッダープロパティの設定方法
CICS ヘッダープロパティの設定方法
More like this
How to Define Dynamic Attributes in XML connector
How to Define Dynamic Attributes in XML connector
More like this
概念およびアーキテクチャ
概念およびアーキテクチャ
More like this
API プロジェクト - マイクロサービス
API プロジェクト - マイクロサービス
More like this
RPC エンティティ
RPC エンティティ
More like this