fr.cnes.sitools.dataset.filter.business
Class AbstractFilter

java.lang.Object
  extended by org.restlet.engine.Helper
      extended by fr.cnes.sitools.common.model.ExtensionModel<E>
          extended by fr.cnes.sitools.common.business.AbstractExtension<FilterParameter>
              extended by fr.cnes.sitools.dataset.filter.business.AbstractFilter
All Implemented Interfaces:
IResource, Validable
Direct Known Subclasses:
AbstractFormFilter, FilterChained, GridFilter, LoggingFilter, PrimaryKeyFilter, SecurityFilter

public abstract class AbstractFilter
extends AbstractExtension<FilterParameter>
implements Validable

Abstract class from which all filters must inherits.

Author:
m.marseille (AKKA Technologies)

Constructor Summary
AbstractFilter()
          Default constructor
AbstractFilter(org.restlet.Context ctx)
          Constructor with DataSet parameter
 
Method Summary
 void addParam(FilterParameter param)
          Add a parameter to the list of parameter The key to this parameter is its name
 java.lang.Number convert(java.lang.String unitFromName, java.lang.String unitToName, java.lang.String valueFrom, java.lang.String dimension)
          Convert valueFrom from unitFromName to unitToName
abstract  java.util.List<Predicat> createPredicats(org.restlet.Request request, java.util.List<Predicat> predicats)
          Method to process conversion, Must be overridden
 java.lang.Boolean getDefaultFilter()
          Gets whether or not a Filter is a added by default to a Dataset when a new Dataset is created
 Dictionary getDictionaryFromName(java.lang.String dicoName)
          Get a dictionary from its name
 FilterParameter getInternParam(java.lang.String name)
          Gets the FilterParameter of type PARAMETER_INTERN corresponding to the following name
 java.util.HashMap<java.lang.String,org.restlet.ext.wadl.ParameterInfo> getRequestParamsDescription()
          Gets the requestParamsDescription value
 void setDefaultFilter(java.lang.Boolean defaultFilter)
          The default filter value is used to tell whether or not a Filter is a added by default to a Dataset when a new Dataset is created
 void setRequestParamsDescription(java.util.HashMap<java.lang.String,org.restlet.ext.wadl.ParameterInfo> requestParamsDescription)
          Sets the value of requestParamsDescription
 
Methods inherited from class fr.cnes.sitools.common.business.AbstractExtension
getContext, setContext
 
Methods inherited from class fr.cnes.sitools.common.model.ExtensionModel
getClassAuthor, getClassName, getClassOwner, getClassVersion, getDescription, getDescriptionAction, getId, getName, getParametersMap, setClassAuthor, setClassName, setClassOwner, setClassVersion, setDescription, setDescriptionAction, setId, setName, setParametersMap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.cnes.sitools.common.validator.Validable
getValidator
 

Constructor Detail

AbstractFilter

public AbstractFilter()
Default constructor


AbstractFilter

public AbstractFilter(org.restlet.Context ctx)
Constructor with DataSet parameter

Parameters:
ctx - Context Object, contains the dataset as a property "DATASET"
Method Detail

getDefaultFilter

public final java.lang.Boolean getDefaultFilter()
Gets whether or not a Filter is a added by default to a Dataset when a new Dataset is created

Returns:
the defaultFilter value

getRequestParamsDescription

public java.util.HashMap<java.lang.String,org.restlet.ext.wadl.ParameterInfo> getRequestParamsDescription()
Gets the requestParamsDescription value

Returns:
the requestParamsDescription

setRequestParamsDescription

public final void setRequestParamsDescription(java.util.HashMap<java.lang.String,org.restlet.ext.wadl.ParameterInfo> requestParamsDescription)
Sets the value of requestParamsDescription

Parameters:
requestParamsDescription - the requestParamsDescription to set

setDefaultFilter

public final void setDefaultFilter(java.lang.Boolean defaultFilter)
The default filter value is used to tell whether or not a Filter is a added by default to a Dataset when a new Dataset is created

Parameters:
defaultFilter - true to set the filter to default, false otherwise

createPredicats

public abstract java.util.List<Predicat> createPredicats(org.restlet.Request request,
                                                         java.util.List<Predicat> predicats)
                                                  throws java.lang.Exception
Method to process conversion, Must be overridden

Parameters:
request - the request to be processed
predicats - the ArrayList to be processed
Returns:
the ArrayList processed
Throws:
java.lang.Exception - TODO EVOLUTION - Possibilité de passer des paramètres d'un filtre à l'autre autrement que par les predicats Voir si besoin.

addParam

public final void addParam(FilterParameter param)
Add a parameter to the list of parameter The key to this parameter is its name

Parameters:
param - the Record

getInternParam

public final FilterParameter getInternParam(java.lang.String name)
Gets the FilterParameter of type PARAMETER_INTERN corresponding to the following name

Parameters:
name - The name of the FilterParameter
Returns:
a FilterParameter of type PARAMETER_INTERN corresponding to the following name or null if the FilterParameter is not found

convert

public final java.lang.Number convert(java.lang.String unitFromName,
                                      java.lang.String unitToName,
                                      java.lang.String valueFrom,
                                      java.lang.String dimension)
                               throws SitoolsException
Convert valueFrom from unitFromName to unitToName

Parameters:
unitFromName - the name of the unit from
unitToName - the name of the unit to
valueFrom - the value to convert
dimension - the dimension
Returns:
the value converted
Throws:
SitoolsException - if something wrong occurs

getDictionaryFromName

public Dictionary getDictionaryFromName(java.lang.String dicoName)
Get a dictionary from its name

Parameters:
dicoName - the name of the dictionary
Returns:
the dictionary with the corresponding dicoName name


Copyright © 2010-2013 CNES. All Rights Reserved.