public Query customizeQuery(Object owner, PersistenceBroker broker, CollectionDescriptor collDescriptor, QueryByCriteria query) { String discriminatorField = this.getAttribute(DISCRIMINATOR_FIELD); if (discriminatorField != null) { query.getCriteria().addEqualTo(discriminatorField, owner.getClass().getName()); } return query; } }
/** * @see org.apache.ojb.broker.accesslayer.QueryCustomizer#customizeQuery(java.lang.Object, * org.apache.ojb.broker.PersistenceBroker, org.apache.ojb.broker.metadata.CollectionDescriptor, * org.apache.ojb.broker.query.QueryByCriteria) */ public Query customizeQuery(Object arg0, PersistenceBroker arg1, CollectionDescriptor arg2, QueryByCriteria arg3) { if ("TRUE".equals(getAttribute(prepaidAttributeName))) { arg3.getCriteria().addEqualTo(prepaidIndicatorField, KFSConstants.ACTIVE_INDICATOR); } else { arg3.getCriteria().addEqualTo(prepaidIndicatorField, KFSConstants.NON_ACTIVE_INDICATOR); } return arg3; }
public Query customizeQuery(Object owner, PersistenceBroker broker, CollectionDescriptor collDescriptor, QueryByCriteria query) { String isClone = this.getAttribute(CLONE_FIELD, "false"); if (isClone.equals("false")) { query.getCriteria().addIsNull("cloneParent"); } else { query.getCriteria().addNotNull("cloneParent"); } return query; } }
/** * Overrides the inactive customizeQuery in the parent class (but makes use * of its code for setting / retrieving parameter values from the XML file). * * @see org.apache.ojb.broker.accesslayer.QueryCustomizer#customizeQuery */ public Query customizeQuery(Object anObject, PersistenceBroker aBroker, CollectionDescriptor aCod, QueryByCriteria aQuery) { // Using reflection, get the long value of the static variable in the DbXrefBean class // that indicates which kind of Param object this is. String paramTypeVariableName = this.getAttribute(ATTRIBUTE_NAME); if (paramTypeVariableName != null && NAME_TO_NUMBER_MAP.get(paramTypeVariableName) != null) { Long paramTypeLongValue = NAME_TO_NUMBER_MAP.get(paramTypeVariableName); // Create the where clause to ensure only the required Param objects are returned. Criteria whereClause = aQuery.getCriteria(); whereClause.addEqualTo("queryXrefType", paramTypeLongValue); aQuery.setCriteria(whereClause); return aQuery; } else { throw new IllegalStateException("The repository.xml file should provide exactly one attribute with an attribute-name of 'param_type_value' and an attribute-value being the name of the field in the DbXrefBean class that describes the required parameter."); } } }
/** * @see org.apache.ojb.broker.accesslayer.QueryCustomizer#customizeQuery(java.lang.Object, * org.apache.ojb.broker.PersistenceBroker, org.apache.ojb.broker.metadata.CollectionDescriptor, * org.apache.ojb.broker.query.QueryByCriteria) */ public Query customizeQuery(Object arg0, PersistenceBroker arg1, CollectionDescriptor arg2, QueryByCriteria arg3) { List paramValues; // these parameter service calls will throw an IllegalArgumentException exception if the parameter doesn't exist if ("TRUE".equals(getAttribute(revenueAttributeName))) { paramValues = BudgetParameterFinder.getRevenueObjectTypes(); } else { paramValues = BudgetParameterFinder.getExpenditureObjectTypes(); } ArrayList<String> revObjs = new ArrayList<String>(); revObjs.addAll(paramValues); arg3.getCriteria().addIn(objectCodeTypeField, revObjs); return arg3; }
Criteria criteria = arg3.getCriteria(); for (String key : m_attributeList.keySet()) {