コード例 #1
0
  public static ConfigModel createConfigModelWithCstic() {
    final ConfigModel model = createEmptyConfigModel();

    final PriceModel basePrice = new PriceModelImpl();
    basePrice.setPriceValue(new BigDecimal(1000));
    basePrice.setCurrency("EUR");
    model.setBasePrice(basePrice);

    final PriceModel selectedOptionsPrice = new PriceModelImpl();
    selectedOptionsPrice.setPriceValue(new BigDecimal(50));
    selectedOptionsPrice.setCurrency("EUR");
    model.setSelectedOptionsPrice(selectedOptionsPrice);

    final PriceModel currentTotalPrice = new PriceModelImpl();
    currentTotalPrice.setPriceValue(new BigDecimal(1050));
    currentTotalPrice.setCurrency("EUR");
    model.setCurrentTotalPrice(currentTotalPrice);

    final InstanceModel rootInstance = model.getRootInstance();
    // Characteristics and Values

    final List<CsticModel> cstics = new ArrayList<CsticModel>();
    cstics.add(createSTRCstic());
    rootInstance.setCstics(cstics);

    return model;
  }
コード例 #2
0
  public static ConfigModel createConfigModelWithSubInstanceOnly() {
    final ConfigModel model = createEmptyConfigModel();

    final InstanceModel rootInstance = model.getRootInstance();

    final InstanceModel subInstance = createInstance();
    rootInstance.getSubInstances().add(subInstance);

    return model;
  }
コード例 #3
0
  public static ConfigModel createConfigModelWithGroups() {
    final ConfigModel configModel = createConfigModelWithCstic();

    final InstanceModel rootInstance = configModel.getRootInstance();

    rootInstance.getCstics().add(createCheckBoxListCsticWithValue2Assigned());
    rootInstance.getCstics().add(createCheckBoxCstic());

    final List<CsticGroupModel> csticGroups = new ArrayList<>();
    final CsticGroupModel group1 = createCsticGroup("GROUP1", "Group 1", STR_NAME, CHBOX_NAME);
    final CsticGroupModel group2 = createCsticGroup("GROUP2", "Group 2", CHBOX_LIST_NAME);

    csticGroups.add(group1);
    csticGroups.add(group2);

    rootInstance.setCsticGroups(csticGroups);

    return configModel;
  }
コード例 #4
0
  public static ConfigModel createConfigModelWithSubInstance() {
    final ConfigModel model = new ConfigModelImpl();

    model.setId(CONFIG_ID);
    model.setName(CONFIG_NAME);
    model.setComplete(false);
    model.setConsistent(true);

    // Root Instance
    final InstanceModel rootInstance = new InstanceModelImpl();
    rootInstance.setId(ROOT_INSTANCE_ID);
    rootInstance.setName(ROOT_INSTANCE_NAME);
    rootInstance.setLanguageDependentName(ROOT_INSTANCE_LANG_DEP_NAME);
    rootInstance.setRootInstance(true);
    rootInstance.setComplete(false);
    rootInstance.setConsistent(true);
    final ArrayList<InstanceModel> subInstances = new ArrayList<InstanceModel>();
    subInstances.add(createSubInstance("SUBINSTANCE1"));
    rootInstance.setSubInstances(subInstances);

    model.setRootInstance(rootInstance);

    // Characteristics and Values

    final List<CsticModel> cstics = new ArrayList<CsticModel>();
    cstics.add(createSTRCstic());
    rootInstance.setCstics(cstics);

    return model;
  }
コード例 #5
0
  public static ConfigModel createConfigModelWithGroupsAndSubInstances() {
    final ConfigModel model = createConfigModelWithGroups();

    final ArrayList<InstanceModel> subInstancesLevel1 = new ArrayList<InstanceModel>();
    final InstanceModel subInstance1Level1 = createSubInstance("SUBINSTANCE1LEVEL1");
    subInstancesLevel1.add(subInstance1Level1);

    final List<CsticGroupModel> csticGroups = new ArrayList<>();
    final CsticGroupModel group1 = createCsticGroup("GROUP1INST1", "Group 1", STR_NAME, CHBOX_NAME);
    final CsticGroupModel group2 = createCsticGroup("GROUP2INST1", "Group 2", CHBOX_LIST_NAME);
    csticGroups.add(group1);
    csticGroups.add(group2);
    subInstance1Level1.setCsticGroups(csticGroups);
    List<CsticModel> cstics = new ArrayList<CsticModel>();
    cstics.add(createSTRCstic());
    cstics.add(createCheckBoxCstic());
    cstics.add(createCheckBoxListCsticWithValue2Assigned());
    subInstance1Level1.setCstics(cstics);

    final ArrayList<InstanceModel> subInstancesLevel2 = new ArrayList<InstanceModel>();
    final InstanceModel subInstance1Level2 = createSubInstance("SUBINSTANCE1LEVEL2");
    cstics = new ArrayList<CsticModel>();
    cstics.add(createSTRCstic());
    cstics.add(createCheckBoxCstic());
    cstics.add(createCheckBoxListCsticWithValue2Assigned());
    subInstance1Level2.setCstics(cstics);
    subInstancesLevel2.add(subInstance1Level2);
    subInstancesLevel2.add(createSubInstance("SUBINSTANCE2LEVEL2"));
    subInstance1Level1.setSubInstances(subInstancesLevel2);

    final ArrayList<InstanceModel> subInstancesLevel3 = new ArrayList<InstanceModel>();
    subInstancesLevel3.add(createSubInstance("SUBINSTANCE1LEVEL3"));
    subInstance1Level2.setSubInstances(subInstancesLevel3);

    subInstancesLevel1.add(createSubInstance("SUBINSTANCE2LEVEL1"));
    model.getRootInstance().setSubInstances(subInstancesLevel1);

    return model;
  }
コード例 #6
0
  public static ConfigModel createEmptyConfigModel() {
    final ConfigModel model = new ConfigModelImpl();

    model.setId(CONFIG_ID);
    model.setName(CONFIG_NAME);
    model.setComplete(false);
    model.setConsistent(true);

    // Root Instance
    InstanceModel rootInstance;
    rootInstance = createInstance();

    model.setRootInstance(rootInstance);

    return model;
  }