• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

link-intersystems / clean-architecture-example / #41

15 Sep 2023 12:36PM UTC coverage: 89.062% (-0.6%) from 89.624%
#41

push

web-flow
Jpa support (#2)

* Added jpa repository impl for booking.

* Using JPA.

* tx management extracted to own module.

* libs parent module introduced and shared libs added.

* Refactored application to switch between jdbc and jpa repositories.

* Separated components creation and made it configurable through app arguments.

* Made application components plugable.

* Refactored maven modules.

* Implemented JPA management repositories.

* Common row mapper extracted.

* Merged offer package with booking.

* Decoupled management.rental from management.offer

* JDBC components should be the default.

* Fixed bug and wrote test.

* Management booking sub components merged.

* Merged management.rental sub components.

456 of 456 new or added lines in 70 files covered. (100.0%)

2060 of 2313 relevant lines covered (89.06%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.3
/libs/aop/src/main/java/com/link_intersystems/aop/MethodInterceptorChain.java
1
package com.link_intersystems.aop;
2

3
import java.lang.reflect.Method;
4
import java.util.ArrayList;
5
import java.util.List;
6

7
import static java.util.Objects.*;
8

9
class MethodInterceptorChain implements MethodInterceptor {
1✔
10

11
    private List<MethodInterceptor> methodInterceptors = new ArrayList<>();
1✔
12

13
    public void addMethodInterceptor(MethodInterceptor methodInterceptor) {
14
        methodInterceptors.add(requireNonNull(methodInterceptor));
1✔
15
    }
1✔
16

17
    @Override
18
    public Object invoke(MethodInvocation methodInvocation) throws Exception {
19
        ChainElement chainElement = new ChainElement(0);
1✔
20
        return chainElement.invoke(methodInvocation);
1✔
21
    }
22

23
    class ChainElement {
24
        private int index;
25

26
        public ChainElement(int index) {
1✔
27
            this.index = index;
1✔
28
        }
1✔
29

30
        ChainElement next() {
31
            if (index < methodInterceptors.size() - 1) {
1✔
32
                return new ChainElement(index + 1);
1✔
33
            }
34
            return null;
1✔
35
        }
36

37
        MethodInterceptor getMethodInterceptor() {
38
            if (index < methodInterceptors.size()) {
1✔
39
                return methodInterceptors.get(index);
1✔
40
            } else {
41
                return methodInvocation -> methodInvocation.proceed();
1✔
42
            }
43
        }
44

45
        public Object invoke(MethodInvocation methodInvocation) throws Exception {
46
            MethodInterceptor methodInterceptor = getMethodInterceptor();
1✔
47
            return methodInterceptor.invoke(new MethodInvocation() {
1✔
48
                @Override
49
                public Method getMethod() {
50
                    return methodInvocation.getMethod();
×
51
                }
52

53
                @Override
54
                public Object[] getArgs() {
55
                    return methodInvocation.getArgs();
×
56
                }
57

58
                @Override
59
                public Object proceed() throws Exception {
60
                    ChainElement nextElement = next();
1✔
61
                    if (nextElement == null) {
1✔
62
                        return methodInvocation.proceed();
1✔
63
                    } else {
64
                        return nextElement.invoke(methodInvocation);
1✔
65
                    }
66
                }
67
            });
68
        }
69
    }
70

71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc