@Override public CompositeConditionType createInstance(Type type) { return new CompositeConditionType(null, null, null, null); } }
public static ConditionType map(CompositeConditionTypeDTO conditionTypeDto) { if (conditionTypeDto.children == null || conditionTypeDto.children.isEmpty()) { return new ConditionType(conditionTypeDto.uid, ConfigDescriptionDTOMapper.map(conditionTypeDto.configDescriptions), conditionTypeDto.label, conditionTypeDto.description, conditionTypeDto.tags, conditionTypeDto.visibility, conditionTypeDto.inputs); } else { return new CompositeConditionType(conditionTypeDto.uid, ConfigDescriptionDTOMapper.map(conditionTypeDto.configDescriptions), conditionTypeDto.label, conditionTypeDto.description, conditionTypeDto.tags, conditionTypeDto.visibility, conditionTypeDto.inputs, ConditionDTOMapper.mapDto(conditionTypeDto.children)); } }
/** * Utility method for localization of ConditionTypes. * * @param ct is a ConditionType for localization. * @param bundle the bundle providing localization resources. * @param moduleTypeUID is a ConditionType uid. * @param locale represents a specific geographical, political, or cultural region. * @param lconfigDescriptions are ConditionType localized config descriptions. * @param llabel is a ConditionType localized label. * @param ldescription is a ConditionType localized description. * @return localized ConditionType. */ private ConditionType createLocalizedConditionType(ConditionType ct, Bundle bundle, String moduleTypeUID, Locale locale, List<ConfigDescriptionParameter> lconfigDescriptions, String llabel, String ldescription) { List<Input> inputs = ModuleTypeI18nUtil.getLocalizedInputs(i18nProvider, ct.getInputs(), bundle, moduleTypeUID, locale); ConditionType lct = null; if (ct instanceof CompositeConditionType) { List<Condition> modules = ModuleI18nUtil.getLocalizedModules(i18nProvider, ((CompositeConditionType) ct).getChildren(), bundle, moduleTypeUID, ModuleTypeI18nUtil.MODULE_TYPE, locale); lct = new CompositeConditionType(moduleTypeUID, lconfigDescriptions, llabel, ldescription, ct.getTags(), ct.getVisibility(), inputs, modules); } else { lct = new ConditionType(moduleTypeUID, lconfigDescriptions, llabel, ldescription, ct.getTags(), ct.getVisibility(), inputs); } return lct; }
result = new CompositeConditionType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs(), new ArrayList<>(m.getChildren()));