API #1에 대한 코드 예제
아래는 파생 사양을 로드하기 위해 API #1을 사용하는 코드 예제입니다.
public static void main(String[] args) throws Exception {
// Create part config specs
List<VariantLoadPartConfigSpecBean> partConfigSpecBeans = new
ArrayList<VariantLoadPartConfigSpecBean> (1);
VariantLoadPartConfigSpecBean partConfigSpecBean1 = new
VariantLoadPartConfigSpecBean("MyPartConfigSpec1", null, null, null, null);
partConfigSpecBeans.add(partConfigSpecBean1);
// Create a Latest ATO rule Config spec
List<VariantLoadATORuleConfigSpecBean> atoConfigSpecBeans = new
ArrayList<VariantLoadATORuleConfigSpecBean> (1);
VariantLoadATORuleConfigSpecBean atoConfigSpecBean1 = new
VariantLoadATORuleConfigSpecBean("MyATOConfigSpec1", null, null);
atoConfigSpecBeans.add(atoConfigSpecBean1);
VariantLoadNavCriteriaBean bean1 = new VariantLoadNavCriteriaBean();
bean1.setVariantSpecName("TestThruApi3");
bean1.setVariantSpecDescription("Test thru API 1");
bean1.setVariantSpecFolder("/Default");
bean1.setVariantSpecCreateVariants(false);
bean1.setPartNumber("BICYCLE1");
bean1.setRuleCheckingDisabled(true);
List<String> choices = new ArrayList<String>();
choices.add("D0022");
bean1.addChoiceNames("Locale", choices);
choices = new ArrayList<String>();
choices.add("D0009");
bean1.addChoiceNames("Steering Type", choices);
// Use the part and option filter config specs from above
bean1.addPartConfigSpec("MyPartConfigSpec1");
bean1.addAtoRuleConfigSpecs("MyATOConfigSpec1");
//////////////////////////////////////////////////////
VariantLoadNavCriteriaBean bean2 = new VariantLoadNavCriteriaBean();
bean2.setVariantSpecName("TestThruApi1");
bean2.setVariantSpecDescription("Test thru API 1");
bean2.setVariantSpecFolder("/Default");
bean2.setVariantSpecCreateVariants(false);
bean2.setPartNumber("BICYCLE1");
bean2.setRuleCheckingDisabled(true);
choices = new ArrayList<String>();
choices.add("D0022");
bean2.addChoiceNames("Locale", choices);
List<VariantLoadNavCriteriaBean> beans = new ArrayList<VariantLoadNavCriteriaBean>(1);
beans.add(bean1);
beans.add(bean2);
VariantSpecLoaderHelper.service.loadVariantSpecs(beans, partConfigSpecBeans, atoConfigSpecBeans);
}