fr.paris.lutece.plugins.stock.service
Class GlobalProductService

java.lang.Object
  extended by fr.paris.lutece.plugins.stock.service.GlobalProductService

public final class GlobalProductService
extends java.lang.Object

This class provides generics methods for IProductService implementations


Method Summary
 java.lang.String doCreateProduct(java.lang.String strProductClassName, Product product, javax.servlet.http.HttpServletRequest request)
          Creates a product
 void doDeleteProduct(java.lang.String strProductClassName, int nIdProduct)
          Deletes a product
 java.lang.String doModifyProduct(java.lang.String strProductClassName, Product product, javax.servlet.http.HttpServletRequest request)
          Modifies a product
 java.util.List<Product> findByFilter(java.lang.String strProductClassName, ProductFilter filter)
          Get all the products which match with the given filter
 java.util.List<ObjectDefinition> getAllRegisteredObjectDefinition(fr.paris.lutece.portal.business.user.AdminUser user)
          Get the ObjectDefinition objects of the registered services where the given user is authorized to create
 java.lang.String getCreateTemplate(java.lang.String strProductClassName)
          Get the creation template of a service
 java.lang.String getDeleteJsp(java.lang.String strProductClassName)
          Get the deletion jsp of a service
static GlobalProductService getInstance()
          Get the instance of this class
 java.lang.String getMessageNotAuthorizedForCreate(java.lang.String strProductClassName)
          Get the message when a user is not authorized to create a product
 java.lang.String getMessageNotAuthorizedForDelete(java.lang.String strProductClassName)
          Get the message when a user is not authorized to delete a product
 java.lang.String getMessageNotAuthorizedForModification(java.lang.String strProductClassName)
          Get the message when a user is not authorized to modify a product
 java.lang.String getModifyTemplate(java.lang.String strProductClassName)
          Get the modification template of a service
 ObjectDefinition getObjectDefinition(java.lang.String strProductClassName)
          Get the ObjectDefinition objects of the given product entity name
 java.lang.String getOrderTemplate(java.lang.String strProductClassName)
          Get the product order template of a service
 Product getProduct(java.lang.String strProductClassName, int nIdProduct)
          Get the product with the given id
 void initModelForModification(java.lang.String strProductClassName, int nIdProduct, java.util.Map<java.lang.String,java.lang.Object> model, javax.servlet.http.HttpServletRequest request)
          Initaliaze the model in parameter for a modification
 void initModelForOrder(java.lang.String strProductClassName, int nIdProduct, java.util.Map<java.lang.String,java.lang.Object> model, javax.servlet.http.HttpServletRequest request)
          Initaliaze the model in parameter for an order
 boolean isAuthorizedToCreate(fr.paris.lutece.portal.business.user.AdminUser user, java.lang.String strProductClassName)
          Checks if a user is authorized to create the given product entity name
 boolean isAuthorizedToDelete(fr.paris.lutece.portal.business.user.AdminUser user, java.lang.String strProductClassName)
          Checks if a user is authorized to delete the given product entity name
 boolean isAuthorizedToModify(fr.paris.lutece.portal.business.user.AdminUser user, java.lang.String strProductClassName)
          Checks if a user is authorized to modify the given product entity name
 void register(IProductService service)
          Register a IProductService service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static GlobalProductService getInstance()
Get the instance of this class

Returns:
the instance of this class

register

public void register(IProductService service)
Register a IProductService service

Parameters:
service - the service to be registered

getCreateTemplate

public java.lang.String getCreateTemplate(java.lang.String strProductClassName)
Get the creation template of a service

Parameters:
strProductClassName - The class name of the product entity to create
Returns:
the relative path of the creation template

getModifyTemplate

public java.lang.String getModifyTemplate(java.lang.String strProductClassName)
Get the modification template of a service

Parameters:
strProductClassName - The class name of the product entity to modify
Returns:
the relative path of the modification template

getOrderTemplate

public java.lang.String getOrderTemplate(java.lang.String strProductClassName)
Get the product order template of a service

Parameters:
strProductClassName - the class name of the service
Returns:
the relative path of the product order template

getDeleteJsp

public java.lang.String getDeleteJsp(java.lang.String strProductClassName)
Get the deletion jsp of a service

Parameters:
strProductClassName - the class name of the service
Returns:
the relative path of the deletion jsp

doCreateProduct

public java.lang.String doCreateProduct(java.lang.String strProductClassName,
                                        Product product,
                                        javax.servlet.http.HttpServletRequest request)
Creates a product

