fr.paris.lutece.plugins.directory.modules.rest.service
Class DirectoryRestService

java.lang.Object
  extended by fr.paris.lutece.plugins.directory.modules.rest.service.DirectoryRestService

public class DirectoryRestService
extends java.lang.Object

DirectoryRestService


Constructor Summary
DirectoryRestService()
           
 
Method Summary
 fr.paris.lutece.plugins.directory.business.Record addToDirectory(java.lang.String strIdDirectory, javax.servlet.ServletRequest request)
          Add a record in a directory with the parameters given if they match
 fr.paris.lutece.plugins.directory.business.Record completeRecord(int nIdRecord, javax.servlet.ServletRequest request)
          Gets record fields values from the request and complete the record for asynchronous record creation.
 fr.paris.lutece.portal.web.upload.MultipartHttpServletRequest convertRequest(javax.servlet.http.HttpServletRequest request)
          Convert the HTTP request to a MultipartHttpServletRequest
 java.lang.String deleteRecord(int nIdRecord, javax.servlet.http.HttpServletRequest request)
          delete the record
 java.util.List<fr.paris.lutece.plugins.directory.business.Directory> getDirectoriesList()
          Get the list of directories
 fr.paris.lutece.plugins.directory.business.Directory getDirectory(int nIdDirectory)
          Get the directory given the id directory
 java.util.List<fr.paris.lutece.plugins.directory.business.IEntry> getEntries(fr.paris.lutece.plugins.directory.business.Record record)
          Get the list of entries from the record
 java.util.List<java.lang.Integer> getIdsEntry(int nIdDirectory)
          Get all entries
 java.util.List<java.lang.Integer> getIdsEntry(int nIdDirectory, javax.servlet.http.HttpServletRequest request)
          Get the ids entry from the parameters of the request.
 java.util.Map<java.lang.String,java.util.List<fr.paris.lutece.plugins.directory.business.RecordField>> getMapIdEntryListRecordField(fr.paris.lutece.plugins.directory.business.Record record)
          Get the map of id entry - List de Record Field
 fr.paris.lutece.plugins.directory.business.Record getRecord(int nIdRecord, javax.servlet.http.HttpServletRequest request)
          Gets the record
 fr.paris.lutece.plugins.directory.business.Record getRecord(int nIdRecord, java.util.List<java.lang.Integer> listIdsEntry)
          Gets the record
 java.util.List<fr.paris.lutece.plugins.directory.business.Record> getRecordsList(int nIdDirectory, javax.servlet.http.HttpServletRequest request)
          Finds the list
 fr.paris.lutece.plugins.directory.business.Record insertOrCompleteRecord(javax.servlet.http.HttpServletRequest request)
          Creates or updates the record
 fr.paris.lutece.plugins.directory.business.Record updateRecord(javax.servlet.http.HttpServletRequest request)
          Update record
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryRestService

public DirectoryRestService()
Method Detail

getRecord

public fr.paris.lutece.plugins.directory.business.Record getRecord(int nIdRecord,
                                                                   javax.servlet.http.HttpServletRequest request)
                                                            throws DirectoryRestException,
                                                                   fr.paris.lutece.plugins.directory.utils.DirectoryErrorException
Gets the record

Parameters:
nIdRecord - resource id
request - the HTTP request
Returns:
the record
Throws:
DirectoryRestException - if occurs
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - if occurs

getRecord

public fr.paris.lutece.plugins.directory.business.Record getRecord(int nIdRecord,
                                                                   java.util.List<java.lang.Integer> listIdsEntry)
                                                            throws DirectoryRestException,
                                                                   fr.paris.lutece.plugins.directory.utils.DirectoryErrorException
Gets the record

Parameters:
nIdRecord - resource id
listIdsEntry - the list of ids entry
Returns:
the record
Throws:
DirectoryRestException - if occurs
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - if occurs

getRecordsList

public java.util.List<fr.paris.lutece.plugins.directory.business.Record> getRecordsList(int nIdDirectory,
                                                                                        javax.servlet.http.HttpServletRequest request)
                                                                                 throws DirectoryRestException,
                                                                                        fr.paris.lutece.plugins.directory.utils.DirectoryErrorException
Finds the list

Parameters:
nIdDirectory - the directory id
request - the HTTP request
Returns:
the record list
Throws:
DirectoryRestException - if occurs
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - if occurs

getEntries

public java.util.List<fr.paris.lutece.plugins.directory.business.IEntry> getEntries(fr.paris.lutece.plugins.directory.business.Record record)
Get the list of entries from the record

