/** * INTERNAL: * Prepare a report query with a count defined on an object attribute. * Added to fix bug 3268040, addCount(objectAttribute) not supported. */ protected void prepareObjectAttributeCount(Map clonedExpressions) { prepareObjectAttributeCount(getItems(), clonedExpressions); }
/** * INTERNAL: * Prepare a report query with a count defined on an object attribute. * Added to fix bug 3268040, addCount(objectAttribute) not supported. */ protected void prepareObjectAttributeCount(Map clonedExpressions) { prepareObjectAttributeCount(getItems(), clonedExpressions); }
/** * INTERNAL: * Prepare a report query with a count defined on an object attribute. * Added to fix bug 3268040, addCount(objectAttribute) not supported. */ protected void prepareObjectAttributeCount(Map clonedExpressions) { prepareObjectAttributeCount(getItems(), clonedExpressions); }
/** * INTERNAL: * Prepare the mechanism. */ @Override protected void prepareSelectAllRows() { prepareObjectAttributeCount(null); getQueryMechanism().prepareReportQuerySelectAllRows(); }
/** * INTERNAL: * Prepare the mechanism. */ protected void prepareSelectAllRows() { prepareObjectAttributeCount(null); getQueryMechanism().prepareReportQuerySelectAllRows(); }
/** * INTERNAL: * Prepare the mechanism. */ @Override protected void prepareSelectAllRows() { prepareObjectAttributeCount(null); getQueryMechanism().prepareReportQuerySelectAllRows(); }
/** * JPQL allows count([distinct] e), where e can be an object, not just a single field, * however the database only allows a single field, so object needs to be translated to a single field. * If the descriptor has a single pk, it is used, otherwise any pk is used if distinct, otherwise a subselect is used. * If the object was obtained through an outer join, then the subselect also will not work, so an error is thrown. */ private void prepareObjectAttributeCount(List<ReportItem> items, Map clonedExpressions) { int numOfReportItems = items.size(); //gf675: need to loop through all items to fix all count(..) instances for (int i =0;i<numOfReportItems; i++){ ReportItem item = items.get(i); if (item == null) { continue; } else if (item instanceof ConstructorReportItem) { // recursive call to process child ReportItems prepareObjectAttributeCount(((ConstructorReportItem)item).getReportItems(), clonedExpressions); } else if (item.getAttributeExpression() instanceof FunctionExpression) { FunctionExpression count = (FunctionExpression)item.getAttributeExpression(); count.prepareObjectAttributeCount(null, item, this, clonedExpressions); } } }
/** * JPQL allows count([distinct] e), where e can be an object, not just a single field, * however the database only allows a single field, so object needs to be translated to a single field. * If the descriptor has a single pk, it is used, otherwise any pk is used if distinct, otherwise a subselect is used. * If the object was obtained through an outer join, then the subselect also will not work, so an error is thrown. */ private void prepareObjectAttributeCount(List items, Map clonedExpressions) { int numOfReportItems = items.size(); //gf675: need to loop through all items to fix all count(..) instances for (int i =0;i<numOfReportItems; i++){ ReportItem item = (ReportItem)items.get(i); if (item == null) { continue; } else if (item instanceof ConstructorReportItem) { // recursive call to process child ReportItems prepareObjectAttributeCount(((ConstructorReportItem)item).getReportItems(), clonedExpressions); } else if (item.getAttributeExpression() instanceof FunctionExpression) { FunctionExpression count = (FunctionExpression)item.getAttributeExpression(); count.prepareObjectAttributeCount(null, item, this, clonedExpressions); } } }
/** * INTERNAL: * Prepare the receiver for being printed inside a subselect. * This prepares the statement but not the call. */ public synchronized void prepareSubSelect(AbstractSession session, AbstractRecord translationRow, Map clonedExpressions) throws QueryException { if (isPrepared()) { return; } setIsPrepared(true); setSession(session); setTranslationRow(translationRow); checkDescriptor(getSession()); if (descriptor.isAggregateDescriptor()) { // Not allowed throw QueryException.aggregateObjectCannotBeDeletedOrWritten(descriptor, this); } try { for (ReportItem item : getItems()) { item.initialize(this); } } catch (QueryException exception) { exception.setQuery(this); throw exception; } prepareObjectAttributeCount(clonedExpressions); getQueryMechanism().prepareReportQuerySubSelect(); setSession(null); setTranslationRow(null); }
/** * INTERNAL: * Prepare the receiver for being printed inside a subselect. * This prepares the statement but not the call. */ public synchronized void prepareSubSelect(AbstractSession session, AbstractRecord translationRow, Map clonedExpressions) throws QueryException { if (isPrepared()) { return; } setIsPrepared(true); setSession(session); setTranslationRow(translationRow); checkDescriptor(getSession()); if (descriptor.isAggregateDescriptor()) { // Not allowed throw QueryException.aggregateObjectCannotBeDeletedOrWritten(descriptor, this); } try { for (ReportItem item : getItems()) { item.initialize(this); } } catch (QueryException exception) { exception.setQuery(this); throw exception; } prepareObjectAttributeCount(clonedExpressions); getQueryMechanism().prepareReportQuerySubSelect(); setSession(null); setTranslationRow(null); }
prepareObjectAttributeCount(clonedExpressions);
} else if (item instanceof ConstructorReportItem) { prepareObjectAttributeCount(((ConstructorReportItem)item).getReportItems(), clonedExpressions); } else if (item.getAttributeExpression() instanceof FunctionExpression) { FunctionExpression count = (FunctionExpression)item.getAttributeExpression();