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;
|
}
|
|
}
|