OWL ITS + 탐지시스템(인터넷 진흥원)
이민희
2022-03-17 916a3cbabe4e50062fce61ff6f2f5d46c05dfbd1
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package kr.wisestone.owl.constant;
 
import com.google.common.collect.Lists;
import kr.wisestone.owl.vo.UsePartnerVo;
 
import java.util.List;
 
public class UsePartner {
 
    public static final int USE_PARTNER_HOSTING = 4;  // 100
    public static final int USE_PARTNER_ISP = 2;      // 010
    public static final int USE_PARTNER_COMPANY = 1;  // 001
 
    public static String[] Names = {"업체", "ISP", "호스팅"};
    public static int[] partners = {USE_PARTNER_COMPANY, USE_PARTNER_ISP, USE_PARTNER_HOSTING};
 
    // 업체/ISP/호스팅 정보 유무 체크 후 UsePartnerVo.Create
    public static UsePartnerVo checkUsePartner(int using, int usePartner) //using - DB에 저장된 값, useAbleCompany - 각 업체들의 실제 값
    {
        if (((using & usePartner) != 0)) {
            Long Id = 0L;
            if (usePartner != USE_PARTNER_COMPANY) {
                Id = usePartner / 2L;
            }
            return UsePartnerVo.Create(Id, Names[Id.intValue()]);
        }
        return null;
    }
 
    // 업체/ISP/호스팅 전체 목록 가져오기
    public static List<UsePartnerVo> getPartnerList() {
        List<UsePartnerVo> usePartnerVos = Lists.newArrayList();
 
        Long index = 0L;
        for (String name : UsePartner.Names) {
            usePartnerVos.add(UsePartnerVo.Create(index, name));
            index++;
        }
        return usePartnerVos;
    }
 
}