/** * PUBLIC: Add the argument named argumentName and its class type. This will * cause the translation of references of argumentName in the receiver's * expression, with the value of the argument as supplied to the query in * order from executeQuery(). Specifying the class type is important if * identically named queries are used but with different argument lists. */ public void addArgument(String argumentName, Class type) { addArgument(argumentName, type, false); }
/** * PUBLIC: Add the argument named argumentName and its class type. This will * cause the translation of references of argumentName in the receiver's * expression, with the value of the argument as supplied to the query in * order from executeQuery(). Specifying the class type is important if * identically named queries are used but with different argument lists. */ public void addArgument(String argumentName, Class type) { addArgument(argumentName, type, false); }
/** * INTERNAL: Add the argument named argumentName. This method was added to maintain * information about whether parameters are positional or named for JPQL query introspeciton * API */ public void addArgument(String argumentName, Class type, ParameterType parameterType) { addArgument(argumentName, type, parameterType, false); }
/** * PUBLIC: Add the argument named argumentName. This will cause the * translation of references of argumentName in the receiver's expression, * with the value of the argument as supplied to the query in order from * executeQuery() */ public void addArgument(String argumentName) { addArgument(argumentName, Object.class); }
/** * PUBLIC: Add the argument named argumentName. This will cause the * translation of references of argumentName in the receiver's expression, * with the value of the argument as supplied to the query in order from * executeQuery() */ public void addArgument(String argumentName) { addArgument(argumentName, Object.class); }
/** * INTERNAL: Add the argument named argumentName. This method was added to maintain * information about whether parameters are positional or named for JPQL query introspeciton * API */ public void addArgument(String argumentName, Class type, ParameterType parameterType) { addArgument(argumentName, type, parameterType, false); }
/** * PUBLIC: * Add the argument named argumentName. * This will cause the translation of references of argumentName in the receiver's expression, * with the value of the argument as supplied to the query in order from executeQuery() */ public void addArgument(String argumentName) { // CR#3545 - Changed the default argument type to make argument types work more consistently // with the SDK addArgument(argumentName, java.lang.Object.class); }
/** * <p><b>INTERNAL</b>: Initialize this <code>QueryHandler</code>'s <code>DatabaseQuery</code>'s * arguments from the {@link Operation}'s {@link Parameter Parameters} * @param xrService the given <code>DBWSService</code> * @param queryOperation the given <code>QueryOperation</code> * @param databaseQuery the given <code>DatabaseQuery</code> */ @SuppressWarnings("unused") public void initializeArguments(XRServiceAdapter xrService, QueryOperation queryOperation, DatabaseQuery databaseQuery) { for (int i = 0; i < queryOperation.getParameters().size(); i++) { Object o = queryOperation.getParameters().get(i); if (o instanceof Parameter) { Parameter p = (Parameter)o; String name = p.getName(); if (name != null && name.length() > 0 ) { databaseQuery.addArgument(name); continue; } } String s = Integer.toString(i + 1); databaseQuery.addArgument(s); } } }
@Override public void initializeArguments(XRServiceAdapter xrService, QueryOperation queryOperation, DatabaseQuery databaseQuery) { for (Parameter p : queryOperation.getParameters()) { databaseQuery.addArgument(p.getName()); } }
@Override public void initializeArguments(XRServiceAdapter xrService, QueryOperation queryOperation, DatabaseQuery databaseQuery) { for (Parameter p : queryOperation.getParameters()) { databaseQuery.addArgument(p.getName()); } }
/** * Registers the input parameters derived from the JPQL expression with the {@link DatabaseQuery}. * * @param queryContext The {@link JPQLQueryContext} containing the information about the JPQL query * @param databaseQuery The EclipseLink {@link DatabaseQuery} where the input parameter types are added */ private void addArguments(JPQLQueryContext queryContext, DatabaseQuery databaseQuery) { if (queryContext.inputParameters != null) { for (Map.Entry<InputParameter, Expression> entry : queryContext.inputParameters.entrySet()) { ParameterExpression parameter = (ParameterExpression) entry.getValue(); databaseQuery.addArgument( parameter.getField().getName(), (Class<?>) parameter.getType(), entry.getKey().isPositional() ? ParameterType.POSITIONAL : ParameterType.NAMED ); } } }
/** * Registers the input parameters derived from the JPQL expression with the {@link DatabaseQuery}. * * @param queryContext The {@link JPQLQueryContext} containing the information about the JPQL query * @param databaseQuery The EclipseLink {@link DatabaseQuery} where the input parameter types are added */ private void addArguments(JPQLQueryContext queryContext, DatabaseQuery databaseQuery) { if (queryContext.inputParameters != null) { for (Map.Entry<InputParameter, Expression> entry : queryContext.inputParameters.entrySet()) { ParameterExpression parameter = (ParameterExpression) entry.getValue(); databaseQuery.addArgument( parameter.getField().getName(), (Class<?>) parameter.getType(), entry.getKey().isPositional() ? ParameterType.POSITIONAL : ParameterType.NAMED ); } } }
/** * INTERNAL * Add parameters to the query */ public void addParametersToQuery(DatabaseQuery query) { //Bug#4646580 Add arguments to query if (context.hasParameters()) { TypeHelper typeHelper = context.getTypeHelper(); for (Iterator i = context.getParameterNames().iterator(); i.hasNext();) { String param = (String)i.next(); Object type = context.getParameterType(param); Class clazz = typeHelper.getJavaClass(type); if (clazz == null) { clazz = Object.class; } query.addArgument(param, clazz); } } }
/** * INTERNAL * Add parameters to the query */ public void addParametersToQuery(DatabaseQuery query) { //Bug#4646580 Add arguments to query if (context.hasParameters()) { TypeHelper typeHelper = context.getTypeHelper(); for (Iterator i = context.getParameterNames().iterator(); i.hasNext();) { String param = (String)i.next(); Object type = context.getParameterType(param); Class clazz = typeHelper.getJavaClass(type); if (clazz == null) { clazz = Object.class; } query.addArgument(param, clazz); } } }
/** * INTERNAL * Add parameters to the query */ public void addParametersToQuery(DatabaseQuery query) { //Bug#4646580 Add arguments to query if (context.hasParameters()) { TypeHelper typeHelper = context.getTypeHelper(); for (Iterator i = context.getParameterNames().iterator(); i.hasNext();) { String param = (String)i.next(); Object type = context.getParameterType(param); Class clazz = typeHelper.getJavaClass(type); if (clazz == null) { clazz = Object.class; } query.addArgument(param, clazz); } } }
/** * INTERNAL: * This method rises appropriate for the session event(s) * right before the connection is released. */ public void preReleaseConnection(Accessor accessor) { if (getProject().hasVPDIdentifier(this)) { if (getPlatform().supportsVPD()) { DatabaseQuery query = getPlatform().getVPDClearIdentifierQuery(getProject().getVPDIdentifier()); List argValues = new ArrayList(); query.addArgument(getProject().getVPDIdentifier()); argValues.add(getProperty(getProject().getVPDIdentifier())); executeQuery(query, argValues); } else { throw ValidationException.vpdNotSupported(getPlatform().getClass().getName()); } } if (this.eventManager != null) { this.eventManager.preReleaseConnection(accessor); } }
/** * INTERNAL: * This method rises appropriate for the session event(s) * right after connection is acquired. */ public void postAcquireConnection(Accessor accessor) { if (getProject().hasVPDIdentifier(this)) { if (getPlatform().supportsVPD()) { DatabaseQuery query = getPlatform().getVPDSetIdentifierQuery(getProject().getVPDIdentifier()); List argValues = new ArrayList(); query.addArgument(getProject().getVPDIdentifier()); argValues.add(getProperty(getProject().getVPDIdentifier())); executeQuery(query, argValues); } else { throw ValidationException.vpdNotSupported(getPlatform().getClass().getName()); } } if (this.eventManager != null) { this.eventManager.postAcquireConnection(accessor); } }
/** * INTERNAL: * This method rises appropriate for the session event(s) * right before the connection is released. */ public void preReleaseConnection(Accessor accessor) { if (getProject().hasVPDIdentifier(this)) { if (getPlatform().supportsVPD()) { DatabaseQuery query = getPlatform().getVPDClearIdentifierQuery(getProject().getVPDIdentifier()); List argValues = new ArrayList(); query.addArgument(getProject().getVPDIdentifier()); argValues.add(getProperty(getProject().getVPDIdentifier())); executeQuery(query, argValues); } else { throw ValidationException.vpdNotSupported(getPlatform().getClass().getName()); } } if (this.eventManager != null) { this.eventManager.preReleaseConnection(accessor); } }
/** * INTERNAL: * This method rises appropriate for the session event(s) * right after connection is acquired. */ public void postAcquireConnection(Accessor accessor) { if (getProject().hasVPDIdentifier(this)) { if (getPlatform().supportsVPD()) { DatabaseQuery query = getPlatform().getVPDSetIdentifierQuery(getProject().getVPDIdentifier()); List argValues = new ArrayList(); query.addArgument(getProject().getVPDIdentifier()); argValues.add(getProperty(getProject().getVPDIdentifier())); executeQuery(query, argValues); } else { throw ValidationException.vpdNotSupported(getPlatform().getClass().getName()); } } if (this.eventManager != null) { this.eventManager.postAcquireConnection(accessor); } }
/** * Translates from the criteria query to a EclipseLink Database Query. */ public DatabaseQuery translate() { DatabaseQuery query = getDatabaseQuery(); for (ParameterExpression<?> parameter : getParameters()) { query.addArgument(((ParameterExpressionImpl)parameter).getInternalName(), parameter.getJavaType()); } if (this.where != null) { if (((InternalExpression) this.where).isJunction()) { if (!((PredicateImpl) this.where).getJunctionValue()) { query.setSelectionCriteria(new ConstantExpression(1, getBaseExpression()).equal(0)); } } else { query.setSelectionCriteria(((InternalSelection) this.where).getCurrentNode()); } } return query; }