Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLM-5539, 5361: updated health-service-common, added serialVersionUID… #753

Merged
merged 4 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private String getQueryForIndividual(IndividualSearch searchObject, Integer limi
Boolean includeDeleted, Map<String, Object> paramsMap) {
String query = "SELECT * FROM individual";
List<String> whereFields = GenericQueryBuilder.getFieldsWithCondition(searchObject, QueryFieldChecker.isNotNull, paramsMap);
query = GenericQueryBuilder.generateQuery(query, whereFields).toString();
query = GenericQueryBuilder.generateQuery(query, whereFields).toString().trim();

query += " AND tenantId=:tenantId ";
if (query.contains(tableName + " AND")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.egov.common.data.query.exception.QueryBuilderException;
import org.egov.common.utils.ObjectUtils;

import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.time.LocalDate;
import java.util.ArrayList;
Expand Down Expand Up @@ -90,12 +91,17 @@ static List<String> getFieldsWithCondition(Object object, QueryFieldChecker chec
// Iterate through all declared fields of the object
Arrays.stream(object.getClass().getDeclaredFields()).forEach(field -> {
// Check if the field is of type LocalDate or enum
if (field.getType().equals(LocalDate.class) || field.getType().isEnum()) {
if (field.getType().equals(LocalDate.class) || field.getType().isEnum() || Modifier.isStatic(field.getModifiers())) {
// Skip processing for LocalDate and enum fields
// No condition applied
} else {
// Make the field accessible for manipulation
field.setAccessible(true);
try {
// Make the field accessible for manipulation FIXME TODO
field.setAccessible(true);
} catch (Exception exception) {
return;
}

try {
// Check if the field meets the condition and is not annotated with exclude
if (!field.getType().isPrimitive() && checkCondition.check(field, object)
Expand Down
Loading