Fragment tree action descriptor declarations and runtime scope routing methods and systems
By introducing action descriptor declarations and runtime scope routing methods from fragment trees into an enterprise-level data management system, the problem of incorporating action surfaces into the declaration system is solved. This achieves zero front-end code modification for action items and decoupling between the front-end and back-end, linearizes the scale of action item declarations, and ensures that action points and execution points meet precisely at runtime.
Patent Information
- Application Number
- CN202611544253.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-08
- Publication Date
- 2026-11-17
AI Technical Summary
In existing enterprise-level data management systems, the declaration system of action planes (such as component operation buttons) is difficult to incorporate into the structural plane declarative architecture, resulting in high front-end development costs. Furthermore, the capability dimensions of action items are orthogonal and can be superimposed, leading to type explosion and strong coupling between the front-end and back-end.
The method of action descriptor declaration and runtime scope routing using fragment trees is adopted. By declaring action descriptor sets on fragment tree nodes, the action items are passed through by the general interpreter. Combined with the ability to determine action items by preset dimensions and carried fields, the action registry is used for runtime scope routing, thereby achieving linearization of the declaration scale of action items and decoupling between the front end and the back end.
It enables the action plane to enter the declaration system without any front-end code modification, linearizes the scale of action item declarations, ensures that the declaration point and the execution point meet precisely at runtime, and allows the front-end and back-end to evolve independently, avoiding type explosion and coupling problems.
Smart Images

