fr.paris.lutece.plugins.directory.utils
Class DirectoryUtils

java.lang.Object
  extended by fr.paris.lutece.plugins.directory.utils.DirectoryUtils

public final class DirectoryUtils
extends java.lang.Object

class DirectoryUtils


Field Summary
static java.lang.String CONSTANT_AMPERSAND
           
static java.lang.String CONSTANT_AND
           
static java.lang.String CONSTANT_COMA
           
static java.lang.String CONSTANT_DOT
           
static java.lang.String CONSTANT_EQUAL
           
static java.lang.String CONSTANT_ID
           
static int CONSTANT_ID_NULL
           
static int CONSTANT_ID_ZERO
           
static java.lang.String CONSTANT_INTERROGATION_MARK
           
static java.lang.String CONSTANT_NAME
           
static java.lang.String CONSTANT_OR
           
static java.lang.String CONSTANT_TRUE
           
static java.lang.String CONSTANT_UNDERSCORE
           
static java.lang.String CONSTANT_WHERE
           
static java.lang.String EMPTY_STRING
           
static java.lang.String JSP_MANAGE_DIRECTORY_RECORD
           
static java.lang.String MESSAGE_DIRECTORY_ERROR
           
static java.lang.String MESSAGE_DIRECTORY_ERROR_MANDATORY_FIELD
           
static java.lang.String MESSAGE_DIRECTORY_ERROR_MIME_TYPE
           
static java.lang.String MESSAGE_RECORD_INVALID_STATE
           
static java.lang.String MESSAGE_SELECT_RECORDS
           
static java.lang.String PARAMETER_DATECREATION
           
static java.lang.String PARAMETER_DATEMODIFICATION
           
static java.lang.String PARAMETER_DELETE_PREFIX
           
static java.lang.String PARAMETER_ID_ACTION
           
static java.lang.String PARAMETER_ID_DIRECTORY
           
static java.lang.String PARAMETER_ID_DIRECTORY_RECORD
           
static java.lang.String PARAMETER_ID_ENTRY
           
static java.lang.String PARAMETER_ID_FILE
           
static java.lang.String PARAMETER_SESSION
           
static java.lang.String PARAMETER_SHOW_ACTION_RESULT
           
static java.lang.String PARAMETER_UPLOAD_SUBMIT
           
static java.lang.String PROPERTY_LUTECE_BASE_URL
           
static java.lang.String PROPERTY_LUTECE_PROD_URL
           
static java.lang.String SESSION_DIRECTORY_LIST_SUBMITTED_RECORD_FIELDS
           
static java.lang.String SESSION_DIRECTORY_TASKS_SUBMITTED_RECORD_FIELDS
           
static java.lang.String TEMPLATE_FORM_DIRECTORY_RECORD
           
static java.lang.String TEMPLATE_FORM_SEARCH_DIRECTORY_RECORD
           
 
Method Summary
static void addHeaderResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String strFileName)
          write the http header in the response
static java.util.Map<java.lang.String,java.util.List<RecordField>> buildMapIdEntryListRecordField(Record record)
          Build the map of from a given record
static java.lang.String buildQueryWithFilter(java.lang.StringBuilder sbSQL, java.util.List<java.lang.String> listFilter, java.lang.String strOrder)
          Builds a query with filters placed in parameters
static java.lang.String buildRequetteWithFilter(java.lang.String strSelect, java.util.List<java.lang.String> listStrFilter, java.lang.String strOrder)
          Builds a query with filters placed in parameters.
static fr.paris.lutece.util.ReferenceList convertMapToReferenceList(java.util.Map<java.lang.String,java.lang.String> map)
          Convert a map of ( String, String ) into a ReferenceList
static int convertStringToInt(java.lang.String strParameter)
          convert a string to int
