/** * INTERNAL: * Add any temporal querying conditions to this object expression. */ public Expression additionalHistoryExpression(Expression context, Expression base) { return additionalHistoryExpression(context, base, null); }
/** * INTERNAL: * Add any temporal querying conditions to this object expression. */ public Expression additionalHistoryExpression(Expression context, Expression base) { return additionalHistoryExpression(context, base, null); }
/** * INTERNAL: * Returns the join criteria stored in the mapping selection query. This criteria * is used to read reference objects across the tables from the database. */ public Expression getJoinCriteria(QueryKeyExpression exp) { if (getHistoryPolicy() != null) { Expression result = super.getJoinCriteria(exp); Expression historyCriteria = getHistoryPolicy().additionalHistoryExpression(exp); if (result != null) { return result.and(historyCriteria); } else if (historyCriteria != null) { return historyCriteria; } else { return null; } } else { return super.getJoinCriteria(exp); } }
/** * INTERNAL: * Returns the join criteria stored in the mapping selection query. This criteria * is used to read reference objects across the tables from the database. */ public Expression getJoinCriteria(QueryKeyExpression exp) { if (getHistoryPolicy() != null) { Expression result = super.getJoinCriteria(exp); Expression historyCriteria = getHistoryPolicy().additionalHistoryExpression(exp); if (result != null) { return result.and(historyCriteria); } else if (historyCriteria != null) { return historyCriteria; } else { return null; } } else { return super.getJoinCriteria(exp); } }
/** * INTERNAL: * Returns the join criteria stored in the mapping selection query. This criteria * is used to read reference objects across the tables from the database. */ @Override public Expression getJoinCriteria(ObjectExpression context, Expression base) { if (getHistoryPolicy() != null) { Expression result = super.getJoinCriteria(context, base); Expression historyCriteria = getHistoryPolicy().additionalHistoryExpression(context, base); if (result != null) { return result.and(historyCriteria); } else if (historyCriteria != null) { return historyCriteria; } else { return null; } } else { return super.getJoinCriteria(context, base); } }
/** * INTERNAL: * Returns the join criteria stored in the mapping selection query. This criteria * is used to read reference objects across the tables from the database. */ @Override public Expression getJoinCriteria(ObjectExpression context, Expression base) { if (getHistoryPolicy() != null) { Expression result = super.getJoinCriteria(context, base); Expression historyCriteria = getHistoryPolicy().additionalHistoryExpression(context, base); if (result != null) { return result.and(historyCriteria); } else if (historyCriteria != null) { return historyCriteria; } else { return null; } } else { return super.getJoinCriteria(context, base); } }
/** * INTERNAL: * Returns the join criteria stored in the mapping selection query. This criteria * is used to read reference objects across the tables from the database. */ @Override public Expression getJoinCriteria(ObjectExpression context, Expression base) { if (getHistoryPolicy() != null) { Expression result = super.getJoinCriteria(context, base); Expression historyCriteria = getHistoryPolicy().additionalHistoryExpression(context, base); if (result != null) { return result.and(historyCriteria); } else if (historyCriteria != null) { return historyCriteria; } else { return null; } } else { return super.getJoinCriteria(context, base); } }
/** * INTERNAL: * Returns the join criteria stored in the mapping selection query. This criteria * is used to read reference objects across the tables from the database. */ @Override public Expression getJoinCriteria(ObjectExpression context, Expression base) { if (getHistoryPolicy() != null) { Expression result = super.getJoinCriteria(context, base); Expression historyCriteria = getHistoryPolicy().additionalHistoryExpression(context, base); if (result != null) { return result.and(historyCriteria); } else if (historyCriteria != null) { return historyCriteria; } else { return null; } } else { return super.getJoinCriteria(context, base); } }
joinExpression = this.baseExpression.twist(joinExpression, this); if (getDescriptor().getHistoryPolicy() != null) { joinExpression = joinExpression.and(getDescriptor().getHistoryPolicy().additionalHistoryExpression(this, this, i));
joinExpression = this.baseExpression.twist(joinExpression, this); if (getDescriptor().getHistoryPolicy() != null) { joinExpression = joinExpression.and(getDescriptor().getHistoryPolicy().additionalHistoryExpression(this, this, i));
/** * INTERNAL: * Add additional fields and check for history. */ protected void postPrepareNestedBatchQuery(ReadQuery batchQuery, ReadAllQuery query) { ReadAllQuery mappingBatchQuery = (ReadAllQuery)batchQuery; mappingBatchQuery.setShouldIncludeData(true); for (Enumeration relationFieldsEnum = getSourceRelationKeyFields().elements(); relationFieldsEnum.hasMoreElements();) { mappingBatchQuery.getAdditionalFields().add(mappingBatchQuery.getExpressionBuilder().getTable(getRelationTable()).getField((DatabaseField)relationFieldsEnum.nextElement())); } if (getHistoryPolicy() != null) { ExpressionBuilder builder = mappingBatchQuery.getExpressionBuilder(); Expression twisted = batchQuery.getSelectionCriteria(); if (query.getSession().getAsOfClause() != null) { builder.asOf(query.getSession().getAsOfClause()); } else if (builder.getAsOfClause() == null) { builder.asOf(AsOfClause.NO_CLAUSE); } twisted = twisted.and(getHistoryPolicy().additionalHistoryExpression(builder)); mappingBatchQuery.setSelectionCriteria(twisted); } }
/** * INTERNAL: * Add additional fields and check for history. */ @Override protected void postPrepareNestedBatchQuery(ReadQuery batchQuery, ObjectLevelReadQuery query) { super.postPrepareNestedBatchQuery(batchQuery, query); ReadAllQuery mappingBatchQuery = (ReadAllQuery)batchQuery; this.mechanism.postPrepareNestedBatchQuery(batchQuery, query); if (this.historyPolicy != null) { ExpressionBuilder builder = mappingBatchQuery.getExpressionBuilder(); Expression twisted = batchQuery.getSelectionCriteria(); if (query.getSession().getAsOfClause() != null) { builder.asOf(query.getSession().getAsOfClause()); } else if (builder.getAsOfClause() == null) { builder.asOf(AsOfClause.NO_CLAUSE); } twisted = twisted.and(this.historyPolicy.additionalHistoryExpression(builder, builder)); mappingBatchQuery.setSelectionCriteria(twisted); } }
/** * INTERNAL: * Add additional fields and check for history. */ @Override protected void postPrepareNestedBatchQuery(ReadQuery batchQuery, ObjectLevelReadQuery query) { super.postPrepareNestedBatchQuery(batchQuery, query); ReadAllQuery mappingBatchQuery = (ReadAllQuery)batchQuery; this.mechanism.postPrepareNestedBatchQuery(batchQuery, query); if (this.historyPolicy != null) { ExpressionBuilder builder = mappingBatchQuery.getExpressionBuilder(); Expression twisted = batchQuery.getSelectionCriteria(); if (query.getSession().getAsOfClause() != null) { builder.asOf(query.getSession().getAsOfClause()); } else if (builder.getAsOfClause() == null) { builder.asOf(AsOfClause.NO_CLAUSE); } twisted = twisted.and(this.historyPolicy.additionalHistoryExpression(builder, builder)); mappingBatchQuery.setSelectionCriteria(twisted); } }
/** * INTERNAL: * Append the temporal selection to the query selection criteria. */ protected ReadQuery prepareHistoricalQuery(ReadQuery targetQuery, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { if (getHistoryPolicy() != null) { if (targetQuery == getSelectionQuery()) { targetQuery = (ObjectLevelReadQuery)targetQuery.clone(); targetQuery.setIsExecutionClone(true); } if (targetQuery.getSelectionCriteria() == getSelectionQuery().getSelectionCriteria()) { targetQuery.setSelectionCriteria((Expression)targetQuery.getSelectionCriteria().clone()); } if (sourceQuery.getSession().getAsOfClause() != null) { ((ObjectLevelReadQuery)targetQuery).setAsOfClause(sourceQuery.getSession().getAsOfClause()); } else if (((ObjectLevelReadQuery)targetQuery).getAsOfClause() == null) { ((ObjectLevelReadQuery)targetQuery).setAsOfClause(AsOfClause.NO_CLAUSE); } Expression temporalExpression = (this).getHistoryPolicy().additionalHistoryExpression(targetQuery.getSelectionCriteria().getBuilder()); targetQuery.setSelectionCriteria(targetQuery.getSelectionCriteria().and(temporalExpression)); } return targetQuery; } }
/** * INTERNAL: * Append the temporal selection to the query selection criteria. */ @Override protected ReadQuery prepareHistoricalQuery(ReadQuery targetQuery, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { if (getHistoryPolicy() != null) { if (targetQuery == getSelectionQuery()) { targetQuery = (ObjectLevelReadQuery)targetQuery.clone(); targetQuery.setIsExecutionClone(true); } if (targetQuery.getSelectionCriteria() == getSelectionQuery().getSelectionCriteria()) { targetQuery.setSelectionCriteria((Expression)targetQuery.getSelectionCriteria().clone()); } if (sourceQuery.getSession().getAsOfClause() != null) { ((ObjectLevelReadQuery)targetQuery).setAsOfClause(sourceQuery.getSession().getAsOfClause()); } else if (((ObjectLevelReadQuery)targetQuery).getAsOfClause() == null) { ((ObjectLevelReadQuery)targetQuery).setAsOfClause(AsOfClause.NO_CLAUSE); } Expression temporalExpression = (this).getHistoryPolicy().additionalHistoryExpression(targetQuery.getSelectionCriteria().getBuilder(), targetQuery.getSelectionCriteria().getBuilder()); targetQuery.setSelectionCriteria(targetQuery.getSelectionCriteria().and(temporalExpression)); } return targetQuery; } }
/** * INTERNAL: * Append the temporal selection to the query selection criteria. */ @Override protected ReadQuery prepareHistoricalQuery(ReadQuery targetQuery, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { if (getHistoryPolicy() != null) { if (targetQuery == getSelectionQuery()) { targetQuery = (ObjectLevelReadQuery)targetQuery.clone(); targetQuery.setIsExecutionClone(true); } if (targetQuery.getSelectionCriteria() == getSelectionQuery().getSelectionCriteria()) { targetQuery.setSelectionCriteria((Expression)targetQuery.getSelectionCriteria().clone()); } if (sourceQuery.getSession().getAsOfClause() != null) { ((ObjectLevelReadQuery)targetQuery).setAsOfClause(sourceQuery.getSession().getAsOfClause()); } else if (((ObjectLevelReadQuery)targetQuery).getAsOfClause() == null) { ((ObjectLevelReadQuery)targetQuery).setAsOfClause(AsOfClause.NO_CLAUSE); } Expression temporalExpression = (this).getHistoryPolicy().additionalHistoryExpression(targetQuery.getSelectionCriteria().getBuilder(), targetQuery.getSelectionCriteria().getBuilder()); targetQuery.setSelectionCriteria(targetQuery.getSelectionCriteria().and(temporalExpression)); } return targetQuery; } }
Expression historyCriteria = getDescriptor().getHistoryPolicy().additionalHistoryExpression(this, this); if (criteria != null) { criteria = criteria.and(historyCriteria);
Expression historyCriteria = getDescriptor().getHistoryPolicy().additionalHistoryExpression(this, this); if (criteria != null) { criteria = criteria.and(historyCriteria);
Expression historyCriteria = getDescriptor().getHistoryPolicy().additionalHistoryExpression(this); if (criteria != null) { criteria = criteria.and(historyCriteria);
builder.asOf(AsOfClause.NO_CLAUSE); Expression temporalExpression = getHistoryPolicy().additionalHistoryExpression(builder); statement.setWhereClause(statement.getWhereClause().and(temporalExpression)); if (builder.hasAsOfClause()) {