You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:warning: Changes in this package have to be taken carefully, considering it is going to reflect in the whole application
7
7
8
8
### What is Aspect-Oriented Programming - AOP?
9
9
10
-
Spring AOP framework is used to modularize cross-cutting concerns in aspects. Simply, t’s just an interceptor to intercept some processes, for example, when a method is execute, Spring AOP can hijack the executing method, and add extra functionality before or after the method execution. The most used feature is logging.
10
+
Spring AOP framework is used to modularize cross-cutting concerns in aspects. Simply, it’s just an interceptor to intercept some processes, for example, when a method is executed, Spring AOP can hijack the executing method, and add extra functionality before or after the method execution. The most used feature is logging.
11
11
However, in Reactome, we are taking benefit of this concept in order to implement our own Lazy-Loading mechanism. This functionality is also available in ORM frameworks, such as, Hibernate and to achieve this they are implementing AOP concepts. Sorting and Logging aspect are present as well.
12
12
13
-
Complete information of Spring AOP you'll find [here](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html).
13
+
Complete information on Spring AOP you'll find [here](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html).
14
14
15
-
### What are the `@PointCut` in Reactome for LazyLoading?
15
+
### What are the `@PointCut` in Reactome for LazyLoading?
Intercepting ALL the getters in our Domain Model whose return type is `DatabaseObject` or `instance of`
26
26
27
-
### How does it work?
27
+
### How does it work?
28
28
29
29
Mainly, we are loading DEPTH{2} data from the graph without any relationship previously loaded, only identifiers. Once intercepted, the code checks whether the AOP is enabled and whether the object has been loaded previously. Substantially using Java Reflection, the code is capable to identify all the information regarding the method that has been intercepted, for instance, return type (`Collection` or `DatabaseObject`) and `@Relationship` which contains important information for querying against the Graph. Up to this point, the data have been retrieve and the code invokes the setter and proceed.
30
30
@@ -95,19 +95,19 @@ public LazyFetchAspect lazyFetchAspect() {
95
95
</plugin>
96
96
```
97
97
98
-
#### What is the flag `enableAOP`?
98
+
#### What is the flag `enableAOP`?
99
99
100
-
The AOP is enabled by default, but in certain projects like [Content Service](https://github.com/reactome-pwp/content-service.git) where we respond a serialised JSON, the `@PointCut` will be invoked every where, every time, endless times. Thus, given the requirements of the `Content Service` it makes sense that we disable this feature. However, in the [Data Content](https://github.com/reactome/data-content) we kept it enabled.
100
+
The AOP is enabled by default, but in certain projects like [Content Service](https://github.com/reactome/content-service.git) where we respond a serialised JSON, the `@PointCut` will be invoked everywhere, every time, endless times. Thus, given the `Content Service`requirements, it makes sense that we disable this feature. However, we kept it enabled in the [Data Content](https://github.com/reactome/data-content).
101
101
102
102
103
103
=
104
104
105
-
### SortingAspect?
105
+
### SortingAspect?
106
106
107
107
Intercepting ALL the getters in our Domain Model whose return type is `Collection<? extends DatabaseObject>` and sorting the list based on the `displayName`.
108
108
109
109
=
110
110
111
-
### LoggingAspect?
111
+
### LoggingAspect?
112
112
113
-
Logging everything at the service level. The package `service` is being intercepted in order to measure the execution time.
113
+
Logging everything at the service level. The package `service` is being intercepted to measure the execution time.
0 commit comments