Product object attribute change identification method, system, equipment and medium
By using Java custom annotation and reflection mechanism in the security product operation platform, the change verification of product object field attributes is automatically handled, and the problems of poor code redundancy and poor scalability in the existing technology are solved, achieving more efficient system maintenance and performance improvement.
Patent Information
- Application Number
- CN202411809623.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-03-18
AI Technical Summary
In the security product operation platform, when the product object field attributes are changed, a large number of duplicate codes are required to be manually written for verification, resulting in redundant codes, poor scalability, insufficient flexibility, high maintenance costs and performance problems.
Use Java custom annotation and reflection mechanism to pre-defined annotations to mark fields that need to be checked, obtain and compare the changes of fields through the reflection mechanism, and automatically adjust the audit node.
Reduces code redundancy, improves system scalability and flexibility, reduces maintenance costs, improves system performance, and reduces error risk.
Smart Images

Figure CN119645965A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of network security, and in particular relates to a method, system, device, and medium for identifying changes in product object attributes. Background Art
[0002] The security product operation platform manages security products of different categories from various manufacturers. Different security products have common attribute information as well as their own characteristic attribute information. As a result, the operation platform has many attribute fields when uniformly managing security products, which need to be classified according to the functions to which the fields belong.
[0003] In addition, security products need to go through the review process when they are added, edited, or removed from shelves. When adding a new product object, all review process nodes need to be followed, and when editing a product object, it is necessary to determine which review nodes should be followed based on the modified fields. For example, when the basic information of a product object is modified, the pre-review node cannot be skipped, and when the business-related information of a product object is modified, the business information review node cannot be skipped, and so on.
[0004] Based on the above business scenarios, if we follow the traditional writing logic, when the field attribute value of the product object changes, we need to check the modified fields one by one with the field value stored in the database, record the change mark when the field value changes, and determine whether a certain audit process node needs to be skipped based on the mark. However, writing code for each field separately to check whether the value has changed has the following disadvantages: (1) Code redundancy: For each field that needs to be audited, the corresponding comparison logic needs to be written, which will result in a large amount of duplicate code and increase the difficulty of maintenance.
[0005] (2) Poor scalability: If you need to add new fields or modify the review process of existing fields, you need to manually update the comparison logic of each field, which is not only error-prone but also inefficient.
[0006] (3) Difficult to manage: As the number of fields increases, the logic of comparing each field becomes more and more complicated, making the entire system difficult to manage and understand.
[0007] (4) Lack of flexibility: This approach lacks flexibility and cannot easily apply different audit rules or processes to different fields.
[0008] (5) High risk of errors: Manually written comparison logic is more prone to errors, such as missing comparisons of certain fields or incorrect comparison logic, which may lead to failure or errors in the audit process.
[0009] (6) Performance issues: Comparing each field may affect the performance of the system, especially when processing large amounts of data or high concurrent requests.
[0010] (7) High maintenance cost: Due to code redundancy and complexity, maintaining such a system requires more time and resources. Summary of the invention
[0011] In view of the shortcomings of the prior art mentioned above, the purpose of the present invention is to propose an implementation method based on custom annotations and reflection mechanisms, which uses Java annotations to mark fields, and utilizes Java's reflection mechanism to extract the changed fields and the corresponding field values in the database for verification, thereby identifying whether the field attributes of the product object have changed and adjusting the audit nodes accordingly.
[0012] To achieve the above-mentioned purpose and other related purposes, the present invention provides a method for identifying changes in product object attributes, which is applied to a security product operation platform, and the security product operation platform is used to manage product objects of different categories from different manufacturers, and store the information of product objects in a back-end database according to different field attributes; the method includes: pre-defining a custom annotation to mark the fields that need to be verified; when the information of any product object is re-edited, using the reflection mechanism to obtain all the edited first fields from the front end, and calling all the corresponding second fields from the back-end database; wherein the fields with the same attributes in the first field and the second field have the same annotation information; for any first field, using the reflection mechanism to obtain its corresponding field name, and indexing the corresponding field value from all second fields according to the field name, and identifying whether the field of the product object has changed by verifying the first field and the field value.
[0013] According to a specific embodiment of the present invention, it also includes: pre-defining an audit node to audit the fields of the product object after adding / deleting a product object on the security product operation platform, or modifying the information of the product object, and updating the back-end database accordingly after the audit is successful; wherein, when a field change of the product object is identified, the corresponding audit node is enabled to audit the field.
[0014] According to a specific embodiment of the present invention, the annotation information of the field includes information about the corresponding audit node; wherein different fields of the product object are set in a one-to-one correspondence with the audit node.
[0015] According to a specific embodiment of the present invention, the step of enabling the corresponding audit node to audit the field after identifying a field change of the product object includes: before verifying the first field and the field value, creating a Map array about the audit node to define the variable value of the audit node; wherein the variable value of each audit node is pre-defined as not enabled; and when the field change of the product object is identified, adjusting the variable value of the corresponding audit node to enabled.
[0016] According to a specific embodiment of the present invention, the attributes of the field include: basic information, extended information, business information, product technical information, and product instance information.
[0017] According to a specific embodiment of the present invention, for any first field, the reflection mechanism is used to obtain its corresponding field name, and the corresponding field value is indexed from all second fields according to the field name, and the step of identifying whether the field of the product object has changed by verifying the first field and the field value includes: creating a corresponding Field array for the first field, and creating a corresponding Map array for the second field; wherein the key in the Field array and the Map array is the field name obtained by the reflection mechanism, and the value is the modified field value and the stored field value, respectively; traversing each first field in the Field array, obtaining the field value of the second field with the same field name from the Map array according to its corresponding field name, and verifying whether the first field and the field value identify whether the field of the product object has changed.
[0018] According to a specific embodiment of the present invention, the step of traversing each first field in the Field array, obtaining the field value of the second field with the same field name as the field name from the Map array through the corresponding field name, and verifying whether the first field and the field value identify the field of the product object to be changed also includes: For any first field in the Field array, check whether there is annotation information: if so, obtain the corresponding field name using the reflection mechanism based on the annotation information, and index the corresponding field value from the Map array according to the field name, otherwise stop checking; by comparing the first field and the corresponding field value, identify whether they are consistent: if so, identify that the field corresponding to the product object has not changed, otherwise identify that the field corresponding to the product object has changed.
[0019] A system for identifying changes in product object attributes is applied to a security product operation platform, and the security product operation platform is used to manage product objects of different categories from different manufacturers, and store the information of product objects in a back-end database according to different field attributes; the system includes: a configuration module, which is used to predefine a custom annotation for marking fields that need to be verified; a field acquisition module, which is used to use a reflection mechanism to obtain all the edited first fields from the front end and call all the corresponding second fields from the back-end database when the information of any product object is re-edited; wherein the fields with the same attributes in the first field and the second field have the same annotation information; a field verification module, which is used to use a reflection mechanism to obtain the corresponding field name of any first field, and index the corresponding field value from all second fields according to the field name, and identify whether the field of the product object has changed by verifying the first field and the field value.
[0020] An electronic device comprises a processor, wherein the processor is coupled to a memory, wherein the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, any of the above-mentioned methods is implemented.
[0021] A computer-readable storage medium includes a program. When the program is run on a computer, the computer is enabled to execute any of the above methods.
[0022] The present invention uses custom annotations and reflection mechanisms to implement field value change verification and determine the audit process, which has the following advantages: (1) Reduce code redundancy: Through annotations and reflection, all fields that need to be audited can be processed uniformly, avoiding the need to write repeated comparison logic for each field.
[0023] (2) Improve scalability: When you need to add new fields or modify the review process of existing fields, you only need to add or modify annotations on the fields without changing the core comparison logic.
[0024] (3) Enhanced flexibility: Different audit rules or processes can be specified for different fields, and can be flexibly configured through annotation parameters.
[0025] (4) Reduce maintenance costs: System maintenance becomes simpler and more efficient due to the reduction of duplicate code and complex manual comparison logic.
[0026] (5) Improve performance: By centrally processing field comparison logic, unnecessary calculations and resource consumption can be reduced, thereby improving system performance.
[0027] (6) Easy to understand and maintain: The unified processing method makes the structure and logic of the entire system clearer, making it easier to understand and maintain.
[0028] (7) Reduced error risk: Automated comparison logic reduces the possibility of human error and improves system stability and reliability.
[0029] (8) Support dynamic configuration: The fields that need to be reviewed can be dynamically adjusted through configuration files or other external inputs, increasing the flexibility of the system.
[0030] (9) Promote code reuse: By abstracting common comparison logic, it can be reused in multiple projects or modules, improving development efficiency.
[0031] (10) Compliance with object-oriented design principles: The use of annotations and reflection mechanisms complies with object-oriented design principles, such as encapsulation, inheritance, and polymorphism, which helps to build more robust and maintainable systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A flowchart of a specific embodiment of a method for identifying changes in product object attributes provided by the present invention; Figure 2 A schematic diagram of a structure of a specific embodiment of a system for identifying changes in product object attributes provided by the present invention; Figure 3 The present invention provides a structural block diagram of a specific embodiment of an electronic device. DETAILED DESCRIPTION
[0033] In order to facilitate understanding of the present application, the present application will be described more fully below with reference to the relevant drawings. Embodiments of the present application are provided in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive.
[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0035] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0036] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0037] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0038] Example 1 The present invention provides a method for identifying changes in product object attributes, which is applied to a security product operation platform. Generally, the security product operation platform needs to manage security products of different categories from different manufacturers, and the attribute information of the security products will be stored in the security product operation platform accordingly. It can be understood that the security product operation platform will store the attribute information of the product object, that is, the security product, in an internal database according to different field attributes.
[0039] In addition, since security products need to go through the review process when adding, editing, putting on and taking off shelves, etc., to ensure that the operation is correct and the data information is accurate. It is understandable that when adding a new security product, the entire review process needs to be followed, while when editing and modifying the security product information, only the modified content can be reviewed. Therefore, it is necessary to identify the information content of the product object change, that is, the corresponding field.
[0040] Usually, you need to write corresponding codes according to the field name to verify whether the field value edited on the front end is consistent with the field value stored on the back end. If there is inconsistency, it means the field has been modified. You can enable the corresponding audit node for audit according to the attributes of the field.
[0041] However, the above operations require manual writing of corresponding codes according to the field name of each field, which will result in a large amount of repeated codes and repeated operations, which is prone to errors and inefficient.
[0042] Therefore, this embodiment provides a method for identifying changes in product object attributes. A set of universal verification codes is edited based on Java's custom annotations and reflection mechanism. It is no longer necessary to write a set of corresponding codes according to different field names to complete the verification operation of field changes. It is more concise and greatly reduces unnecessary operations. Figure 1 As shown, the specific steps are as follows: Step S100, pre-define a custom annotation to mark the fields that need to be verified.
[0043] It can be understood here that in this embodiment, only the fields that need to be reviewed are customized with annotations. Specifically, the field attributes include, for example, basic information, extended information, business information, product technical information, and product instance information. Among them, basic information may include, for example, product name, version number, logo, etc., extended information may include further supplementary descriptions of the product, business information may include, for example, product business introduction, qualifications, etc., product technical information may include, for example, product interface description, performance description, working description, etc., and product instance information may include actual application information of the product, working parameters, test data, etc. Of course, the field attributes of the product object are not limited to the above. In actual applications, the fields that need to be reviewed may also include other attributes. Without making too many restrictions on this, the modifications and embellishments made to the embodiments of the present invention by those skilled in the art without departing from the spirit of the present invention still fall within the scope of the invention application of the present invention.
[0044] In addition, the information of the product object, that is, the fields, is not limited to the above. In this embodiment, the focus is on the fields that may be adjusted, and no additional processing is performed on the fields that will not change and remain unchanged. Therefore, the fields that need to be custom annotated are only the fields that need to be verified, that is, the information of the product object that may change.
[0045] In a specific embodiment, the code for custom annotation of a field can be seen as follows: @Retention(RetentionPolicy.RUNTIME)@Target(ElementType.FIELD)public @interface FieldAnnotation {String value() default "";} Among them, @Retention(RetentionPolicy.RUNTIME) indicates that this annotation can be read at runtime, @Target(ElementType.FIELD) indicates that the annotation can be applied to the fields of the class, and FieldAnnotation is used to mark the required type of the field.
[0046] Step S200, when the information of any product object is re-edited, the reflection mechanism is used to obtain all the edited first fields from the front end, and all the corresponding second fields are called from the back end database; wherein the fields with the same attributes in the first field and the second field have the same annotation information.
[0047] After defining the custom annotations of the fields on the security product operation platform, since the custom annotations of the fields have been pre-defined and the corresponding mapping relationships have been established, when the information of the product object changes, the Java reflection mechanism can be used to obtain the corresponding fields after the product object information is re-edited from the front end, that is, the first field, and call the original fields of the product object from the back-end database, that is, the second field.
[0048] Specifically, in actual applications, a corresponding Field array can be created based on the first field, and a corresponding Map array can be created based on the second field, which are used to represent the re-edited information of the product object, that is, the corresponding field value, and the original information of the product object, that is, the corresponding field value. Among them, the key in the Field array and the Map array is the field name obtained by the reflection mechanism, and the value in the Field array and the Map array is the modified field value and the stored field value, respectively.
[0049] Step S300, for any first field, use the reflection mechanism to obtain its corresponding field name, and index the corresponding field value from all second fields according to the field name, and identify whether the field of the product object is changed by verifying the first field and the field value.
[0050] In this regard, this embodiment edits a verification tool, and the code can be seen as follows: / / Get the audit node Map<String, Boolean> map = ModuleTypeEnum.findAllModuleType(); / / product field validation Field[] voFields = productsVo.getClass().getDeclaredFields(); Map<String, Field> dbFieldMap = Arrays.stream(db.getClass().getDeclaredFields()).collect(Collectors.toMap(Field::getName, field -> field)); for (Field vo : voFields) { if (vo.isAnnotationPresent(FieldAnnotation.class)) { vo.setAccessible(true); String annotationValue = vo.getAnnotation(FieldAnnotation.class).value(); Field dbField = dbFieldMap.get(vo.getName()); dbField.setAccessible(true); if (vo.get(productsVo) != null &&!StringUtils.equals(String.valueOf(vo.get(productsVo)), String.valueOf(dbField.get(db)))) { map.put(annotationValue, true);}}} It should also be noted here that the audit node is a pre-set workflow, so that after adding / deleting a product object on the security product operation platform, or modifying the information of the product object, the workflow is enabled to audit the fields of the product object, and the back-end database is updated accordingly after the audit is successful. In addition, the audit node corresponding to the field can be defined in the annotation information of the field, so that after identifying a change in a certain field, the reflection mechanism of Java can be used to obtain and enable the corresponding audit node for audit. In this embodiment, the audit node can be set in a one-to-one correspondence with the attributes of the field, for example, a pre-audit node is set to audit the basic information of the product object, a technical audit node is set to audit the extended information of the product object, a commercial audit node is set to audit the commercial information of the product object, and two product listing audit nodes are set to audit the product technical information and product instance information of the product object respectively; or the audit node can be set in correspondence with multiple field attributes, for example, the product listing audit node can be used to audit the product technical information and product instance information of the product object, etc., without making too many restrictions on this, the modifications and embellishments made by those skilled in the art to the embodiments of the present invention without departing from the spirit of the present invention still fall within the scope of the invention application of the present invention.
[0051] Step S400, using the reflection mechanism according to the changed field to obtain the annotation information of the field about the corresponding audit node, and enable the audit node to audit the changed field of the product object.
[0052] Based on the above, when the information of the product object changes, a Map array about the audit node will be created synchronously to define the variable value of each audit node. For example, the initial variable values are all false, indicating that the audit node is not enabled. When a field of the product object is identified to have changed, the variable value of the audit node corresponding to the field can be changed to true, indicating that the audit node is enabled. Accordingly, the workflow of the audit node can be started based on the adjusted Map array, that is, the audit node with the variable value of true in the Map array is used to obtain the annotation information about the corresponding audit node of the changed field through the Java reflection mechanism, and the audit node is enabled to audit the changed information of the product object, that is, the changed field.
[0053] Specifically, in actual applications, by traversing the fields in the Field array, for each field, check whether the first field has annotation information: if so, the field name corresponding to the first field can be obtained based on the annotation information using Java's reflection mechanism, and the field value of the corresponding second field can be indexed from the Map array according to the field name, so that the first field and field value can be directly checked to identify whether the field of the product object has changed, that is, the field value modified by the front end of the same field and the field value stored in the back end are compared to identify whether the field has changed. Of course, if the annotation value of the field is not queried, it may mean that the field has not been pre-customized with annotations, and an error can be reported to remind the operation and maintenance personnel to readjust it.
[0054] It can be seen that the verification tool based on the above can be used to verify whether all fields have changed. It is no longer necessary to write corresponding codes for verification according to the field name of each field. Java's custom annotations and reflection mechanism can be well used to index the fields and field values of the front and back ends for verification, which greatly simplifies the operation steps and avoids code redundancy. In addition, the verification tool of the present application is not limited to application in the security product operation platform. The verification tool provided by this embodiment can be used for scenarios where field changes need to be verified. The modifications and embellishments made to the embodiments of the present invention by those skilled in the art without departing from the spirit of the present invention still fall within the scope of the invention application patent of the present invention.
[0055] It should be noted that the step division of the above methods is only for clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they contain the same logical relationship, they are all within the scope of protection of this application; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this application.
[0056] Example 2 See also Figure 2 As shown, this embodiment also provides a product object attribute change identification system, which is characterized by being applied to a security product operation platform, and the security product operation platform is used to manage product objects of different categories from different manufacturers, and store the information of the product objects in a back-end database according to different field attributes; the system includes: The configuration module 10 is used to pre-annotate fields of different attributes.
[0057] The field acquisition module 20 is used to obtain all the first fields after editing from the front end by using the reflection mechanism, and to call all the corresponding second fields from the back end database when the information of any product object is re-edited; wherein the fields with the same attributes in the first field and the second field have the same annotation information.
[0058] The field verification module 30 is used to obtain the corresponding field name of any first field using the reflection mechanism, and index the corresponding field value from all second fields according to the field name, and identify whether the field of the product object has changed by verifying the first field and the field value.
[0059] The field audit module 40 is used to obtain the annotation information of the field about the corresponding audit node by using the reflection mechanism according to the changed field, and enable the audit node to audit the changed field of the product object.
[0060] It should be noted that the system for identifying changes in product object attributes provided in the above embodiment and the method for identifying changes in product object attributes provided in the above embodiment 1 belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment and will not be repeated here. In actual applications, the method for identifying changes in product object attributes provided in the above embodiment 1 can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0061] Example 3 See also Figure 3 As shown, an embodiment of the present application further provides an electronic device, comprising a memory 2, a processor 1, and a program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above methods when executing the program.
[0062] Among them, the memory includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory can be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory can also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory can also include both an internal storage unit of the electronic device and an external storage device. The memory can not only be used to store application software and various types of data installed in the electronic device, but also can be used to temporarily store data that has been output or is to be output.
[0063] In some embodiments, the processor may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor is the control core (Control Unit) of the electronic device, which connects the various components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device and processes data by running or executing programs or modules stored in the memory, and calling data stored in the memory.
[0064] The processor executes the operating system of the electronic device and various installed application programs. The processor executes the application programs to implement the steps in the above method embodiment.
[0065] Exemplarily, the program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of program instruction segments capable of completing specific functions, which are used to describe the execution process of the program in the electronic device.
[0066] The above-mentioned integrated unit implemented in the form of software function modules can be stored in a computer-readable storage medium. The above-mentioned software function modules are stored in a storage medium and include several instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to perform part of the functions of various embodiments of the present invention.
[0067] In summary, the present invention uses custom annotations and reflection mechanisms to implement field value change verification and determine the review process, which has the following advantages: (1) Reduce code redundancy: Through annotations and reflection, all fields that need to be audited can be processed uniformly, avoiding the need to write repeated comparison logic for each field.
[0068] (2) Improve scalability: When you need to add new fields or modify the review process of existing fields, you only need to add or modify annotations on the fields without changing the core comparison logic.
[0069] (3) Enhanced flexibility: Different audit rules or processes can be specified for different fields, and can be flexibly configured through annotation parameters.
[0070] (4) Reduce maintenance costs: System maintenance becomes simpler and more efficient due to the reduction of duplicate code and complex manual comparison logic.
[0071] (5) Improve performance: By centrally processing field comparison logic, unnecessary calculations and resource consumption can be reduced, thereby improving system performance.
[0072] (6) Easy to understand and maintain: The unified processing method makes the structure and logic of the entire system clearer, making it easier to understand and maintain.
[0073] (7) Reduced error risk: Automated comparison logic reduces the possibility of human error and improves system stability and reliability.
[0074] (8) Support dynamic configuration: The fields that need to be reviewed can be dynamically adjusted through configuration files or other external inputs, increasing the flexibility of the system.
[0075] (9) Promote code reuse: By abstracting common comparison logic, it can be reused in multiple projects or modules, improving development efficiency.
[0076] (10) Compliance with object-oriented design principles: The use of annotations and reflection mechanisms complies with object-oriented design principles, such as encapsulation, inheritance, and polymorphism, which helps to build more robust and maintainable systems.
[0077] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A method for identifying changes in product object attributes, characterized in that: Applied to a security product operation platform, and the security product operation platform is used to manage product objects of different categories from different manufacturers, and store the information of the product objects in a back-end database according to different field attributes; the method includes: Predefine a custom annotation to mark the fields that need to be verified; When the information of any product object is re-edited, the reflection mechanism is used to obtain all the edited first fields from the front end, and all the corresponding second fields are called from the back end database; wherein the fields with the same attributes in the first field and the second field have the same annotation information; For any first field, the reflection mechanism is used to obtain its corresponding field name, and the corresponding field value is indexed from all second fields according to the field name, and whether the field of the product object is changed is identified by verifying the first field and the field value.
2. The method for identifying changes in product object attributes according to claim 1, characterized in that: Also includes: Pre-define the audit node to audit the fields of the product object after adding / deleting the product object or modifying the information of the product object on the security product operation platform, and update the backend database accordingly after the audit is successful; When a field change of a product object is identified, a corresponding audit node is enabled to audit the field.
3. The method for identifying changes in product object attributes according to claim 2, characterized in that: The annotation information of the field includes information about the corresponding audit node; Among them, different fields of the product object are set in one-to-one correspondence with the audit nodes.
4. The method for identifying changes in product object attributes according to claim 2, characterized in that: The steps of enabling the corresponding audit node to audit the field after identifying the field change of the product object include: Before verifying the first field and the field value, creating a Map array about the audit node to define the variable value of the audit node; wherein the variable value of each audit node is defined as disabled in advance; When a field change of a product object is identified, the variable value of the corresponding audit node is adjusted to enable.
5. The method for identifying changes in product object attributes according to claim 1 or 3, characterized in that: The attributes of the field include: basic information, extended information, business information, product technical information, and product instance information.
6. The method for identifying changes in product object attributes according to claim 1, characterized in that: For any first field, the reflection mechanism is used to obtain the corresponding field name, and the corresponding field value is indexed from all second fields according to the field name, and the step of identifying whether the field of the product object is changed by verifying the first field and the field value includes: A corresponding Field array is created for the first field, and a corresponding Map array is created for the second field; wherein the keys in the Field array and the Map array are the field names obtained by using the reflection mechanism, and the values are the modified field values and the stored field values respectively; Traverse each first field in the Field array, obtain the field value of the second field with the same field name from the Map array according to its corresponding field name, and verify whether the first field and the field value identify the field of the product object to be changed.
7. The method for identifying changes in product object attributes according to claim 6, characterized in that: The step of traversing each first field in the Field array, obtaining the field value of the second field with the same field name as the field name from the Map array through the corresponding field name, and verifying whether the first field and the field value identify the field of the product object to be changed also includes: For any first field in the Field array, check whether there is annotation information: If yes, then the corresponding field name is obtained by using the reflection mechanism based on the annotation information, and the corresponding field value is indexed from the Map array according to the field name, otherwise the verification is stopped; By comparing the first field and the corresponding field value, it is determined whether they are consistent: If so, it is identified that the field corresponding to the product object has not changed, otherwise it is identified that the field corresponding to the product object has changed.
8. A system for identifying changes in product object attributes, characterized in that: Applied to a security product operation platform, and the security product operation platform is used to manage product objects of different categories from different manufacturers, and store the information of product objects in a back-end database according to different field attributes; the system includes: The configuration module is used to predefine a custom annotation to mark the fields that need to be verified; A field acquisition module is used to obtain all the first fields after editing from the front end by using the reflection mechanism, and to call all the corresponding second fields from the back end database when the information of any product object is re-edited; wherein the fields with the same attributes in the first field and the second field have the same annotation information; The field verification module is used to obtain the corresponding field name of any first field using the reflection mechanism, and index the corresponding field value from all second fields according to the field name, and identify whether the field of the product object has changed by verifying the first field and the field value.
9. An electronic device, characterized in that: The method comprises a processor, wherein the processor is coupled to a memory, wherein the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The invention comprises a program, which, when being executed on a computer, causes the computer to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Business object change identification and log generation system and method based on annotation driving
CN121764889A
System and method for annotation-driven business object change identification and log generation
CN121764889B