Class StudioDeployService

java.lang.Object
com.axelor.studio.service.StudioDeployService

public class StudioDeployService extends Object
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).

  • Constructor Details

    • StudioDeployService

      public StudioDeployService()
  • Method Details

    • deployApp

      public void deployApp(StudioResource resource)
      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

      public void deployView(StudioResource resource)
    • deployModel

      public void deployModel(StudioResource resource)
    • deployModelOnly

      public void deployModelOnly(StudioResource resource)
      Phase 1 of a two-phase model deploy: writes the MetaJsonModel record without fields, so all models exist before any field that references another model's target type is deployed.
    • deployModelFields

      public void deployModelFields(StudioResource resource)
      Phase 2 of a two-phase model deploy: writes the MetaJsonField records.
    • deployField

      public void deployField(StudioResource resource)
    • deployField

      public void deployField(StudioResource app, StudioJsonField field)
    • deployAction

      public void deployAction(StudioResource resource)
    • deployMenu

      public void deployMenu(StudioResource resource)
    • deploySelect

      public void deploySelect(StudioResource resource)
    • deployQuery

      public void deployQuery(StudioResource resource)
    • deployWorkflow

      public StudioDeployService.Deployed deployWorkflow(StudioResource resource)
      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

      public void deployWorkflows(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. 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

      public void deployMenus(StudioResource resource)
      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 by deployMenu(StudioJsonMenu, MetaMenu, StudioResource)).
    • undeployApp

      public void undeployApp(StudioResource resource)
    • undeployApp

      public void undeployApp(String name)
    • undeployApp

      public void undeployApp(String name, boolean sweepWorkflows)
      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

      public void undeployResource(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)). 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 individual undeploy* methods). A whole revision is torn down through undeployApp(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

      public void undeployView(StudioResource resource)
    • undeployView

      public void undeployView(String name, StudioResource app)
    • undeployWorkflow

      public void undeployWorkflow(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. 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

      public void undeployAction(String name, StudioResource app)
    • undeployMenu

      public void undeployMenu(String name, StudioResource app)
    • undeploySelect

      public void undeploySelect(String name, StudioResource app)
    • undeployModel

      public void undeployModel(String name)
    • findBlockingReferences

      public List<String> findBlockingReferences(StudioResource resource)
      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

      public void undeployField(String name, String model, StudioResource app)
    • undeployQuery

      public void undeployQuery(String name, StudioResource app)