VariantLoadNavCriteriaBean API のサンプルコード
VariantLoadNavCriteriaBean API を使用してバリエーション仕様を読み込むためのサンプルコードを以下に示します。
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);
Map<String, Object> ibas = new HashMap<>();
ibas.put(stringIBA, "first test value");
ibas.put(intIBA, 5);
ibas.put(booleanIBA, false);
ibas.put(realIBA, FloatingPoint.valueOf("5.7"));
ibas.put(realWithUnitsIBA, FloatingPointWithUnits.valueOf("12.0253 kg"));
ibas.put(dateIBA, new WrappedTimestamp("09 01 2020 02:30:00 GMT", 0));
ibas.put(linkIBA, new Hyperlink("http://www.ptc.com", "PTC"));
VariantLoadNavCriteriaBean bean1 = new VariantLoadNavCriteriaBean();
bean1.setFilterMode(1);
bean1.setVariantSpecName("TestThruApi3");
bean1.setVariantSpecDescription("Test thru API 1");
bean1.setVariantSpecFolder("/Default");
bean1.setVariantSpecCreateVariants(false);
bean1.setPartNumber("BICYCLE1");
bean1.setRuleCheckingDisabled(true);
bean1.setVariantSpecIBAs(ibas);
bean1.setVariantSpecLifeCycleTemplate(“Basic”);
bean1.setVariantSpecLifeCycleState(“INWORK”);
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.setFilterMode(1);
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);