...
概要
RPC entities are Plain Java Objects that are used as models for Mainframe and AS400 RPC programs, SOAP Services, Stored Procedures, etc.
Structure
The RPC Entity comprises of three main parts: RPC Field, RPC Part and an enclosing RPC Entity.
RPC Field - is an ordinary Java field annotated with @RpcField
annotation. It should represent a field of the backend program.
RPC Fields can be organized with RPC Parts which represent the backend's program structure object. An RPC Part is a Java class or static nested class annotated with @RpcPart
annotation.
The code snippet on the right is an example of the basic RPC Entity structure. RPC Fields are enclosed in the RPC Part (not obligatory) which is then enclosed in the RPC Entity, together with another RPC Field. The hierarchy of the nested Parts is not limited to a specific number of layers or Java static nested classes. An RPC Part can also be defined as a separate class. According to OpenLegacy terminology, this kind of class is called an External RPC Part. An RPC Field can be any Java type in accordance to legacy type conventions.
An enclosing RPC Entity forms a representation of a single backend program (input, output and metadata) that should be executed by the SDK Project.
The definition and behavior of an RPC Entity can be defined by various properties such as @RpcActions
, @Actions
, @RpcNavigation
, etc.
Rpc Entityエンティティとは、メインフレームおよび AS400 RPC プログラム、SOAP サービス、ストアドプロシージャなどのモデルとして使用されるプレーン Java オブジェクトです。
構造
RPC エンティティは 、RPC フィールド、RPC パートおよび包含する RPC エンティティの 3 つの主要なパートで構成されます。
RPC フィールド - @RpcField
に注釈が付けられた普通の Java フィールド。バックエンドプログラムのフィールドを表わす必要があります。
RPC フィールドは、バックエンドのプログラム構造オブジェクトを表わす RPC パートで体系化できます。RPC パートは、@RpcPart
に注釈が付けられた Java クラス または 静的ネストクラス です。
右の コードスニペットは基本的な RPC エンティティ構造の例です。RPC フィールドは RPC パート(必須ではない)に包含され、次に RPC エンティティに別の RPC フィールドとともに包含されます。ネストパートの階層は、特定数のレイヤまたは Java 静的ネストクラスに制限されません。RPC パートも別のクラスとして定義できます。OpenLegacy の専門用語によると、この種類のクラスは外部 RPC パートと呼ばれます。RPC フィールドは、レガシータイプの慣行に従い、任意のJava タイプにできます。
内包 RPC エンティティは、SDK プロジェクトが実行する必要がある単一バックエンドプログラム(入力、出力およびメタデータ)を表わします。
RPC エンティティの定義および動作は、@RpcActions
、@Actions
、 @RpcNavigation
などのさまざまなプロパティで定義できます。
Rpc エンティティ
|
RPC
...
プロパティ
Properties such as @RpcEntity
, @RpcField
and @RpcPart
are structural properties and are used to define how parts of Java code should be treated by OpenLegacy connectors. When a Java class is annotated with one of: @RpcEntity
, @RpcPart
, @RpcEntitySuperClass
and @RpcPartSuperClasss
, the following additional logic is applied during compilation of the Java Class:
Generation of
getters
andsetters
for each field of the Class;Generation of
List<RpcActionDefinition> actions
field and its getter/setter;Generation of auxiliary annotations (
@JsonIgnore
,@XmlAccessorType
,@XmlTransient
) for hiding actions and other irrelevant fields when serializing to Json and Xml
The behavior of the RpcEntity in run-time can be controlled using the following properties:
@RpcActions
and@Action
RPC Field properties except
@Hidden
Direction Enum
The following table shows the relationships between RPC properties (annotations) and OpenLegacy RPC Model Classes:
...
RPC Entity Properties
...
RPC Field Properties
...
@RpcEntity
、 @RpcField
および @RpcPart
などのプロパティは構造プロパティで、OpenLegacy コネクタによる Java コードのパートの取扱方法の定義に使用されます。Java クラスが、以下の @RpcEntity
、 @RpcPart
、@RpcEntitySuperClass
および @RpcPartSuperClasss
のいずれかで注釈が付けられている場合は、次の追加ロジックが Java クラスのコンパイル中に適用されます。
クラスの各フィールドの
getters
およびsetters
の生成List<RpcActionDefinition> アクション
フィールドおよびその getter/setter の生成補助注釈の生成 (
@JsonIgnore
、@XmlAccessorType
、@XmlTransient
)Json および Xml にシリアル化する際の
非表示アクションおよびその他の関連性のないフィールド
ランタイムにおける RpcEntity の動作は、以下のプロパティを使用してコントロールできます。
@RpcActions
および@Action
@Hidden
を除く、RPC フィールドのプロパティ方向列挙
以下の表は、RPC プロパティ(注釈)と OpenLegacy RPC モデルクラス間の関係を示しています。
RPC エンティティプロパティ | RPC フィールドプロパティ | RPC パートプロパティ |
|
|
|
|
|
|
|
| |
|
| |
|
| |
|
| |
| ||
|
Actions
Actions are specified on the entity with the @RpcActions
annotation, and contain all the actions that can be performed on the current entity.
@RpcActions
contains an array of @Actions
which specify an action. The @Actions
annotations comprise a few attributes:
...
The action attribute is mandatory and declares what Action is performed ( READ, EXECUTE, UPDATE, DELETE, GET, POST );
...
The path attribute defines a path to an executable program in the legacy system. This property should be defined to trigger the correct Program/Procedure/REST API.
...
The alias attribute is another option to use the action with the specified alias name
...
The displayName attribute is solely for demonstration.
...
アクション
アクションはエンティティ上に @RpcActions
注釈付きで指定され、現在のエンティティで実行できるすべてのアクションが含まれます。
@RpcActions
には、アクションを指定する @Actions
のアレイが含まれます。@Actions
注釈はいくつかの属性で構成されます。
action 属性は必須で、どのアクションを実行( READ、EXECUTE、UPDATE、DELETE、GET、POST)するかを宣言します。
path 属性は、レガシーシステムの実行可能プログラムへのパスを定義します。このプロパティを定義して、正しいプログラム/プロシージャ/REST API をトリガーする必要があります。
alias 属性は、指定した別名でアクションを使用する別のオプションです。
displayName 属性はデモ専用です。
olCache および olCacheEvict 属性は、特定のアクションのキャッシュ構成を定義できます。キャッシング OpenLegacy エンティティについて参照
RpcActions
Code Block language java @RpcEntity(name="Items", language=Languages.COBOL) @RpcActions(actions = { @Action(action = SHOW.class, path = ""), @Action(action = EXECUTE.class, path = "ITEMS", displayName = "Execute", alias = "execute" ) }) public class Items { ... }
RPC
...
フィールドプロパティ
Rpc Entity should be annotated with @RpcField
.
@RpcField
annotation has multiple attributes that can customize the definition of the current field. Following are some of main attributes used with this annotation:
The length attribute define how many bytes will be occupied by this field in the buffer
The originalName attribute describes the name of the field in the backend system
The legacyType attribute is used to declare the type of the field in the backend platform. Note: the use of this attribute can vary on different platforms. Please check if this attribute is relevant for the platform on which you are working, before using it.
The order attribute is used to override the default order in which Fields will be read during serialization of the Entity.
The direction attribute is used to define the field as an Input, Output, Input_Output or Error. The direction attribute is an object of Direction Enum which defines following directions: INPUT, OUTPUT, INPUT_OUTPUT, ERROR and NONE. The default direction is INPUT_OUTPUT.
@RpcBooleanField
, @RpcNumericField
, @RpcList
, etc., can be used alongside with @RpcField
annotation.
@RpcBooleanField
is used to define boolean fields and set the True and False value to match the backend value platform.
@RpcDateField
is used to define date and time format and locale of the backend platform.
@RpcNumericField
allows you to define minimum and maximum values, decimal places and display pattern.
@FieldAttribute
annotation is used to provide additional metadata about the field
With @RpcList
you can define fields that should represent the list structures in the backend platform. The count attribute defines the length of the list. If count is equal 0, than this list is treated as a dynamic list with variable length.
Additional
...
@RpcNavigation
annotation defines the category name with the category attribute. This category is used to display the entity for Web solutions.
...
の各フィールドは @RpcField
で注釈する必要があります。
@RpcField
注釈には、現在のフィールドの定義をカスタマイズできる複数の属性があります。以下は、この注釈で使用される主な属性の一部です。
length 属性は、バッファでこのフィールドが占めるバイト数を定義します。
originalName 属性は、バックエンドシステムのフィールド名を説明します。
legacyType 属性は、バックエンドプラットフォームのフィールドのタイプを宣言します。注: この属性の使用はプラットフォームにより異なります。使用前に、この属性がお使いのプラットフォームに関連しているかどうかを確認してください。
order 属性は、エンティティのシリアライズ中に読まれるフィールドのデフォルト順序を変更する場合に使用します。
direction 属性は、フィールドを入力、出力、Input_Output またはエラーとして定義する場合に使用します。direction 属性は、以下の方向を定義する方向列挙のオブジェクトです。入力、出力、INPUT_OUTPUT、エラーおよび なし。デフォルト方向は INPUT_OUTPUT です。
@RpcBooleanField
、 @RpcNumericField
、@RpcList
などは、@RpcField
注釈と一緒に使用できます。
@RpcBooleanField
は、ブール値フィールドの定義、真/偽値を設定してバックエンド値プラットフォームと一致させる場合に使用します。
@RpcDateField
は、日時形式の定義およびバックエンドプラットフォームのロケールに使用します。
@RpcNumericField
を使用すると、最小および最大値、小数位および表示パターンを定義できます。
@FieldAttribute
注釈は、フィールドに関する追加メタデータの提供に使用します。
@RpcList
を使用すると、バックエンドプラットフォームのリスト構造を表すフィールドを定義できます。count 属性はリストの長さを定義します。カウントが 0 の場合は、リストは変数長の動的リストとみなされます。
追加
@RpcNavigation
注釈は、 category 属性があるカテゴリ名を定義します。このカテゴリは Web ソリューションのエンティティ表示に使用されます。@Hidden は、ビュー内の注釈付きフィールドを非表示にする場合に使用されます。