static IEntry createEntryByType(javax.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          return an instance of IEntry function of type entry
static IEntry createEntryByType(int nIdType, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          return an instance of IEntry function of type entry
static java.util.Map<java.lang.String,java.lang.Object> depopulate(Directory directory)
          Depopulate the directory into a map of key - value
static File doDownloadFile(java.lang.String strUrl)
          Do download a file
static void doDownloadFile(java.lang.String strUrl, java.lang.String strFilePath)
          Do download a file
static Field findFieldByIdInTheList(int nIdField, java.util.List<Field> listField)
          return the field which key is specified in parameter
static Field findFieldByTitleInTheList(java.lang.String strTitle, java.util.List<Field> listFields)
          Return the field which title is specified in parameter
static Field findFieldByValueInTheList(java.lang.String strFieldValue, java.util.List<Field> listField)
          return the field which value is specified in parameter
static java.util.List<Field> getAuthorizedFieldsByRole(javax.servlet.http.HttpServletRequest request, java.util.List<Field> listField)
          Filter a list of field for a given user
static java.util.List<Field> getAuthorizedFieldsByWorkgroup(java.util.List<Field> listField, fr.paris.lutece.portal.business.user.AdminUser user)
          Filter a list of field for a given user
static java.lang.String getBaseUrl(javax.servlet.http.HttpServletRequest request)
          Get the base url
static java.sql.Timestamp getCurrentTimestamp()
          return current Timestamp
static void getDirectoryRecordData(javax.servlet.http.HttpServletRequest request, Record record, fr.paris.lutece.portal.service.plugin.Plugin plugin, java.util.Locale locale)
          Get the request data and if there is no error insert the data in the record specified in parameter. return null if there is no error or else return a DirectoryError object
static void getDirectoryRecordFieldData(Record record, javax.servlet.http.HttpServletRequest request, int nIdEntry, boolean bTestDirectoryError, java.util.List<RecordField> listRecordFieldResult, fr.paris.lutece.portal.service.plugin.Plugin plugin, java.util.Locale locale)
          perform in the record field list the record field associates with a entry specify in parameter. return null if there is no error in the response else return a DirectoryError Object
static File getFileData(java.lang.String strFileInputName, javax.servlet.http.HttpServletRequest request)
          Get the file contains in the request from the name of the input file
static java.lang.String getFileName(java.lang.String strUrl)
          Get the file name of a file from the url
static java.util.List<IEntry> getFormEntries(int nIdDirectory, fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.business.user.AdminUser user)
          return all entry associate to the directory
static java.util.List<IEntry> getFormEntriesByFilter(EntryFilter filter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          return all entry associate to the directory
static int getIndexEntryInTheEntryList(int nIdEntry, java.util.List<IEntry> listEntry)
          return the index in the list of the entry whose key is specified in parameter
static int getIndexFieldInTheFieldList(int nIdField, java.util.List<Field> listField)
          return the index in the list of the field whose key is specified in parameter
static java.lang.String getJspManageDirectoryRecord(javax.servlet.http.HttpServletRequest request, int nIdDirectory)
          return url of the jsp manage directory record
static java.util.List<RecordField> getListRecordField(IEntry entry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Gets all RecordField for the entry
static java.util.List<java.lang.Integer> getListResults(javax.servlet.http.HttpServletRequest request, Directory directory, boolean bWorkflowServiceEnable, boolean bUseFilterDirectory, IDirectorySearchFields searchFields, fr.paris.lutece.portal.business.user.AdminUser adminUser, java.util.Locale locale)
          Get the result list according to queries
static java.util.List<java.lang.Integer> getListResults(javax.servlet.http.HttpServletRequest request, Directory directory, boolean bWorkflowServiceEnable, boolean bUseFilterDirectory, IEntry sortEntry, int nSortOrder, IDirectorySearchFields searchFields, fr.paris.lutece.portal.business.user.AdminUser adminUser, java.util.Locale locale)
          Get the result list according to queries
static java.util.Map<java.lang.String,java.util.List<RecordField>> getMapIdEntryListRecordField(java.util.List<IEntry> lisEntry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          get a Map which contains for each entry the list of recordField object associated
static java.util.Map<java.lang.String,java.util.List<RecordField>> getMapIdEntryListRecordField(java.util.List<IEntry> lisEntry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin, boolean bGetFileName)
          get a Map which contains for each entry the list of recordField object associated
static fr.paris.lutece.portal.service.plugin.Plugin getPlugin()
          Gets the plugin
static java.util.HashMap<java.lang.String,java.util.List<RecordField>> getSearchRecordData(javax.servlet.http.HttpServletRequest request, int nIdDirectory, fr.paris.lutece.portal.service.plugin.Plugin plugin, java.util.Locale locale)
          Get the request data and return a Map which contains for each entry the list of recordField object associated
static java.util.Date getSearchRecordDateCreationFromRequest(javax.servlet.http.HttpServletRequest request, java.lang.String dateTypeParameter, java.util.Locale locale)
           
static java.util.Map<java.lang.String,java.util.List<RecordField>> getSpecificMapIdEntryListRecordField(java.util.List<IEntry> lisEntry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          get a Map which contains for each entry the list of recordField object associated
static java.lang.Boolean isFieldInTheRecordFieldList(int nIdField, java.util.List<RecordField> listRecordField)
          return true if the field which key is specified in parameter is in the response list
static java.util.List<java.lang.Integer> retainAll(java.util.List<java.lang.Integer> list1, java.util.List<java.lang.Integer> list2)
          Removes from list all the elements that are not contained in the other list Faster than classic "List.retainAll" because each id is unique
static java.util.List<java.lang.Integer> retainAllIdsKeepingFirstOrder(java.util.List<java.lang.Integer> list1, java.util.List<java.lang.Integer> list2)
          Like List.retainAll(java.util.Collection), keeping first list order.
static java.lang.String substituteSpecialCaractersForExport(java.lang.String strSource)
          replace special characters in the string passed as a parameter
static java.lang.String trim(java.lang.String strParameter)
          Returns a copy of the string , with leading and trailing whitespace omitted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT_WHERE

public static final java.lang.String CONSTANT_WHERE
See Also:
Constant Field Values

CONSTANT_AND

public static final java.lang.String CONSTANT_AND
See Also:
Constant Field Values

CONSTANT_OR

public static final java.lang.String CONSTANT_OR
See Also:
Constant Field Values

CONSTANT_EQUAL

public static final java.lang.String CONSTANT_EQUAL
See Also:
Constant Field Values

CONSTANT_COMA

public static final java.lang.String CONSTANT_COMA
See Also:
Constant Field Values

CONSTANT_INTERROGATION_MARK

public static final java.lang.String CONSTANT_INTERROGATION_MARK
See Also:
Constant Field Values

CONSTANT_AMPERSAND

public static final java.lang.String CONSTANT_AMPERSAND
See Also:
Constant Field Values

CONSTANT_ID_NULL

public static final int CONSTANT_ID_NULL
See Also:
Constant Field Values

CONSTANT_ID_ZERO

public static final int CONSTANT_ID_ZERO
See Also:
Constant Field Values

EMPTY_STRING

public static final java.lang.String EMPTY_STRING
See Also:
Constant Field Values

CONSTANT_ID

public static final java.lang.String CONSTANT_ID
See Also:
Constant Field Values

CONSTANT_NAME

public static final java.lang.String CONSTANT_NAME
See Also:
Constant Field Values

CONSTANT_TRUE

public static final java.lang.String CONSTANT_TRUE
See Also:
Constant Field Values

CONSTANT_DOT

public static final java.lang.String CONSTANT_DOT
See Also:
Constant Field Values

CONSTANT_UNDERSCORE

public static final java.lang.String CONSTANT_UNDERSCORE
See Also:
Constant Field Values

TEMPLATE_FORM_DIRECTORY_RECORD

public static final java.lang.String TEMPLATE_FORM_DIRECTORY_RECORD
See Also:
Constant Field Values

TEMPLATE_FORM_SEARCH_DIRECTORY_RECORD

public static final java.lang.String TEMPLATE_FORM_SEARCH_DIRECTORY_RECORD
See Also:
Constant Field Values

MESSAGE_DIRECTORY_ERROR_MANDATORY_FIELD

public static final java.lang.String MESSAGE_DIRECTORY_ERROR_MANDATORY_FIELD
See Also:
Constant Field Values

MESSAGE_DIRECTORY_ERROR

public static final java.lang.String MESSAGE_DIRECTORY_ERROR
See Also:
Constant Field Values

MESSAGE_DIRECTORY_ERROR_MIME_TYPE

public static final java.lang.String MESSAGE_DIRECTORY_ERROR_MIME_TYPE
See Also:
Constant Field Values

MESSAGE_SELECT_RECORDS

public static final java.lang.String MESSAGE_SELECT_RECORDS
See Also:
Constant Field Values

MESSAGE_RECORD_INVALID_STATE

public static final java.lang.String MESSAGE_RECORD_INVALID_STATE
See Also:
Constant Field Values

PARAMETER_ID_DIRECTORY

public static final java.lang.String PARAMETER_ID_DIRECTORY
See Also:
Constant Field Values

PARAMETER_ID_DIRECTORY_RECORD

public static final java.lang.String PARAMETER_ID_DIRECTORY_RECORD
See Also:
Constant Field Values

PARAMETER_ID_ENTRY

public static final java.lang.String PARAMETER_ID_ENTRY
See Also:
Constant Field Values

PARAMETER_SESSION

public static final java.lang.String PARAMETER_SESSION
See Also:
Constant Field Values

PARAMETER_DELETE_PREFIX

public static final java.lang.String PARAMETER_DELETE_PREFIX
See Also:
Constant Field Values

PARAMETER_UPLOAD_SUBMIT

public static final java.lang.String PARAMETER_UPLOAD_SUBMIT
See Also:
Constant Field Values

PARAMETER_ID_FILE

public static final java.lang.String PARAMETER_ID_FILE
See Also:
Constant Field Values

PARAMETER_ID_ACTION

public static final java.lang.String PARAMETER_ID_ACTION
See Also:
Constant Field Values

PARAMETER_SHOW_ACTION_RESULT

public static final java.lang.String PARAMETER_SHOW_ACTION_RESULT
See Also:
Constant Field Values

PARAMETER_DATECREATION

public static final java.lang.String PARAMETER_DATECREATION
See Also:
Constant Field Values

PARAMETER_DATEMODIFICATION

public static final java.lang.String PARAMETER_DATEMODIFICATION
See Also:
Constant Field Values

JSP_MANAGE_DIRECTORY_RECORD

public static final java.lang.String JSP_MANAGE_DIRECTORY_RECORD
See Also:
Constant Field Values

SESSION_DIRECTORY_LIST_SUBMITTED_RECORD_FIELDS

public static final java.lang.String SESSION_DIRECTORY_LIST_SUBMITTED_RECORD_FIELDS
See Also:
Constant Field Values

SESSION_DIRECTORY_TASKS_SUBMITTED_RECORD_FIELDS

public static final java.lang.String SESSION_DIRECTORY_TASKS_SUBMITTED_RECORD_FIELDS
See Also:
Constant Field Values

PROPERTY_LUTECE_BASE_URL

public static final java.lang.String PROPERTY_LUTECE_BASE_URL
See Also:
Constant Field Values

PROPERTY_LUTECE_PROD_URL

public static final java.lang.String PROPERTY_LUTECE_PROD_URL
See Also:
Constant Field Values
Method Detail

getCurrentTimestamp

public static java.sql.Timestamp getCurrentTimestamp()
return current Timestamp

Returns:
return current Timestamp

createEntryByType

public static IEntry createEntryByType(javax.servlet.http.HttpServletRequest request,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
return an instance of IEntry function of type entry

Parameters:
request - the request
plugin - the plugin
Returns:
an instance of IEntry function of type entry

createEntryByType

public static IEntry createEntryByType(int nIdType,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
return an instance of IEntry function of type entry

Parameters:
nIdType - the type id
plugin - the plugin
Returns:
an instance of IEntry function of type entry

getIndexEntryInTheEntryList

public static int getIndexEntryInTheEntryList(int nIdEntry,
                                              java.util.List<IEntry> listEntry)
return the index in the list of the entry whose key is specified in parameter

Parameters:
nIdEntry - the key of the entry
listEntry - the list of the entry
Returns:
the index in the list of the entry whose key is specified in parameter

getIndexFieldInTheFieldList

public static int getIndexFieldInTheFieldList(int nIdField,
                                              java.util.List<Field> listField)
return the index in the list of the field whose key is specified in parameter

Parameters:
nIdField - the key of the field
listField - the list of field
Returns:
the index in the list of the field whose key is specified in parameter

getFormEntries

public static java.util.List<IEntry> getFormEntries(int nIdDirectory,
                                                    fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                                    fr.paris.lutece.portal.business.user.AdminUser user)
return all entry associate to the directory

Parameters:
nIdDirectory - the id of the directory
plugin - the plugin
user - the AdminUser
Returns:
list of entry

getFormEntriesByFilter

public static java.util.List<IEntry> getFormEntriesByFilter(EntryFilter filter,
                                                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
return all entry associate to the directory

Parameters:
filter - entry filter
plugin - the plugin
user - the AdminUser
Returns:
list of entry

getMapIdEntryListRecordField

public static java.util.Map<java.lang.String,java.util.List<RecordField>> getMapIdEntryListRecordField(java.util.List<IEntry> lisEntry,
                                                                                                       int nIdRecord,
                                                                                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
get a Map which contains for each entry the list of recordField object associated

Parameters:
lisEntry - the list of entry associate to the record
nIdRecord - the id of the record
plugin - plugin
Returns:
a map

getMapIdEntryListRecordField

public static java.util.Map<java.lang.String,java.util.List<RecordField>> getMapIdEntryListRecordField(java.util.List<IEntry> lisEntry,
                                                                                                       int nIdRecord,
                                                                                                       fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                                                                                       boolean bGetFileName)
get a Map which contains for each entry the list of recordField object associated

Parameters:
lisEntry - the list of entry associate to the record
nIdRecord - the id of the record
plugin - plugin
bGetFileName - true if it must get the file name, false otherwise
Warning : The file name is fetch by a webservice call. Beware of performance.
Returns:
a map

buildMapIdEntryListRecordField

public static java.util.Map<java.lang.String,java.util.List<RecordField>> buildMapIdEntryListRecordField(Record record)
Build the map of from a given record

Parameters:
record - the record
Returns:
the map of

getListRecordField

public static java.util.List<RecordField> getListRecordField(IEntry entry,
                                                             int nIdRecord,
                                                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Gets all RecordField for the entry

Parameters:
entry - the entry
nIdRecord - the record id
plugin - the plugin
Returns:
the list

getSpecificMapIdEntryListRecordField

public static java.util.Map<java.lang.String,java.util.List<RecordField>> getSpecificMapIdEntryListRecordField(java.util.List<IEntry> lisEntry,
                                                                                                               int nIdRecord,
                                                                                                               fr.paris.lutece.portal.service.plugin.Plugin plugin)
get a Map which contains for each entry the list of recordField object associated

Parameters:
lisEntry - the list of entry associate to the record
nIdRecord - the id of the record
plugin - plugin
Returns:
a map

getDirectoryRecordData

public static void getDirectoryRecordData(javax.servlet.http.HttpServletRequest request,
                                          Record record,
                                          fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                          java.util.Locale locale)
                                   throws DirectoryErrorException
Get the request data and if there is no error insert the data in the record specified in parameter. return null if there is no error or else return a DirectoryError object

Parameters:
request - the request
nIdDirectory - the id of the directory associate to the record
record - the record
plugin - the plugin
locale - the locale
Throws:
DirectoryErrorException

getSearchRecordData

public static java.util.HashMap<java.lang.String,java.util.List<RecordField>> getSearchRecordData(javax.servlet.http.HttpServletRequest request,
                                                                                                  int nIdDirectory,
                                                                                                  fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                                                                                  java.util.Locale locale)
                                                                                           throws DirectoryErrorException
Get the request data and return a Map which contains for each entry the list of recordField object associated

Parameters:
request - the request
nIdDirectory - the id of the directory
plugin - the plugin
locale - the locale
Returns:
a map
Throws:
DirectoryErrorException

getDirectoryRecordFieldData

public static void getDirectoryRecordFieldData(Record record,
                                               javax.servlet.http.HttpServletRequest request,
                                               int nIdEntry,
                                               boolean bTestDirectoryError,
                                               java.util.List<RecordField> listRecordFieldResult,
                                               fr.paris.lutece.portal.service.plugin.Plugin plugin,
                                               java.util.Locale locale)
                                        throws DirectoryErrorException
perform in the record field list the record field associates with a entry specify in parameter. return null if there is no error in the response else return a DirectoryError Object

Parameters:
request - the request
nIdEntry - the key of the entry
bTestDirectoryError - true if we must test the validity of user input
listRecordFieldResult - the list of record field result
plugin - the plugin
locale - the locale
Throws:
DirectoryErrorException

findFieldByIdInTheList

public static Field findFieldByIdInTheList(int nIdField,
                                           java.util.List<Field> listField)
return the field which key is specified in parameter

Parameters:
nIdField - the id of the field who is search
listField - the list of field
Returns:
the field which key is specified in parameter

findFieldByValueInTheList

public static Field findFieldByValueInTheList(java.lang.String strFieldValue,
                                              java.util.List<Field> listField)
return the field which value is specified in parameter

Parameters:
strFieldValue - the value of the field who is search
listField - the list of field
Returns:
the field which key is specified in parameter

findFieldByTitleInTheList

public static Field findFieldByTitleInTheList(java.lang.String strTitle,
                                              java.util.List<Field> listFields)
Return the field which title is specified in parameter

Parameters:
strTitle - the title
listFields - the list of fields
Returns:
the field which title is specified in parameter

isFieldInTheRecordFieldList

public static java.lang.Boolean isFieldInTheRecordFieldList(int nIdField,
                                                            java.util.List<RecordField> listRecordField)
return true if the field which key is specified in parameter is in the response list

Parameters:
nIdField - the id of the field who is search
listRecordField - the list of object Response
Returns:
true if the field which key is specified in parameter is in the response list

addHeaderResponse

public static void addHeaderResponse(javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.String strFileName)
write the http header in the response

Parameters:
request - the httpServletRequest
response - the http response
strFileName - the name of the file who must insert in the response

convertStringToInt

public static int convertStringToInt(java.lang.String strParameter)
convert a string to int

Parameters:
strParameter - the string parameter to convert
Returns:
the conversion

trim

public static java.lang.String trim(java.lang.String strParameter)
Returns a copy of the string , with leading and trailing whitespace omitted.

Parameters:
strParameter - the string parameter to convert
Returns:
null if the strParameter is null other return with leading and trailing whitespace omitted.

getFileData

public static File getFileData(java.lang.String strFileInputName,
                               javax.servlet.http.HttpServletRequest request)
Get the file contains in the request from the name of the input file

Parameters:
strFileInputName - le name of the input file file
request - the request
Returns:
file the file contains in the request from the name of the input file

buildRequetteWithFilter

public static java.lang.String buildRequetteWithFilter(java.lang.String strSelect,
                                                       java.util.List<java.lang.String> listStrFilter,
                                                       java.lang.String strOrder)
Builds a query with filters placed in parameters. Consider using buildQueryWithFilter(StringBuilder, List, String) instead.

Parameters:
strSelect - the select of the query
listStrFilter - the list of filter to add in the query
strOrder - the order by of the query
Returns:
a query

buildQueryWithFilter

public static java.lang.String buildQueryWithFilter(java.lang.StringBuilder sbSQL,
                                                    java.util.List<java.lang.String> listFilter,
                                                    java.lang.String strOrder)
Builds a query with filters placed in parameters

Parameters:
sbSQL - the beginning of the query
listFilter - the list of filter to add in the query
strOrder - the order by of the query
Returns:
a query

substituteSpecialCaractersForExport

public static java.lang.String substituteSpecialCaractersForExport(java.lang.String strSource)
replace special characters in the string passed as a parameter

Parameters:
strSource - the string
Returns:
substitute special in the string passed as a parameter

getAuthorizedFieldsByWorkgroup

public static java.util.List<Field> getAuthorizedFieldsByWorkgroup(java.util.List<Field> listField,
                                                                   fr.paris.lutece.portal.business.user.AdminUser user)
Filter a list of field for a given user

Parameters:
listField - a list of field
user - an adminUser
Returns:
a field list

getAuthorizedFieldsByRole

public static java.util.List<Field> getAuthorizedFieldsByRole(javax.servlet.http.HttpServletRequest request,
                                                              java.util.List<Field> listField)
Filter a list of field for a given user

Parameters:
listField - a list of field
user - a luteceUser
Returns:
a field list

retainAll

public static java.util.List<java.lang.Integer> retainAll(java.util.List<java.lang.Integer> list1,
                                                          java.util.List<java.lang.Integer> list2)
Removes from list all the elements that are not contained in the other list Faster than classic "List.retainAll" because each id is unique

Parameters:
list1 - input list 1
list2 - input list 2
Returns:
the result list

retainAllIdsKeepingFirstOrder

public static java.util.List<java.lang.Integer> retainAllIdsKeepingFirstOrder(java.util.List<java.lang.Integer> list1,
                                                                              java.util.List<java.lang.Integer> list2)
Like List.retainAll(java.util.Collection), keeping first list order. This method is based on the fact that list1 and list2 have unique elements.

Parameters:
list1 - the first list
list2 - the other list
Returns:
first list

getSearchRecordDateCreationFromRequest

public static java.util.Date getSearchRecordDateCreationFromRequest(javax.servlet.http.HttpServletRequest request,
                                                                    java.lang.String dateTypeParameter,
                                                                    java.util.Locale locale)

getListResults

public static java.util.List<java.lang.Integer> getListResults(javax.servlet.http.HttpServletRequest request,
                                                               Directory directory,
                                                               boolean bWorkflowServiceEnable,
                                                               boolean bUseFilterDirectory,
                                                               IDirectorySearchFields searchFields,
                                                               fr.paris.lutece.portal.business.user.AdminUser adminUser,
                                                               java.util.Locale locale)
Get the result list according to queries

Parameters:
request - The HttpServletRequest
directory - The Directory
bWorkflowServiceEnable - true if the WorkflowService is enabled
Returns:
The list of id records

getListResults

public static java.util.List<java.lang.Integer> getListResults(javax.servlet.http.HttpServletRequest request,
                                                               Directory directory,
                                                               boolean bWorkflowServiceEnable,
                                                               boolean bUseFilterDirectory,
                                                               IEntry sortEntry,
                                                               int nSortOrder,
                                                               IDirectorySearchFields searchFields,
                                                               fr.paris.lutece.portal.business.user.AdminUser adminUser,
                                                               java.util.Locale locale)
Get the result list according to queries

Parameters:
request - The HttpServletRequest
directory - The Directory
bWorkflowServiceEnable - true if the WorkflowService is enabled
Returns:
The list of id records

getPlugin

public static fr.paris.lutece.portal.service.plugin.Plugin getPlugin()
Gets the plugin

Returns:
the plugin

getJspManageDirectoryRecord

public static java.lang.String getJspManageDirectoryRecord(javax.servlet.http.HttpServletRequest request,
                                                           int nIdDirectory)
return url of the jsp manage directory record

Parameters:
request - The HTTP request
nIdDirectory - the directory id
Returns:
url of the jsp manage directory record

convertMapToReferenceList

public static fr.paris.lutece.util.ReferenceList convertMapToReferenceList(java.util.Map<java.lang.String,java.lang.String> map)
Convert a map of ( String, String ) into a ReferenceList

Parameters:
map - the map to convert
Returns:
a ReferenceList

getFileName

public static java.lang.String getFileName(java.lang.String strUrl)
Get the file name of a file from the url

Parameters:
strUrl - the url of the file
Returns:
the file name

doDownloadFile

public static void doDownloadFile(java.lang.String strUrl,
                                  java.lang.String strFilePath)
Do download a file

Parameters:
strUrl - the url of the file to download
strFilePath - the file path to download the file

doDownloadFile

public static File doDownloadFile(java.lang.String strUrl)
Do download a file

Parameters:
strUrl - the url of the file to download
Returns:
a FileItem

getBaseUrl

public static java.lang.String getBaseUrl(javax.servlet.http.HttpServletRequest request)
Get the base url

Parameters:
request - the HTTP request
Returns:
the base url

depopulate

public static java.util.Map<java.lang.String,java.lang.Object> depopulate(Directory directory)
Depopulate the directory into a map of key - value

Parameters:
directory - the directory
Returns:
a map of key - value


Copyright © 2012 Mairie de Paris. All Rights Reserved.