Parameters:
record - the record
Returns:
a list of IEntry

getIdsEntry

public java.util.List<java.lang.Integer> getIdsEntry(int nIdDirectory,
                                                     javax.servlet.http.HttpServletRequest request)
Get the ids entry from the parameters of the request.
If there is no ids entry in the parameter, then get all entries.

Parameters:
nIdDirectory - the id directory
request - the HTTP request
Returns:
the list of id entry

getIdsEntry

public java.util.List<java.lang.Integer> getIdsEntry(int nIdDirectory)
Get all entries

Parameters:
nIdDirectory - the id directory
Returns:
the list of id entry

getDirectory

public fr.paris.lutece.plugins.directory.business.Directory getDirectory(int nIdDirectory)
Get the directory given the id directory

Parameters:
nIdDirectory - the id directory
Returns:
the directory

getDirectoriesList

public java.util.List<fr.paris.lutece.plugins.directory.business.Directory> getDirectoriesList()
Get the list of directories

Returns:
the list of directories

getMapIdEntryListRecordField

public java.util.Map<java.lang.String,java.util.List<fr.paris.lutece.plugins.directory.business.RecordField>> getMapIdEntryListRecordField(fr.paris.lutece.plugins.directory.business.Record record)
Get the map of id entry - List de Record Field

Parameters:
record - the record
Returns:
the map

addToDirectory

public fr.paris.lutece.plugins.directory.business.Record addToDirectory(java.lang.String strIdDirectory,
                                                                        javax.servlet.ServletRequest request)
                                                                 throws fr.paris.lutece.plugins.directory.utils.DirectoryErrorException
Add a record in a directory with the parameters given if they match

Parameters:
strIdDirectory - the directory id
request - the HTTP request
Returns:
the record
Throws:
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - exception if there is an error

insertOrCompleteRecord

public fr.paris.lutece.plugins.directory.business.Record insertOrCompleteRecord(javax.servlet.http.HttpServletRequest request)
                                                                         throws fr.paris.lutece.plugins.directory.utils.DirectoryErrorException,
                                                                                DirectoryRestException
Creates or updates the record

Parameters:
request - the request
Returns:
the record created or updated
Throws:
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - if occurs
DirectoryRestException - if occurs

deleteRecord

public java.lang.String deleteRecord(int nIdRecord,
                                     javax.servlet.http.HttpServletRequest request)
                              throws fr.paris.lutece.plugins.directory.utils.DirectoryErrorException,
                                     DirectoryRestException
delete the record

Parameters:
nIdRecord - the id record
request - the HTTP request
Returns:
the record deleted
Throws:
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - if occurs
DirectoryRestException - if occurs

completeRecord

public fr.paris.lutece.plugins.directory.business.Record completeRecord(int nIdRecord,
                                                                        javax.servlet.ServletRequest request)
                                                                 throws fr.paris.lutece.plugins.directory.utils.DirectoryErrorException,
                                                                        DirectoryRestException
Gets record fields values from the request and complete the record for asynchronous record creation. This method is NOT a modification of the record.

Parameters:
nIdRecord - the id of the record to complete
request - the request
Returns:
the stored record
Throws:
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - if a directory exception occurs
DirectoryRestException - if a rest exception occurs

updateRecord

public fr.paris.lutece.plugins.directory.business.Record updateRecord(javax.servlet.http.HttpServletRequest request)
                                                               throws DirectoryRestException,
                                                                      fr.paris.lutece.plugins.directory.utils.DirectoryErrorException
Update record

Parameters:
request - the HTTP request
Returns:
the record
Throws:
fr.paris.lutece.plugins.directory.utils.DirectoryErrorException - exception if there is an error
DirectoryRestException - exception if there is an error

convertRequest

public fr.paris.lutece.portal.web.upload.MultipartHttpServletRequest convertRequest(javax.servlet.http.HttpServletRequest request)
                                                                             throws org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException,
                                                                                    org.apache.commons.fileupload.FileUploadException
Convert the HTTP request to a MultipartHttpServletRequest

Parameters:
request - the HTTP request
Returns:
a MultipartHttpServletRequest, null if the content is not multipart
Throws:
org.apache.commons.fileupload.FileUploadBase.SizeLimitExceededException - exception if the file size is too big
org.apache.commons.fileupload.FileUploadException - exception if an unknown error has occurred


Copyright © 2011 Mairie de Paris. All Rights Reserved.