Object result = targetPropertyValue; if (result == null) { if (propertyType.getValueTypeId() != null) { if (propertyType.getValueTypeId().equals("integer")) { result = new Integer(0); } else if (propertyType.getValueTypeId().equals("long")) { result = new Long(0); } else if (propertyType.getValueTypeId().equals("double")) { result = new Double(0.0); } else if (propertyType.getValueTypeId().equals("float")) { result = new Float(0.0); } else { if (propertyType.getValueTypeId().equals("integer") || (property instanceof Integer)) { result = (Integer) result + (Integer) property; } else if (propertyType.getValueTypeId().equals("long") || (property instanceof Long)) { result = (Long) result + (Long) property; } else if (propertyType.getValueTypeId().equals("double") || (property instanceof Double)) { result = (Double) result + (Double) property; } else if (propertyType.getValueTypeId().equals("float") || (property instanceof Float)) { result = (Float) result + (Float) property; } else {
Object result = targetPropertyValue; if (result == null) { if (propertyType.getValueTypeId() != null) { if (propertyType.getValueTypeId().equals("integer")) { result = new Integer(0); } else if (propertyType.getValueTypeId().equals("long")) { result = new Long(0); } else if (propertyType.getValueTypeId().equals("double")) { result = new Double(0.0); } else if (propertyType.getValueTypeId().equals("float")) { result = new Float(0.0); } else { if (propertyType.getValueTypeId().equals("integer") || (property instanceof Integer)) { result = (Integer) result + (Integer) property; } else if (propertyType.getValueTypeId().equals("long") || (property instanceof Long)) { result = (Long) result + (Long) property; } else if (propertyType.getValueTypeId().equals("double") || (property instanceof Double)) { result = (Double) result + (Double) property; } else if (propertyType.getValueTypeId().equals("float") || (property instanceof Float)) { result = (Float) result + (Float) property; } else {
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; }
public static void resolveValueType(DefinitionsService definitionsService, PropertyType propertyType) { if (propertyType.getValueType() == null) { ValueType valueType = definitionsService.getValueType(propertyType.getValueTypeId()); if (valueType != null) { propertyType.setValueType(valueType); } } }
public static void resolveValueType(DefinitionsService definitionsService, PropertyType propertyType) { if (propertyType.getValueType() == null) { ValueType valueType = definitionsService.getValueType(propertyType.getValueTypeId()); if (valueType != null) { propertyType.setValueType(valueType); } } }
logger.error("No valid property type found for propertyTypeId=" + fieldMappingKey); } else { if (propertyType.getValueTypeId() == null) { logger.error("No value type id found for property type " + propertyType.getItemId()); if (propertyType.getValueTypeId().equals("string") || propertyType.getValueTypeId().equals("email") || propertyType.getValueTypeId().equals("date")) { if (BooleanUtils.isTrue(propertyType.isMultivalued())) { String multivalueArray = profileData[fieldsMapping.get(fieldMappingKey)].trim(); properties.put(fieldMappingKey, singleValue); } else if (propertyType.getValueTypeId().equals("boolean")) { properties.put(fieldMappingKey, new Boolean(profileData[fieldsMapping.get(fieldMappingKey)].trim())); } else if (propertyType.getValueTypeId().equals("integer")) { properties.put(fieldMappingKey, new Integer(profileData[fieldsMapping.get(fieldMappingKey)].trim())); logger.error("Error converting profileData", t); if (fieldMappingKey != null && fieldsMapping.get(fieldMappingKey) != null && profileData != null && profileData[fieldsMapping.get(fieldMappingKey)] != null) { throw new BadProfileDataFormatException("Unable to convert '" + profileData[fieldsMapping.get(fieldMappingKey)].trim() + "' to " + propertyType!=null?propertyType.getValueTypeId():"Null propertyType ", new Throwable("DATA_TYPE")); } else { throw new BadProfileDataFormatException("Unable to find profile data for key " + fieldMappingKey, new Throwable("DATA_TYPE"));