/** * INTERNAL: * In case Query By Example is used, this method generates an expression from a attribute value pair. Since * this is an Aggregate mapping, a recursive call is made to the buildExpressionFromExample method of * ObjectBuilder. */ public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) { String attributeName = this.getAttributeName(); Object attributeValue = this.getRealAttributeValueFromObject(queryObject, session); if (!policy.shouldIncludeInQuery(queryObject.getClass(), attributeName, attributeValue)) { //the attribute name and value pair is not to be included in the query. return null; } if (attributeValue == null) { //even though it is null, it is to be always included in the query Expression expression = expressionBuilder.get(attributeName); return policy.completeExpressionForNull(expression); } ObjectBuilder objectBuilder = getReferenceDescriptor().getObjectBuilder(); return objectBuilder.buildExpressionFromExample(attributeValue, policy, expressionBuilder.get(attributeName), processedObjects, session); }
/** * INTERNAL: * In case Query By Example is used, this method generates an expression from a attribute value pair. Since * this is an Aggregate mapping, a recursive call is made to the buildExpressionFromExample method of * ObjectBuilder. */ public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) { String attributeName = this.getAttributeName(); Object attributeValue = this.getRealAttributeValueFromObject(queryObject, session); if (!policy.shouldIncludeInQuery(queryObject.getClass(), attributeName, attributeValue)) { //the attribute name and value pair is not to be included in the query. return null; } if (attributeValue == null) { //even though it is null, it is to be always included in the query Expression expression = expressionBuilder.get(attributeName); return policy.completeExpressionForNull(expression); } ObjectBuilder objectBuilder = getReferenceDescriptor().getObjectBuilder(); return objectBuilder.buildExpressionFromExample(attributeValue, policy, expressionBuilder.get(attributeName), processedObjects, session); }
/** * INTERNAL: * In case Query By Example is used, this method generates an expression from a attribute value pair. Since * this is an Aggregate mapping, a recursive call is made to the buildExpressionFromExample method of * ObjectBuilder. */ public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) { String attributeName = this.getAttributeName(); Object attributeValue = this.getRealAttributeValueFromObject(queryObject, session); if (!policy.shouldIncludeInQuery(queryObject.getClass(), attributeName, attributeValue)) { //the attribute name and value pair is not to be included in the query. return null; } if (attributeValue == null) { //even though it is null, it is to be always included in the query Expression expression = expressionBuilder.get(attributeName); return policy.completeExpressionForNull(expression); } ObjectBuilder objectBuilder = getReferenceDescriptor().getObjectBuilder(); return objectBuilder.buildExpressionFromExample(attributeValue, policy, expressionBuilder.get(attributeName), processedObjects, session); }