Package com.axelor.studio.service
Class StudioResourceService
java.lang.Object
com.axelor.studio.service.StudioResourceService
Service for managing Studio resources (CRUD operations).
Handles resource lookup, creation, updates, and project dependency management.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidensureModelResources(StudioResource app, StudioJsonModel model) Ensures that the default form, grid, action, and menu resources exist for a custom model.voidensureProject(StudioResource revision, String... modules) findField(StudioResource parent, String name, String model, String modelField) Finds or creates aStudioResourceType.VIEWresource for the given view name.importModuleWorkflow(MetaWorkflow source, StudioResource appRevision) Import a module-defined workflow into the given Studio app revision as an editable WORKFLOW resource.voidonRemove(StudioResource resource) Callback invoked when a resource is deleted — the teardown counterpart ofonSave(com.axelor.studio.db.StudioResource).onSave(StudioResource resource) Callback invoked when a resource is saved.saveFields(StudioResource app, List<StudioJsonField> fields) Saves a list of fields.saveResource(StudioResource resource) saveView(StudioResource resource, List<StudioJsonField> fields)
-
Constructor Details
-
StudioResourceService
public StudioResourceService()
-
-
Method Details
-
onSave
Callback invoked when a resource is saved. Updates resource metadata based on type. -
onRemove
Callback invoked when a resource is deleted — the teardown counterpart ofonSave(com.axelor.studio.db.StudioResource). When the resource belongs to a live revision, the artifact it deployed is undeployed so a delete never leaves an orphaned menu, workflow, view, action, etc. behind in the running app. A whole revision (anStudioResourceType.APP) is torn down throughStudioDeployService.undeployApp(com.axelor.studio.db.StudioResource), which sweeps every artifact in FK-safe order and refuses while a workflow has in-flight instances. -
findView
Finds or creates aStudioResourceType.VIEWresource for the given view name. -
findField
public StudioResource findField(StudioResource parent, String name, String model, String modelField) -
saveFields
Saves a list of fields. Fields that belong to a custom (json) model are folded into the MODEL resource; custom fields on a real entity get their own FIELD resources. -
saveView
-
saveResource
-
importModuleWorkflow
Import a module-defined workflow into the given Studio app revision as an editable WORKFLOW resource. The Studio copy is stamped priority 100 (it supersedes the module original at runtime and clears the save-time priority conflict). Saving runs the normal resource path (onSave(com.axelor.studio.db.StudioResource)→updateWorkflow(com.axelor.studio.db.StudioResource): validation and linking, no deploy), so the imported copy supersedes the module original only once it is deployed. -
ensureProject
-
ensureModelResources
Ensures that the default form, grid, action, and menu resources exist for a custom model. Action and menu are skipped whenmodel.getMenuTitle()is blank.
-