/** * 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."); } } }
arg3.setCriteria(criteria); return arg3;
public void createChartForNextBudgetCycle() { // first we have to remove what's there // (the documentation says deleteByQuery (1) ignores object references and (2) does // not synchronize the cache. so, we clear the cache before and after.) getPersistenceBrokerTemplate().clearCache(); Criteria criteriaID = QueryByCriteria.CRITERIA_SELECT_ALL; QueryByCriteria killAcctQuery = new QueryByCriteria(BudgetConstructionAccountReports.class); killAcctQuery.setCriteria(criteriaID); getPersistenceBrokerTemplate().deleteByQuery(killAcctQuery); QueryByCriteria killOrgQuery = new QueryByCriteria(BudgetConstructionOrganizationReports.class); killOrgQuery.setCriteria(criteriaID); getPersistenceBrokerTemplate().deleteByQuery(killOrgQuery); getPersistenceBrokerTemplate().clearCache(); // build the organization table buildNewOrganizationReportsTo(); // build the account table buildNewAccountReportsTo(); }
criteriaID.addEqualTo(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, RequestYear); QueryByCriteria killOrgHierQuery = new QueryByCriteria(BudgetConstructionAccountOrganizationHierarchy.class, criteriaID); killOrgHierQuery.setCriteria(criteriaID); getPersistenceBrokerTemplate().deleteByQuery(killOrgHierQuery); getPersistenceBrokerTemplate().clearCache();