public final class DirectoryUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addHeaderResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String strFileName)
write the http header in the response
|
static Map<String,List<RecordField>> |
buildMapIdEntryListRecordField(Record record)
Build the map of
|
static String |
buildQueryWithFilter(StringBuilder sbSQL,
List<String> listFilter,
String strOrder)
Builds a query with filters placed in parameters
|
static String |
buildRequetteWithFilter(String strSelect,
List<String> listStrFilter,
String strOrder)
Builds a query with filters placed in parameters.
|
static fr.paris.lutece.util.ReferenceList |
convertMapToReferenceList(Map<String,String> map)
Convert a map of ( String, String ) into a
ReferenceList |
static int |
convertStringToInt(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 Map<String,Object> |
depopulate(Directory directory)
Depopulate the directory into a map of key - value
|
static File |
doDownloadFile(String strUrl)
Do download a file
|
static void |
doDownloadFile(String strUrl,
String strFilePath)
Do download a file
|
static Field |
findFieldByIdInTheList(int nIdField,
List<Field> listField)
return the field which key is specified in parameter
|
static Field |
findFieldByTitleInTheList(String strTitle,
List<Field> listFields)
Return the field which title is specified in parameter
|
static Field |
findFieldByValueInTheList(String strFieldValue,
List<Field> listField)
return the field which value is specified in parameter
|
static List<Field> |
getAuthorizedFieldsByRole(javax.servlet.http.HttpServletRequest request,
List<Field> listField)
Filter a list of field for a given user
|
static List<Field> |
getAuthorizedFieldsByWorkgroup(List<Field> listField,
fr.paris.lutece.portal.business.user.AdminUser user)
Filter a list of field for a given user
|
static String |
getBaseUrl(javax.servlet.http.HttpServletRequest request)
Get the base url
|
static Timestamp |
getCurrentTimestamp()
return current Timestamp
|
static void |
getDirectoryRecordData(javax.servlet.http.HttpServletRequest request,
Record record,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Locale locale)
Get the request data and if there is no error insert the data in the record specified in parameter.
|
static void |
getDirectoryRecordFieldData(Record record,
javax.servlet.http.HttpServletRequest request,
int nIdEntry,
boolean bTestDirectoryError,
List<RecordField> listRecordFieldResult,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Locale locale)
perform in the record field list the record field associates with a entry specify in parameter.
|
static File |
getFileData(String strFileInputName,
javax.servlet.http.HttpServletRequest request)
Get the file contains in the request from the name of the input file
|
static String |
getFileName(String strUrl)
Get the file name of a file from the url
|
static 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 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,
List<IEntry> listEntry)
return the index in the list of the entry whose key is specified in parameter
|
static int |
getIndexFieldInTheFieldList(int nIdField,
List<Field> listField)
return the index in the list of the field whose key is specified in parameter
|
static String |
getJspManageDirectoryRecord(javax.servlet.http.HttpServletRequest request,
int nIdDirectory)
return url of the jsp manage directory record
|
static List<RecordField> |
getListRecordField(IEntry entry,
int nIdRecord,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Gets all
RecordField for the entry |
static List<Integer> |
getListResults(javax.servlet.http.HttpServletRequest request,
Directory directory,
boolean bWorkflowServiceEnable,
boolean bUseFilterDirectory,
IDirectorySearchFields searchFields,
fr.paris.lutece.portal.business.user.AdminUser adminUser,
Locale locale)
Get the result list according to queries
|
static List<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,
Locale locale)
Get the result list according to queries
|
static Map<Integer,Field> |
getMapFieldsOfListEntry(List<IEntry> listEntry,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
return a map containing all fields containing in the list of entry
|
static Map<String,List<RecordField>> |
getMapIdEntryListRecordField(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 Map<String,List<RecordField>> |
getMapIdEntryListRecordField(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 HashMap<String,List<RecordField>> |
getSearchRecordData(javax.servlet.http.HttpServletRequest request,
int nIdDirectory,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Locale locale)
Get the request data and return a Map which contains for each entry the list of recordField object associated
|
static Date |
getSearchRecordDateCreationFromRequest(javax.servlet.http.HttpServletRequest request,
String dateTypeParameter,
Locale locale)
Get the search record creation date from the request
|
static Map<String,List<RecordField>> |
getSpecificMapIdEntryListRecordField(List<IEntry> lisEntry,
int nIdRecord,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Map<Integer,Field> mapFieldEntry)
get a Map which contains for each entry the list of recordField object associated
|
static Boolean |
isFieldInTheRecordFieldList(int nIdField,
List<RecordField> listRecordField)
return true if the field which key is specified in parameter is in the response list
|
static List<Integer> |
retainAll(List<Integer> list1,
List<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 List<Integer> |
retainAllIdsKeepingFirstOrder(List<Integer> list1,
List<Integer> list2)
Like
List.retainAll(java.util.Collection), keeping first list order. |
static String |
substituteSpecialCaractersForExport(String strSource)
replace special characters in the string passed as a parameter
|
static String |
trim(String strParameter)
Returns a copy of the string , with leading and trailing whitespace omitted.
|
public static final String CONSTANT_WHERE
public static final String CONSTANT_AND
public static final String CONSTANT_OR
public static final String CONSTANT_EQUAL
public static final String CONSTANT_COMA
public static final String CONSTANT_INTERROGATION_MARK
public static final String CONSTANT_AMPERSAND
public static final int CONSTANT_ID_NULL
public static final int CONSTANT_ID_ZERO
public static final String EMPTY_STRING
public static final String CONSTANT_ID
public static final String CONSTANT_NAME
public static final String CONSTANT_TRUE
public static final String CONSTANT_DOT
public static final String CONSTANT_UNDERSCORE
public static final String TEMPLATE_FORM_DIRECTORY_RECORD
public static final String TEMPLATE_FORM_SEARCH_DIRECTORY_RECORD
public static final String MESSAGE_DIRECTORY_ERROR_MANDATORY_FIELD
public static final String MESSAGE_DIRECTORY_ERROR
public static final String MESSAGE_DIRECTORY_ERROR_MIME_TYPE
public static final String MESSAGE_SELECT_RECORDS
public static final String MESSAGE_RECORD_INVALID_STATE
public static final String PARAMETER_ID_DIRECTORY
public static final String PARAMETER_ID_DIRECTORY_RECORD
public static final String PARAMETER_ID_ENTRY
public static final String PARAMETER_SESSION
public static final String PARAMETER_DELETE_PREFIX
public static final String PARAMETER_UPLOAD_SUBMIT
public static final String PARAMETER_ID_FILE
public static final String PARAMETER_ID_ACTION
public static final String PARAMETER_SHOW_ACTION_RESULT
public static final String PARAMETER_DATECREATION
public static final String PARAMETER_DATEMODIFICATION
public static final String JSP_MANAGE_DIRECTORY_RECORD
public static final String SESSION_DIRECTORY_LIST_SUBMITTED_RECORD_FIELDS
public static final String SESSION_DIRECTORY_TASKS_SUBMITTED_RECORD_FIELDS
public static final String PROPERTY_LUTECE_BASE_URL
public static final String PROPERTY_LUTECE_PROD_URL
public static Timestamp getCurrentTimestamp()
public static IEntry createEntryByType(javax.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.service.plugin.Plugin plugin)
request - the requestplugin - the pluginpublic static IEntry createEntryByType(int nIdType, fr.paris.lutece.portal.service.plugin.Plugin plugin)
nIdType - the type idplugin - the pluginpublic static int getIndexEntryInTheEntryList(int nIdEntry,
List<IEntry> listEntry)
nIdEntry - the key of the entrylistEntry - the list of the entrypublic static int getIndexFieldInTheFieldList(int nIdField,
List<Field> listField)
nIdField - the key of the fieldlistField - the list of fieldpublic static List<IEntry> getFormEntries(int nIdDirectory, fr.paris.lutece.portal.service.plugin.Plugin plugin, fr.paris.lutece.portal.business.user.AdminUser user)
nIdDirectory - the id of the directoryplugin - the pluginuser - the AdminUserpublic static List<IEntry> getFormEntriesByFilter(EntryFilter filter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
filter - entry filterplugin - the pluginpublic static Map<String,List<RecordField>> getMapIdEntryListRecordField(List<IEntry> lisEntry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin)
lisEntry - the list of entry associate to the recordnIdRecord - the id of the recordplugin - pluginpublic static Map<String,List<RecordField>> getMapIdEntryListRecordField(List<IEntry> lisEntry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin, boolean bGetFileName)
lisEntry - the list of entry associate to the recordnIdRecord - the id of the recordplugin - pluginbGetFileName - true if it must get the file name, false otherwise public static Map<String,List<RecordField>> buildMapIdEntryListRecordField(Record record)
record - the recordpublic static List<RecordField> getListRecordField(IEntry entry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin)
RecordField for the entryentry - the entrynIdRecord - the record idplugin - the pluginpublic static Map<String,List<RecordField>> getSpecificMapIdEntryListRecordField(List<IEntry> lisEntry, int nIdRecord, fr.paris.lutece.portal.service.plugin.Plugin plugin, Map<Integer,Field> mapFieldEntry)
lisEntry - the list of entry associate to the recordnIdRecord - the id of the recordplugin - pluginmapFieldEntry - a map containing all fields associated to the list of entrypublic static void getDirectoryRecordData(javax.servlet.http.HttpServletRequest request,
Record record,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
Locale locale)
throws DirectoryErrorException
request - the requestrecord - the recordplugin - the pluginlocale - the localeDirectoryErrorException - If an error occurspublic static HashMap<String,List<RecordField>> getSearchRecordData(javax.servlet.http.HttpServletRequest request, int nIdDirectory, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale) throws DirectoryErrorException
request - the requestnIdDirectory - the id of the directoryplugin - the pluginlocale - the localeDirectoryErrorException - If an error occurspublic static void getDirectoryRecordFieldData(Record record, javax.servlet.http.HttpServletRequest request, int nIdEntry, boolean bTestDirectoryError, List<RecordField> listRecordFieldResult, fr.paris.lutece.portal.service.plugin.Plugin plugin, Locale locale) throws DirectoryErrorException
record - The recordrequest - the requestnIdEntry - the key of the entrybTestDirectoryError - true if we must test the validity of user inputlistRecordFieldResult - the list of record field resultplugin - the pluginlocale - the localeDirectoryErrorException - If an error occurspublic static Field findFieldByIdInTheList(int nIdField, List<Field> listField)
nIdField - the id of the field who is searchlistField - the list of fieldpublic static Field findFieldByValueInTheList(String strFieldValue, List<Field> listField)
strFieldValue - the value of the field who is searchlistField - the list of fieldpublic static Field findFieldByTitleInTheList(String strTitle, List<Field> listFields)
strTitle - the titlelistFields - the list of fieldspublic static Boolean isFieldInTheRecordFieldList(int nIdField, List<RecordField> listRecordField)
nIdField - the id of the field who is searchlistRecordField - the list of object Responsepublic static void addHeaderResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String strFileName)
request - the httpServletRequestresponse - the http responsestrFileName - the name of the file who must insert in the responsepublic static int convertStringToInt(String strParameter)
strParameter - the string parameter to convertpublic static String trim(String strParameter)
strParameter - the string parameter to convertpublic static File getFileData(String strFileInputName, javax.servlet.http.HttpServletRequest request)
strFileInputName - le name of the input file filerequest - the requestpublic static String buildRequetteWithFilter(String strSelect, List<String> listStrFilter, String strOrder)
buildQueryWithFilter(StringBuilder, List, String) instead.strSelect - the select of the querylistStrFilter - the list of filter to add in the querystrOrder - the order by of the querypublic static String buildQueryWithFilter(StringBuilder sbSQL, List<String> listFilter, String strOrder)
sbSQL - the beginning of the querylistFilter - the list of filter to add in the querystrOrder - the order by of the querypublic static String substituteSpecialCaractersForExport(String strSource)
strSource - the stringpublic static List<Field> getAuthorizedFieldsByWorkgroup(List<Field> listField, fr.paris.lutece.portal.business.user.AdminUser user)
listField - a list of fielduser - an adminUserpublic static List<Field> getAuthorizedFieldsByRole(javax.servlet.http.HttpServletRequest request, List<Field> listField)
listField - a list of fieldrequest - The http requestpublic static List<Integer> retainAll(List<Integer> list1, List<Integer> list2)
list1 - input list 1list2 - input list 2public static List<Integer> retainAllIdsKeepingFirstOrder(List<Integer> list1, List<Integer> list2)
List.retainAll(java.util.Collection), keeping first list order. This method is based on the fact that list1 and list2 have unique elements.list1 - the first listlist2 - the other listpublic static Date getSearchRecordDateCreationFromRequest(javax.servlet.http.HttpServletRequest request, String dateTypeParameter, Locale locale)
request - The requestdateTypeParameter - The date type parameterlocale - The localepublic static List<Integer> getListResults(javax.servlet.http.HttpServletRequest request, Directory directory, boolean bWorkflowServiceEnable, boolean bUseFilterDirectory, IDirectorySearchFields searchFields, fr.paris.lutece.portal.business.user.AdminUser adminUser, Locale locale)
request - The HttpServletRequestdirectory - The DirectorybWorkflowServiceEnable - true if the WorkflowService is enabledbUseFilterDirectory - True to use filter directorysearchFields - The search fieldadminUser - The admin userlocale - The localepublic static List<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, Locale locale)
request - The HttpServletRequestdirectory - The DirectorybWorkflowServiceEnable - true if the WorkflowService is enabledbUseFilterDirectory - True to use filter directorysortEntry - The entry to sort results bynSortOrder - The sort ordersearchFields - The search fieldadminUser - The admin userlocale - The localepublic static fr.paris.lutece.portal.service.plugin.Plugin getPlugin()
public static String getJspManageDirectoryRecord(javax.servlet.http.HttpServletRequest request, int nIdDirectory)
request - The HTTP requestnIdDirectory - the directory idpublic static fr.paris.lutece.util.ReferenceList convertMapToReferenceList(Map<String,String> map)
ReferenceListmap - the map to convertReferenceListpublic static String getFileName(String strUrl)
strUrl - the url of the filepublic static void doDownloadFile(String strUrl, String strFilePath)
strUrl - the url of the file to downloadstrFilePath - the file path to download the filepublic static File doDownloadFile(String strUrl)
strUrl - the url of the file to downloadFileItempublic static String getBaseUrl(javax.servlet.http.HttpServletRequest request)
request - the HTTP requestpublic static Map<String,Object> depopulate(Directory directory)
directory - the directorypublic static Map<Integer,Field> getMapFieldsOfListEntry(List<IEntry> listEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin)
listEntry - the entyListplugin - the pluginCopyright © 2018 City of Paris. All rights reserved.