if (validation) {
ConceptConfig conceptConfig = entity.getConceptConfig();
if (conceptConfig != null) {
validation = validMaxCardinality(1);
if (validation) {
ModelMeta modelMeta = domainModel.getModelMeta();
PropertiesConfig propertiesConfig = conceptConfig
.getPropertiesConfig();
for (IEntity config : propertiesConfig) {
PropertyConfig propertyConfig = (PropertyConfig) config;
String propertyCode = propertyConfig.getCode();
Object property = entity
.getProperty(propertyCode);
if (propertyConfig.isRequired()) {
if (property != null) {
if (propertyConfig.isValidateType()) {
validation = modelMeta
.validPropertyType(this,
entity,
propertyConfig,
property)
&& validation;
}
if (propertyConfig.getPropertyClass()
.equals("java.lang.String")) {
validation = modelMeta
.validMaxLength(this,
entity,
propertyConfig,
property)
&& validation;
}
} else { // property is null
if (propertyConfig.getDefaultValue() != null) {
if (!modelMeta
.setPropertyDefaultValue(
entity,
propertyConfig,
property)) {
modelMeta
.addRequiredPropertyError(
this, entity,
propertyConfig);
validation = false;
}
} else {
modelMeta.addRequiredPropertyError(
this, entity,
propertyConfig);
validation = false;
}
}
} else { // property is not required
if (property != null) {
if (propertyConfig.isValidateType()) {
validation = modelMeta
.validPropertyType(this,
entity,
propertyConfig,
property)
&& validation;
}
if (propertyConfig.getPropertyClass()
.equals("java.lang.String")) {
validation = modelMeta
.validMaxLength(this,
entity,
propertyConfig,
property)
&& validation;
}
} else { // property is null
if (propertyConfig.getDefaultValue() != null) {
modelMeta.setPropertyDefaultValue(
entity, propertyConfig,
property);
}
} // if
} // if