OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-11-25 305de5dd5a88baf49b9939fe3233f207f3f7acf8
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
43
44
package kr.wisestone.owl.constant;
 
import com.google.common.collect.Lists;
import kr.wisestone.owl.vo.HostingFieldVo;
import kr.wisestone.owl.vo.UseCompanyVo;
 
import java.util.List;
 
public class UseCompany {
 
    public static final int USE_COMPANY_HOSTING = 4;  // 100
    public static final int USE_COMPANY_ISP = 2;      // 010
    public static final int USE_COMPANY_COMPANY = 1;  // 001
 
    public static String[] Names = {"업체", "ISP", "호스팅"};
    public static int[] useCompanies = {USE_COMPANY_COMPANY, USE_COMPANY_ISP, USE_COMPANY_HOSTING};
 
    // 권한 체크후 HostingFieldVo 가져오기
    public static UseCompanyVo checkUseCompany(int userPermission, int typePermission)
    {
        if (((userPermission & typePermission) != 0)) {
            Long Id = 0L;
            if (typePermission != USE_COMPANY_COMPANY) {
                Id = typePermission / 2L;
            }
 
            return UseCompanyVo.Create(Id, Names[Id.intValue()]);
        }
        return  null;
    }
 
    // 업체/ISP/호스팅 전체 목록 가져오기
    public static List<UseCompanyVo> getCompanyList() {
        List<UseCompanyVo> useCompanyVos = Lists.newArrayList();
 
        Long index = 0L;
        for (String name : UseCompany.Names) {
            useCompanyVos.add(UseCompanyVo.Create(index, name));
            index++;
        }
        return useCompanyVos;
    }
 
}