保誠-保戶業務員媒合平台
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.pollex.pam.aop.logging.audit.strategy;
 
import com.pollex.pam.aop.logging.audit.AuditLoggingType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
@Component
public class AuditLoggingFactory {
 
    @Autowired
    List<AuditLoggingStrategy> strategies;
 
    @Autowired
    DoNothingStrategy doNothingStrategy;
 
    public AuditLoggingStrategy getAuditLoggingStrategy(AuditLoggingType type) {
        for(AuditLoggingStrategy strategy : strategies) {
            if(strategy.getType() == type) {
                return strategy;
            }
        }
 
        return doNothingStrategy;
    }
 
}