2026年6月19日金曜日

APEX BlueprintsからAPEXlang形式のAPEXアプリケーションを生成する

Oracle APEX 26.1の新機能にBlueprintsが含まれています。以下の記事で、Oracle CorporationがGitHubで公開しているOrdery Entryの機能要件定義書や、自前で作成した従業員管理の機能要件定義書からブループリントを生成し、そのブループリントをAPEXワークスペースにインポートしてAPEXのアプリケーションを生成しています。

Order Entry版: Oracle APEX 26.1のBlueprintの生成とインポートを試してみる

現状ではブループリントからAPEXのアプリケーションを生成するには、アプリケーション・ビルダーからブループリントをインポートする必要があります。ブラウザでの作業になるため、スクリプトに組み込んで実行できません。

APEX 26.1には、ブループリントからAPEXlang形式のアプリケーションを生成するパッケージAPEX_GENDEVが含まれています。

APEX 26.1のAPI Referenceにはまだ記載されていません。そのため、仕様については今後変わる可能性がありますが、このパッケージを呼び出してブループリントからAPEXアプリケーションを生成するORDS RESTサービスを作成してみます。

ORDSモジュールとしてblueprint、テンプレートとしてprocessを作成し、マークダウンのテキストを受け付け、APEXアプリケーションのZIPファイルを返すPOSTハンドラを作成します。

以下のスクリプトを実行します。


APEXワークスペースに紐づく、パーシング・スキーマに接続して実行します。こちらの記事「サンプル・データセットのEMP/DEPTを元にAPEX Blueprintを作成しBlueprintからAPEXアプリケーションを生成する」から継続して作業を行なっていることを前提としています。

sql -name local-26ai-apexdev @ords-blueprint-process.sql

RESTサービスを呼び出すURLは以下になります。

https://ホスト名/ords/<ORDS別名=APEXワークスペース>/blueprint/process

blueprint-emp-dept % sql -name local-26ai-apexdev @ords-blueprint-process.sql


SQLcl: 金 6月 19 15:12:24 2026のリリース26.1 Production


Copyright (c) 1982, 2026, Oracle.  All rights reserved.


接続先:

Oracle AI Database 26ai Free Release 23.26.1.0.0 - Develop, Learn, and Run for Free

Version 23.26.1.0.0



PL/SQLプロシージャが正常に完了しました。


SQL> exit

Oracle AI Database 26ai Free Release 23.26.1.0.0 - Develop, Learn, and Run for Free

Version 23.26.1.0.0から切断されました

blueprint-emp-dept % 


作業ディレクトリにブループリントとしてemployees-management-blueprint.mdがあるとします。

curlコマンドを実行してブループリントをアップロードし、生成されたAPEXアプリケーションをapp.zipとして保存します。
curl -X POST -H "Content-Type: text/markdown; charset=UTF-8" -o app.zip \
--data-binary @employees-management-blueprint.md \
http://localhost:8181/ords/apexdev/blueprint/process

blueprint-emp-dept % curl -X POST -H "Content-Type: text/markdown; charset=UTF-8" -o app.zip --data-binary @employees-management-blueprint.md http://localhost:8181/ords/apexdev/blueprint/process

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100 55533    0 49375  100  6158    99k  12720 --:--:-- --:--:-- --:--:--  112k

blueprint-emp-dept % 


出力されたapp.zipの内容を確認します。

unzip -l app.zip

blueprint-emp-dept % unzip -l app.zip

Archive:  app.zip

  Length      Date    Time    Name

---------  ---------- -----   ----

      974  06-19-2026 06:19   application.apx

       33  06-19-2026 06:19   .apex/apexlang.json

       32  06-19-2026 06:19   deployments/default.json

     1619  06-19-2026 06:19   shared-components/themes/universal-theme/theme.apx

     4780  06-19-2026 06:19   shared-components/static-files/icons/app-icon-144-rounded.png

     5951  06-19-2026 06:19   shared-components/static-files/icons/app-icon-192.png

     9655  06-19-2026 06:19   shared-components/static-files/icons/app-icon-256-rounded.png

      643  06-19-2026 06:19   shared-components/static-files/icons/app-icon-32.png

    20119  06-19-2026 06:19   shared-components/static-files/icons/app-icon-512.png

      101  06-19-2026 06:19   shared-components/authentications.apx

       55  06-19-2026 06:19   shared-components/build-options.apx

      405  06-19-2026 06:19   shared-components/static-files.apx

     1483  06-19-2026 06:19   shared-components/lists.apx

      290  06-19-2026 06:19   shared-components/breadcrumbs.apx

      336  06-19-2026 06:19   shared-components/lovs.apx

      222  06-19-2026 06:19   page-groups.apx

     8634  06-19-2026 06:19   pages/p00001-employee-list.apx

    10582  06-19-2026 06:19   pages/p00002-employee-form.apx

     5665  06-19-2026 06:19   pages/p09999-login.apx

---------                     -------

    71579                     19 files

blueprint-emp-dept % 


application.apxが含まれており、正常なAPEXアプリケーションになっていることが確認できます。

app.zipはAPEXアプリケーションなので、SQLclを使用してAPEXワークスペースにインポートできます。

apex import -input app.zip

SQL> apex import -input app.zip

アプリケーションID: 101をワークスペース: APEXDEVにインポートしています

インポートに成功しました。


SQL> 


ブループリントからAPEXアプリケーションを生成する作業を、コマンドラインから実行できるようになりました。

機能要件定義書の修正からAPEXアプリケーションの生成までを、人手を解さずに実行することで、作業の繰り返しが楽になりました。

この実装では、ORDS RESTサービスを保護していません。必要に応じて、OAuthなどで保護を追加する必要があります。

今回の記事は以上になります。