protected Device getDevice(ThemeDisplay themeDisplay) { if (themeDisplay != null) { return themeDisplay.getDevice(); } return UnknownDevice.getInstance(); }
public boolean evaluateRule(MDRRule mdrRule, ThemeDisplay themeDisplay) { Device device = themeDisplay.getDevice(); if (device == null) { return false; } UnicodeProperties typeSettingsProperties = mdrRule.getTypeSettingsProperties(); boolean result = true; String os = typeSettingsProperties.get("os"); if (Validator.isNotNull(os)) { String[] operatingSystems = StringUtil.split(os); if (ArrayUtil.contains(operatingSystems, device.getOS())) { result = true; } else { result = false; } } String tablet = typeSettingsProperties.get("tablet"); if (Validator.isNotNull(tablet)) { boolean tabletBoolean = GetterUtil.getBoolean(tablet); if (result && (tabletBoolean == device.isTablet())) { result = true; } else { result = false; } } return result; }