Figure CN123115147A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer software technology, and in particular to a method and system for declaring action descriptors and runtime scope routing in a fragment tree. Background Technology
[0002] As enterprises deepen their IT infrastructure development, enterprise-level data management systems such as product lifecycle management, quality management systems, and process modeling need to display a large number of business components on the same screen, and the page formats under different business objects and different meta-models vary significantly.
[0003] To reduce front-end development costs, existing enterprise-level data management systems generally adopt an architecture that combines back-end declarative page structure with general front-end rendering. The back-end issues a page structure description tree (hereinafter referred to as a fragment tree) based on the current business object. Each node in the tree declares the component type, layout slot, child node list, and data binding for that rendering location. The front-end uses a general interpreter, not written for any specific page, to recursively traverse the fragment tree, querying the component registry by component type identifier and completing the rendering. Under this architecture, the page structure is declarative; that is, the four types of declarations—component type, layout slot, nested child nodes, and data binding—are all carried by fragment tree nodes. Adding or adjusting the page structure only requires modifying the back-end declaration; the front-end can construct any page without writing business logic.
[0004] However, even after declaring the structure plane, the action plane of the page (the operation entry points on components, such as buttons for adding associations, editing notes, changing status, batch deletion, browsing and selection, etc.) is still difficult to incorporate into the declaration system. A business object details page typically renders more than ten components on the same screen, and each component's toolbar and each data row may have several operation buttons. Compared with the structure plane, the operation buttons on the action plane have the following three characteristics: First, the execution point of a button is often not its declaration point. To make the operation entry point focus on container components such as aggregation cards from the user's perspective, buttons are usually declared on ancestor container nodes, while the component that actually implements the operation is its child node or even grandchild node. For example, the "Add Upstream" button is declared on the associated aggregation card node, but the component that actually opens the selector and performs the add operation is a specific associated list component under that aggregation card.
[0005] Secondly, the correspondence between declaration points and execution points is determined at runtime. The shape of the fragment tree and which node carries which component are all issued by the backend at runtime according to business objects, metamodels, perspectives, etc. Therefore, the correspondence between declaration points and execution points cannot be determined at compile time, nor can it be hardcoded into any frontend component in advance.
[0006] Third, the capabilities of buttons are orthogonal to each other and can be freely superimposed. A button may simultaneously require multiple capabilities such as cross-node dispatch, child item runtime retrieval, read-only release, and rendering according to a specific expansion form. These dimensions can be combined arbitrarily.
[0007] If the action plane cannot be incorporated into the declaration system like the structure plane, the architectural goal of the page structure being entirely determined by the declaration will be interrupted at the button layer. Each new button will require modification of the front-end code and redeployment, and the benefits gained from the declarative nature of the structure plane will be offset by this layer of the action plane.
[0008] To address the above problems, existing technologies mainly offer the following solutions: Option 1 involves hardcoding the buttons within the component. Each business component hardcodes its included buttons and click behaviors in its own code. However, this option directly contradicts the aforementioned architectural concept where the structure is determined by declaration: the structural aspect achieves zero front-end code changes, but the action aspect still requires code changes. Adding a new button requires front-end code modification, release, and synchronization with the back-end, rendering the configurability of the metamodel virtually meaningless.
[0009] Option 2 involves setting explicit type enumerations for action items in the metamodel. A type field is set on the declaration item, with values such as "normal button," "jump button," "dropdown button," and "remote dropdown button." The frontend assigns tasks to different processing branches based on the enumeration values. This option suffers from type explosion when capability dimensions are orthogonal and can be stacked: N orthogonal dimensions require pre-defining at most 2^N types. Each new dimension doubles the size of the type table, and the number of frontend assignment branches also doubles. However, the combinations actually used often only represent a small portion of these, with the remaining types being pre-defined as possible combinations that are never used, resulting in significant redundancy.
[0010] Option 3: Global Event Bus / Publish-Subscribe Mechanism. When a button is clicked, the event name is broadcast globally, and listeners determine whether to respond. However, this option lacks scope, and actions with the same name can interfere with each other: multiple similar components on the same screen (such as multiple related lists) may have the same action, such as adding something. The global broadcast cannot indicate which component instance should be delivered to by the click, and the only solution is to append an instance identifier to the event name. Event names are difficult to maintain and prone to errors, and listeners need to filter them manually, which can easily lead to missed or incorrect responses.
[0011] Option 4: Metadata command mechanism for model-driven UI platforms. In low-code or model-driven platforms, buttons are declared by metadata or annotations, bound to UI controls at runtime, and call backend logic. Some platforms also support populating dropdown sub-items with query results at runtime. This option still has the following shortcomings: First, commands are usually bound to control or container semantics determined during design phase. The correspondence between declaration points and execution points is fixed during modeling, which cannot adapt to scenarios where both declaration and execution points are issued at runtime. Second, command routing and runtime sub-item population are usually two independent mechanisms that cannot be freely superimposed on the same declaration item. Third, there is a general lack of read-only release mechanisms that allow for item-by-item declaration.
[0012] In addition, the above solutions share common drawbacks: once the contract of the action declaration field is changed, the front-end and back-end must be updated simultaneously; under the project organization of independent release in the two warehouses, a strongly coupled release window will be formed, which will restrict the independent evolution of the front-end and back-end.
[0013] Based on this, this case is proposed. Summary of the Invention
[0014] The purpose of this invention is to provide a method and system for action descriptor declaration and runtime scope routing in a fragment tree, so that the action plane enters the declaration system like the structure plane. While maintaining zero front-end code modification, it achieves linearization of the action item declaration scale, cross-level runtime routing between declaration points and execution points, scope isolation of actions with the same name, and decoupled publishing between the front-end and back-end.
[0015] To achieve the above objectives, the present invention provides the following technical solution: A method for declaring action descriptors and runtime scope routing in a fragment tree includes: S1, Receive the fragment tree sent by the backend according to the target object. In addition to declaring the component type identifier, layout slot, child node list and data binding descriptor, the nodes of the fragment tree also declare the action descriptor set. The action descriptor set contains at least one action item. Each action item consists of several optional fields and does not carry a type field. S2, when the general interpreter recursively projects each node of the fragment tree, it passes the set of action descriptors declared on each node as input attributes to the component corresponding to that node. S3. For each action item, the corresponding component identifies the fields carried by the action item based on the preset correspondence between dimensions and carried fields, and determines the combination of dimensions that the action item has. The dimensions in the combination of dimensions are orthogonal to each other and can be freely superimposed. S4, When the execution component carrying the execution logic in the corresponding component is mounted, it registers the processor corresponding to the execution logic with the pre-set action registry; S5, when any action is triggered by the user, the corresponding component resolves the dispatch target of the action based on the dimension combination of the action, with explicit priority and default fallback. S6. Using the parsed dispatch target, find the processor that matches the dispatch target and has been registered in the action registry and call it. Pass the payload of the action item triggered this time to the called processor to execute the operation corresponding to the action item. S7, when the execution component carrying the execution logic in the corresponding component is unloaded as the fragment tree changes, the processor registered in the action registry is deregistered.
[0016] Furthermore, in S1, the action description subset is divided into toolbar slots and inline slots according to the presentation position. The field structure of the action items in the two slots is exactly the same, only the presentation position is different.
[0017] Furthermore, in S3, the preset correspondence between dimensions and carried fields includes at least the following: The semantic execution dimension corresponds to the operation identifier, indicating that the action item corresponds to an operation semantic that can be executed by the backend; Cross-scope routing dimension corresponds to the scope identifier and action code of the target node, indicating that the execution point of the action item is not its declaration point and needs to be dispatched to the specified node. When the action item carries both the scope identifier and action code of the target node, it is determined that it has this dimension. The runtime data sub-item dimension corresponds to the data source descriptor, indicating that the candidate sub-items of this action item are unknown at the time of declaration, and are retrieved according to the data source descriptor when the action item is expanded; The read-only release dimension corresponds to the release level, indicating that the action item is released in read-only state according to the declared release level; The rendering mode dimension corresponds to the rendering mode identifier, indicating that the action item is presented in the expanded form specified by the rendering mode identifier.
[0018] Furthermore, in S4, the action registry uses the scope identifier as the first-level index, the action code as the second-level index, and the processor as the mapping value of the combination of the first-level index and the second-level index. The scope identifier is taken from the identifier of the fragment tree node.
[0019] Furthermore, S4 includes the following process: S41, when the execution component carrying the execution logic is mounted, the parent scope identifier is resolved and obtained from the nearest one according to the following rules: The container identifier passed by the component context of the upper-level container component of the execution component is preferred as the parent scope identifier. The upper-level container component is generated by the fragment tree recursively projected by the general interpreter. If the upper-level container component does not pass the container identifier through the component context, then the parent node is searched back from the node where the execution component is located to the root node in the fragment tree, and the scope identifier of the first parent node found is used as the parent scope identifier. If the backtracking search does not find any parent node's scope identifier, then the scope identifier of the node where the execution component is located is used as the parent scope identifier. S42, the execution component simultaneously registers the same processor with the action registry via two channels: The first channel uses the scope identifier of the fragment tree node where the execution component is located as the first-level index and the action code carried by the execution component as the second-level index; The second channel uses the parent scope identifier as the first-level index and the composite action code formed by concatenating its own scope identifier and the action code as the second-level index.
[0020] Furthermore, it also includes: S43, the processor is stored via a variable reference, and the execution component registers a fixed wrapper function that reads the variable reference with the action registry, so that the processor closure is not repeatedly registered when the rendering changes.
[0021] Furthermore, in S5, when any action is triggered by the user, it is determined whether the action should be allowed: This action is allowed when the page is not in read-only mode; When the page is in read-only mode, the corresponding component determines whether to allow the action item based on the allowance level declared for that action item. The allowance rules are as follows: Actions that do not specify a gear position for release will not be released; The sources causing a page to be in a read-only state include at least version freeze, comparison state, compliance state, and permission bit not specified. Among these, version freeze, comparison state, and compliance state are hard read-only, while permission bit not specified is soft read-only. The allowance level includes at least a first level and a second level. The first level only allows soft read-only caused by permission bit not specified and must not exceed hard read-only caused by version freeze, comparison state, and compliance state. The second level allows all read-only sources, including hard read-only. The allowance level can be declared at both the action item level and its corresponding node level. When making a judgment, the action item level declaration is taken. If the action item level is not declared, the default declaration of its corresponding node level is inherited. If neither level is declared, the page is not allowed. Actions that have not been approved will not be dispatched.
[0022] Furthermore, for actions that are allowed, the corresponding component resolves the dispatch target of the action based on the dimension combination of the action, using an explicit priority and default fallback approach, as follows: The node that declares the action item serves as the declaration point; When the dimension combination of the action item includes cross-scope routing dimensions, the first-level index takes the scope identifier of the target node corresponding to the cross-scope routing dimension, and the second-level index takes the action code corresponding to the cross-scope routing dimension. When the dimension combination of the action item does not include cross-scope routing dimensions, the first-level index takes the scope identifier of the node where the declaration point is located, and the second-level index takes the action code carried by the action item. When the action item does not carry an action code, if the dimension combination of the action item includes a semantic execution dimension, the operation identifier corresponding to the semantic execution dimension is used as a secondary index. If the dimension combination of the action item does not include a semantic execution dimension, the presentation identifier of the action item is used as a secondary index. The presentation identifier is one of the optional fields of the action item. When the action item does not carry an action code, operation identifier, or presentation identifier, dispatch is not initiated. The dispatch target is a combination of primary indexes and secondary indexes.
[0023] Furthermore, for action items that are determined to have runtime data sub-item dimensions in S3, when they are expanded, candidate sub-items are obtained according to the data source descriptor carried by the action item, and the obtained results are written to the cache shared with other data consumers. Action items that are not expanded do not initiate a retrieval request. For actions that are determined to have a rendering mode dimension in S3, the action is presented as a submenu or slide-out selector according to the rendering mode identifier carried by the action. When an action item has both runtime data sub-item dimension and rendering mode dimension, the candidate sub-items obtained when it is expanded are rendered into an option list by the selector component corresponding to the action item. The selector component is presented in the form determined by the rendering mode identifier. When the user selects a candidate item from the selector component, it constitutes a trigger for the action item. The value of the candidate item is used as part of the payload of this trigger and is dispatched along with the dispatch target already determined for the action item.
[0024] A fragment tree-based action descriptor declaration and runtime scope routing system, comprising: The action declaration module is used to declare a set of action descriptors on the nodes of the fragment tree, in addition to declaring the component type identifier, layout slot, child node list and data binding descriptor. The set of action descriptors contains at least one action item, and each action item consists of several optional fields and does not carry a type field. The general interpreter module is used to receive the fragment tree issued by the action declaration module, recursively project each node of the fragment tree, and pass the set of action descriptors declared on each node as input attributes to the component corresponding to that node. The dimension type determination module is used to receive the action description subset passed through by the general interpreter module, identify the fields carried by each action item according to the preset dimension and field correspondence relationship, and determine the dimension combination that the action item has. The dimensions include at least one or more of the following: semantic execution dimension, cross-scope routing dimension, runtime data sub-item dimension, read-only allow dimension, and rendering mode dimension. The read-only release determination module is used to receive action items with read-only release dimensions sent by the dimension type determination module. When the page is in read-only state, it determines whether to release the action item with a declared release level according to the declared release level and outputs the release determination conclusion; action items without a declared release level are not released in read-only state. The delayed data retrieval module is used to receive action items with runtime data sub-item dimensions sent by the dimension classification module. When the action item is expanded, it obtains candidate sub-items according to the data source descriptor through unified data retrieval and caching facilities, reuses the cache shared with other data consumers, and outputs the candidate sub-items. The rendering module is used to receive action items with rendering mode dimensions sent by the dimension determination module, determine the expanded form of the action item according to the rendering mode identifier, and present the action item as a submenu or slide-out selector. When the action item also has runtime data sub-item dimensions, the candidate sub-items output by the delayed data retrieval module are rendered as an option list of the selector component corresponding to the action item. When the user selects a candidate item in the selector component, it constitutes a trigger for the action item. The value of the candidate item is output to the dispatch parsing module as part of the payload of this trigger. The dispatch parsing module is used to receive the cross-scope routing dimension and semantic execution dimension of the triggered action item sent by the dimension type determination module, the release determination conclusion of the read-only release determination module, and the trigger sent by the presentation form rendering module. When the action item is triggered, the dispatch target of the action item is parsed according to the cross-scope routing dimension and semantic execution dimension of the action item in an explicit priority and default fallback manner, and a dispatch signal carrying the scope identifier, action code and payload is issued. The scope resolution module is used to receive the container identifier and fragment tree structure provided by the general interpreter module, and resolve them according to the nearest principle to obtain the parent scope identifier of the node where the execution component is located. The execution-side registration agent module is used to receive the parent scope identifier output by the scope resolution module, send registration signals through two channels to register the processor corresponding to the execution logic when the execution component is mounted, and send deregistration signals when the execution component is unmounted. The action registry module is used to maintain processor mapping with scope identifier as the first-level index and action code as the second-level index. It receives the registration / deregistration signal from the execution-side registration agent module and the dispatch signal from the dispatch parsing module, retrieves the corresponding processor according to the dispatch signal and calls it, and passes the payload through to the execution component.
[0025] The technical solution provided in this application has the following beneficial effects: 1. This invention extends the zero-frontend-modification approach from the structural plane to the action plane. It treats action descriptors as the fifth type of declaration in the fragment tree node, originating from the same node as the original four types of declarations, and is passed through by the general interpreter as is. Thus, the architectural conventions of the page structure, entirely determined by the fragment tree, are extended from the structural plane to the action plane. Adding, deleting, renaming, or adjusting an action item only requires modifying the metamodel declaration; the frontend requires no code changes and no re-release is needed. The previous gap where zero frontend-modification was achieved on the structural plane but still required code modification on the action plane is eliminated, and the configurability of the metamodel is no longer compromised by the button layer.
[0026] 2. The scale of the declaration is reduced from exponential to linear. This invention replaces explicit type enumeration with implicit type determination based on the presence of dimensions. Action items do not carry type fields; their capability dimensions are determined solely by the presence of their carried fields. Dimensions are orthogonal to each other and can be freely superimposed, eliminating the need to predefine types for any combination. Therefore, the scale of the action item declaration is reduced from at most 2^N types to N sets of fields. Adding a new capability dimension only requires adding one set of fields and a separate processing logic, preventing the front-end dispatch branches from exponentially expanding with the number of combinations. Actual testing shows that in a scenario with 5 dimensions and 320 active action items, this solution requires only 10 field types, while explicit enumeration requires predefining 32 types.
[0027] 3. Declaration points and execution points meet precisely at runtime, with zero crosstalk between actions of the same name. This invention utilizes an action registry with scope identifiers as the first-level index and action codes as the second-level index. This allows declaration points and execution points to accurately connect at runtime without any compile-time binding. Execution components register processors upon mounting, and declaration points, when triggered by a user, resolve and dispatch targets according to explicit priority and default fallback. Therefore, the same action item can fall on different execution points at different levels under different business objects and different meta-models. Simultaneously, the registry's first-level index uses the identifier of the fragment tree node. Even if multiple similar components on the same screen register the exact same action code, they remain isolated and do not interfere with each other. Only one execution point responds to a single click, eliminating the need for broadcasting or filtering by the listener.
[0028] 4. The front-end and back-end can evolve independently, ensuring stable and reliable system operation. Execution components register with the same processor through two channels. The dispatching end resolves based on explicit priority and default fallback, ensuring that the behavior of both the old and new meta-model declarations is completely consistent under the same front-end code. The front-end and back-end code repositories can be deployed independently without interfering with each other. Registration uses stable references as intermediaries, preventing repeated registration when processor closures change with rendering. Components are deregistered upon unloading, ensuring the registry size always matches the actual components on the page, and dispatch results consistently point to the actual execution point. A silent null operation occurs when the registry is not found, without affecting the normal use of other actions.
[0029] 5. Based on the orthogonality of dimensions, various capabilities can be independently superimposed without interference. Actions with runtime data sub-item dimensions only obtain candidate sub-items according to the data source descriptor when expanded, and reuse the cache shared with other data consumers. Unexpanded action items do not incur any network overhead. Actions with read-only release dimensions can be released item by item according to their declared release levels. The first level only allows soft read-only caused by permission bits being no, and the second level allows all read-only sources, including hard read-only, to meet the business needs of individual actions still being available in read-only state. The rendering mode dimension and custom rendering component name ensure that the presentation form of action items is also determined by the meta-model declaration. Any node can both act as the declaration point of action items to initiate dispatch and carry execution logic as an execution component to be called by other nodes, forming a peer-to-peer call network between nodes, rather than a one-way parent-child call.
[0030] 6. Runtime dynamic candidate items and statically declared action items are handled uniformly. For action items with runtime data sub-item dimensions, their candidate sub-items are obtained through unified data retrieval and caching facilities during expansion, and then rendered as an option list by the selector component corresponding to the action item. When a user selects a candidate item in the selector, it constitutes a trigger for the action item itself. The value of the candidate item is only a component of the payload of this trigger and is dispatched along with the already determined dispatch target of the action item. Thus, the candidate items dynamically obtained at runtime and the action items statically declared in the metamodel reuse the same type determination-trigger-dispatch mechanism, eliminating the need for a separate processing path for filling dropdown sub-items at runtime. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0032] Figure 1This is a schematic diagram illustrating the system architecture of the fragment tree's action descriptor declaration and runtime scope routing, as well as the signal transmission between modules in this embodiment. Figure 2 This is a schematic diagram of the orthogonal implicit type determination of the dimensions of the action items in the embodiment. Detailed Implementation
[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] Terminology Explanation 1. Fragment Tree: A page structure description issued by the backend based on the current business object, declaring which components the page should consist of and how these components are nested and arranged. This description is organized in a tree structure, where each node corresponds to a component on the page, and the parent-child relationship between nodes represents the nesting relationship between containers and their contents on the page. Each node internally declares five items: what component the unit renders (component type identifier), its position within its parent container (layout slot), which other components it contains (child node list), where the unit obtains the required data (data binding descriptor), and the set of action descriptors added in this invention.
[0035] 2. Action Description Subset: The fifth type of declaration added to the fragment tree node, containing at least one action item. It is divided into toolbar slots (a set of action items in the header of the node itself) and / or inline slots (a set of action items on each data row rendered by the node) according to the presentation position. The field structure of the action items in the two slots is exactly the same, only the presentation position is different.
[0036] 3. Action Item: A single operable item in the action descriptor subset, consisting of several optional fields and without a type field; optional fields include operation identifier, scope identifier of the target node, action code, data source descriptor, release level, rendering mode identifier, presentation identifier, label, icon, and payload, etc.
[0037] 4. General Interpreter: A front-end interpreter that recursively traverses the fragment tree, looks up the component registry by the component type identifier declared by the node, and instantiates the component. It is not written for a specific page; it passes the action descriptor subset on the node as is, without parsing or judging it itself.
[0038] 5. Dimensions: The capability characteristics of an action item; each dimension is orthogonal to the others and can be freely superimposed. Which dimensions an action item possesses is determined by the presence of its carried fields. In this embodiment, orthogonal dimensions include semantic execution dimension, cross-scope routing dimension, runtime data sub-item dimension, read-only access dimension, and rendering mode dimension; custom rendering is an optional presentation layer extension and is not included in the complete set of orthogonal dimensions. It should be noted that the dimensions in this invention refer to the capability dimensions of the action item and are unrelated to aspects in aspect-oriented programming.
[0039] 6. Implicit type determination: Instead of setting an explicit type field, the dimensions of the action item are determined directly by whether a certain set of fields are present.
[0040] 7. Scope Identifier: A first-level index in the action registry, retrieved from the identifier of the fragment tree node; the same action code does not interfere with each other in different scopes.
[0041] 8. Action Code: A secondary index of the action registry, a short identifier that expresses what to do, such as add, edit, delete, refresh, etc.; Action codes include compound action codes, which are composed of a scope identifier and an action code, and are used for old-style declarations to hit the default fallback registration.
[0042] 9. Allowing level: The degree to which an action item can be allowed in read-only state; in this embodiment, it includes at least a first level and a second level, wherein the first level only allows soft read-only caused by permission bit not being set, hard read-only caused by not exceeding version freeze, comparison state and compliance state, and the second level allows all read-only sources including hard read-only.
[0043] 10. Read-only state: The state in which write operations are prohibited on the page; the sources of read-only state include at least version freeze, comparison state, compliance state, and permission bit setting. Among them, version freeze, comparison state, and compliance state are hard read-only, while permission bit setting is soft read-only.
[0044] 11. Modeling Data and Communication Data: Modeling data refers to formal data on business objects that are subject to control constraints such as version freeze, comparison status, and compliance status, such as notes, business attributes, and status fields on related rows; communication data refers to content that does not constitute formal data of business objects, such as independent comments, whose existence is not constrained by the modeling version status. The two-tier release level is based on this: the first tier applies to actions written into modeling data, and the second tier applies to actions written into communication data.
[0045] 12. Rendering identifier: The rendering layer identifier field carried by the action item, which is one of the optional fields of the action item; in the old declaration, it adopts a compound syntax of execution point identifier and action code, and serves as the last fallback value when the action code is defaulted.
[0046] 13. Payload: The data that is passed through to the processor along with the dispatch when the action item is triggered this time. It may include the static part carried in the action item declaration, as well as the dynamic part injected at the time of triggering (such as the candidate value selected in the selector).
[0047] 14. Selector component: A UI component used to present a list of candidate sub-items for an action item and receive user selections, such as a drop-down component or a slide-out selector; when an action item with runtime data sub-item dimensions is expanded, the candidate sub-items obtained by the delayed data retrieval module are presented by the selector component, and the operation corresponding to the action item is executed after the user selects a candidate item.
[0048] 15. Component Context: The mechanism by which the front-end framework passes runtime information to components (such as Context injection), used by upper-level container components to pass container identifiers to lower-level components.
[0049] 16. Container Identifier: The identifier of the fragment tree node where the upper container component is located; the upper container component is generated by the container node in the fragment tree recursively projected by the general interpreter, and its container identifier is passed down to the lower component through the component context.
[0050] 17. Declaration Point and Execution Point: The declaration point refers to the fragment tree node where the action item is declared; the execution point refers to the node where the component that actually implements the operation is located. They may not be the same node, and both are determined by the runtime fragment tree. The component corresponding to a node refers to the component instantiated by the general interpreter according to the component type identifier declared at that node, where the component carrying the execution logic is the execution component.
[0051] 18. Button Component Registry: A mapping table maintained by the front end between custom rendered component names and button components; when an action item declares a custom rendered component name, the action item is rendered using the component with the corresponding name in this table, replacing the default label button form. The default label button form is the appearance of the action item when there is no special presentation declaration, rendered as a normal button / menu item displaying its label text.
[0052] 19. Metamodel: Defines the specifications for how pages and action items can be declared, specifying which optional fields an action item can carry, the semantics of each field, and the correspondence between dimensions and carried fields (type determination rules). The metamodel is the authoritative source for action item declarations; the fragment tree and action description subset under a specific business object are instances filled in according to the metamodel specifications. Adding, deleting, renaming, or adjusting action items all reflect modifications to the metamodel declaration content.
[0053] like Figure 1 As shown, this embodiment provides a method for declaring action descriptors and runtime scope routing in a fragment tree, including the following steps.
[0054] Step S1: According to existing technology, when the backend generates the fragment tree, the fragment tree node needs to declare four items: component type identifier, layout slot, child node list, and data binding descriptor. These items are used to determine which component the node renders, its position in the parent container, which child nodes it contains, and where it obtains data from. As an improvement, this embodiment adds a fifth declaration to the fragment tree node, namely the action descriptor set, so that the page's action surfaces (toolbar buttons, inline action items, etc.) are also included in the declaration system, and the frontend does not need to write code for any specific buttons.
[0055] The action description subset is divided into two slots based on its presentation location: toolbar slots (a set of action items in the node's own header, used to initiate operations on the entire business object) and inline slots (a set of action items on each data row rendered by the node, used to initiate operations on a single row of data). These two slots cover two typical presentation locations for action items, ensuring the action plane is fully integrated into the declaration system. Furthermore, the field structures of the action items within both slots are identical, differing only in their presentation location. Therefore, the same set of type determination, routing, and execution mechanisms applies indiscriminately to action items in both slots, eliminating the need for separate mechanisms for different presentation locations.
[0056] The action descriptor subset contains several action items, each consisting of several optional fields and without a type field. The capability dimensions of an action item are entirely determined by the presence of the fields it carries (see step S3 below). Optional fields include: operation identifier, target node scope identifier, action code, data source descriptor, release level, rendering mode identifier, and presentation identifier, which correspond to capability dimensions such as semantic execution, cross-scope routing, runtime data sub-items, read-only release, and rendering mode, respectively.
[0057] Optional fields may also include labels, icons, and payloads. Labels and icons are used for presentation and do not participate in dimension classification. Payloads are the data required to perform the operation corresponding to the action item, and are divided into static payloads and dynamic payloads according to their source: static payloads are carried by the action item declaration and are applicable to data that is determined at the time of declaration (such as the target state value of the change state operation, etc.); dynamic payloads are injected by the component that declares the action item when it is triggered or dispatched, and are applicable to data that changes with the runtime context (such as the value of the candidate selected in the selector, the currently selected row, the current filter condition, etc.); static payloads and dynamic payloads can also be used together. In step S1, the action item declaration carries a static payload; in the data and presentation processing flow below, when the user selects a candidate in the selector, the value of the selected candidate is injected as a dynamic payload into the payload triggered by the action item this time. In step S6 below, the declaration point component injects dynamic payloads (such as the currently selected row, the current filter condition, etc.) when dispatching, and the payload is passed through to the processor along with the dispatch of the action item this time.
[0058] Since the presentation location, capability dimensions, and dispatch target of an action item are all determined by the aforementioned declaration fields, the front-end general interpreter and each component do not recognize any specific action item, nor do they write code for any specific action item. They only pass the declaration as is and execute it according to its field behavior. Therefore, adding an action item, deleting an action item, modifying the tag name of an action item, or adjusting the affiliation of an action item (i.e., adjusting the fragment tree node where its declaration is located) only requires modifying the action item declaration in the metamodel. The front-end does not need to change any code or release a new version.
[0059] In step S2, for the action descriptor subset declared in step S1 to reach the front end and take effect, it needs to be sent along with the fragment tree and passed to the corresponding component. Therefore, in this step, the backend sends the fragment tree containing the action descriptor subset along with the page structure. When the general interpreter recursively projects each node, it instantiates the component corresponding to that node according to the component type identifier declared by that node, and passes the action descriptor subset of that node as an input attribute to the component.
[0060] The general interpreter only performs transport operations in this process; it does not parse, judge, or recognize any specific action items. This design is because once the interpreter starts recognizing specific actions, the action semantics are hardcoded into the general layer, and adding a new type of action requires modifying the interpreter code. However, in this embodiment, adding or removing action types does not affect the general interpreter code; the general interpreter remains a pure structure projector, and the front-end general layer is completely decoupled from the action plane.
[0061] Step S3: After an action item reaches the corresponding component, it's necessary to know the action item's capabilities and subsequent processing behavior. The traditional approach is to use Solution 2 from the background technology, which involves setting a type field on the declaration item (e.g., regular button, jump button, dropdown button, etc.). The front-end then dispatches to different branches based on the enumerated values. However, when capability dimensions are orthogonal and can be stacked, the number of types in this approach expands exponentially with the number of combinations. Therefore, this step uses implicit type checking, i.e., it doesn't look up any type field, but instead uses Table 1 below and... Figure 2 As shown, each action item is checked to see if it is carried over, in order to determine which dimensions the action item has.
[0062] Table 1: Preset Dimensions and Corresponding Fields The dimensions within the action items are orthogonal to each other and can be freely superimposed. No predefined types are needed for any combination; five orthogonal dimensions require only five sets of fields, whereas the explicit enumeration in the background technology requires predefining 2 to the power of 5, or 32 types. In this embodiment, actual testing of 320 production action items showed that only 10 field types were used, with the remaining 22 types being redundant types reserved for possible combinations under the explicit enumeration scheme. Therefore, through the implicit type determination used in this step, the declaration scale is reduced from exponential to linear; adding a new dimension only requires adding one set of fields and one independent processing logic.
[0063] The dimensional combination obtained from the classification still needs to clarify the processing destination for each dimension: The operation identifier of the semantic execution dimension serves as the source of the action code during the default fallback, and together with the scope identifier and action code of the target node in the cross-scope routing dimension (as an explicit dispatch path, taking precedence over the default fallback), they are used for dispatch parsing in step S5. The read-only release dimension is used for the release determination in step S5. Its conclusion determines whether the dispatch of the action item is allowed. Action items that are not released will not enter the subsequent parsing and dispatch process. Runtime data sub-items and rendering mode dimensions directly enter the subsequent data and presentation processing flow.
[0064] The presentation of the same batch of action items is not uniform. Some action items need to be expanded into sub-menus, some need to slide out a selector, and some need to replace the default label with a special component. If the form differences and data retrieval logic are hardcoded in the declaration point component, adding a new form requires modifying the front-end code. If candidate sub-items are prefetched at page load, a large number of action items that have never been expanded will cause unnecessary requests. Therefore, the data and presentation processing flow of this embodiment is as follows: For action items with a rendering mode dimension, their expanded form on the interface (such as a submenu, slide-out selector, etc.) is determined according to the declared rendering mode identifier; those without this dimension are presented in the default label button form. If the action item also carries an optional extended custom rendering component name, the action item is rendered with the component with the corresponding name in the button component registry, instead of the default label button form.
[0065] For action items with runtime data sub-items, their candidate sub-items only initiate requests when the action item is expanded. The requests are sent through a unified data retrieval and caching facility and written to the same cache shared by other data consumers on the page. If the cache is hit, it is directly retrieved without issuing another network request. Action items that are not expanded do not incur any network overhead.
[0066] It should be noted that the acquisition of candidate sub-items is determined solely by the runtime data sub-item dimension, and does not depend on the rendering mode dimension; the morphological presentation of candidate sub-items occurs when the action item simultaneously possesses both the runtime data sub-item dimension and the rendering mode dimension. Action items that do not declare a rendering mode dimension (i.e., regardless of whether they possess a runtime data sub-item dimension) are always presented in the default label button format.
[0067] If an action item possesses both runtime data sub-item dimensions and rendering mode dimensions, then the optional content in its rendered selector component is taken from the candidate sub-items obtained during the expansion process. In this embodiment, candidate sub-items, optional items, and candidate options point to the same batch of data items, differing only in name at different stages. When a user selects a candidate option in the selector, it constitutes a trigger for the action item itself. The dispatch target and action code of the action item are pre-determined by its own semantic execution or cross-scope routing dimensions. Selecting the action is merely the timing of the trigger, and the value of the selected candidate option is only part of the payload of this trigger, followed by parsing in step S5 and searching and executing in step S6. Thus, the output of data retrieval and presentation is re-integrated into the existing dispatch chain, using the same dispatch mechanism as statically declared action item reuse, eliminating the need for a separate path for dynamic candidate options.
[0068] Step S4, after the action item is declared and typed, the registration and locating of the processor that actually performs the operation is handled by the action registry. Before describing the registration process, the format of the action registry is explained. The action registry is a two-level mapping table with the scope identifier as the first-level index and the action code as the second-level index. The combination of the first-level and second-level indices maps to a single processor. The scope identifier is taken from the identifier of the fragment tree node, and the same action code does not interfere with each other in different scopes. The action registry provides three basic primitives: register, deregister, and dispatch, and also provides two alternative primitives: batch dispatch of action codes with the same name within a scope and clearing of the entire scope.
[0069] Based on this, when the execution component carrying the execution logic is mounted, it registers the processor corresponding to the execution logic with the pre-set action registry, including the following process: Step S41: Obtain the parent scope identifier according to the nearest principle, with the following priorities: First, the container identifier passed by the upper-level container component of the execution component through the component context is used as the parent scope identifier. The upper-level container component is generated by the fragment tree recursively projected by the general interpreter. Second, if the upper-level container component does not pass the container identifier, the parent node is searched back from the node where the execution component is located to the root node in the fragment tree, and the scope identifier of the first parent node found is taken as the parent scope identifier. Third, if the scope identifier of any parent node is not found through backtracking, the scope identifier of the node where the executing component is located is taken as the parent scope identifier.
[0070] Proximity resolution ensures that the same component can be correctly assigned even when it is wrapped in different containers.
[0071] Step S42, the execution component simultaneously registers the same processor with the action registry through two channels: The first channel uses the scope identifier of the fragment tree node where the execution component is located as the first-level index and the action code carried by the execution component as the second-level index; The second channel uses the parent scope identifier obtained in step S41 as the first-level index and the composite action code formed by concatenating its own scope identifier and the action code as the second-level index. The two channels point to the same processor, enabling both the old and new meta-models to work under the same front-end code, thus decoupling the release windows of the front-end and back-end code repositories.
[0072] In step S43, the processor entity is stored in a mutable reference, and the fixed wrapper function that reads this mutable reference is registered in the action registry. Since the processor closure generates a new function entity with each rendering, if the entity is registered directly, each rendering will trigger a deregistration and re-registration, and there may be a temporary index loss or dispatch failure between the two operations. By using a stable reference as a transfer, the registration relationship remains stable throughout the component's lifecycle.
[0073] Step S5: When a user clicks on an action item (or the user selects a candidate item in the selector), this step first determines whether the action item should be allowed, and then parses and assigns a target to the allowed action item, as follows.
[0074] In step S51, the page may be in a read-only state. In read-only state, write operations are prohibited by default, but some actions (such as comments) still need to be available in read-only state, while others (such as writing modeling data) must be prohibited. To strike a balance between controllability and non-overstepping, this step introduces an allowance decision, that is, when any action is triggered by the user, it is necessary to determine whether the action should be allowed.
[0075] The sources of a page being in a read-only state include at least version freeze, comparison state, compliance state, and permission bit setting. Among these, version freeze, comparison state, and compliance state are considered hard read-only, while permission bit setting is considered soft read-only.
[0076] The release decision is configured with release tiers, including at least a first tier and a second tier. The rules for each release tier are as follows: The first tier only allows soft read-only access caused by a permission bit being false, and cannot bypass hard read-only access caused by version freeze, comparison state, or compliance state; the second tier allows all read-only sources, including the aforementioned hard read-only access. The release tier can be declared at both the action item level and its parent node level. The decision is made based on the action item level declaration; if no action item is declared, the default declaration of its parent node level is inherited; if neither level is declared, release is denied. In this way, the same set of rules covers both the requirement of releasing the entire component in read-only state and the requirement of releasing only individual action items.
[0077] The two tiers are based on the nature of the data written to the action item, i.e., whether the data belongs to modeling data or communication data. Modeling data refers to formal data on a business object that is subject to control constraints such as version freeze, comparison state, and compliance state, such as notes, business attributes, and status fields on related rows. Communication data refers to content that does not constitute formal data of a business object, such as independent comments, whose existence is not constrained by the modeling version state. The first tier applies to action items that write modeling data: modeling data should be locked when the version is frozen. Therefore, when the page is under a hard read-only source such as version freeze, action items in the first tier (whose writer is modeling data) are declared not to be allowed or dispatched. Only when the read-only source has a no permission bit (soft read-only) can the action item be allowed. The second tier applies to action items that write communication data: its existence is not constrained by the modeling version state. Therefore, even if the page is under a hard read-only source such as version freeze, action items in the second tier can still be allowed. Whether a specific action item is written as modeling data or communication data is determined by the metamodel declarer based on business semantics when declaring the action item, and the corresponding level is selected accordingly.
[0078] The rules for determining whether to allow an action are as follows: First, when the page is not in a read-only state, the action is allowed; second, when the page is in a read-only state, action items without a declared allowance level are not allowed, and for action items with a declared allowance level, the rules for allowing the action are determined according to the declared allowance level. Actions that are not allowed are not dispatched; optionally, actions that are not allowed are also not expanded or have their data retrieved.
[0079] Since the read-only release dimension is an independent dimension orthogonal to other dimensions, there is no need to set up separate types for combinations of releaseable routing items, releaseable data items, etc. This satisfies the business needs of individual actions still being available in read-only state. At the same time, no matter which action item the first level is declared on, it cannot bypass the hard read-only caused by version freeze, comparison state, and compliance state. Therefore, the action item that writes modeling data is subject to the above control according to the first level it should be declared.
[0080] Step S52: For the approved action item, the declaration point component resolves the dispatch target according to the dimension combination of the action item and follows the rule of explicit priority and default fallback, as follows: The node that declares the action item serves as the declaration point; When the dimension combination of the action item includes cross-scope routing dimensions, the first-level index takes the scope identifier of the target node corresponding to the cross-scope routing dimension, and the second-level index takes the action code corresponding to the cross-scope routing dimension. When the dimension combination of the action item does not include cross-scope routing dimensions, the first-level index takes the scope identifier of the node where the declaration point is located, and the second-level index takes the action code carried by the action item. When the action item does not carry an action code, if the dimension combination of the action item includes a semantic execution dimension, the operation identifier corresponding to the semantic execution dimension is used as a secondary index. If the dimension combination of the action item does not include a semantic execution dimension, the presentation identifier of the action item is used as a secondary index. The presentation identifier is one of the optional fields of the action item. When the action item does not carry an action code, operation identifier, or presentation identifier, dispatch is not initiated. The dispatch target is a combination of primary indexes and secondary indexes.
[0081] Since the action item carries the scope identifier and action code of the target node, and the execution component registers its own scope identifier and action code, neither needs to know who the other is or which level of the fragment tree it is located at during compilation. They only need to meet in the action registry at runtime. Therefore, the same action item can fall on different execution points at different levels under different business objects and different meta-models, and the default fallback rule happens to hit the old channel in step S4, thus achieving backward compatibility.
[0082] Step S6: Using the parsed dispatch target, search for a matching and registered processor in the action registry and call it. Pass the payload triggered by this action item to the called processor to execute the corresponding operation. If no matching and registered processor is found, no operation is performed and no exception is thrown (silent no-operation), which does not affect the normal use of other action items.
[0083] If no matching and registered processor is found, it means that there is currently no available execution point for the action. This is a normal situation where the declaration and registration are out of sync, rather than a program defect. Therefore, no operation is performed and no exception is thrown. From the user's perspective, clicking a currently unavailable button and having no response is consistent with the experience of a disabled button, and will not cause confusion. However, if an error message pops up, the user cannot fix it and will be interrupted, affecting the user experience.
[0084] Since the first-level index takes the identifier of the fragment tree node, and the node identifier is unique in the same fragment tree, even if multiple similar components on the same screen register the exact same action code, they will not overwrite each other and will be completely isolated from each other. This ensures that there is only one execution point to respond to each trigger, without the need for broadcasting or filtering by the listener, thus eliminating crosstalk of actions with the same name from the mechanism.
[0085] Step S7: When the execution component carrying the execution logic in the corresponding component is unloaded as the fragment tree changes, the processor registered in the action registry is deregistered.
[0086] If registration is only made but not deregistered, the action registry will accumulate failed handlers pointing to unloaded components, causing memory growth and potentially leading to dispatching to an execution point that no longer exists. Therefore, when the execution component carrying the execution logic in the corresponding component is unloaded as the fragment tree changes, both channels registered in step S4 are deregistered from the registry to ensure that the size of the action registry always matches the actual components existing on the current page, and that the dispatch result consistently points to the actual execution point.
[0087] Continue to refer to Figure 1 This embodiment also provides an action descriptor declaration and runtime scope routing system for fragment trees, including ten modules. The specific functions and signal transmission relationships of each module are as follows: The action declaration module is used to declare a set of action descriptors on the nodes of the fragment tree, in addition to declaring the component type identifier, layout slot, child node list and data binding descriptor. The set of action descriptors contains at least one action item, and each action item consists of several optional fields and does not carry a type field. The general interpreter module is used to receive the fragment tree issued by the action declaration module, recursively project each node of the fragment tree, and pass the set of action descriptors declared on each node as input attributes to the component corresponding to that node. The dimension determination module is used to receive the action description subset passed through by the general interpreter module, identify the fields carried by each action item according to the preset dimension and field correspondence, determine the dimension combination of the action item, and send the determination flag with cross-scope routing dimension and semantic execution dimension to the dispatch parsing module, send the action item with read-only release dimension to the read-only release determination module, send the action item with runtime data sub-item dimension to the delayed data retrieval module, and send the action item with rendering mode dimension to the rendering form rendering module.
[0088] The read-only release determination module is used to receive action items with read-only release dimensions sent by the dimension type determination module. When the page is in read-only state, it determines whether to release the action item with a declared release level according to the declared release level and outputs the release determination conclusion; action items without a declared release level are not released by default in read-only state. The delayed data retrieval module is used to receive action items with runtime data sub-item dimensions sent by the dimension classification module. When the action item is expanded, it obtains candidate sub-items according to the data source descriptor through unified data retrieval and caching facilities, reuses the cache shared with other data consumers, and outputs the candidate sub-items. The rendering module receives action items with rendering mode dimensions from the dimension determination module, determines the expanded form of the action item according to the rendering mode identifier, and presents the action item as a submenu or a slide-out selector. When the action item also has runtime data sub-item dimensions, the candidate sub-items output by the delayed data retrieval module are rendered as an option list of the selector component corresponding to the action item. When the user selects a candidate item in the selector component, it constitutes a trigger for the action item. The value of the candidate item is output to the dispatch parsing module as part of the payload of this trigger. When the action item carries a custom rendering component name, the action item is rendered using the component corresponding to the component name in the button component registry. The dispatch parsing module is used to receive the cross-scope routing dimension and semantic execution dimension judgment flags of the triggered action item sent by the dimension type judgment module, the release judgment conclusion of the read-only release judgment module, and the trigger sent by the presentation form rendering module. When the action item is triggered, the dispatch target of the action item is parsed according to the cross-scope routing dimension and semantic execution dimension of the action item in an explicit priority and default fallback manner, and a dispatch signal carrying the scope identifier, action code and payload is issued. The scope resolution module is used to receive the container identifier and fragment tree structure provided by the general interpreter module, and resolve them according to the nearest principle to obtain the parent scope identifier of the node where the execution component is located. The execution-side registration agent module is used to receive the parent scope identifier output by the scope resolution module, send registration signals through two channels to register the processor corresponding to the execution logic when the execution component is mounted, and send deregistration signals when the execution component is unmounted. The action registry module is used to maintain processor mapping with scope identifier as the first-level index and action code as the second-level index. It receives the registration / deregistration signal from the execution-side registration agent module and the dispatch signal from the dispatch parsing module, retrieves the corresponding processor according to the dispatch signal and calls it, and passes the payload through to the execution component.
[0089] Application Cases Case 1 (Cross-generation dispatch: Declaration on ancestor node, execution on grandchild node) The fragment tree of a certain business object's details page is distributed by the backend according to that business object, and the associated aggregate card node (the ancestor container node in the fragment tree) declares the following action items: The scope identifier for the target node: activities-predecessor-list; Action code: add; Tag: Add upstream.
[0090] This action item carries both the scope identifier and action code of the target node, possessing a cross-scope routing dimension. It is passed through the general interpreter to the aggregation card component as is, along with the action descriptor subset. The association list component is located as a grandchild node of the aggregation card, and its node scope identifier is exactly activities-predecessor-list. When this component is mounted, the processor that opens the selector is registered with (activities-predecessor-list, add).
[0091] When a user clicks the "Add Upstream" button in the aggregation card header, the action is triggered. The dispatcher parses the dispatch target, the action registry is matched, and the grandchild node displays a selector.
[0092] Throughout the process, the aggregate card component code does not contain the phrase "add upstream", the associated list component does not know who will call it, the declaration point and the execution point do not recognize each other, and only meet in the action registry.
[0093] Case 2 (Actions with the same name do not interfere with each other) Three related lists are rendered on the same page: the upstream list, the downstream list, and the reference list. The scope identifiers of the nodes of the three are activities-predecessor-list, activities-successor-list, and activities-reference-list, respectively. All three declare the action code add.
[0094] When the three execution components are mounted, they are registered with the `add` event using their respective node scope identifiers. This creates three non-overlapping indices in the action registry: `activities-predecessor-list` with `add`, `activities-successor-list` with `add`, and `activities-reference-list` with `add`. When a user clicks the `add` button in any list header, only that list responds; the other two lists remain unaffected. If a global event bus were used instead, all three lists would receive the `add` event and would need to determine whether it belongs to them. In contrast, this solution ensures that only one execution point responds to each trigger.
[0095] Case 3 (Dimension Overlay: including cross-scope routing dimension, runtime data sub-item dimension, and rendering mode dimension) An action item carries the scope identifier of the target node, the action code, the data source descriptor, and the rendering mode identifier.
[0096] After a user clicks: Step S5 parses the data, and step S6 searches and dispatches it to the target node. The target component recognizes the item with a data source descriptor, and upon expansion, pulls candidate sub-items based on the data source descriptor, presenting them as a slide-out selector according to the rendering mode. When the user selects a candidate item from the slide-out selector, this constitutes a trigger for that action item. The value of this candidate item becomes part of the trigger payload and is dispatched and executed along with the already determined dispatch target for that action item. Throughout the process, the three dimensions operate independently without interfering with each other.
[0097] Case 4 (Item-by-item release and no boundary crossing in read-only mode) When the page is read-only from the version freeze (hard read-only), it is declared that the first-tier edit note action item will not be allowed (notes belong to modeling data, and the first tier cannot bypass the hard read-only version freeze, so it will not be dispatched); it is declared that the second-tier independent comment action item is still available (comments belong to communication data and are not constrained by the modeling version status).
[0098] When the page is read-only and the permission bit is not specified (soft read-only), the first-level edit note action item is allowed according to the first-level rules, and the second-level comment action item is allowed according to the second-level rules. Both can be triggered normally. Action items without a declared permission level are not allowed by default in read-only mode, which reflects the ability to declare each item individually.
[0099] The above determination is unrelated to whether the action item is a routing item or whether it has a data source. Read-only access is an independent dimension orthogonal to other dimensions, and there is no need to set a separate type for combinations such as accessible routing items and accessible data items.
[0100] Case 5 (Asynchronous Deployment of Front-end and Back-end) The backend metamodel has not yet been modified, and the action items are still declared in the old style (presentation identifier: activities-predecessor-list:add, label: ...), without the scope identifier and action code of the target node.
[0101] Step S3 determines the type based on field presence: only the presentation identifier is present, the dimension combination is empty, and there are no orthogonal dimensions. After user triggering, step S51 determines to allow (not read-only), and step S52 parses according to the default fallback rules: the dimension combination does not contain cross-scope routing dimensions, and the first-level index takes the scope identifier of the node where the declaration point is located; it does not carry an action code or an operation identifier, and the second-level index takes the presentation identifier of the action item, activities-predecessor-list:add. At the same time, when the execution component is mounted, the legacy channel has been registered with the parent scope identifier and the composite action code (the scope identifier of the device itself and add concatenated). Since the presentation identifier of the legacy declaration happens to use the composite syntax of the execution point identifier and the action code, and the parsed first-level index is consistent with the parent scope identifier used to register the legacy channel, the dispatch target happens to hit the legacy channel registration item, and the behavior is completely consistent with the new declaration. After the backend is transformed and switched to the new declaration, the frontend does not need any changes, and the two repository publishing windows are decoupled.
[0102] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0103] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification. Furthermore, the above embodiments only illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. For those skilled in the art, several modifications and improvements can be made, and these all fall within the protection scope of the present invention.
Claims
1. A method for declaring action descriptors and routing runtime scope in a fragment tree, characterized in that, include: S1, Receive the fragment tree sent by the backend according to the target object. In addition to declaring the component type identifier, layout slot, child node list and data binding descriptor, the nodes of the fragment tree also declare the action descriptor set. The action descriptor set contains at least one action item. Each action item consists of several optional fields and does not carry a type field. S2, when the general interpreter recursively projects each node of the fragment tree, it passes the set of action descriptors declared on each node as input attributes to the component corresponding to that node. S3. For each action item, the corresponding component identifies the fields carried by the action item based on the preset correspondence between dimensions and carried fields, and determines the combination of dimensions that the action item has. The dimensions in the combination of dimensions are orthogonal to each other and can be freely superimposed. S4, When the execution component carrying the execution logic in the corresponding component is mounted, it registers the processor corresponding to the execution logic with the pre-set action registry; S5, when any action is triggered by the user, the corresponding component resolves the dispatch target of the action based on the dimension combination of the action, with explicit priority and default fallback. S6. Using the parsed dispatch target, find the processor that matches the dispatch target and has been registered in the action registry and call it. Pass the payload of the action item triggered this time to the called processor to execute the operation corresponding to the action item. S7, when the execution component carrying the execution logic in the corresponding component is unloaded as the fragment tree changes, the processor registered in the action registry is deregistered.
2. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 1, characterized in that, In S1, the action description subset is divided into toolbar slots and inline slots according to the presentation position. The field structure of the action items in the two slots is exactly the same, only the presentation position is different.
3. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 1, characterized in that, In S3, the preset correspondence between dimensions and carried fields includes at least the following: The semantic execution dimension corresponds to the operation identifier, indicating that the action item corresponds to an operation semantic that can be executed by the backend; Cross-scope routing dimension corresponds to the scope identifier and action code of the target node, indicating that the execution point of the action item is not its declaration point and needs to be dispatched to the specified node. When the action item carries both the scope identifier and action code of the target node, it is determined that it has this dimension. The runtime data sub-item dimension corresponds to the data source descriptor, indicating that the candidate sub-items of this action item are unknown at the time of declaration, and are retrieved according to the data source descriptor when the action item is expanded; The read-only release dimension corresponds to the release level, indicating that the action item is released in read-only state according to the declared release level; The rendering mode dimension corresponds to the rendering mode identifier, indicating that the action item is presented in the expanded form specified by the rendering mode identifier.
4. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 3, characterized in that, In S4, the action registry uses the scope identifier as the first-level index, the action code as the second-level index, and the processor as the mapping value of the combination of the first-level index and the second-level index. The scope identifier is taken from the identifier of the fragment tree node.
5. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 4, characterized in that, S4 includes the following process: S41, when the execution component carrying the execution logic is mounted, the parent scope identifier is resolved and obtained from the nearest one according to the following rules: The container identifier passed by the component context of the upper-level container component of the execution component is preferred as the parent scope identifier. The upper-level container component is generated by the fragment tree recursively projected by the general interpreter. If the upper-level container component does not pass the container identifier through the component context, then the parent node is searched back from the node where the execution component is located to the root node in the fragment tree, and the scope identifier of the first parent node found is used as the parent scope identifier. If the backtracking search does not find any parent node's scope identifier, then the scope identifier of the node where the execution component is located is used as the parent scope identifier. S42, the execution component simultaneously registers the same processor with the action registry via two channels: The first channel uses the scope identifier of the fragment tree node where the execution component is located as the first-level index and the action code carried by the execution component as the second-level index; The second channel uses the parent scope identifier as the first-level index and the composite action code formed by concatenating its own scope identifier and the action code as the second-level index.
6. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 5, characterized in that, Also includes: S43, the processor is stored via a variable reference, and the execution component registers a fixed wrapper function that reads the variable reference with the action registry, so that the processor closure is not repeatedly registered when the rendering changes.
7. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 4, characterized in that, In S5, when any action is triggered by the user, it is determined whether the action should be allowed: This action is allowed when the page is not in read-only mode; When the page is in read-only mode, the corresponding component determines whether to allow the action item based on the allowance level declared for that action item. The allowance rules are as follows: Actions that do not specify a gear position for release will not be released; The sources causing a page to be in a read-only state include at least version freeze, comparison state, compliance state, and permission bit not specified. Among these, version freeze, comparison state, and compliance state are hard read-only, while permission bit not specified is soft read-only. The allowance level includes at least a first level and a second level. The first level only allows soft read-only caused by permission bit not specified and must not exceed hard read-only caused by version freeze, comparison state, and compliance state. The second level allows all read-only sources, including hard read-only. The allowance level can be declared at both the action item level and its corresponding node level. When making a judgment, the action item level declaration is taken. If the action item level is not declared, the default declaration of its corresponding node level is inherited. If neither level is declared, the page is not allowed. Actions that have not been approved will not be dispatched.
8. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 7, characterized in that, For actions that are allowed to proceed, the corresponding component resolves the dispatch target of the action based on the dimension combination of the action, with explicit priority and default fallback, as follows: The node that declares the action item serves as the declaration point; When the dimension combination of the action item includes cross-scope routing dimensions, the first-level index takes the scope identifier of the target node corresponding to the cross-scope routing dimension, and the second-level index takes the action code corresponding to the cross-scope routing dimension. When the dimension combination of the action item does not include cross-scope routing dimensions, the first-level index takes the scope identifier of the node where the declaration point is located, and the second-level index takes the action code carried by the action item. When the action item does not carry an action code, if the dimension combination of the action item includes a semantic execution dimension, the operation identifier corresponding to the semantic execution dimension is used as a secondary index. If the dimension combination of the action item does not include a semantic execution dimension, the presentation identifier of the action item is used as a secondary index. The presentation identifier is one of the optional fields of the action item. When the action item does not carry an action code, operation identifier, or presentation identifier, dispatch is not initiated. The dispatch target is a combination of primary indexes and secondary indexes.
9. The method for declaring action descriptors and runtime scope routing in a fragment tree as described in claim 3, characterized in that, For action items that are determined to have runtime data sub-item dimensions in S3, when they are expanded, candidate sub-items are obtained according to the data source descriptor carried by the action item. The obtained results are written to a cache shared with other data consumers. Action items that are not expanded do not initiate a retrieval request. For actions that are determined to have a rendering mode dimension in S3, the action is presented as a submenu or slide-out selector according to the rendering mode identifier carried by the action. When an action item has both runtime data sub-item dimension and rendering mode dimension, the candidate sub-items obtained when it is expanded are rendered into an option list by the selector component corresponding to the action item. The selector component is presented in the form determined by the rendering mode identifier. When the user selects a candidate item from the selector component, it constitutes a trigger for the action item. The value of the candidate item is used as part of the payload of this trigger and is dispatched along with the dispatch target already determined for the action item.
10. A fragment tree action descriptor declaration and runtime scope routing system based on the method of any one of claims 1 to 9, characterized in that, include: The action declaration module is used to declare a set of action descriptors on the nodes of the fragment tree, in addition to declaring the component type identifier, layout slot, child node list and data binding descriptor. The set of action descriptors contains at least one action item, and each action item consists of several optional fields and does not carry a type field. The general interpreter module is used to receive the fragment tree issued by the action declaration module, recursively project each node of the fragment tree, and pass the set of action descriptors declared on each node as input attributes to the component corresponding to that node. The dimension type determination module is used to receive the action description subset passed through by the general interpreter module, identify the fields carried by each action item according to the preset dimension and field correspondence relationship, and determine the dimension combination that the action item has. The dimensions include at least one or more of the following: semantic execution dimension, cross-scope routing dimension, runtime data sub-item dimension, read-only allow dimension, and rendering mode dimension. The read-only release determination module is used to receive action items with read-only release dimensions sent by the dimension type determination module. When the page is in read-only state, it determines whether to release the action item with a declared release level according to the declared release level and outputs the release determination conclusion; action items without a declared release level are not released in read-only state. The delayed data retrieval module is used to receive action items with runtime data sub-item dimensions sent by the dimension classification module. When the action item is expanded, it obtains candidate sub-items according to the data source descriptor through unified data retrieval and caching facilities, reuses the cache shared with other data consumers, and outputs the candidate sub-items. The rendering module is used to receive action items with rendering mode dimensions sent by the dimension determination module, determine the expanded form of the action item according to the rendering mode identifier, and present the action item as a submenu or slide-out selector. When the action item also has runtime data sub-item dimensions, the candidate sub-items output by the delayed data retrieval module are rendered as an option list of the selector component corresponding to the action item. When the user selects a candidate item in the selector component, it constitutes a trigger for the action item. The value of the candidate item is output to the dispatch parsing module as part of the payload of this trigger. The dispatch parsing module is used to receive the cross-scope routing dimension and semantic execution dimension of the triggered action item sent by the dimension type determination module, the release determination conclusion of the read-only release determination module, and the trigger sent by the presentation form rendering module. When the action item is triggered, the dispatch target of the action item is parsed according to the cross-scope routing dimension and semantic execution dimension of the action item in an explicit priority and default fallback manner, and a dispatch signal carrying the scope identifier, action code and payload is issued. The scope resolution module is used to receive the container identifier and fragment tree structure provided by the general interpreter module, and resolve them according to the nearest principle to obtain the parent scope identifier of the node where the execution component is located. The execution-side registration agent module is used to receive the parent scope identifier output by the scope resolution module, send registration signals through two channels to register the processor corresponding to the execution logic when the execution component is mounted, and send deregistration signals when the execution component is unmounted. The action registry module is used to maintain processor mapping with scope identifier as the first-level index and action code as the second-level index. It receives the registration / deregistration signal from the execution-side registration agent module and the dispatch signal from the dispatch parsing module, retrieves the corresponding processor according to the dispatch signal and calls it, and passes the payload through to the execution component.
