org.ikasan.console.web.controller
Class MasterDetailControllerUtil

java.lang.Object
  extended by org.ikasan.console.web.controller.MasterDetailControllerUtil

public class MasterDetailControllerUtil
extends Object

Common utility functions used by MVC controllers that deal with paged Master/Detail search functions

Author:
The Ikasan Development Team

Constructor Summary
MasterDetailControllerUtil()
           
 
Method Summary
static void addPagedModelAttributes(String orderBy, Boolean orderAsc, String pointToPointFlowProfileSearch, Boolean pointToPointFlowProfileSelectAll, Boolean moduleSelectAll, org.springframework.ui.ModelMap model, int pageNo, int pageSize, PagedSearchResult<?> pagedResult, javax.servlet.http.HttpServletRequest request, Map<String,Object> searchParams)
          Adds all standard control attributes to the model for displaying the search results page
static void addParam(Map<String,Object> searchParams, String paramName, Object paramValue)
          Adds a parameter to the searchParams map, only if it has a value
static boolean defaultFalse(Boolean input)
          Standardises the input field to use false if otherwise not supplied
static boolean defaultTrue(Boolean input)
          Standardises the input field to use true if otherwise not supplied
static int defaultZero(Integer input)
          Returns the input value if not null, otherwise 0
static String nullForEmpty(String input)
          Returns the input value or null for an empty String
static String resolveOrderBy(String orderBy)
          Returns the input value if not null, otherwise "id"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MasterDetailControllerUtil

public MasterDetailControllerUtil()
Method Detail

addParam

public static void addParam(Map<String,Object> searchParams,
                            String paramName,
                            Object paramValue)
Adds a parameter to the searchParams map, only if it has a value

Parameters:
searchParams - - The search parameters map to add to
paramName - - The name of the parameter to add
paramValue - - The value of the parameter to add

addPagedModelAttributes

public static void addPagedModelAttributes(String orderBy,
                                           Boolean orderAsc,
                                           String pointToPointFlowProfileSearch,
                                           Boolean pointToPointFlowProfileSelectAll,
                                           Boolean moduleSelectAll,
                                           org.springframework.ui.ModelMap model,
                                           int pageNo,
                                           int pageSize,
                                           PagedSearchResult<?> pagedResult,
                                           javax.servlet.http.HttpServletRequest request,
                                           Map<String,Object> searchParams)
Adds all standard control attributes to the model for displaying the search results page

Parameters:
orderBy - - The field we are ordering by
orderAsc - - Flag to determine if we are ordering by ascending value or not
pointToPointFlowProfileSearch - - Flag to indicate what type of search
pointToPointFlowProfileSelectAll - - Select all boolean for pointToPointFlowProfile based search
moduleSelectAll - - Select all boolean for pointToPointFlowProfile based search
model - - The model we are displaying (the data)
pageNo - - The page number we are on
pageSize - - The page Size (how many results to display per page)
pagedResult - - The paged result page
request - - standard HttpRequest
searchParams - - The search parameters we're using

defaultFalse

public static boolean defaultFalse(Boolean input)
Standardises the input field to use false if otherwise not supplied

Parameters:
input - - The ascending order flag
Returns:
false by default

defaultTrue

public static boolean defaultTrue(Boolean input)
Standardises the input field to use true if otherwise not supplied

Parameters:
input - - The ascending order flag
Returns:
true by default

resolveOrderBy

public static String resolveOrderBy(String orderBy)
Returns the input value if not null, otherwise "id"

Parameters:
orderBy - - Field to order by
Returns:
orderBy or default to 'id'

defaultZero

public static int defaultZero(Integer input)
Returns the input value if not null, otherwise 0

Parameters:
input - - input
Returns:
0 as a default

nullForEmpty

public static String nullForEmpty(String input)
Returns the input value or null for an empty String

Parameters:
input - - input
Returns:
null for an empty String as default


Copyright © 2007-2014 Ikasan. All Rights Reserved.