}
BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(entity.getClass()).getBeanDescriptor();
Collection<ValidationResult> collection = new ArrayList<ValidationResult>();
for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
ValidationResult result = null;
boolean checkIdOnly = false;
boolean checkColumn = false;
boolean checkJoinColumn = false;
if ((this.operation == Operation.FIND) || (this.operation == Operation.REMOVE)) {
checkIdOnly = true;
}
if (checkIdOnly) {
if (propertyDescriptor.isAnnotationPresent(Id.class)) {
result = this.validateId(entity, propertyDescriptor, this.operation);
}
} else {
if (propertyDescriptor.isAnnotationPresent(Id.class)) {
result = this.validateId(entity, propertyDescriptor, this.operation);
checkColumn = true;
} else if (propertyDescriptor.isAnnotationPresent(Basic.class)) {
result = this.validateBasic(entity, propertyDescriptor, propertyDescriptor.getAnnotation(Basic.class));
checkColumn = true;
} else if (propertyDescriptor.isAnnotationPresent(OneToOne.class)) {
result = this.validateOneToOne(entity, propertyDescriptor, propertyDescriptor.getAnnotation(OneToOne.class));
checkJoinColumn = true;
} else if (propertyDescriptor.isAnnotationPresent(OneToMany.class)) {
result = this.validateOneToMany(entity, propertyDescriptor, propertyDescriptor.getAnnotation(OneToMany.class));
} else if (propertyDescriptor.isAnnotationPresent(ManyToOne.class)) {
result = this.validateManyToOne(entity, propertyDescriptor, propertyDescriptor.getAnnotation(ManyToOne.class));
checkJoinColumn = true;
} else if (propertyDescriptor.isAnnotationPresent(ManyToMany.class)) {
result = this.validateManyToMany(entity, propertyDescriptor, propertyDescriptor.getAnnotation(ManyToMany.class));
} else if (propertyDescriptor.isAnnotationPresent(Column.class)) {
result = this.validateColumn(entity, propertyDescriptor, propertyDescriptor.getAnnotation(Column.class));
}
if ((result != null) && (!result.isError())) {
if (checkColumn) {
if (propertyDescriptor.isAnnotationPresent(Column.class)) {
result = this.validateColumn(entity, propertyDescriptor, propertyDescriptor.getAnnotation(Column.class));
}
}
if (checkJoinColumn) {
if (propertyDescriptor.isAnnotationPresent(JoinColumn.class)) {
result = this.validateJoinColumn(entity, propertyDescriptor, propertyDescriptor.getAnnotation(JoinColumn.class));
}
}
}
}
if (result != null) {
if (result.isError()) {
collection.add(result);
} else if (this.includeSuccessResult) {
collection.add(result);
}
}