org.openswing.swing.util.server
Class CayenneUtils

java.lang.Object
  extended byorg.openswing.swing.util.server.CayenneUtils

public class CayenneUtils
extends java.lang.Object

Title: OpenSwing Framework

Description: Helper class containing some utility methods useful when retrieving data for a grid.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it


Constructor Summary
CayenneUtils()
           
 
Method Summary
static org.apache.cayenne.query.SelectQuery applyFiltersAndSorter(java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, org.apache.cayenne.query.SelectQuery query, java.util.Map additionalConditions, org.apache.cayenne.access.DataContext context)
          Apply filtering and sorting conditions to the specified base select query and return a new query that contains those conditions too.
static Response getAllFromQuery(java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, java.lang.Class valueObjectType, org.apache.cayenne.query.SelectQuery query, java.util.Map additionalConditions, org.apache.cayenne.access.DataContext context)
          Read the whole result set, by applying filtering and sorting conditions + query parameters.
static Response getBlockFromQuery(int action, int startIndex, int blockSize, java.util.Map filteredColumns, java.util.ArrayList currentSortedColumns, java.util.ArrayList currentSortedVersusColumns, org.apache.cayenne.query.SelectQuery query, java.util.Map additionalConditions, org.apache.cayenne.access.DataContext context)
          Read a block of records from the result set, by applying filtering and sorting conditions + query parameters.
static Response getBlockFromQuery(int action, int startIndex, int blockSize, org.apache.cayenne.query.SelectQuery query, org.apache.cayenne.access.DataContext context)
          Read a block of records from the result set, starting from a Query object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CayenneUtils

public CayenneUtils()
Method Detail

applyFiltersAndSorter

public static org.apache.cayenne.query.SelectQuery applyFiltersAndSorter(java.util.Map filteredColumns,
                                                                         java.util.ArrayList currentSortedColumns,
                                                                         java.util.ArrayList currentSortedVersusColumns,
                                                                         org.apache.cayenne.query.SelectQuery query,
                                                                         java.util.Map additionalConditions,
                                                                         org.apache.cayenne.access.DataContext context)
                                                                  throws java.lang.Exception
Apply filtering and sorting conditions to the specified base select query and return a new query that contains those conditions too.

Parameters:
filteredColumns - filtering conditions
currentSortedColumns - sorting conditions (attribute names)
currentSortedVersusColumns - sorting conditions (order versus)
query - Cayenne SelectQuery object
additionalConditions - conditions expressed as
context - Cayenne data context
Throws:
java.lang.Exception

getAllFromQuery

public static Response getAllFromQuery(java.util.Map filteredColumns,
                                       java.util.ArrayList currentSortedColumns,
                                       java.util.ArrayList currentSortedVersusColumns,
                                       java.lang.Class valueObjectType,
                                       org.apache.cayenne.query.SelectQuery query,
                                       java.util.Map additionalConditions,
                                       org.apache.cayenne.access.DataContext context)
                                throws java.lang.Exception
Read the whole result set, by applying filtering and sorting conditions + query parameters.

Parameters:
filteredColumns - filtering conditions
currentSortedColumns - sorting conditions (attribute names)
currentSortedVersusColumns - sorting conditions (order versus)
valueObjectType - value object type
query - Cayenne SelectQuery object
additionalConditions - conditions expressed as
context - Cayenne data context
Throws:
java.lang.Exception

getBlockFromQuery

public static Response getBlockFromQuery(int action,
                                         int startIndex,
                                         int blockSize,
                                         java.util.Map filteredColumns,
                                         java.util.ArrayList currentSortedColumns,
                                         java.util.ArrayList currentSortedVersusColumns,
                                         org.apache.cayenne.query.SelectQuery query,
                                         java.util.Map additionalConditions,
                                         org.apache.cayenne.access.DataContext context)
                                  throws java.lang.Exception
Read a block of records from the result set, by applying filtering and sorting conditions + query parameters.

Parameters:
action - fetching versus: PREVIOUS_BLOCK_ACTION, NEXT_BLOCK_ACTION or LAST_BLOCK_ACTION
blockSize - number of records to read
filteredColumns - filtering conditions
currentSortedColumns - sorting conditions (attribute names)
currentSortedVersusColumns - sorting conditions (order versus)
query - Cayenne SelectQuery object
additionalConditions - conditions expressed as
context - Cayenne data context
Throws:
java.lang.Exception

getBlockFromQuery

public static Response getBlockFromQuery(int action,
                                         int startIndex,
                                         int blockSize,
                                         org.apache.cayenne.query.SelectQuery query,
                                         org.apache.cayenne.access.DataContext context)
                                  throws java.lang.Exception
Read a block of records from the result set, starting from a Query object.

Parameters:
action - fetching versus: PREVIOUS_BLOCK_ACTION, NEXT_BLOCK_ACTION or LAST_BLOCK_ACTION
blockSize - number of records to read
query - Query object
context - Cayenne data context
Throws:
java.lang.Exception