ConceptConfig conceptConfig = entity.getConceptConfig();
if (conceptConfig != null) {
PropertiesConfig propertiesConfig = conceptConfig
.getPropertiesConfig();
for (IEntity config : propertiesConfig) {
PropertyConfig propertyConfig = (PropertyConfig) config;
Class propertyClass = propertyConfig
.getPropertyClassObject();
String propertyCode = propertyConfig.getCode();
if (propertyCode.equals("code")) {
continue;
}
String conceptDotProperty = conceptConfig.getCode() + "."
+ propertyCode;
Element codeChild = element.element(propertyCode);
if (codeChild != null) {
String propertyStringValue = codeChild.getText().trim();
if (propertyClass == String.class) {
entity.setProperty(propertyCode,
propertyStringValue);
} else if (propertyClass == Integer.class) {
Integer propertyIntegerValue = Transformer
.integer(propertyStringValue);
if (propertyIntegerValue != null) {
entity.setProperty(propertyCode,
propertyIntegerValue);
} else {
throw new TypeException("Not a valid Integer: "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else if (propertyClass == Long.class) {
Long propertyLongValue = Transformer
.longInteger(propertyStringValue);
if (propertyLongValue != null) {
entity.setProperty(propertyCode,
propertyLongValue);
} else {
throw new TypeException(
"Not a valid Long (integer): "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else if (propertyClass == Float.class) {
Float propertyFloatValue = Transformer
.floatDecimal(propertyStringValue);
if (propertyFloatValue != null) {
entity.setProperty(propertyCode,
propertyFloatValue);
} else {
throw new TypeException(
"Not a valid Float (decimal): "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else if (propertyClass == Double.class) {
Double propertyDoubleValue = Transformer
.doubleDecimal(propertyStringValue);
if (propertyDoubleValue != null) {
entity.setProperty(propertyCode,
propertyDoubleValue);
} else {
throw new TypeException(
"Not a valid Double (decimal): "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else if (propertyClass == Boolean.class) {
Boolean propertyBooleanValue = Transformer
.logic(propertyStringValue);
if (propertyBooleanValue != null) {
entity.setProperty(propertyCode,
propertyBooleanValue);
} else {
throw new TypeException("Not a valid Boolean: "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else if (propertyClass == Date.class) {
String datePattern = entity.getConceptConfig()
.getContextModelConfig().getDatePattern();
Date propertyDateValue = Transformer.date(
propertyStringValue, datePattern);
if (propertyDateValue != null) {
entity.setProperty(propertyCode,
propertyDateValue);
} else {
throw new TypeException("Not a valid Date: "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else if (propertyClass == URL.class) {
URL propertyUrlValue = Transformer
.url(propertyStringValue);
if (propertyUrlValue != null) {
entity.setProperty(propertyCode,
propertyUrlValue);
} else {
throw new TypeException("Not a valid URL: "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else if (propertyClass == Email.class) {
Email propertyEmailValue = Transformer
.email(propertyStringValue);
if (propertyEmailValue != null) {
entity.setProperty(propertyCode,
propertyEmailValue);
} else {
throw new TypeException("Not a valid Email: "
+ propertyStringValue + " ("
+ conceptDotProperty + ")");
}
} else {
throw new TypeException(
"Property type not supported by dmLite: "
+ propertyConfig.getPropertyClass());
}
}
}
}
} catch (Exception e) {