Commit f3f1cc89 authored by Matija Obreza's avatar Matija Obreza

Merge branch...

Merge branch 'server-487-error-request-failed-with-status-code-500-happens-if-user-apply-filters-from-blocks-on-the-a-overview-page' into 'master'

Fixed generation of NULL/NOTNULL paths for nested fields

See merge request genesys-pgr/application-blocks!59
parents fb0bc5ce 24523978
...@@ -153,30 +153,14 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten ...@@ -153,30 +153,14 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
field.set(toClear, null); field.set(toClear, null);
} }
// @Override /**
// public int hashCode() { * Find the property of DSL-generated type.
// String str = toString(); *
// * @param instance the DSL-generated type
// final int prime = 31; * @param clazz type of instance
// int result = 1; * @param nullProp property name
// result = prime * result + ((str == null) ? 0 : str.hashCode()); * @return
// return result; */
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj)
// return true;
// if (obj == null)
// return false;
// if (getClass() != obj.getClass())
// return false;
// BasicModelFilter other = (BasicModelFilter) obj;
// if (!this.toString().equals(other.toString()))
// return false;
// return true;
// }
private DslExpression<?> getProperty(final EntityPathBase<R> instance, final Class<?> clazz, final String nullProp) { private DslExpression<?> getProperty(final EntityPathBase<R> instance, final Class<?> clazz, final String nullProp) {
try { try {
// build path for nesting filters // build path for nesting filters
...@@ -214,9 +198,9 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten ...@@ -214,9 +198,9 @@ public abstract class BasicModelFilter<T extends BasicModelFilter<T, R>, R exten
Field result = field.getType().getField(nullProp); Field result = field.getType().getField(nullProp);
PathBuilder<?> pathBuilder = new PathBuilder<>(instance.getType(), instance.getMetadata()); PathBuilder<?> pathBuilder = new PathBuilder<>(instance.getType(), instance.getMetadata());
if (CollectionPathBase.class.isAssignableFrom(result.getType())) { if (CollectionPathBase.class.isAssignableFrom(result.getType())) {
return pathBuilder.getSet(nullProp, result.getDeclaringClass()); return pathBuilder.getSet(field.getName() + "." + nullProp, result.getDeclaringClass());
} }
return pathBuilder.getSimple(nullProp, result.getDeclaringClass()); return pathBuilder.getSimple(field.getName() + "." + nullProp, result.getDeclaringClass());
} catch (NoSuchFieldException e1) { } catch (NoSuchFieldException e1) {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment