Package com.axelor.studio.service
Class StudioDeployService
java.lang.Object
com.axelor.studio.service.StudioDeployService
Service for deploying and undeploying Studio resources.
Handles deployment of views, models, fields, actions, menus, and selections to the metadata tables (MetaView, MetaJsonModel, MetaJsonField, MetaAction, MetaMenu, MetaSelect).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat a workflow deploy wrote, and the revision it displaced. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeployAction(StudioResource resource) voiddeployApp(StudioResource resource) Deploys an entire app revision with all its resources.voiddeployField(StudioResource resource) voiddeployField(StudioResource app, StudioJsonField field) voiddeployMenu(StudioResource resource) voiddeployMenus(StudioResource resource) Deploys all menu resources in parent-before-child order to avoid foreign key violations.voiddeployModel(StudioResource resource) voiddeployModelFields(StudioResource resource) Phase 2 of a two-phase model deploy: writes theMetaJsonFieldrecords.voiddeployModelOnly(StudioResource resource) Phase 1 of a two-phase model deploy: writes theMetaJsonModelrecord without fields, so all models exist before any field that references another model's target type is deployed.voiddeployQuery(StudioResource resource) voiddeploySelect(StudioResource resource) voiddeployView(StudioResource resource) deployWorkflow(StudioResource resource) Deploys a workflow resource to MetaWorkflow.voiddeployWorkflows(StudioResource resource) Deploys all workflow resources in subflow-dependency order: a referenced subflow is written to MetaWorkflow before its caller, so the strict MetaWorkflow-only ref check at the save boundary passes during a batch deploy.findBlockingReferences(StudioResource resource) Descriptions of records, outside this resource's own deletable scope, that still reference it and would block deletion.voidundeployAction(String name, StudioResource app) voidundeployApp(StudioResource resource) voidundeployApp(String name) voidundeployApp(String name, boolean sweepWorkflows) Tear the app's artifacts down.voidundeployField(String name, String model, StudioResource app) voidundeployMenu(String name, StudioResource app) voidundeployModel(String name) voidundeployQuery(String name, StudioResource app) voidundeployResource(StudioResource resource) Tears down the single artifact this resource deployed, dispatching by type — the per-resource counterpart of the deploy-on-save hook (StudioResourceService.onSave(com.axelor.studio.db.StudioResource)).voidundeploySelect(String name, StudioResource app) voidundeployView(StudioResource resource) voidundeployView(String name, StudioResource app) voidundeployWorkflow(StudioResource resource) Undeploys the workflow this resource deployed, matched by (studioProject, stable xmlId) so it removes only this app's row — not every same-named workflow across projects and models.
-
Constructor Details
-
StudioDeployService
public StudioDeployService()
-
-
Method Details
-
deployApp
Deploys an entire app revision with all its resources.- Parameters:
resource- the app revision to deploy- Throws:
IllegalArgumentException- if resource is not an app revision
-
deployView
-
deployModel
-
deployModelOnly
Phase 1 of a two-phase model deploy: writes theMetaJsonModelrecord without fields, so all models exist before any field that references another model's target type is deployed. -
deployModelFields
Phase 2 of a two-phase model deploy: writes theMetaJsonFieldrecords. -
deployField
-
deployField
-
deployAction
-
deployMenu
-
deploySelect
-
deployQuery
-
deployWorkflow
Deploys a workflow resource to MetaWorkflow. The save runs the engine's normalize/validate/ compile gate, so a Studio-authored workflow is validated exactly like a module one.- Parameters:
resource- the workflow resource to deploy- Returns:
- the deployed workflow and the revision it superseded, if any
-
deployWorkflows
Deploys all workflow resources in subflow-dependency order: a referenced subflow is written to MetaWorkflow before its caller, so the strict MetaWorkflow-only ref check at the save boundary passes during a batch deploy. Cycles are forbidden upstream (Studio + core checks); if one slips through,topoOrder(java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.util.Set<java.lang.String>>)falls back to input order and the save boundary rejects it.- Parameters:
resource- the app revision containing workflow resources
-
deployMenus
Deploys all menu resources in parent-before-child order to avoid foreign key violations. Menus with inline children are deployed immediately (children are handled recursively bydeployMenu(StudioJsonMenu, MetaMenu, StudioResource)). -
undeployApp
-
undeployApp
-
undeployApp
Tear the app's artifacts down.- Parameters:
sweepWorkflows- whether to remove the app's workflow definitions too. True for a real undeploy, which is the end of them. False when this is the first half of a redeploy: the new revision brings a definition for each of them, and deleting and reinserting the rows would throw away the prior XML that the save boundary compares parked runs against.
-
undeployResource
Tears down the single artifact this resource deployed, dispatching by type — the per-resource counterpart of the deploy-on-save hook (StudioResourceService.onSave(com.axelor.studio.db.StudioResource)). Menus recurse to their children and workflows go through the repository so dependent state rows are purged and the workflow registry is evicted (see the individualundeploy*methods). A whole revision is torn down throughundeployApp(com.axelor.studio.db.StudioResource)instead; a type that deploys nothing (APP, ENTITY, ENUM) is a no-op here.- Parameters:
resource- the resource being deleted, whose deployed artifact must be removed
-
undeployView
-
undeployView
-
undeployWorkflow
Undeploys the workflow this resource deployed, matched by (studioProject, stable xmlId) so it removes only this app's row — not every same-named workflow across projects and models. Goes through the repository (not a bulk delete) so dependent state rows and the workflow registry caches are cleaned, the same path undeployApp uses. Falls back to (project, name) when the resource carries no stable id.- Parameters:
resource- the workflow resource to undeploy
-
undeployAction
-
undeployMenu
-
undeploySelect
-
undeployModel
-
findBlockingReferences
Descriptions of records, outside this resource's own deletable scope, that still reference it and would block deletion. An empty list means the resource is safe to delete.Only references we will not clean up ourselves are reported — a model referenced by a field in another model, or an action referenced by a non-Studio menu. Studio-owned dependents are removed by the caller's dependency-ordered batch, so they are not blockers. This lets the caller refuse with a clear message instead of hitting a raw foreign-key violation.
-
undeployField
-
undeployQuery
-