Parameters:
strProductClassName - The class name of the product entity to create
product - The product to create in database
request - The HTTP request
Returns:
error if occurs

doModifyProduct

public java.lang.String doModifyProduct(java.lang.String strProductClassName,
                                        Product product,
                                        javax.servlet.http.HttpServletRequest request)
Modifies a product

Parameters:
strProductClassName - The class name of the product entity to modify
product - The product to modify in database
request - The HTTP request
Returns:
error if occurs

doDeleteProduct

public void doDeleteProduct(java.lang.String strProductClassName,
                            int nIdProduct)
Deletes a product

Parameters:
strProductClassName - The class name of the product entity to delete
nIdProduct - The product id to delete

initModelForModification

public void initModelForModification(java.lang.String strProductClassName,
                                     int nIdProduct,
                                     java.util.Map<java.lang.String,java.lang.Object> model,
                                     javax.servlet.http.HttpServletRequest request)
Initaliaze the model in parameter for a modification

Parameters:
strProductClassName - The class name of the product entity to delete
nIdProduct - The product id to modify
model - the model which will be passed in the modification template
request - The HTTP request

initModelForOrder

public void initModelForOrder(java.lang.String strProductClassName,
                              int nIdProduct,
                              java.util.Map<java.lang.String,java.lang.Object> model,
                              javax.servlet.http.HttpServletRequest request)
Initaliaze the model in parameter for an order

Parameters:
strProductClassName - The class name of the product entity to delete
nIdProduct - The product id to order
model - the model which will be passed in the order template
request - The HTTP request

getProduct

public Product getProduct(java.lang.String strProductClassName,
                          int nIdProduct)
Get the product with the given id

Parameters:
strProductClassName - The class name of the product entity to delete
nIdProduct - The product id
Returns:
The product with the given id

findByFilter

public java.util.List<Product> findByFilter(java.lang.String strProductClassName,
                                            ProductFilter filter)
Get all the products which match with the given filter

Parameters:
strProductClassName - The class name of the product entity to delete
filter - the filter
Returns:
A list of products which match with the given filter

getAllRegisteredObjectDefinition

public java.util.List<ObjectDefinition> getAllRegisteredObjectDefinition(fr.paris.lutece.portal.business.user.AdminUser user)
Get the ObjectDefinition objects of the registered services where the given user is authorized to create

Parameters:
user - the user
Returns:
The list of ObjectDefinition for which the given user is authorized to create a product

getObjectDefinition

public ObjectDefinition getObjectDefinition(java.lang.String strProductClassName)
Get the ObjectDefinition objects of the given product entity name

Parameters:
strProductClassName - The class name of the product entity
Returns:
the ObjectDefinition objects of the given class name

isAuthorizedToCreate

public boolean isAuthorizedToCreate(fr.paris.lutece.portal.business.user.AdminUser user,
                                    java.lang.String strProductClassName)
Checks if a user is authorized to create the given product entity name

Parameters:
user - the user
strProductClassName - The class name of the product entity
Returns:
true if the given user is authorized to create the given product entity. False otherwise.

isAuthorizedToModify

public boolean isAuthorizedToModify(fr.paris.lutece.portal.business.user.AdminUser user,
                                    java.lang.String strProductClassName)
Checks if a user is authorized to modify the given product entity name

Parameters:
user - the user
strProductClassName - The class name of the product entity
Returns:
true if the given user is authorized to modify the given product entity. False otherwise.

isAuthorizedToDelete

public boolean isAuthorizedToDelete(fr.paris.lutece.portal.business.user.AdminUser user,
                                    java.lang.String strProductClassName)
Checks if a user is authorized to delete the given product entity name

Parameters:
user - the user
strProductClassName - The class name of the product entity
Returns:
true if the given user is authorized to delete the given product entity. False otherwise.

getMessageNotAuthorizedForCreate

public java.lang.String getMessageNotAuthorizedForCreate(java.lang.String strProductClassName)
Get the message when a user is not authorized to create a product

Parameters:
strProductClassName - The class name of the product entity
Returns:
The message

getMessageNotAuthorizedForModification

public java.lang.String getMessageNotAuthorizedForModification(java.lang.String strProductClassName)
Get the message when a user is not authorized to modify a product

Parameters:
strProductClassName - The class name of the product entity
Returns:
The message

getMessageNotAuthorizedForDelete

public java.lang.String getMessageNotAuthorizedForDelete(java.lang.String strProductClassName)
Get the message when a user is not authorized to delete a product

Parameters:
strProductClassName - The class name of the product entity
Returns:
The message


Copyright © 2011 Mairie de Paris. All Rights Reserved.