public static Object getValueByTypeId(Object propertyValue, String valueTypeId) { if (("boolean".equals(valueTypeId))) { return getBooleanValue(propertyValue); } else if ("integer".equals(valueTypeId)) { return getInteger(propertyValue); } else { return propertyValue; } }
private boolean processProperties(Profile target, Map<String, Object> propsMap, String strategy) { boolean isProfileOrPersonaUpdated = false; for (String prop : propsMap.keySet()) { PropertyType propType = null; if (prop.startsWith("properties.") || prop.startsWith("systemProperties.")) { propType = profileService.getPropertyType(prop.substring(prop.indexOf('.') + 1)); } else { propType = profileService.getPropertyType(prop); //ideally each property must have a matching propertyType if(prop.equals("segments")) { propsMap.put(prop, new HashSet<String>((ArrayList<String>)propsMap.get(prop))); } } if (propType != null) { isProfileOrPersonaUpdated |= PropertyHelper.setProperty(target, prop, PropertyHelper.getValueByTypeId(propsMap.get(prop), propType.getValueTypeId()), "alwaysSet"); } else { isProfileOrPersonaUpdated |= PropertyHelper.setProperty(target, prop, propsMap.get(prop), strategy); } } return isProfileOrPersonaUpdated; }
propertyValue = PropertyHelper.getInteger(propertyValueInteger); propertyValue = PropertyHelper.getBooleanValue(setPropertyValueBoolean); if (PropertyHelper.setProperty(event.getSession(), propertyName, propertyValue, (String) action.getParameterValues().get("setPropertyStrategy"))) { return EventService.SESSION_UPDATED; if (PropertyHelper.setProperty(event.getProfile(), propertyName, propertyValue, (String) action.getParameterValues().get("setPropertyStrategy"))) { return EventService.PROFILE_UPDATED;
if (propsToDelete != null) { for (String prop : propsToDelete) { isProfileOrPersonaUpdated |= PropertyHelper.setProperty(target, prop, null, "remove");
private int compare(Object actualValue, String expectedValue, Object expectedValueDate, Object expectedValueInteger, Object expectedValueDateExpr) { if (expectedValue == null && expectedValueDate == null && expectedValueInteger == null && getDate(expectedValueDateExpr) == null) { return actualValue == null ? 0 : 1; } else if (actualValue == null) { return -1; } if (expectedValueInteger != null) { return PropertyHelper.getInteger(actualValue).compareTo(PropertyHelper.getInteger(expectedValueInteger)); } else if (expectedValueDate != null) { return getDate(actualValue).compareTo(getDate(expectedValueDate)); } else if (expectedValueDateExpr != null) { return getDate(actualValue).compareTo(getDate(expectedValueDateExpr)); } else { return actualValue.toString().compareTo(expectedValue); } }
return true; } else if (propertyValue != null && !compareValues(propertyValue, BeanUtils.getProperty(target, propertyName))) { if (setPropertyStrategy == null || setPropertyStrategy.equals("alwaysSet") ||
public void batchProfilesUpdate(BatchUpdate update) { ParserHelper.resolveConditionType(definitionsService, update.getCondition()); List<Profile> profiles = persistenceService.query(update.getCondition(), null, Profile.class); for (Profile profile : profiles) { if (PropertyHelper.setProperty(profile, update.getPropertyName(), update.getPropertyValue(), update.getStrategy())) { save(profile); } } }
return true; } else if (propertyValue != null && !compareValues(propertyValue, BeanUtils.getProperty(target, propertyName))) { if (setPropertyStrategy == null || setPropertyStrategy.equals("alwaysSet") ||
public static Object getValueByTypeId(Object propertyValue, String valueTypeId) { if (("boolean".equals(valueTypeId))) { return getBooleanValue(propertyValue); } else if ("integer".equals(valueTypeId)) { return getInteger(propertyValue); } else { return propertyValue; } }
public void batchProfilesUpdate(BatchUpdate update) { ParserHelper.resolveConditionType(definitionsService, update.getCondition()); List<Profile> profiles = persistenceService.query(update.getCondition(), null, Profile.class); for (Profile profile : profiles) { if (PropertyHelper.setProperty(profile, update.getPropertyName(), update.getPropertyValue(), update.getStrategy())) { save(profile); } } }
public static boolean compareValues(Object propertyValue, Object beanPropertyValue) { if (propertyValue == null) { return true; } else if (beanPropertyValue == null) { return false; } if (propertyValue instanceof Integer) { return propertyValue.equals(getInteger(beanPropertyValue)); } else if (propertyValue instanceof Boolean) { return propertyValue.equals(getBooleanValue(beanPropertyValue)); } else { return propertyValue.equals(beanPropertyValue); } }
public static boolean compareValues(Object propertyValue, Object beanPropertyValue) { if (propertyValue == null) { return true; } else if (beanPropertyValue == null) { return false; } if (propertyValue instanceof Integer) { return propertyValue.equals(getInteger(beanPropertyValue)); } else if (propertyValue instanceof Boolean) { return propertyValue.equals(getBooleanValue(beanPropertyValue)); } else { return propertyValue.equals(beanPropertyValue); } }