From d3689abf35eafcd8ad201ea466a8514f4fc51c89 Mon Sep 17 00:00:00 2001 From: sebastien leridon Date: Wed, 15 May 2024 12:02:44 +0200 Subject: [PATCH] LUT-25865 : add category and generic status --- .../business/customer/Customer.java | 31 +- .../business/customer/CustomerService.java | 2 +- .../business/customer/ICustomerDAO.java | 2 +- .../grubusiness/business/demand/Action.java | 2 +- .../grubusiness/business/demand/Demand.java | 5 +- .../business/demand/DemandCategory.java | 120 +++++++ .../business/demand/DemandService.java | 311 ------------------ .../business/demand/DemandStatus.java | 112 +++++++ .../business/demand/DemandType.java | 32 +- .../business/demand/IDemandCategoryDAO.java | 116 +++++++ .../business/demand/IDemandDAO.java | 29 +- .../business/demand/IDemandListener.java | 2 +- .../demand/IDemandServiceProvider.java | 202 ++++++++++++ .../business/demand/IDemandStatusDAO.java | 136 ++++++++ .../business/demand/IDemandTypeDAO.java | 102 ++++++ .../business/indexing/IIndexingService.java | 2 +- .../business/indexing/IndexingException.java | 2 +- .../business/mock/MockActionListenerEnum.java | 6 +- .../business/mock/MockCustomerDAO.java | 2 +- .../business/mock/MockDemandDAO.java | 36 +- .../business/mock/MockDemandListener.java | 2 +- .../business/mock/MockNotificationDAO.java | 70 ++-- .../mock/MockNotificationEventDAO.java | 94 +++--- .../mock/MockNotificationListener.java | 2 +- .../notification/BackofficeNotification.java | 2 +- .../BillingAccountBasedSMSNotification.java | 2 +- .../notification/BroadcastNotification.java | 2 +- .../business/notification/EmailAddress.java | 4 +- .../notification/EmailNotification.java | 2 +- .../notification/EnumNotificationType.java | 4 +- .../business/notification/Event.java | 58 ++-- .../notification/INotificationDAO.java | 32 +- .../notification/INotificationEventDAO.java | 38 +-- .../notification/INotificationListener.java | 2 +- .../notification/MyDashboardNotification.java | 2 +- .../business/notification/Notification.java | 6 +- .../notification/NotificationConstants.java | 2 +- .../notification/NotificationEvent.java | 23 +- .../notification/NotificationFilter.java | 62 ++-- .../notification/NotifyGruResponse.java | 23 +- .../notification/SMSNotification.java | 2 +- .../business/web/rs/DemandDisplay.java | 21 +- .../business/web/rs/DemandResult.java | 10 +- .../business/web/rs/EnumGenericStatus.java | 102 ++++-- .../business/web/rs/NotificationResult.java | 7 +- .../business/web/rs/SearchResult.java | 31 +- .../ICustomerEncryptionService.java | 2 +- ...der.java => INotifyerServiceProvider.java} | 12 +- .../notification/NotificationException.java | 10 +- .../customer/CustomerServiceTest.java | 2 +- .../business/demand/DemandServiceTest.java | 226 ------------- .../notification/NotificationTest.java | 6 +- 52 files changed, 1259 insertions(+), 856 deletions(-) create mode 100644 src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandCategory.java delete mode 100644 src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandService.java create mode 100644 src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandStatus.java create mode 100644 src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandCategoryDAO.java create mode 100644 src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandServiceProvider.java create mode 100644 src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandStatusDAO.java create mode 100644 src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandTypeDAO.java rename src/java/fr/paris/lutece/plugins/grubusiness/service/notification/{INotificationServiceProvider.java => INotifyerServiceProvider.java} (91%) delete mode 100644 src/test/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandServiceTest.java diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/Customer.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/Customer.java index daa0f94..3a30ca5 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/Customer.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/Customer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,9 +84,13 @@ public class Customer implements Serializable private String _strAccountLogin; /** The connection Id. */ - @Size( max = 50, message = "#i18n{gru.validation.customer.AccountGuid.size}" ) + @Size( max = 56, message = "#i18n{gru.validation.customer.AccountGuid.size}" ) private String _strConnectionId; + /** The customer Id. */ + @Size( max = 50, message = "#i18n{gru.validation.customer.AccountCuid.size}" ) + private String _strCustomerId; + /** The _str email. */ @Email( message = "#i18n{portal.validation.message.email}" ) @Size( max = 255, message = "#i18n{gru.validation.customer.Email.size}" ) @@ -298,6 +302,29 @@ public void setConnectionId( String strConnectionId ) _strConnectionId = strConnectionId; } + /** + * Returns the Customer Id. + * + * @return The Customer Id + */ + @JsonProperty( "customer_id" ) + public String getCustomerId( ) + { + return _strCustomerId; + } + + /** + * Sets the Customer id. + * + * @param strCustomerId + * The Customer Id + */ + @JsonProperty( "customer_id" ) + public void setCustomerId( String strCustomerId ) + { + _strCustomerId = strCustomerId; + } + /** * Returns the Email. * diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerService.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerService.java index 2db5ff8..67580d4 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerService.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/ICustomerDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/ICustomerDAO.java index 2ec3d50..4f0f9af 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/ICustomerDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/customer/ICustomerDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Action.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Action.java index 9e1a8dc..2007263 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Action.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Action.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Demand.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Demand.java index 0aff02e..92d71c9 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Demand.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/Demand.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -431,7 +431,8 @@ public long getModifyDate( ) } /** - * @param lModifyDate the _lModifyDate to set + * @param lModifyDate + * the _lModifyDate to set */ public void setModifyDate( long lModifyDate ) { diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandCategory.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandCategory.java new file mode 100644 index 0000000..ebca728 --- /dev/null +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandCategory.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2002-2024, City of Paris + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright notice + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice + * and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * License 1.0 + */ +package fr.paris.lutece.plugins.grubusiness.business.demand; + +import javax.validation.constraints.Size; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; + +/** + * This is the business class for the object DemandCategory + */ +public class DemandCategory implements Serializable +{ + private static final long serialVersionUID = 1L; + + // Variables declarations + private int _nId; + + @NotEmpty( message = "#i18n{grusupply.validation.demandcategory.Code.notEmpty}" ) + @Size( max = 255, message = "#i18n{grusupply.validation.demandcategory.Code.size}" ) + private String _strCode; + + @NotEmpty( message = "#i18n{grusupply.validation.demandcategory.Label.notEmpty}" ) + private String _strLabel; + + /** + * Returns the Id + * + * @return The Id + */ + public int getId( ) + { + return _nId; + } + + /** + * Sets the Id + * + * @param nId + * The Id + */ + public void setId( int nId ) + { + _nId = nId; + } + + /** + * Returns the Code + * + * @return The Code + */ + public String getCode( ) + { + return _strCode; + } + + /** + * Sets the Code + * + * @param strCode + * The Code + */ + public void setCode( String strCode ) + { + _strCode = strCode; + } + + /** + * Returns the Label + * + * @return The Label + */ + public String getLabel( ) + { + return _strLabel; + } + + /** + * Sets the Label + * + * @param strLabel + * The Label + */ + public void setLabel( String strLabel ) + { + _strLabel = strLabel; + } + +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandService.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandService.java deleted file mode 100644 index 8c9b380..0000000 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandService.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2002-2017, Mairie de Paris - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright notice - * and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice - * and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * License 1.0 - */ -package fr.paris.lutece.plugins.grubusiness.business.demand; - -import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationDAO; -import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationEventDAO; -import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationListener; -import fr.paris.lutece.plugins.grubusiness.business.notification.Notification; -import fr.paris.lutece.plugins.grubusiness.business.notification.NotificationEvent; -import fr.paris.lutece.plugins.grubusiness.business.notification.NotificationFilter; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * This class manages demands - * - */ -public class DemandService -{ - private final IDemandDAO _demandDao; - private final List _listDemandListener; - private final INotificationDAO _notificationDao; - private final List _listNotificationListener; - private final INotificationEventDAO _notificationEventDao; - - /** - * Constructor - * - * @param demandDAO - * the DAO for the demands - * @param notificationDAO - * the DAO for the notifications - */ - public DemandService( IDemandDAO demandDAO, INotificationDAO notificationDAO ) - { - _demandDao = demandDAO; - _notificationDao = notificationDAO; - _listDemandListener = new ArrayList( ); - _listNotificationListener = new ArrayList( ); - _notificationEventDao = null; - } - - /** - * Constructor - * - * @param demandDAO - * the DAO for the demands - * @param notificationDAO - * the DAO for the notifications - */ - public DemandService( IDemandDAO demandDAO, INotificationDAO notificationDAO, INotificationEventDAO notificationEventDAO ) - { - _demandDao = demandDAO; - _notificationDao = notificationDAO; - _listDemandListener = new ArrayList( ); - _listNotificationListener = new ArrayList( ); - _notificationEventDao = notificationEventDAO; - } - - /** - * Constructor - * - * @param demandDAO - * the DAO for the demands - * @param notificationDAO - * the DAO for the notifications - * @param listDemandListener - * list of IDemandListener - * @param listNotificationListener - * list of INotificationListener - */ - public DemandService( IDemandDAO demandDAO, INotificationDAO notificationDAO, List listDemandListener, - List listNotificationListener ) - { - _demandDao = demandDAO; - _notificationDao = notificationDAO; - _listDemandListener = listDemandListener; - _listNotificationListener = listNotificationListener; - _notificationEventDao = null; - } - - /** - * Constructor - * - * @param demandDAO - * the DAO for the demands - * @param notificationDAO - * the DAO for the notifications - * @param listDemandListener - * list of IDemandListener - * @param listNotificationListener - * list of INotificationListener - * @param notificationEventDAO - */ - public DemandService( IDemandDAO demandDAO, INotificationDAO notificationDAO, List listDemandListener, - List listNotificationListener, INotificationEventDAO notificationEventDAO ) - { - _demandDao = demandDAO; - _notificationDao = notificationDAO; - _listDemandListener = listDemandListener; - _listNotificationListener = listNotificationListener; - _notificationEventDao = notificationEventDAO; - } - - - /** - * Finds demands for the specified customer id - * - * @param strCustomerId - * the customer id - * @return the demands. An empty collection is returned if no demand has been found - */ - public Collection findByCustomerId( String strCustomerId ) - { - Collection collectionDemands = _demandDao.loadByCustomerId( strCustomerId ); - - for ( Demand demand : collectionDemands ) - { - if ( demand != null ) - { - demand.setNotifications( _notificationDao.loadByDemand( demand.getId( ), demand.getTypeId( ) ) ); - } - } - return collectionDemands; - } - - /** - * Finds demands for the specified reference - * - * @param strReference - * the reference - * @return the demands. An empty collection is returned if no demand has been found - */ - public Collection findByReference( String strReference ) - { - Collection collectionDemands = _demandDao.loadByReference( strReference ); - - for ( Demand demand : collectionDemands ) - { - if ( demand != null ) - { - demand.setNotifications( _notificationDao.loadByDemand( demand.getId( ), demand.getTypeId( ) ) ); - } - } - return collectionDemands; - } - - - /** - * Finds a demand for the specified id and type id - * - * @param strDemandId - * the demand id - * @param strDemandTypeId - * the demand type id - * @return the demand if found, {@code null} otherwise - */ - public Demand findByPrimaryKey( String strDemandId, String strDemandTypeId ) - { - Demand demand = _demandDao.load( strDemandId, strDemandTypeId ); - - if ( demand != null ) - { - demand.setNotifications( _notificationDao.loadByDemand( strDemandId, strDemandTypeId ) ); - } - - return demand; - } - - /** - * Creates a demand - * - * @param demand - * the demand to create - * @return the created demand - */ - public Demand create( Demand demand ) - { - Demand demandDao = _demandDao.insert( demand ); - for ( IDemandListener iDemandListener : _listDemandListener ) - { - iDemandListener.onCreateDemand( demandDao ); - } - return demandDao; - } - - /** - * Creates a notification - * - * @param notification - * the notification to create - * @return the created notification - */ - public Notification create( Notification notification ) - { - Notification notificationDao = _notificationDao.insert( notification ); - for ( INotificationListener iNotificationListener : _listNotificationListener ) - { - iNotificationListener.onCreateNotification( notificationDao ); - } - return notificationDao; - } - - /** - * Creates a notification event - * - * @param notificationEvent - * @return the created notification event - */ - public NotificationEvent create( NotificationEvent notificationEvent ) - { - NotificationEvent notificationDao = _notificationEventDao.insert( notificationEvent ); - - return notificationDao; - } - - - /** - * Updates a demand - * - * @param demand - * the demand to update - * @return the updated demand - */ - public Demand update( Demand demand ) - { - Demand demandDao = _demandDao.store( demand ); - for ( IDemandListener iDemandListener : _listDemandListener ) - { - iDemandListener.onUpdateDemand( demandDao ); - } - return demandDao; - } - - /** - * Removes a demand with the specified id and type id - * - * @param strDemandId - * the demand id - * @param strDemandTypeId - * the demand type id - */ - public void remove( String strDemandId, String strDemandTypeId ) - { - _notificationDao.deleteByDemand( strDemandId, strDemandTypeId ); - for ( INotificationListener iNotificationListener : _listNotificationListener ) - { - iNotificationListener.onDeleteDemand( strDemandId, strDemandTypeId ); - } - _demandDao.delete( strDemandId, strDemandTypeId ); - for ( IDemandListener iDemandListener : _listDemandListener ) - { - iDemandListener.onDeleteDemand( strDemandId, strDemandTypeId ); - } - } - - /** - * Finds events by date and demand_type_id and status - * - * @param dStart - * @param dEnd - * @param strDemandTypeId - * @param strStatus - * - * @return the demands. An empty list is returned if no event has been found - */ - public List findEventsByDateAndDemandTypeIdAndStatus( long dStart, long dEnd, String strDemandTypeId, String strStatus ) - { - NotificationFilter notificationFilter = new NotificationFilter(); - - notificationFilter.setStartDate( dStart ); - notificationFilter.setEndDate( dEnd ); - notificationFilter.setDemandTypeId( strDemandTypeId ); - notificationFilter.setEventStatus( strStatus ); - - return _notificationEventDao.loadByFilter( notificationFilter ); - } -} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandStatus.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandStatus.java new file mode 100644 index 0000000..c5f137b --- /dev/null +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandStatus.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2002-2024, City of Paris + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright notice + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice + * and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * License 1.0 + */ +package fr.paris.lutece.plugins.grubusiness.business.demand; + +import javax.validation.constraints.NotEmpty; + +import fr.paris.lutece.plugins.grubusiness.business.web.rs.EnumGenericStatus; + +import java.io.Serializable; + +/** + * This is the business class for the object Status + */ +public class DemandStatus implements Serializable +{ + private static final long serialVersionUID = 1L; + + // Variables declarations + private int _nId; + + @NotEmpty( message = "#i18n{grusupply.validation.status.Status.notEmpty}" ) + private String _strStatus; + + private EnumGenericStatus _genericStatus; + + /** + * Returns the Id + * + * @return The Id + */ + public int getId( ) + { + return _nId; + } + + /** + * Sets the Id + * + * @param nId + * The Id + */ + public void setId( int nId ) + { + _nId = nId; + } + + /** + * @return the _strStatus + */ + public String getStatus( ) + { + return _strStatus; + } + + /** + * @param strStatus + * the _strStatus to set + */ + public void setStatus( String strStatus ) + { + this._strStatus = strStatus; + } + + /** + * @return the _genericStatus + */ + public EnumGenericStatus getGenericStatus( ) + { + return _genericStatus; + } + + /** + * @param genericStatus + * : the genericStatus to set + */ + public void setGenericStatus( EnumGenericStatus genericStatus ) + { + this._genericStatus = genericStatus; + } + +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandType.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandType.java index e518eb1..3f79b63 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandType.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2018, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,13 +39,19 @@ public class DemandType { @JsonProperty( "id_demand_type" ) private int _nIdDemandType; + @JsonProperty( "label" ) private String _strLabel; + @JsonProperty( "url" ) private String _strUrl; + @JsonProperty( "app_code" ) private String _strAppCode; + @JsonProperty( "category" ) + private String _strCategory; + /** * Get the id demand type * @@ -136,5 +142,27 @@ public void setAppCode( String strAppCode ) { _strAppCode = strAppCode; } - + + /** + * Returns the Category + * + * @return The Category + */ + @JsonProperty( "category" ) + public String getCategory( ) + { + return _strCategory; + } + + /** + * Sets the Category + * + * @param strCategory + * The Category + */ + public void setCategory( String strCategory ) + { + _strCategory = strCategory; + } + } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandCategoryDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandCategoryDAO.java new file mode 100644 index 0000000..6fc97f3 --- /dev/null +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandCategoryDAO.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2002-2024, City of Paris + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright notice + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice + * and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * License 1.0 + */ +package fr.paris.lutece.plugins.grubusiness.business.demand; + +import java.util.List; +import java.util.Optional; + +/** + * IDemandCategoryDAO Interface + */ +public interface IDemandCategoryDAO +{ + /** + * Insert a new record in the table. + * + * @param demandCategory + * instance of the DemandCategory object to insert + * @param plugin + * the Plugin + */ + void insert( DemandCategory demandCategory ); + + /** + * Update the record in the table + * + * @param demandCategory + * the reference of the DemandCategory + * @param plugin + * the Plugin + */ + void store( DemandCategory demandCategory ); + + /** + * Delete a record from the table + * + * @param nKey + * The identifier of the DemandCategory to delete + * @param plugin + * the Plugin + */ + void delete( int nKey ); + + /////////////////////////////////////////////////////////////////////////// + // Finders + + /** + * Load the data from the table + * + * @param nKey + * The identifier of the demandCategory + * @param plugin + * the Plugin + * @return The instance of the demandCategory + */ + Optional load( int nKey ); + + /** + * Load the data of all the demandCategory objects and returns them as a list + * + * @param plugin + * the Plugin + * @return The list which contains the data of all the demandCategory objects + */ + List selectDemandCategoriesList( ); + + /** + * Load the id of all the demandCategory objects and returns them as a list + * + * @param plugin + * the Plugin + * @return The list which contains the id of all the demandCategory objects + */ + List selectIdDemandCategoriesList( ); + + /** + * Load the data of all the avant objects and returns them as a list + * + * @param plugin + * the Plugin + * @param listIds + * liste of ids + * @return The list which contains the data of all the avant objects + */ + List selectDemandCategoriesListByIds( List listIds ); +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandDAO.java index caeba9b..e4202a4 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,7 +67,7 @@ public interface IDemandDAO * Search demands by filter * * @param filter - * @return the demands list + * @return the demands list */ Collection loadByFilter( NotificationFilter filter ); @@ -75,16 +75,17 @@ public interface IDemandDAO * Search demands by filter * * @param filter - * @return the demands list + * @return the demands list */ List loadIdsByFilter( NotificationFilter filter ); /** * load demands corresponding to the id list + * * @param listIds * @return the demands */ - List loadByIds( List listIds); + List loadByIds( List listIds ); /** * Finds a demand with the specified id and type id @@ -139,23 +140,27 @@ public interface IDemandDAO * @return the demand coresponding to given id. */ Demand loadById( String strId ); - + /** * Load demand ids ordered by date notification + * * @param strCustomerId * @param strNotificationType - * @param strIdDemandType (Optional can be null) + * @param strIdDemandType + * (Optional can be null) * @return The list of demand ids */ - List loadIdsByCustomerIdAndIdDemandType ( String strCustomerId, String strNotificationType, String strIdDemandType ); - + List loadIdsByCustomerIdAndIdDemandType( String strCustomerId, String strNotificationType, String strIdDemandType ); + /** * Load demand ids by status + * * @param strCustomerId - * @param listStatus + * @param listStatus * @param strNotificationType - * @param strIdDemandType (Optional can be null) + * @param strIdDemandType + * (Optional can be null) * @return The list of demand ids */ - List loadIdsByStatus ( String strCustomerId, List listStatus, String strNotificationType, String strIdDemandType ); -} \ No newline at end of file + List loadIdsByStatus( String strCustomerId, List listStatus, String strNotificationType, String strIdDemandType ); +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandListener.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandListener.java index 2f332ab..1ba670d 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandListener.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandServiceProvider.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandServiceProvider.java new file mode 100644 index 0000000..42b8632 --- /dev/null +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandServiceProvider.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2002-2024, City of Paris + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright notice + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice + * and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * License 1.0 + */ +package fr.paris.lutece.plugins.grubusiness.business.demand; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationDAO; +import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationEventDAO; +import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationListener; +import fr.paris.lutece.plugins.grubusiness.business.notification.Notification; +import fr.paris.lutece.plugins.grubusiness.business.notification.NotificationEvent; + +public interface IDemandServiceProvider +{ + + /** + * init DAO + * + * @param dao + */ + public void setDemandDao( IDemandDAO dao ); + + /** + * init DAO + * + * @param dao + */ + public void setDemandTypeDao( IDemandTypeDAO dao ); + + /** + * init DAO + * + * @param dao + */ + public void setNotificationDao( INotificationDAO dao ); + + /** + * init DAO + * + * @param dao + */ + public void setNotificationEventDao( INotificationEventDAO dao ); + + /** + * init DAO + * + * @param dao + */ + public void setStatusDao( IDemandStatusDAO dao ); + + /** + * Finds demands for the specified customer id + * + * @param strCustomerId + * the customer id + * @return the demands. An empty collection is returned if no demand has been found + */ + public Collection findByCustomerId( String strCustomerId ); + + /** + * Finds demands for the specified reference + * + * @param strReference + * the reference + * @return the demands. An empty collection is returned if no demand has been found + */ + public Collection findByReference( String strReference ); + + /** + * Finds a demand for the specified id and type id + * + * @param strDemandId + * the demand id + * @param strDemandTypeId + * the demand type id + * @return the demand if found, {@code null} otherwise + */ + public Demand findByPrimaryKey( String strDemandId, String strDemandTypeId ); + + /** + * Creates a demand + * + * @param demand + * the demand to create + * @return the created demand + */ + public Demand create( Demand demand ); + + /** + * Creates a notification + * + * @param notification + * the notification to create + * @return the created notification + */ + public Notification create( Notification notification ); + + /** + * Creates a notification event + * + * @param notificationEvent + * @return the created notification event + */ + public NotificationEvent create( NotificationEvent notificationEvent ); + + /** + * Updates a demand + * + * @param demand + * the demand to update + * @return the updated demand + */ + public Demand update( Demand demand ); + + /** + * Removes a demand with the specified id and type id + * + * @param strDemandId + * the demand id + * @param strDemandTypeId + * the demand type id + */ + public void remove( String strDemandId, String strDemandTypeId ); + + /** + * Finds events by date and demand_type_id and status + * + * @param dStart + * @param dEnd + * @param strDemandTypeId + * @param strStatus + * + * @return the demands. An empty list is returned if no event has been found + */ + public List findEventsByDateAndDemandTypeIdAndStatus( long dStart, long dEnd, String strDemandTypeId, String strStatus ); + + /** + * get demand types list + * + * @return the list + */ + public List getDemandTypesList( ); + + /** + * get demand type + * + * @param id + * @return the demand type as optional + */ + public Optional getDemandType( int id ); + + /** + * get demand Ids by customer Id and demand Type + * + * @param strCustomerId + * @param strNotificationType + * @param strIdDemandType + * @return the demand Id list + */ + public List getIdsByCustomerIdAndDemandTypeId( String strCustomerId, String strNotificationType, String strIdDemandType ); + + /** + * get status + * + * @param strStatusLabel + * @return the status + */ + public Optional getStatusByLabel( String strStatusLabel ); +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandStatusDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandStatusDAO.java new file mode 100644 index 0000000..e22f94d --- /dev/null +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandStatusDAO.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2002-2024, City of Paris + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright notice + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice + * and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * License 1.0 + */ +package fr.paris.lutece.plugins.grubusiness.business.demand; + +import java.util.List; +import java.util.Optional; + +/** + * IStatusDAO Interface + */ +public interface IDemandStatusDAO +{ + /** + * Insert a new record in the table. + * + * @param status + * instance of the Status object to insert + * @param plugin + * the Plugin + */ + void insert( DemandStatus status ); + + /** + * Update the record in the table + * + * @param status + * the reference of the Status + * @param plugin + * the Plugin + */ + void store( DemandStatus status ); + + /** + * Delete a record from the table + * + * @param nKey + * The identifier of the Status to delete + * @param plugin + * the Plugin + */ + void delete( int nKey ); + + /////////////////////////////////////////////////////////////////////////// + // Finders + + /** + * Load the data from the table + * + * @param nKey + * The identifier of the status + * @param plugin + * the Plugin + * @return The instance of the status + */ + Optional load( int nKey ); + + /** + * Load the data from the table + * + * @param nStatusId + * @param plugin + * the Plugin + * @return The instance of the status + */ + Optional loadByStatusId( int nStatusId ); + + /** + * Load the data of all the status objects and returns them as a list + * + * @param plugin + * the Plugin + * @return The list which contains the data of all the status objects + */ + List selectStatusList( ); + + /** + * Load the id of all the status objects and returns them as a list + * + * @param plugin + * the Plugin + * @return The list which contains the id of all the status objects + */ + List selectIdStatusList( ); + + /** + * Load the data of all the avant objects and returns them as a list + * + * @param plugin + * the Plugin + * @param listIds + * liste of ids + * @return The list which contains the data of all the avant objects + */ + List selectStatusListByIds( List listIds ); + + /** + * Load the data from the table + * + * @param strStatus + * @param plugin + * the Plugin + * @return The instance of the status + */ + Optional loadByStatus( String strStatus ); +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandTypeDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandTypeDAO.java new file mode 100644 index 0000000..dc110fc --- /dev/null +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/demand/IDemandTypeDAO.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2002-2024, City of Paris + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright notice + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice + * and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * License 1.0 + */ +package fr.paris.lutece.plugins.grubusiness.business.demand; + +import java.util.List; +import java.util.Optional; + +/** + * IDemandTypeDAO Interface + */ +public interface IDemandTypeDAO +{ + /** + * Insert a new record in the table. + * + * @param demandType + * instance of the DemandType object to insert + */ + void insert( DemandType demandType ); + + /** + * Update the record in the table + * + * @param demandType + * the reference of the DemandType + */ + void store( DemandType demandType ); + + /** + * Delete a record from the table + * + * @param nKey + * The identifier of the DemandType to delete + */ + void delete( int nKey ); + + /////////////////////////////////////////////////////////////////////////// + // Finders + + /** + * Load the data from the table + * + * @param nKey + * The identifier of the demandType + * @return The instance of the demandType + */ + Optional load( int nKey ); + + /** + * Load the data of all the demandType objects and returns them as a list + * + * @return The list which contains the data of all the demandType objects + */ + List selectDemandTypesList( ); + + /** + * Load the id of all the demandType objects and returns them as a list + * + * @return The list which contains the id of all the demandType objects + */ + List selectIdDemandTypesList( ); + + /** + * Load the data of all the avant objects and returns them as a list + * + * @param listIds + * liste of ids + * @return The list which contains the data of all the avant objects + */ + List selectDemandTypesListByIds( List listIds ); +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IIndexingService.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IIndexingService.java index b01544c..02f0ffb 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IIndexingService.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IIndexingService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IndexingException.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IndexingException.java index de4748c..db7417b 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IndexingException.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/indexing/IndexingException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockActionListenerEnum.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockActionListenerEnum.java index 539d188..3342064 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockActionListenerEnum.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockActionListenerEnum.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,5 +38,7 @@ */ public enum MockActionListenerEnum { - CREATE, UPDATE, DELETE; + CREATE, + UPDATE, + DELETE; } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockCustomerDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockCustomerDAO.java index 56f5916..4c88c2f 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockCustomerDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockCustomerDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandDAO.java index c7fe42e..b9bffd3 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -142,26 +142,26 @@ public Demand loadById( String strId ) } @Override - public Collection loadByFilter(NotificationFilter filter) + public Collection loadByFilter( NotificationFilter filter ) { return _mapMockDemand.values( ); } - @Override - public List loadIdsByFilter(NotificationFilter filter) - { - // TODO Auto-generated method stub - return null; - } - - @Override - public List loadByIds(List listIds) - { - List listDemands = new ArrayList<>(); - listDemands.addAll( _mapMockDemand.values( ) ); - - return listDemands; - } + @Override + public List loadIdsByFilter( NotificationFilter filter ) + { + // TODO Auto-generated method stub + return null; + } + + @Override + public List loadByIds( List listIds ) + { + List listDemands = new ArrayList<>( ); + listDemands.addAll( _mapMockDemand.values( ) ); + + return listDemands; + } @Override public List loadIdsByCustomerIdAndIdDemandType( String strCustomerId, String strNotificationType, String strIdDemandType ) @@ -175,4 +175,4 @@ public List loadIdsByStatus( String strCustomerId, List listSta return null; } -} \ No newline at end of file +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandListener.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandListener.java index 449dbb1..277908f 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandListener.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockDemandListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationDAO.java index 813d5d3..8b7d43a 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,23 +88,23 @@ public List loadByFilter( NotificationFilter notificationFilter ) { bAddNotif = notification.getDemand( ) != null && notificationFilter.getDemandTypeId( ).equals( notification.getDemand( ).getTypeId( ) ); } - if ( bAddNotif && notificationFilter.containsHasBackofficeNotification( ) ) + if ( bAddNotif && notificationFilter.containsBackofficeNotificationType( ) ) { bAddNotif = notification.getBackofficeNotification( ) != null; } - if ( bAddNotif && notificationFilter.containsHasBroadcastEmailNotification( ) ) + if ( bAddNotif && notificationFilter.containsBroadcastEmailNotificationType( ) ) { - bAddNotif = notification.getBroadcastEmail( ) != null && !notification.getBroadcastEmail( ).isEmpty( ) ; + bAddNotif = notification.getBroadcastEmail( ) != null && !notification.getBroadcastEmail( ).isEmpty( ); } - if ( bAddNotif && notificationFilter.containsHasCustomerEmailNotification( ) ) + if ( bAddNotif && notificationFilter.containsCustomerEmailNotificationType( ) ) { bAddNotif = notification.getEmailNotification( ) != null; } - if ( bAddNotif && notificationFilter.containsHasMyDashboardNotification( ) ) + if ( bAddNotif && notificationFilter.containsMyDashboardNotificationType( ) ) { bAddNotif = notification.getMyDashboardNotification( ) != null; } - if ( bAddNotif && notificationFilter.containsHasSmsNotification( ) ) + if ( bAddNotif && notificationFilter.containsSmsNotificationType( ) ) { bAddNotif = notification.getSmsNotification( ) != null; } @@ -168,29 +168,29 @@ public List loadIdsByFilter( NotificationFilter notificationFilter ) { bAddNotif = notification.getDemand( ) != null && notificationFilter.getDemandTypeId( ).equals( notification.getDemand( ).getTypeId( ) ); } - if ( bAddNotif && notificationFilter.containsHasBackofficeNotification( ) ) + if ( bAddNotif && notificationFilter.containsBackofficeNotificationType( ) ) { bAddNotif = notification.getBackofficeNotification( ) != null; } - if ( bAddNotif && notificationFilter.containsHasBroadcastEmailNotification( ) ) + if ( bAddNotif && notificationFilter.containsBroadcastEmailNotificationType( ) ) { - bAddNotif = notification.getBroadcastEmail( ) != null && !notification.getBroadcastEmail( ).isEmpty(); + bAddNotif = notification.getBroadcastEmail( ) != null && !notification.getBroadcastEmail( ).isEmpty( ); } - if ( bAddNotif && notificationFilter.containsHasCustomerEmailNotification( ) ) + if ( bAddNotif && notificationFilter.containsCustomerEmailNotificationType( ) ) { bAddNotif = notification.getEmailNotification( ) != null; } - if ( bAddNotif && notificationFilter.containsHasMyDashboardNotification( ) ) + if ( bAddNotif && notificationFilter.containsMyDashboardNotificationType( ) ) { bAddNotif = notification.getMyDashboardNotification( ) != null; } - if ( bAddNotif && notificationFilter.containsHasSmsNotification( ) ) + if ( bAddNotif && notificationFilter.containsSmsNotificationType( ) ) { bAddNotif = notification.getSmsNotification( ) != null; } if ( bAddNotif ) { - listResult.add( notification.getId( ) ); + listResult.add( notification.getId( ) ); } } return listResult; @@ -200,9 +200,9 @@ public List loadIdsByFilter( NotificationFilter notificationFilter ) * {@inheritDoc} */ @Override - public Optional loadById( int nId ) + public Optional loadById( int nId ) { - + for ( Notification notification : _listMockNotification ) { if ( notification.getDemand( ) != null && notification.getId( ) == nId ) @@ -214,13 +214,13 @@ public Optional loadById( int nId ) } @Override - public List loadByDemandAndDate(String strDemandId, String strDemandTypeId, long lDate) { + public List loadByDemandAndDate( String strDemandId, String strDemandTypeId, long lDate ) + { List listResult = new ArrayList( ); for ( Notification notification : _listMockNotification ) { if ( notification.getDemand( ) != null && notification.getDemand( ).getId( ).equals( strDemandId ) - && notification.getDemand( ).getTypeId( ).equals( strDemandTypeId ) - && notification.getDate( ) == lDate ) + && notification.getDemand( ).getTypeId( ).equals( strDemandTypeId ) && notification.getDate( ) == lDate ) { listResult.add( notification ); } @@ -229,44 +229,46 @@ public List loadByDemandAndDate(String strDemandId, String strDema } @Override - public List loadDistinctDemandTypeIds( ) + public List loadDistinctDemandTypeIds( ) { - Map mapDemandTypeIds = new HashMap<>( ); + Map mapDemandTypeIds = new HashMap<>( ); for ( Notification notification : _listMockNotification ) { mapDemandTypeIds.put( String.valueOf( notification.getId( ) ), null ); } - + return new ArrayList<>( mapDemandTypeIds.keySet( ) ); } - @Override - public List loadByIds(List listIds) { + @Override + public List loadByIds( List listIds ) + { - List list = new ArrayList<>(); + List list = new ArrayList<>( ); for ( Notification notification : _listMockNotification ) { if ( listIds.contains( notification.getId( ) ) ) { - list.add( notification ); + list.add( notification ); } } return list; - } + } - @Override - public void delete(int id) { + @Override + public void delete( int id ) + { for ( Notification notification : _listMockNotification ) { - if ( id == notification.getId( ) ) + if ( id == notification.getId( ) ) { - _listMockNotification.remove( notification ); - break; + _listMockNotification.remove( notification ); + break; } } - - } + + } @Override public List loadByDemandIdTypeIdCustomerId( String strDemandId, String strDemandTypeId, String strCustomerId ) diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationEventDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationEventDAO.java index 61f8ff5..a2f0a39 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationEventDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationEventDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2021, City of Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,7 +31,6 @@ * * License 1.0 */ - package fr.paris.lutece.plugins.grubusiness.business.mock; import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationEventDAO; @@ -48,14 +47,14 @@ public final class MockNotificationEventDAO implements INotificationEventDAO { List _eventList = new ArrayList<>( ); - + /** * {@inheritDoc } */ @Override public NotificationEvent insert( NotificationEvent notificationEvent ) { - _eventList.add( notificationEvent ); + _eventList.add( notificationEvent ); return notificationEvent; } @@ -66,11 +65,12 @@ public NotificationEvent insert( NotificationEvent notificationEvent ) @Override public Optional loadById( int nKey ) { - for (NotificationEvent event : _eventList ) + for ( NotificationEvent event : _eventList ) { - if (event.getId( ) == nKey ) return Optional.of( event ); + if ( event.getId( ) == nKey ) + return Optional.of( event ); } - + return Optional.empty( ); } @@ -80,9 +80,10 @@ public Optional loadById( int nKey ) @Override public void delete( int nKey ) { - for (NotificationEvent event : _eventList ) + for ( NotificationEvent event : _eventList ) { - if (event.getId( ) == nKey ) { + if ( event.getId( ) == nKey ) + { _eventList.remove( event ); return; } @@ -93,18 +94,18 @@ public void delete( int nKey ) * {@inheritDoc } */ @Override - public List loadByDemand(String strDemandId, String strDemandTypeId) + public List loadByDemand( String strDemandId, String strDemandTypeId ) { - List eventDemandList = new ArrayList<>(); - - for (NotificationEvent event : _eventList ) + List eventDemandList = new ArrayList<>( ); + + for ( NotificationEvent event : _eventList ) { - if (event.getDemand( ).getId( ).equals( strDemandId ) && event.getDemand( ).getTypeId( ).equals( strDemandTypeId ) ) + if ( event.getDemand( ).getId( ).equals( strDemandId ) && event.getDemand( ).getTypeId( ).equals( strDemandTypeId ) ) { eventDemandList.add( event ); } } - + return eventDemandList; } @@ -112,13 +113,13 @@ public List loadByDemand(String strDemandId, String strDemand * {@inheritDoc } */ @Override - public List loadByFilter(NotificationFilter filter) + public List loadByFilter( NotificationFilter filter ) { - List eventDemandList = new ArrayList<>(); - - for (NotificationEvent event : _eventList ) + List eventDemandList = new ArrayList<>( ); + + for ( NotificationEvent event : _eventList ) { - if ( filter.containsDemandTypeId( ) && event.getDemand( ).getTypeId( ).equals( filter.getDemandTypeId( ) ) ) + if ( filter.containsDemandTypeId( ) && event.getDemand( ).getTypeId( ).equals( filter.getDemandTypeId( ) ) ) { eventDemandList.add( event ); } @@ -127,17 +128,17 @@ public List loadByFilter(NotificationFilter filter) return eventDemandList; } - /** * {@inheritDoc } */ @Override - public List loadIdsByFilter(NotificationFilter filter) { - List eventDemandList = new ArrayList<>(); - - for (NotificationEvent event : _eventList ) + public List loadIdsByFilter( NotificationFilter filter ) + { + List eventDemandList = new ArrayList<>( ); + + for ( NotificationEvent event : _eventList ) { - if ( filter.containsDemandTypeId( ) && event.getDemand( ).getTypeId( ).equals( filter.getDemandTypeId( ) ) ) + if ( filter.containsDemandTypeId( ) && event.getDemand( ).getTypeId( ).equals( filter.getDemandTypeId( ) ) ) { eventDemandList.add( event.getId( ) ); } @@ -147,14 +148,14 @@ public List loadIdsByFilter(NotificationFilter filter) { } @Override - public List loadByNotification(String strDemandId, String strDemandTypeId, long lNotificationDate) { - List eventList = new ArrayList<>(); - - for (NotificationEvent event : _eventList ) + public List loadByNotification( String strDemandId, String strDemandTypeId, long lNotificationDate ) + { + List eventList = new ArrayList<>( ); + + for ( NotificationEvent event : _eventList ) { - if ( event.getDemand( ).getId( ).equals( strDemandId ) - && event.getDemand( ).getTypeId( ).equals( strDemandTypeId ) - && event.getNotificationDate( ) == lNotificationDate ) + if ( event.getDemand( ).getId( ).equals( strDemandId ) && event.getDemand( ).getTypeId( ).equals( strDemandTypeId ) + && event.getNotificationDate( ) == lNotificationDate ) { eventList.add( event ); } @@ -163,26 +164,27 @@ public List loadByNotification(String strDemandId, String str return eventList; } - @Override - public List loadByIds(List listIds) { - List eventList = new ArrayList<>(); - - for (NotificationEvent event : _eventList ) + @Override + public List loadByIds( List listIds ) + { + List eventList = new ArrayList<>( ); + + for ( NotificationEvent event : _eventList ) { - if ( listIds.contains( event.getId() ) ) + if ( listIds.contains( event.getId( ) ) ) { - eventList.add( event ); + eventList.add( event ); } } return eventList; - } + } - @Override - public String deleteBeforeDate(long lDate) { - - return "MOCK (no need to purge)"; - } + @Override + public String deleteBeforeDate( long lDate ) + { + return "MOCK (no need to purge)"; + } } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationListener.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationListener.java index a74d6c7..6e4aa8a 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationListener.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/mock/MockNotificationListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BackofficeNotification.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BackofficeNotification.java index 0a2f679..19dc8de 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BackofficeNotification.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BackofficeNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BillingAccountBasedSMSNotification.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BillingAccountBasedSMSNotification.java index db9b8ea..b59121a 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BillingAccountBasedSMSNotification.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BillingAccountBasedSMSNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2018, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BroadcastNotification.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BroadcastNotification.java index fb2d21d..b8888d9 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BroadcastNotification.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/BroadcastNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailAddress.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailAddress.java index ef486d0..3438eae 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailAddress.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ */ @JsonRootName( value = "email_address" ) @JsonPropertyOrder( { - "address" + "address" } ) public class EmailAddress { diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailNotification.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailNotification.java index fefc4a5..6a1d9d8 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailNotification.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EmailNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EnumNotificationType.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EnumNotificationType.java index 619d7f2..d15fd88 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EnumNotificationType.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/EnumNotificationType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2023, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,5 +45,5 @@ public enum EnumNotificationType BACKOFFICE, MYDASHBOARD, BROADCAST_EMAIL; - + } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Event.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Event.java index 8b8b3a9..44ea138 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Event.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Event.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2021, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,15 +38,13 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonRootName; - - /** * NotificationEvent class, object to log events as delivery success or failure. * */ @JsonRootName( value = "event" ) -@JsonPropertyOrder( { - "id", "event_date", "type", "status", "redelivry", "message" +@JsonPropertyOrder( { + "id", "event_date", "type", "status", "redelivry", "message" } ) public class Event { @@ -108,50 +106,58 @@ public void setEventDate( Long lEventDate ) * * @return the type */ - public String getType() { + public String getType( ) + { return _strType; } /** - * set type + * set type * - * @param _strType + * @param _strType */ - public void setType(String _strType) { + public void setType( String _strType ) + { this._strType = _strType; } /** * get the status + * * @return the status */ - public String getStatus() { + public String getStatus( ) + { return _strStatus; } /** * set the status * - * @param _strStatus + * @param _strStatus */ - public void setStatus(String _strStatus) { + public void setStatus( String _strStatus ) + { this._strStatus = _strStatus; } /** * get the reason + * * @return the reason */ - public String getReason() { + public String getReason( ) + { return _strReason; } /** * set the reason * - * @param _strReason + * @param _strReason */ - public void setReason(String _strReason) { + public void setReason( String _strReason ) + { this._strReason = _strReason; } @@ -160,35 +166,39 @@ public void setReason(String _strReason) { * * @return the message */ - public String getMessage() { + public String getMessage( ) + { return _strMessage; } /** * set the message * - * @param _strMessage + * @param _strMessage */ - public void setMessage(String _strMessage) { + public void setMessage( String _strMessage ) + { this._strMessage = _strMessage; } - + /** * get the nb of times that the message has been redelivred * - * @return the redelivry number + * @return the redelivry number */ - public int getRedelivry() { + public int getRedelivry( ) + { return _nRedelivry; } /** * set redelivry nb * - * @param nRedelivry + * @param nRedelivry */ - public void setRedelivry(int nRedelivry) { + public void setRedelivry( int nRedelivry ) + { this._nRedelivry = nRedelivry; } - + } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationDAO.java index ad662b0..e1af774 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ public interface INotificationDAO * @param strId * @return the notification coresponding to given id. */ - Optional loadById( int id ); + Optional loadById( int id ); /** * Finds notifications associated to the specified demand id and demand type id. The notifications must be sorted by date descending @@ -80,25 +80,25 @@ public interface INotificationDAO * @return the notifications. An empty list is returned if no notification has been found. */ List loadByFilter( NotificationFilter notificationFilter ); - + /** * Finds and populate notification by demand id, type id, customer id * - * @param strDemandId + * @param strDemandId * @param strDemandTypeId * @param strCustomerId * @return the notifications. An empty list is returned if no notification has been found. */ List loadByDemandIdTypeIdCustomerId( String strDemandId, String strDemandTypeId, String strCustomerId ); - + /** * Find last notification by demand id and demand type id + * * @param strDemandId * @param strDemandTypeId * @return last notification */ - Notification loadLastNotifByDemandIdAndDemandTypeId( String strDemandId, String strDemandTypeId ); - + Notification loadLastNotifByDemandIdAndDemandTypeId( String strDemandId, String strDemandTypeId ); /** * Inserts a notification @@ -127,26 +127,26 @@ public interface INotificationDAO * @return The list of notifications ids */ List loadIdsByFilter( NotificationFilter notificationFilter ); - + /** * load distinct demand type ids * - * @return the id list + * @return the id list */ List loadDistinctDemandTypeIds( ); /** - * Loads list by Ids + * Loads list by Ids * * @param listIds * @return list of Notification */ - List loadByIds(List listIds); + List loadByIds( List listIds ); - /** - * delete notification - * + /** + * delete notification + * * @param id - */ - void delete(int id); + */ + void delete( int id ); } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationEventDAO.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationEventDAO.java index bd47508..89095c4 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationEventDAO.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationEventDAO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,10 +49,10 @@ public interface INotificationEventDAO * @param nId * @return the notification corresponding to given id. */ - Optional loadById( int nId ); + Optional loadById( int nId ); /** - * Finds notification events associated to the specified demand id and demand type id. + * Finds notification events associated to the specified demand id and demand type id. * * @param strDemandId * the demand id @@ -63,14 +63,14 @@ public interface INotificationEventDAO List loadByDemand( String strDemandId, String strDemandTypeId ); /** - * Finds notification events associated to the specified notification + * Finds notification events associated to the specified notification * * @param strDemandId * @param strDemandTypeId * @param lNotificationDate * @return the notification event list */ - public List loadByNotification( String strDemandId, String strDemandTypeId, long lNotificationDate); + public List loadByNotification( String strDemandId, String strDemandTypeId, long lNotificationDate ); /** * Finds and populate notification according to the filter @@ -85,7 +85,7 @@ public interface INotificationEventDAO * Inserts a notification event * * @param notificationEvent - * the notification event to insert + * the notification event to insert * @return the inserted notification event */ NotificationEvent insert( NotificationEvent notificationEvent ); @@ -106,18 +106,18 @@ public interface INotificationEventDAO */ List loadIdsByFilter( NotificationFilter notificationFilter ); - /** - * load the events for an id list - * - * @return The list of notification events - */ - List loadByIds(List listIds); + /** + * load the events for an id list + * + * @return The list of notification events + */ + List loadByIds( List listIds ); - /** - * purge the events after N days - * - * @param nbDays - * @return - */ - String deleteBeforeDate( long lDate ); + /** + * purge the events after N days + * + * @param nbDays + * @return + */ + String deleteBeforeDate( long lDate ); } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationListener.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationListener.java index e906728..6b505f4 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationListener.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/INotificationListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/MyDashboardNotification.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/MyDashboardNotification.java index 4792da1..13cc874 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/MyDashboardNotification.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/MyDashboardNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Notification.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Notification.java index 713b28c..2592b79 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Notification.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/Notification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -285,5 +285,5 @@ public void addBroadcastEmail( BroadcastNotification broadcastEmail ) _listBroadcastEmail.add( broadcastEmail ); } - -} \ No newline at end of file + +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationConstants.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationConstants.java index 9fb01b4..c0c13f3 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationConstants.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationEvent.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationEvent.java index 8915817..9676f66 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationEvent.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2021, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,14 +41,13 @@ import fr.paris.lutece.plugins.grubusiness.business.demand.Demand; import fr.paris.lutece.plugins.grubusiness.business.notification.Event; - /** * NotificationEvent class, object to log events as delivery success or failure. * */ @JsonRootName( value = "notificationEvent" ) -@JsonPropertyOrder( { - "date", "msg_id", "demand", "event" +@JsonPropertyOrder( { + "date", "msg_id", "demand", "event" } ) public class NotificationEvent { @@ -128,29 +127,33 @@ public void setNotificationDate( Long lNotificationDate ) /** * get msg id + * * @return the message id */ @JsonProperty( "msg_id" ) - public String getMsgId() { + public String getMsgId( ) + { return _strMsgId; } /** * set message Id + * * @param strMsgId */ @JsonProperty( "msg_id" ) - public void setMsgId(String strMsgId) { + public void setMsgId( String strMsgId ) + { this._strMsgId = strMsgId; } - + /** * get event * * @return the event */ @JsonProperty( "event" ) - public Event getEvent( ) + public Event getEvent( ) { return _event; } @@ -158,10 +161,10 @@ public Event getEvent( ) /** * set event * - * @param event + * @param event */ @JsonProperty( "event" ) - public void setEvent( Event event ) + public void setEvent( Event event ) { this._event = event; } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationFilter.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationFilter.java index 6d73792..1116233 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationFilter.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,17 +47,17 @@ public class NotificationFilter // filter on demand private String _strDemandId; private String _strDemandTypeId; - + // filter on date private long _lStartDate; private long _lEndDate; - + // Notification type - private List _listNotificationType = new ArrayList< >() ; + private List _listNotificationType = new ArrayList<>( ); // filter on eventStatus private String _strEventStatus; - + /** * Check if this filter contains a id * @@ -148,18 +148,17 @@ public void setDemandTypeId( String strDemandTypeId ) * * @return true if the filter contain a hasCustomerEmailNotification */ - public boolean containsHasCustomerEmailNotification( ) + public boolean containsCustomerEmailNotificationType( ) { return ( !_listNotificationType.isEmpty( ) && _listNotificationType.contains( EnumNotificationType.CUSTOMER_EMAIL ) ); } - /** * Check if this filter contains a hasSmsNotification * * @return true if the filter contain a hasSmsNotification */ - public boolean containsHasSmsNotification( ) + public boolean containsSmsNotificationType( ) { return ( !_listNotificationType.isEmpty( ) && _listNotificationType.contains( EnumNotificationType.SMS ) ); } @@ -169,7 +168,7 @@ public boolean containsHasSmsNotification( ) * * @return true if the filter contain a hasBackofficeNotification */ - public boolean containsHasBackofficeNotification( ) + public boolean containsBackofficeNotificationType( ) { return ( !_listNotificationType.isEmpty( ) && _listNotificationType.contains( EnumNotificationType.BACKOFFICE ) ); } @@ -179,7 +178,7 @@ public boolean containsHasBackofficeNotification( ) * * @return true if the filter contain a hasMyDashboardNotification */ - public boolean containsHasMyDashboardNotification( ) + public boolean containsMyDashboardNotificationType( ) { return ( !_listNotificationType.isEmpty( ) && _listNotificationType.contains( EnumNotificationType.MYDASHBOARD ) ); } @@ -189,21 +188,22 @@ public boolean containsHasMyDashboardNotification( ) * * @return true if the filter contain a hasBroadcastEmailNotification */ - public boolean containsHasBroadcastEmailNotification( ) + public boolean containsBroadcastEmailNotificationType( ) { return ( !_listNotificationType.isEmpty( ) && _listNotificationType.contains( EnumNotificationType.BROADCAST_EMAIL ) ); } /** * Check if this filter contains a notification type filter + * * @return true if the filter contain a notification type filter */ public boolean containsNotificationTypeFilter( ) { - return containsHasCustomerEmailNotification( ) || containsHasSmsNotification( ) - || containsHasBackofficeNotification( ) || containsHasMyDashboardNotification( ) || containsHasBroadcastEmailNotification( ); + return containsCustomerEmailNotificationType( ) || containsSmsNotificationType( ) || containsBackofficeNotificationType( ) + || containsMyDashboardNotificationType( ) || containsBroadcastEmailNotificationType( ); } - + /** * test if filter contains start date * @@ -215,19 +215,22 @@ public boolean containsStartDate( ) } /** - * get start date + * get start date + * * @return the start date */ - public long getStartDate() { + public long getStartDate( ) + { return _lStartDate; } /** * set start date * - * @param _lStartDate + * @param _lStartDate */ - public void setStartDate(long _lStartDate) { + public void setStartDate( long _lStartDate ) + { this._lStartDate = _lStartDate; } @@ -240,38 +243,44 @@ public boolean containsEndDate( ) { return ( _lEndDate > 0 ); } - + /** * get end date + * * @return the end date */ - public long getEndDate() { + public long getEndDate( ) + { return _lEndDate; } /** * set end date * - * @param _lEndDate + * @param _lEndDate */ - public void setEndDate(long _lEndDate) { + public void setEndDate( long _lEndDate ) + { this._lEndDate = _lEndDate; } /** * get event status + * * @return the status filter */ - public String getEventStatus() { + public String getEventStatus( ) + { return _strEventStatus; } /** * set event status * - * @param strEventStatus + * @param strEventStatus */ - public void setEventStatus(String strEventStatus) { + public void setEventStatus( String strEventStatus ) + { this._strEventStatus = strEventStatus; } @@ -284,7 +293,8 @@ public List getListNotificationType( ) } /** - * @param listNotificationType the _listNotificationType to set + * @param listNotificationType + * the _listNotificationType to set */ public void setListNotificationType( List listNotificationType ) { diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotifyGruResponse.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotifyGruResponse.java index 8ea1699..72789bf 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotifyGruResponse.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotifyGruResponse.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ */ @JsonRootName( value = "acknowledge" ) @JsonPropertyOrder( { - "status", "errors", "warnings" + "status", "errors", "warnings" } ) public class NotifyGruResponse { @@ -79,17 +79,19 @@ public void setStatus( String strStatus ) * @return the list */ @JsonProperty( "warnings" ) - public List getWarnings() { + public List getWarnings( ) + { return _warnings; } /** * set warnings * - * @param warnings + * @param warnings */ @JsonProperty( "warnings" ) - public void setWarnings(List warnings) { + public void setWarnings( List warnings ) + { this._warnings = warnings; } @@ -99,19 +101,20 @@ public void setWarnings(List warnings) { * @return the list */ @JsonProperty( "errors" ) - public List getErrors() { + public List getErrors( ) + { return _errors; } /** * set errors * - * @param errors + * @param errors */ @JsonProperty( "errors" ) - public void setErrors(List errors) { + public void setErrors( List errors ) + { this._errors = errors; } - - + } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/SMSNotification.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/SMSNotification.java index bdaad61..0d99dcd 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/SMSNotification.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/notification/SMSNotification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandDisplay.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandDisplay.java index 7bc7d4e..e4b35c6 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandDisplay.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandDisplay.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2023, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,8 +43,8 @@ public class DemandDisplay { private Demand _demand; - private String _strStatus; - + private String _strStatus; + /** * @return the _demand */ @@ -52,13 +52,16 @@ public Demand getDemand( ) { return _demand; } + /** - * @param demand the _demand to set + * @param demand + * the _demand to set */ public void setDemand( Demand demand ) { this._demand = demand; } + /** * @return the _strStatus */ @@ -66,12 +69,14 @@ public String getStatus( ) { return _strStatus; } + /** - * @param strStatus the _strStatus to set + * @param strStatus + * the _strStatus to set */ public void setStatus( String strStatus ) { this._strStatus = strStatus; - } - -} \ No newline at end of file + } + +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandResult.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandResult.java index aefe97f..424f80c 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandResult.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/DemandResult.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2023, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,12 +53,12 @@ public List getListDemandDisplay( ) } /** - * @param listDemandDisplay the _listDemandDisplay to set + * @param listDemandDisplay + * the _listDemandDisplay to set */ public void setListDemandDisplay( List listDemandDisplay ) { this._listDemandDisplay = listDemandDisplay; } - - -} \ No newline at end of file + +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/EnumGenericStatus.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/EnumGenericStatus.java index ce37119..7767634 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/EnumGenericStatus.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/EnumGenericStatus.java @@ -1,28 +1,62 @@ +/* + * Copyright (c) 2002-2024, City of Paris + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright notice + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice + * and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * License 1.0 + */ package fr.paris.lutece.plugins.grubusiness.business.web.rs; - public enum EnumGenericStatus { - TERMINE(15,"grustoragedb.enum.generic_status.label.termine"), - ACQUITTE(14,"grustoragedb.enum.generic_status.label.acquitte"), - ACOMPLETER(13,"grustoragedb.enum.generic_status.label.a_completer"), - AREGLER(12,"grustoragedb.enum.generic_status.label.a_regler"), - ENCOURS(11,"grustoragedb.enum.generic_status.label.en_cours"), - ANNULE(10,"grustoragedb.enum.generic_status.label.annule"); - - + CLOSED( 15, "grustoragedb.enum.generic_status.label.closed", true ), + PAID( 14, "grustoragedb.enum.generic_status.label.paid", true ), + TOCOMPLETE( 13, "grustoragedb.enum.generic_status.label.tocomplete", false ), + TOPAY( 12, "grustoragedb.enum.generic_status.label.topay", false ), + ONGOING( 11, "grustoragedb.enum.generic_status.label.ongoing", false ), + CANCELED( 10, "grustoragedb.enum.generic_status.label.canceled", true ); + private Integer _nStatusId; private String _strLabel; - + private boolean _bFinalStatus; + /** * Private constructor + * * @param nStatusId * @param strLabelle */ - private EnumGenericStatus( Integer nStatusId, String strLabel ) + private EnumGenericStatus( Integer nStatusId, String strLabel, boolean isFinalStatus ) { _nStatusId = nStatusId; _strLabel = strLabel; + _bFinalStatus = isFinalStatus; } /** @@ -40,49 +74,55 @@ public String getLabel( ) { return _strLabel; } - + + /** + * + * @return true if is final + */ + public boolean isFinalStatus( ) + { + return _bFinalStatus; + } + /** * Check if id status exist + * * @param nIdStatus * @return true if exist */ - public static boolean existStatus ( Integer nIdStatus ) + public static boolean exists( Integer nIdStatus ) { - for ( EnumGenericStatus status : EnumGenericStatus.values( ) ) + if ( nIdStatus != null ) { - if( status.getStatusId( ).equals( nIdStatus ) ) + for ( EnumGenericStatus status : EnumGenericStatus.values( ) ) { - return true; + if ( status.getStatusId( ).equals( nIdStatus ) ) + { + return true; + } } } + + // default return false; } - + /** * Return EnumGenericStatus by id status + * * @param nIdStatus * @return enumGenericStatus */ - public static EnumGenericStatus getByStatusId ( Integer nIdStatus ) + public static EnumGenericStatus getByStatusId( Integer nIdStatus ) { for ( EnumGenericStatus status : EnumGenericStatus.values( ) ) { - if( status.getStatusId( ).equals( nIdStatus ) ) + if ( status.getStatusId( ).equals( nIdStatus ) ) { return status; } } return null; } - - /** - * Return true if id status is an closed status - * @param nIdStatus - * @return true if id status is an closed status - */ - public static boolean isClosedStatus ( Integer nIdStatus ) - { - return EnumGenericStatus.TERMINE.getStatusId( ).equals( nIdStatus ) || EnumGenericStatus.ANNULE.getStatusId( ).equals( nIdStatus ) - || EnumGenericStatus.ACQUITTE.getStatusId( ).equals( nIdStatus ) ; - } -} \ No newline at end of file + +} diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/NotificationResult.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/NotificationResult.java index 4cf7a39..9e7ecac 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/NotificationResult.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/NotificationResult.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2023, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,11 +55,12 @@ public List getNotifications( ) } /** - * @param notifications the _notifications to set + * @param notifications + * the _notifications to set */ public void setNotifications( List notifications ) { this._notifications = notifications; } - + } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/SearchResult.java b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/SearchResult.java index 3e63b95..7e19741 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/SearchResult.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/business/web/rs/SearchResult.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2023, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,13 +41,13 @@ public abstract class SearchResult { public static final String ERROR_FIELD_MANDATORY = "ERROR_FIELD_MANDATORY"; - + private String _status; private String _paginator; private String _index; private Integer _nNumberResult; private String _strErrorMessage; - + /** * @return the _status */ @@ -55,14 +55,16 @@ public String getStatus( ) { return _status; } + /** - * @param status the _status to set + * @param status + * the _status to set */ public void setStatus( String status ) { this._status = status; } - + /** * @return the _index */ @@ -70,13 +72,16 @@ public String getIndex( ) { return _index; } + /** - * @param index the _index to set + * @param index + * the _index to set */ public void setIndex( String index ) { this._index = index; } + /** * @return the _paginator */ @@ -84,13 +89,16 @@ public String getPaginator( ) { return _paginator; } + /** - * @param paginator the _paginator to set + * @param paginator + * the _paginator to set */ public void setPaginator( String paginator ) { this._paginator = paginator; } + /** * @return the _nNumberResult */ @@ -98,13 +106,16 @@ public Integer getNumberResult( ) { return _nNumberResult; } + /** - * @param nNumberResult the _nNumberResult to set + * @param nNumberResult + * the _nNumberResult to set */ public void setNumberResult( Integer nNumberResult ) { this._nNumberResult = nNumberResult; } + /** * @return the _strErrorMessage */ @@ -112,8 +123,10 @@ public String getErrorMessage( ) { return _strErrorMessage; } + /** - * @param _strErrorMessage the _strErrorMessage to set + * @param _strErrorMessage + * the _strErrorMessage to set */ public void setErrorMessage( String _strErrorMessage ) { diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/service/encryption/ICustomerEncryptionService.java b/src/java/fr/paris/lutece/plugins/grubusiness/service/encryption/ICustomerEncryptionService.java index 58f8c59..46d6add 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/service/encryption/ICustomerEncryptionService.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/service/encryption/ICustomerEncryptionService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/INotificationServiceProvider.java b/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/INotifyerServiceProvider.java similarity index 91% rename from src/java/fr/paris/lutece/plugins/grubusiness/service/notification/INotificationServiceProvider.java rename to src/java/fr/paris/lutece/plugins/grubusiness/service/notification/INotifyerServiceProvider.java index 1859c6a..e56160d 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/INotificationServiceProvider.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/INotifyerServiceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2019, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,21 +39,21 @@ * This interface provide notification methods to implement * */ -public interface INotificationServiceProvider +public interface INotifyerServiceProvider { /** - * Process notification + * Process notification * * @param notification * @throws fr.paris.lutece.plugins.grubusiness.service.notification.NotificationException */ public void process( Notification notification ) throws NotificationException; - + /** * get provider name * - * @return the name of the provider + * @return the name of the provider */ - public String getName ( ); + public String getName( ); } diff --git a/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/NotificationException.java b/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/NotificationException.java index 5710550..5ac2884 100644 --- a/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/NotificationException.java +++ b/src/java/fr/paris/lutece/plugins/grubusiness/service/notification/NotificationException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2019, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,13 +37,14 @@ * * @author sleridon */ -public class NotificationException extends Exception { - +public class NotificationException extends Exception +{ + /** * */ private static final long serialVersionUID = 4086460224358874263L; - + /** * Constructor * @@ -68,5 +69,4 @@ public NotificationException( String strMessage, Exception e ) super( strMessage, e ); } - } diff --git a/src/test/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerServiceTest.java b/src/test/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerServiceTest.java index 22108f3..0ffbb37 100644 --- a/src/test/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerServiceTest.java +++ b/src/test/java/fr/paris/lutece/plugins/grubusiness/business/customer/CustomerServiceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/test/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandServiceTest.java b/src/test/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandServiceTest.java deleted file mode 100644 index 4ca7e13..0000000 --- a/src/test/java/fr/paris/lutece/plugins/grubusiness/business/demand/DemandServiceTest.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2002-2017, Mairie de Paris - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright notice - * and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice - * and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * License 1.0 - */ -package fr.paris.lutece.plugins.grubusiness.business.demand; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.junit.Test; - -import fr.paris.lutece.plugins.grubusiness.business.customer.Customer; -import fr.paris.lutece.plugins.grubusiness.business.mock.MockActionListenerEnum; -import fr.paris.lutece.plugins.grubusiness.business.mock.MockDemandDAO; -import fr.paris.lutece.plugins.grubusiness.business.mock.MockDemandListener; -import fr.paris.lutece.plugins.grubusiness.business.mock.MockNotificationDAO; -import fr.paris.lutece.plugins.grubusiness.business.mock.MockNotificationListener; -import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationListener; - -/** - * - */ -public class DemandServiceTest extends TestCase -{ - private MockDemandDAO _demandDAO; - private MockNotificationDAO _notificationDAO; - private MockDemandListener _demandListener; - private MockNotificationListener _notificationListener; - - /** - * init des services et objet - */ - public DemandServiceTest( ) - { - super( ); - _demandDAO = new MockDemandDAO( ); - _notificationDAO = new MockNotificationDAO( ); - _demandListener = new MockDemandListener( ); - _notificationListener = new MockNotificationListener( ); - } - - @Test - public void testDemandServiceWithoutListener( ) - { - DemandService serviceTest = new DemandService( _demandDAO, _notificationDAO ); - // Ici on a besoin que des infos pour les DAOs - // Demand.typeId - // Demand.id - // Demand.reference - // Demand.Customer.id - // Notification.Demand avec la Demand comme ci dessus - - Customer customer1 = new Customer( ); - customer1.setId( "cust_1" ); - - Demand demand1 = new Demand( ); - demand1.setTitle( "type_1" ); - demand1.setId( "id_1" ); - demand1.setReference( "ref_1" ); - demand1.setCustomer( customer1 ); - - Demand demand2 = new Demand( ); - demand2.setTitle( "type_2" ); - demand2.setId( "id_2" ); - demand2.setReference( "ref_2" ); - demand2.setCustomer( customer1 ); - - // creation demand1 - serviceTest.create( demand1 ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand1 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand1 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand1 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 1 ); - assertNotNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 1 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 0 ); - - // creation demand2 - serviceTest.create( demand2 ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand2 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand2 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand2 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 2 ); - assertNotNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNotNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 1 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 1 ); - - // suppression demand1 - serviceTest.remove( demand1.getId( ), demand1.getTypeId( ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand1 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand1 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand1 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 1 ); - assertNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNotNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 0 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 1 ); - - // maj ref sur demand2, attention la cle primaire n'est pas modifiable - String strOldRef = demand2.getReference( ); - demand2.setReference( "ref_new_2" ); - serviceTest.update( demand2 ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand2 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand2 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand2 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 1 ); - assertNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNotNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 0 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 1 ); - assertEquals( serviceTest.findByReference( strOldRef ).size( ), 0 ); - } - - @Test - public void testDemandServiceWithListener( ) - { - List listDemandListener = new ArrayList( ); - listDemandListener.add( _demandListener ); - List listNotificationListener = new ArrayList( ); - listNotificationListener.add( _notificationListener ); - DemandService serviceTest = new DemandService( _demandDAO, _notificationDAO, listDemandListener, listNotificationListener ); - - // Ici on a besoin que des infos pour les DAOs - // Demand.typeId - // Demand.id - // Demand.reference - // Demand.Customer.id - // Notification.Demand avec la Demand comme ci dessus - - Customer customer1 = new Customer( ); - customer1.setId( "cust_1" ); - - Demand demand1 = new Demand( ); - demand1.setTitle( "type_1" ); - demand1.setId( "id_1" ); - demand1.setReference( "ref_1" ); - demand1.setCustomer( customer1 ); - - Demand demand2 = new Demand( ); - demand2.setTitle( "type_2" ); - demand2.setId( "id_2" ); - demand2.setReference( "ref_2" ); - demand2.setCustomer( customer1 ); - - // creation demand1 - serviceTest.create( demand1 ); - assertTrue( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand1 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand1 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand1 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 1 ); - assertNotNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 1 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 0 ); - - // creation demand2 - serviceTest.create( demand2 ); - assertTrue( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand2 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand2 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand2 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 2 ); - assertNotNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNotNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 1 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 1 ); - - // suppression demand1 - serviceTest.remove( demand1.getId( ), demand1.getTypeId( ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand1 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand1 ) ); - assertTrue( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand1 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 1 ); - assertNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNotNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 0 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 1 ); - - // maj ref sur demand2, attention la cle primaire n'est pas modifiable - String strOldRef = demand2.getReference( ); - demand2.setReference( "ref_new_2" ); - serviceTest.update( demand2 ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.CREATE, demand2 ) ); - assertTrue( _demandListener.listenAndConsume( MockActionListenerEnum.UPDATE, demand2 ) ); - assertFalse( _demandListener.listenAndConsume( MockActionListenerEnum.DELETE, demand2 ) ); - assertEquals( serviceTest.findByCustomerId( customer1.getId( ) ).size( ), 1 ); - assertNull( serviceTest.findByPrimaryKey( demand1.getId( ), demand1.getTypeId( ) ) ); - assertNotNull( serviceTest.findByPrimaryKey( demand2.getId( ), demand2.getTypeId( ) ) ); - assertEquals( serviceTest.findByReference( demand1.getReference( ) ).size( ), 0 ); - assertEquals( serviceTest.findByReference( demand2.getReference( ) ).size( ), 1 ); - assertEquals( serviceTest.findByReference( strOldRef ).size( ), 0 ); - } - -} diff --git a/src/test/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationTest.java b/src/test/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationTest.java index 55c15ab..6832956 100644 --- a/src/test/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationTest.java +++ b/src/test/java/fr/paris/lutece/plugins/grubusiness/business/notification/NotificationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2017, Mairie de Paris + * Copyright (c) 2002-2024, City of Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -133,7 +133,7 @@ public void testSerialize( ) throws JsonParseException, JsonMappingException, IO } ) ); broadcastNotif.setMessage( "strMessage" ); broadcastNotif.setRecipient( EmailAddress.buildEmailAddresses( new String [ ] { - "strRecipient" + "strRecipient" } ) ); broadcastNotif.setSenderEmail( "strSenderEmail" ); broadcastNotif.setSenderName( "strSenderName" ); @@ -145,7 +145,7 @@ public void testSerialize( ) throws JsonParseException, JsonMappingException, IO broadcastNotif.setCc( null ); broadcastNotif.setMessage( "strMessage" ); broadcastNotif.setRecipient( EmailAddress.buildEmailAddresses( new String [ ] { - "strRecipient" + "strRecipient" } ) ); broadcastNotif.setSenderEmail( "strSenderEmail" ); broadcastNotif.setSenderName( "strSenderName" );