Class StudioViewUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringapplyUid(StudioResource resource) Mints Studio's stable identity into the resource content if it carries none, and returns it.static StringensureTitle(String title, String name) static StringfindUid(StudioResource resource) Studio's stable identity as recorded in the resource content, or null when it has none yet.static StudioJsonAction<?, ?> toAction(StudioResource resource) static <T extends StudioContent<?>>
TtoContent(StudioResource resource, Class<T> type) static AbstractViewtoDeployableView(AbstractView view) Resolves the view to deploy or export for a Studio-authored view: an<extend>fragment against the module-authored original when one exists, so the Studio customization composes with module extensions the same way any other extension does — instead of a full snapshot that masks the computed result and gets masked back after any module recompute.static StringtoEntityName(StudioResource resource) static StudioJsonFieldtoField(StudioResource resource) toJsonAttrs(StudioJsonField field) static StudioJsonMenutoMenu(StudioResource resource) static StudioJsonModeltoModel(StudioResource resource) static StudioJsonQuerytoQuery(StudioResource resource) static StudioJsonSelecttoSelect(StudioResource resource) static AbstractViewtoView(StudioResource resource) static StudioJsonWorkflowtoWorkflow(StudioResource resource)
-
Method Details
-
toEntityName
-
ensureTitle
-
toView
-
findUid
Studio's stable identity as recorded in the resource content, or null when it has none yet.Read-only on purpose. Writing the uid during a deploy would save the resource and bump its row version, and a designer holding the document open still has the version it loaded — its next save then fails the optimistic-lock check with "Record was updated or deleted by another transaction". Deploying must never invalidate an open designer session, so the uid is written only by the save path (see
StudioResourceService.saveView), where the row is being saved anyway and the client gets the new version back in the response.- Parameters:
resource- the resource- Returns:
- the stable uid, or null
-
applyUid
Mints Studio's stable identity into the resource content if it carries none, and returns it. The content is patched in memory only — the caller is responsible for saving, so this must be called from a path that already persists the resource.Patches the content as a
JsonNodeinstead of round-tripping it throughStudioContent: the designer stores its node graph as verbatim JSON, and a typed round-trip would quietly drop or reorder anything the schema beans don't model.- Parameters:
resource- the resource- Returns:
- the stable uid, or null when there is no content to carry one
-
toDeployableView
Resolves the view to deploy or export for a Studio-authored view: an<extend>fragment against the module-authored original when one exists, so the Studio customization composes with module extensions the same way any other extension does — instead of a full snapshot that masks the computed result and gets masked back after any module recompute. A brand-new Studio view (no module-authored original) passes through unchanged.The original is the module-composed view (base plus every module-authored extension), not the bare base: the designer is seeded from the composed view, so anything the module extensions contribute is already in the Studio content and must not be re-derived as a Studio change — see
StudioMetaUtils.findModuleComposedView(java.lang.String, java.lang.String, java.lang.String).The content's own
xmlIdis the base view the designer was seeded from, so it pins the diff to that exact view; name/type/model alone can match several. It is only ever read here — never written to the deployed row, which carries Studio's ownfindUid(com.axelor.studio.db.StudioResource)identity instead. -
toJsonAttrs
-
toModel
-
toField
-
toContent
-
toMenu
-
toAction
-
toSelect
-
toQuery
-
toWorkflow
-