Merge branch 'ch-evo-17-03-2025' into 'main'

Fix :: Erreur 401 sur toutes les ressources à la levée d'une exception quelconque.

See merge request christianakpona/fiscad!6
This commit is contained in:
2025-03-19 07:35:17 +00:00
262 changed files with 8390 additions and 3883 deletions

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;

View File

@@ -1,6 +1,7 @@
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)

View File

@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="listBlocParStructure" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="60393fd8-8f4e-44f7-8418-0139271081b1">
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="listBlocParStructure" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802"
leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"
uuid="60393fd8-8f4e-44f7-8418-0139271081b1">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
@@ -64,8 +69,10 @@
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3" uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3"
uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -80,8 +87,10 @@
<text><![CDATA[Code]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="110" y="0" width="220" height="20" backcolor="#E6E3E3" uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="110" y="0" width="220" height="20" backcolor="#E6E3E3"
uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -96,8 +105,10 @@
<text><![CDATA[Nom]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="330" y="0" width="185" height="20" backcolor="#E6E3E3" uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="330" y="0" width="185" height="20" backcolor="#E6E3E3"
uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -113,8 +124,10 @@
<text><![CDATA[Arrondissement]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="515" y="0" width="145" height="20" backcolor="#E6E3E3" uuid="86774042-75a8-480b-8cee-b051aaf448f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="515" y="0" width="145" height="20" backcolor="#E6E3E3"
uuid="86774042-75a8-480b-8cee-b051aaf448f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -130,8 +143,10 @@
<text><![CDATA[Commune]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="660" y="0" width="140" height="20" backcolor="#E6E3E3" uuid="c083896b-34f1-4034-8422-171bac20fa8b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="660" y="0" width="140" height="20" backcolor="#E6E3E3"
uuid="c083896b-34f1-4034-8422-171bac20fa8b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -151,8 +166,10 @@
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20" uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20"
uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -167,8 +184,10 @@
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ContainerHeight" x="110" y="0" width="220" height="20" uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement stretchType="ContainerHeight" x="110" y="0" width="220" height="20"
uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
@@ -184,8 +203,10 @@
<textFieldExpression><![CDATA[$F{nom}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="330" y="0" width="185" height="20" uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="330" y="0" width="185" height="20"
uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -200,8 +221,10 @@
<textFieldExpression><![CDATA[$F{arrondissement}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="515" y="0" width="145" height="20" uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="515" y="0" width="145" height="20"
uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -216,8 +239,10 @@
<textFieldExpression><![CDATA[$F{commune}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="660" y="0" width="140" height="20" uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="660" y="0" width="140" height="20"
uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>

View File

@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="listBlocParStructure" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="60393fd8-8f4e-44f7-8418-0139271081b1">
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="listBlocParStructure" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802"
leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"
uuid="60393fd8-8f4e-44f7-8418-0139271081b1">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
@@ -110,8 +115,10 @@
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3" uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3"
uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -126,8 +133,10 @@
<text><![CDATA[NUP Provisoire]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="110" y="0" width="120" height="20" backcolor="#E6E3E3" uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="110" y="0" width="120" height="20" backcolor="#E6E3E3"
uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -142,8 +151,10 @@
<text><![CDATA[Quartier]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="230" y="0" width="50" height="20" backcolor="#E6E3E3" uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="230" y="0" width="50" height="20" backcolor="#E6E3E3"
uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -159,8 +170,10 @@
<text><![CDATA[Q]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="280" y="0" width="40" height="20" backcolor="#E6E3E3" uuid="86774042-75a8-480b-8cee-b051aaf448f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="280" y="0" width="40" height="20" backcolor="#E6E3E3"
uuid="86774042-75a8-480b-8cee-b051aaf448f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -176,8 +189,10 @@
<text><![CDATA[I]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="320" y="0" width="50" height="20" backcolor="#E6E3E3" uuid="c083896b-34f1-4034-8422-171bac20fa8b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="320" y="0" width="50" height="20" backcolor="#E6E3E3"
uuid="c083896b-34f1-4034-8422-171bac20fa8b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -193,8 +208,10 @@
<text><![CDATA[P]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="370" y="0" width="60" height="20" backcolor="#E6E3E3" uuid="43fae784-98c5-4c75-bb0a-11f364bce22f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="370" y="0" width="60" height="20" backcolor="#E6E3E3"
uuid="43fae784-98c5-4c75-bb0a-11f364bce22f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -209,8 +226,10 @@
<text><![CDATA[Litige]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="430" y="0" width="114" height="20" backcolor="#E6E3E3" uuid="6fb97069-4150-4b4d-a7e4-110f7275e530">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="430" y="0" width="114" height="20" backcolor="#E6E3E3"
uuid="6fb97069-4150-4b4d-a7e4-110f7275e530">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -225,8 +244,10 @@
<text><![CDATA[Nature Domaine]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="544" y="0" width="156" height="20" backcolor="#E6E3E3" uuid="b609f024-82e7-491d-8558-ad6010c18cb6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="544" y="0" width="156" height="20" backcolor="#E6E3E3"
uuid="b609f024-82e7-491d-8558-ad6010c18cb6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -241,8 +262,10 @@
<text><![CDATA[Nom Propriétaire]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3" uuid="4f3d245d-16c5-4992-81b9-f7de8d10ed45">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3"
uuid="4f3d245d-16c5-4992-81b9-f7de8d10ed45">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -261,8 +284,10 @@
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20" uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20"
uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -277,8 +302,10 @@
<textFieldExpression><![CDATA[$F{nupProvisoire}==null ? "" : $F{nupProvisoire}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ContainerHeight" x="110" y="0" width="120" height="20" uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement stretchType="ContainerHeight" x="110" y="0" width="120" height="20"
uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
@@ -294,8 +321,10 @@
<textFieldExpression><![CDATA[$F{quartier}==null ? "": $F{quartier}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="230" y="0" width="50" height="20" uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="230" y="0" width="50" height="20"
uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -310,8 +339,10 @@
<textFieldExpression><![CDATA[$F{q}==null ? "" : $F{q}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="280" y="0" width="40" height="20" uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="280" y="0" width="40" height="20"
uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -326,8 +357,10 @@
<textFieldExpression><![CDATA[$F{i} == null ? "" : $F{i}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="320" y="0" width="50" height="20" uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="320" y="0" width="50" height="20"
uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -342,8 +375,10 @@
<textFieldExpression><![CDATA[$F{p} == null ? "" : $F{p}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="370" y="0" width="60" height="20" uuid="5d6015a1-12af-4979-9b77-576cb6c99c05">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="370" y="0" width="60" height="20"
uuid="5d6015a1-12af-4979-9b77-576cb6c99c05">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -358,8 +393,10 @@
<textFieldExpression><![CDATA[$F{litige}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="114" height="20" uuid="5880e9de-e658-4cda-b737-0d1e791fff8c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="114" height="20"
uuid="5880e9de-e658-4cda-b737-0d1e791fff8c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -374,8 +411,10 @@
<textFieldExpression><![CDATA[$F{nature}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="544" y="0" width="156" height="20" uuid="34bb5d2b-4841-49b0-a7fa-83217ce30dda">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="544" y="0" width="156" height="20"
uuid="34bb5d2b-4841-49b0-a7fa-83217ce30dda">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -387,11 +426,14 @@
<font size="12"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{nomProprietaire} == null ? "" : $F{nomProprietaire}]]></textFieldExpression>
<textFieldExpression>
<![CDATA[$F{nomProprietaire} == null ? "" : $F{nomProprietaire}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20" uuid="beeb4530-5e7b-4759-a5ff-b8f2a4115d6d">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20"
uuid="beeb4530-5e7b-4759-a5ff-b8f2a4115d6d">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>

View File

@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="listBlocParStructure" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="60393fd8-8f4e-44f7-8418-0139271081b1">
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="listBlocParStructure" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802"
leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"
uuid="60393fd8-8f4e-44f7-8418-0139271081b1">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
@@ -55,8 +60,10 @@
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<reportElement mode="Opaque" x="0" y="0" width="70" height="20" backcolor="#E6E3E3"
uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -71,8 +78,10 @@
<text><![CDATA[NUP Provisoire]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="200" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="200" y="0" width="70" height="20" backcolor="#E6E3E3"
uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -87,8 +96,10 @@
<text><![CDATA[Commune]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="270" y="0" width="80" height="20" backcolor="#E6E3E3" uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="270" y="0" width="80" height="20" backcolor="#E6E3E3"
uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -104,8 +115,10 @@
<text><![CDATA[Arrondissement]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="350" y="0" width="80" height="20" backcolor="#E6E3E3" uuid="86774042-75a8-480b-8cee-b051aaf448f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="350" y="0" width="80" height="20" backcolor="#E6E3E3"
uuid="86774042-75a8-480b-8cee-b051aaf448f3">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -121,8 +134,10 @@
<text><![CDATA[Bloc]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="430" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="c083896b-34f1-4034-8422-171bac20fa8b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement mode="Opaque" x="430" y="0" width="70" height="20" backcolor="#E6E3E3"
uuid="c083896b-34f1-4034-8422-171bac20fa8b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -138,8 +153,10 @@
<text><![CDATA[Structure]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="140" y="0" width="60" height="20" backcolor="#E6E3E3" uuid="43fae784-98c5-4c75-bb0a-11f364bce22f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="140" y="0" width="60" height="20" backcolor="#E6E3E3"
uuid="43fae784-98c5-4c75-bb0a-11f364bce22f">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -154,8 +171,10 @@
<text><![CDATA[Litige]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="70" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="6fb97069-4150-4b4d-a7e4-110f7275e530">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="70" y="0" width="70" height="20" backcolor="#E6E3E3"
uuid="6fb97069-4150-4b4d-a7e4-110f7275e530">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -170,8 +189,10 @@
<text><![CDATA[Nature Domaine]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="590" y="0" width="110" height="20" backcolor="#E6E3E3" uuid="b609f024-82e7-491d-8558-ad6010c18cb6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="590" y="0" width="110" height="20" backcolor="#E6E3E3"
uuid="b609f024-82e7-491d-8558-ad6010c18cb6">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -186,8 +207,10 @@
<text><![CDATA[Nom Propriétaire]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3" uuid="4f3d245d-16c5-4992-81b9-f7de8d10ed45">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3"
uuid="4f3d245d-16c5-4992-81b9-f7de8d10ed45">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -202,8 +225,10 @@
<text><![CDATA[Statut]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="500" y="0" width="90" height="20" backcolor="#E6E3E3" uuid="3a10eece-e81b-408b-b680-d7f31c9931a1">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement mode="Opaque" x="500" y="0" width="90" height="20" backcolor="#E6E3E3"
uuid="3a10eece-e81b-408b-b680-d7f31c9931a1">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -222,8 +247,10 @@
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="70" height="20" uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="70" height="20"
uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -238,8 +265,10 @@
<textFieldExpression><![CDATA[$F{nupprovisoire}==null ? "" : $F{nupprovisoire}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ContainerHeight" x="200" y="0" width="70" height="20" uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<reportElement stretchType="ContainerHeight" x="200" y="0" width="70" height="20"
uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
@@ -255,8 +284,10 @@
<textFieldExpression><![CDATA[$F{communenom}==null ? "": $F{communenom}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="270" y="0" width="80" height="20" uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="270" y="0" width="80" height="20"
uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -268,11 +299,14 @@
<font size="8"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{arrondissementnom}==null ? "" : $F{arrondissementnom}]]></textFieldExpression>
<textFieldExpression>
<![CDATA[$F{arrondissementnom}==null ? "" : $F{arrondissementnom}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="350" y="0" width="80" height="20" uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="350" y="0" width="80" height="20"
uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -287,8 +321,10 @@
<textFieldExpression><![CDATA[$F{blocnom} == null ? "" : $F{blocnom}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="70" height="20" uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="70" height="20"
uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -303,8 +339,10 @@
<textFieldExpression><![CDATA[$F{structurenom}== null ? "" : $F{structurenom}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="140" y="0" width="60" height="20" uuid="5d6015a1-12af-4979-9b77-576cb6c99c05">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="140" y="0" width="60" height="20"
uuid="5d6015a1-12af-4979-9b77-576cb6c99c05">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -319,8 +357,10 @@
<textFieldExpression><![CDATA[$F{litige}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="70" y="0" width="70" height="20" uuid="5880e9de-e658-4cda-b737-0d1e791fff8c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="70" y="0" width="70" height="20"
uuid="5880e9de-e658-4cda-b737-0d1e791fff8c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -335,8 +375,10 @@
<textFieldExpression><![CDATA[$F{naturedomaine}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="590" y="0" width="110" height="20" uuid="34bb5d2b-4841-49b0-a7fa-83217ce30dda">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="590" y="0" width="110" height="20"
uuid="34bb5d2b-4841-49b0-a7fa-83217ce30dda">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -351,8 +393,10 @@
<textFieldExpression><![CDATA[$F{prenomraisonsociale} +" "+ $F{nomsigle}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20" uuid="beeb4530-5e7b-4759-a5ff-b8f2a4115d6d">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20"
uuid="beeb4530-5e7b-4759-a5ff-b8f2a4115d6d">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>
@@ -364,11 +408,14 @@
<font size="8"/>
<paragraph leftIndent="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{statusenquete} == null ? "" : $F{statusenquete}]]></textFieldExpression>
<textFieldExpression>
<![CDATA[$F{statusenquete} == null ? "" : $F{statusenquete}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="ElementGroupHeight" x="500" y="0" width="90" height="20" uuid="28eac03c-0024-4451-9e95-b755a6cb6cb7">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<reportElement stretchType="ElementGroupHeight" x="500" y="0" width="90" height="20"
uuid="28eac03c-0024-4451-9e95-b755a6cb6cb7">
<property name="com.jaspersoft.studio.spreadsheet.connectionID"
value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
</reportElement>
<box>

View File

@@ -98,7 +98,6 @@
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>

View File

@@ -37,7 +37,6 @@ public class DataLoadConfig {
}
public void loadRoles() {
if (roleRepository.count() > 0) return;

View File

@@ -9,7 +9,10 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@@ -18,6 +21,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
public class ApplicationConfig {
private final CustomUserDetailsService customUserDetailsService;
private final UserDetailsService userDetailsService;
@Bean
public AuthenticationProvider authenticationProvider() {
@@ -37,13 +41,27 @@ public class ApplicationConfig {
return new JwtAuthenticationFilter();
}
@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
return config.getAuthenticationManager();
}
// @Bean
// public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
// return config.getAuthenticationManager();
// }
@Bean
public ModelMapper modelMapper() {
return new ModelMapper();
}
@Bean
public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
daoAuthenticationProvider.setUserDetailsService(customUserDetailsService);
daoAuthenticationProvider.setPasswordEncoder(passwordEncoder());
AuthenticationManagerBuilder authenticationManagerBuilder =
http.getSharedObject(AuthenticationManagerBuilder.class);
authenticationManagerBuilder.authenticationProvider(daoAuthenticationProvider);
return authenticationManagerBuilder.build();
}
}

View File

@@ -9,8 +9,7 @@ import javax.sql.DataSource;
@Configuration
public class JdbcConfig {
@Bean
public JdbcTemplate jdbcTemplate(DataSource dataSource)
{
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
}

View File

@@ -55,6 +55,7 @@ public class SpringSecurityConfig {
// .csrf(csrf -> {
// csrf.ignoringRequestMatchers("/api/**");
// })
.exceptionHandling(ex -> ex.authenticationEntryPoint(jwtAuthenticationEntryPoint))
.authorizeHttpRequests(req ->
req
//.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
@@ -65,10 +66,11 @@ public class SpringSecurityConfig {
.authenticationProvider(authenticationProvider)
.sessionManagement(session -> session.sessionCreationPolicy(STATELESS))
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
.exceptionHandling(ex -> ex.authenticationEntryPoint(jwtAuthenticationEntryPoint))
;
return http.build();
}
}

View File

@@ -84,7 +84,6 @@ public class SwaggerOAS3Config {
}
@Bean
public GroupedOpenApi infocadMetierApi() {
return GroupedOpenApi.builder()

View File

@@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRSaver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -23,6 +25,8 @@ public class OpenController {
@Value("${file.jasper-reports}")
private String jaspersDir;
private static final Logger logger = LoggerFactory.getLogger(OpenController.class);
@GetMapping("/compile-report")
public ResponseEntity<?> compile(@RequestParam String jrxmlFileName) {
try {
@@ -43,5 +47,4 @@ public class OpenController {
}
}

View File

@@ -2,13 +2,15 @@ package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.entities.decoupage.Arrondissement;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.ArrondissementService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -16,7 +18,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
public class ArrondissementController {
private final ArrondissementService arrondissementService;
private static final Logger logger = LoggerFactory.getLogger(ArrondissementController.class);
public ArrondissementController(ArrondissementService arrondissementService) {
this.arrondissementService = arrondissementService;
@@ -47,11 +50,19 @@ public class ArrondissementController {
new ApiResponse<>(true, arrondissement, "Arrondissement créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,11 +80,19 @@ public class ArrondissementController {
new ApiResponse<>(true, arrondissementService.updateArrondissement(id, arrondissement), "Arrondissement mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -85,52 +104,115 @@ public class ArrondissementController {
new ApiResponse<>(true, "Arrondissement supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllArrondissementList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, arrondissementService.getArrondissementList(), "Liste des arrondissements chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllArrondissementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, arrondissementService.getArrondissementList(pageable), "Liste des arrondissements chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, arrondissementService.getArrondissementById(id), "Arrondissement trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/commune/{communeId}")
public ResponseEntity<?> getArrondissementByCommune(@PathVariable Long communeId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, arrondissementService.getArrondissementByComune(communeId), "Liste des arrondissements par commune chargée avec succès."),
HttpStatus.OK
);
}catch (NotFoundException e){
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,12 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.entities.decoupage.Commune;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.CommuneService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -15,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -27,6 +29,8 @@ public class CommuneController {
private final CommuneService communeService;
private static final Logger logger = LoggerFactory.getLogger(CommuneController.class);
public CommuneController(CommuneService communeService) {
this.communeService = communeService;
}
@@ -39,11 +43,19 @@ public class CommuneController {
new ApiResponse<>(true, commune, "Commune créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -54,11 +66,19 @@ public class CommuneController {
new ApiResponse<>(true, communeService.updateCommune(id, commune), "Commune mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -70,37 +90,92 @@ public class CommuneController {
new ApiResponse<>(true, "Commune supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllCommuneList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, communeService.getCommuneList(), "Liste des communes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllCommunePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, communeService.getCommuneList(pageable), "Liste des communes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getCommuneById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, communeService.getCommuneById(id), "Commune trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/departement/{departementId}")
@@ -111,11 +186,19 @@ public class CommuneController {
new ApiResponse<>(true, communeService.getCommunesByDepartement(departementId), "Liste des communes par département chargée avec succès."),
HttpStatus.OK
);
}catch (NotFoundException e){
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.entities.decoupage.Departement;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.DepartementService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class DepartementController {
private final DepartementService departementService;
private static final Logger logger = LoggerFactory.getLogger(DepartementController.class);
public DepartementController(DepartementService departementService) {
this.departementService = departementService;
@@ -38,11 +42,19 @@ public class DepartementController {
new ApiResponse<>(true, departement, "Departement créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class DepartementController {
new ApiResponse<>(true, departementService.updateDepartement(id, departement), "Département mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,91 @@ public class DepartementController {
new ApiResponse<>(true, "Département supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllDepartementList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, departementService.getDepartementList(), "Liste des département chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllDepartementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, departementService.getDepartementList(pageable), "Liste des département chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getDepartementById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, departementService.getDepartementById(id), "Département trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.entities.decoupage.Nationalite;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.NationaliteService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class NationaliteController {
private final NationaliteService nationaliteService;
private static final Logger logger = LoggerFactory.getLogger(NationaliteController.class);
public NationaliteController(NationaliteService nationaliteService) {
this.nationaliteService = nationaliteService;
@@ -38,11 +42,19 @@ public class NationaliteController {
new ApiResponse<>(true, nationalite, "Nationalite créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class NationaliteController {
new ApiResponse<>(true, nationaliteService.updateNationalite(id, nationalite), "Nationalités mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,90 @@ public class NationaliteController {
new ApiResponse<>(true, "Nationalités supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllNationaliteList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, nationaliteService.getNationaliteList(), "Liste des nationalités chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllNationalitePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, nationaliteService.getNationaliteList(pageable), "Liste des nationalités chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getNationaliteById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, nationaliteService.getNationaliteById(id), "Nationalités trouvées avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,12 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.entities.decoupage.Quartier;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.QuartierService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -15,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class QuartierController {
private final QuartierService quartierService;
private static final Logger logger = LoggerFactory.getLogger(QuartierController.class);
public QuartierController(QuartierService quartierService) {
this.quartierService = quartierService;
@@ -38,11 +42,19 @@ public class QuartierController {
new ApiResponse<>(true, quartier, "Quartier créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class QuartierController {
new ApiResponse<>(true, quartierService.updateQuartier(id, quartier), "Quartier mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,37 +89,90 @@ public class QuartierController {
new ApiResponse<>(true, "Quartier supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllQuartierList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, quartierService.getQuartierList(), "Liste des quartiers chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllQuartierPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, quartierService.getQuartierList(pageable), "Liste des quartiers chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getQuartierById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, quartierService.getQuartierById(id), "Quartier trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/arrondissement/{arrondissementId}")
@@ -110,11 +183,19 @@ public class QuartierController {
new ApiResponse<>(true, quartierService.getQuartierByArrondissement(arrondissementId), "Liste des quartiers par commune chargée avec succès."),
HttpStatus.OK
);
}catch (NotFoundException e){
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -1,12 +1,15 @@
package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.entities.decoupage.Secteur;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.SecteurPayload;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -23,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
public class SecteurController {
private final SecteurService secteurService;
private static final Logger logger = LoggerFactory.getLogger(SecteurController.class);
public SecteurController(SecteurService secteurService) {
this.secteurService = secteurService;
@@ -38,16 +43,23 @@ public class SecteurController {
new ApiResponse<>(true, secteur, "Secteur créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PutMapping("/update/{id}")
public ResponseEntity<?> updateSecteur(@PathVariable Long id, @RequestBody SecteurPayload secteurPayload) {
try {
@@ -55,11 +67,19 @@ public class SecteurController {
new ApiResponse<>(true, secteurService.updateSecteur(id, secteurPayload), "Secteur mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -71,46 +91,114 @@ public class SecteurController {
new ApiResponse<>(true, "Secteur supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllSecteurList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurList(), "Liste des secteurs chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllSecteurPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurList(pageable), "Liste des secteurs chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getSecteurById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurById(id), "Secteur trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/by-structure-id/{structureId}")
public ResponseEntity<?> getSecteurByStructureId(@PathVariable Long structureId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurById(structureId), "Secteur trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}

View File

@@ -1,11 +1,14 @@
package io.gmss.fiscad.controllers.decoupage;
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -13,6 +16,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -22,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
public class SecteurDecoupageController {
private final SecteurDecoupageService secteurDecoupageService;
private static final Logger logger = LoggerFactory.getLogger(SecteurDecoupageController.class);
public SecteurDecoupageController(SecteurDecoupageService secteurDecoupageService) {
this.secteurDecoupageService = secteurDecoupageService;
@@ -36,11 +41,19 @@ public class SecteurDecoupageController {
new ApiResponse<>(true, secteurDecoupage, "SecteurDecoupage créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -51,11 +64,19 @@ public class SecteurDecoupageController {
new ApiResponse<>(true, secteurDecoupageService.updateSecteurDecoupage(id, secteurDecoupage), "SecteurDecoupage mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -67,37 +88,90 @@ public class SecteurDecoupageController {
new ApiResponse<>(true, "Secteur découpage supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllSecteurDecoupageList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(), "Liste des secteurDecoupages chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllSecteurDecoupagePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(pageable), "Liste des secteurDecoupages chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getSecteurDecoupageById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageById(id), "SecteurDecoupage trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}

View File

@@ -1,13 +1,17 @@
package io.gmss.fiscad.controllers.infocad.metier;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.metier.ActeurConcerneService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@RequestMapping(value = "api/acteur-concerne", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -18,6 +22,8 @@ public class ActeurConcerneController {
private final ActeurConcerneService acteurConcerneService;
private static final Logger logger = LoggerFactory.getLogger(ActeurConcerneController.class);
public ActeurConcerneController(ActeurConcerneService acteurConcerneService) {
this.acteurConcerneService = acteurConcerneService;
}
@@ -25,10 +31,25 @@ public class ActeurConcerneController {
@GetMapping("/id/{id}")
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, acteurConcerneService.getActeurConcerneById(id).get(), "Arrondissement trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,6 +2,7 @@ package io.gmss.fiscad.controllers.infocad.metier;
import io.gmss.fiscad.entities.infocad.metier.Commentaire;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.metier.CommentaireService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.CommentaireRequest;
@@ -9,11 +10,14 @@ import io.gmss.fiscad.paylaods.request.SyncCommentaireRequest;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
import java.time.LocalDateTime;
import java.util.List;
@@ -27,6 +31,8 @@ public class CommentaireController {
private final CommentaireService commentaireService;
private static final Logger logger = LoggerFactory.getLogger(CommentaireController.class);
public CommentaireController(CommentaireService commentaireService) {
this.commentaireService = commentaireService;
}
@@ -41,11 +47,19 @@ public class CommentaireController {
new ApiResponse<>(true, commentaire, "Commentaire créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -56,11 +70,19 @@ public class CommentaireController {
new ApiResponse<>(true, commentaireService.updateCommentaire(id, commentaire), "commentaire mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -72,89 +94,232 @@ public class CommentaireController {
new ApiResponse<>(true, "Commentaire supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllcommentaireList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.getCommentaireList(), "Liste des commentaires chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getcommentaireById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.getCommentaireById(id), "commentaire trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/nup/{nup}")
public ResponseEntity<?> getcommentaireByNup(@PathVariable String nup) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.getCommentaireByNup(nup), "commentaire trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/enquete")
public ResponseEntity<?> getcommentaireByEnquete(@RequestBody Commentaire commentaire) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndTerminal(commentaire.getIdEnquete(), commentaire.getTerminalId()), "Liste des commentaires chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/enquete-and-state")
//@ApiOperation(value = "Cette ressource permet d'avoir la liste de tous les commentaires d'une enquête avec le statut (lu ou non lu). Les champs a renseigner pour le payload sont idEnquete et lu")
public ResponseEntity<?> getcommentaireByEnqueteAndStatut(@RequestBody Commentaire commentaire) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndLu(commentaire.getIdEnquete(), commentaire.isLu()), "Liste des commentaires chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/all-by-params")
//@ApiOperation(value = "Cette ressource permet d'avoir 4 résultats différents. \n 1 - Liste des commentaires non lus provenant du Web. \n 2 - Liste des commentaires lus provenant du Web \n 3 - Liste des commentaires non lus provenant du mobile. \n 4 - Liste des commentaires lus provenant du mobile. \n A savoir : Les variables Origine et lu sont à varier pour avoir le résultat")
public ResponseEntity<?> getcommentaireByParams(@RequestBody CommentaireRequest commentaireRequest) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateReadAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isLu(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("synchronise/from-mobile")
//@ApiOperation(value = "Cette ressource permet de synchroniser tous les commentaires effectués sur le mobile vers le backend.")
public ResponseEntity<?> synchroniseCommentairesFromMobile(@RequestBody List<Commentaire> commentaires) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.saveAllCommentairesFromMobile(commentaires), "Liste des commentaires synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("synchronise/from-web")
//@ApiOperation(value = "Cette ressource permet d'avoir 4 résultats différents. \n 1 - Liste des commentaires non synchronisés provenant du Web. \n 2 - Liste des commentaires synchronisés provenant du Web \n 3 - Liste des commentaires non synchronisés provenant du mobile. \n 4 - Liste des commentaires synchronisés provenant du mobile. \n A savoir : Les variables Origine et Synchronise sont à varier pour avoir le résultat")
public ResponseEntity<?> synchroniseCommentairesFromWeb(@RequestBody CommentaireRequest commentaireRequest) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateSynchronizedAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isSynchronise(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("synchronise/notify-done-from-mobile")
//@ApiOperation(value = "Cette ressource permet matérialiser coté backend les commentaires du WEB déjà synchronisé avec le MOBILE pour que les prochaines extractions ne prennent pas en compte cela. ")
public ResponseEntity<?> notifyDoneSynchronizedFromMobile(@RequestBody List<SyncCommentaireRequest> syncCommentaireRequests) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, commentaireService.notifySynchronizedDoneFromMobile(syncCommentaireRequests), "Synchronisation terminée."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -1,5 +1,6 @@
package io.gmss.fiscad.controllers.infocad.metier;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.EnquetePayLoad;
@@ -8,6 +9,8 @@ import io.gmss.fiscad.paylaods.request.FiltreEnquetePayLoad;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -15,6 +18,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
import java.util.List;
@@ -27,6 +31,8 @@ public class EnqueteController {
private final EnqueteService enqueteService;
private static final Logger logger = LoggerFactory.getLogger(EnqueteController.class);
public EnqueteController(EnqueteService enqueteService) {
this.enqueteService = enqueteService;
}
@@ -56,11 +62,19 @@ public class EnqueteController {
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoad), "Validation effectuée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -71,11 +85,19 @@ public class EnqueteController {
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -86,11 +108,19 @@ public class EnqueteController {
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoads), "Validation effectuée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false,"Impossible de valider l'enquête : " + e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -101,20 +131,43 @@ public class EnqueteController {
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectuée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all/decoupage-admin-for-enquete")
public ResponseEntity<?> getAllByEnqueteDecoupageAdmin() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getDecoupageAdminUserConnecterAndStat(), "Liste des enquetes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -126,69 +179,182 @@ public class EnqueteController {
new ApiResponse<>(true, "enquete supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllStructureList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getEnqueteList(), "Liste des enquetes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all/com-arrond-bloc")
public ResponseEntity<?> getAllByCommuneArrondBloc() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBloc(), "Liste des enquetes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/all/com-arrond-bloc/filtre")
public ResponseEntity<?> getAllByCommuneArrondBlocFiltre(@RequestBody FiltreEnquetePayLoad filtreEnquetePayLoad) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBlocFiltre(filtreEnquetePayLoad), "Liste des enquetes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllEnquetePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getEnqueteList(pageable), "Liste des enquetes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/fiche/id/{id}")
public ResponseEntity<?> getFicheEnqueteById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getFicheEnquete(id), "enquete trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getEnqueteById(id), "enquete trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/traiter-non-synch-to-mobile/{terminalId}")
public ResponseEntity<?> getEnqueteValideNonSynch(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteService.getEnqueteValideNonSynch(terminalId), "Liste des enquetes traitées non synchronisées sur le termianl."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.metier;
import io.gmss.fiscad.entities.infocad.metier.Tpe;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.metier.TpeService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class TpeController {
private final TpeService tpeService;
private static final Logger logger = LoggerFactory.getLogger(TpeController.class);
public TpeController(TpeService tpeService) {
this.tpeService = tpeService;
@@ -37,11 +42,19 @@ public class TpeController {
new ApiResponse<>(true, tpe, "Tpe créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +65,19 @@ public class TpeController {
new ApiResponse<>(true, tpeService.updateTpe(id, tpe), "Tpe mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,61 +89,159 @@ public class TpeController {
new ApiResponse<>(true, "Tpe supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllTpeList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, tpeService.getTpeList(), "Liste des tpe chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-by-model/{model}")
public ResponseEntity<?> getAllTpeListByModel(@PathVariable String model) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, tpeService.getTpeListByModel(model), "Liste des tpe chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-by-userId/{userId}")
public ResponseEntity<?> getAllTpeListByUserId(@PathVariable Long userId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, tpeService.getTpeListByUserId(userId), "Liste des tpe de l'utilisateurs."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllTpePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, tpeService.getTpeList(pageable), "Liste des tpe chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getTpeById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, tpeService.getTpeById(id), "Tpe trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/identifier/{identifier}")
public ResponseEntity<?> getTpeByIdentifier(@PathVariable String identifier) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, tpeService.getTepByIdentifier(identifier), "Tpe trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -44,7 +44,6 @@ public class UploadController {
private UploadRepository uploadRepository;
@Autowired
private FileStorageService fileStorageService;
@@ -55,9 +54,6 @@ public class UploadController {
// private ActeurRepository proprietaireRepository;
private int firstLineColumnNumber = 0;
private String fileHeader;
private String fileHeaderType;
@@ -65,14 +61,10 @@ public class UploadController {
private int indiceOfFile = 0;
private SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMDD");
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYYMMDD");
@GetMapping("/all")
public ResponseEntity<?> all() {
try {
@@ -114,8 +106,6 @@ public class UploadController {
// }
@GetMapping("/id/{id}")
public ResponseEntity<?> one(@PathVariable Long id) {
@@ -137,7 +127,6 @@ public class UploadController {
}
/**
* @param fileName
* @param request
@@ -201,8 +190,6 @@ public class UploadController {
}
@DeleteMapping("/delete/id/{id}")
public ResponseEntity<?> delete(@PathVariable Long id) {
try {

View File

@@ -2,13 +2,15 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.BlocService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.security.CurrentUser;
import io.gmss.fiscad.security.UserPrincipal;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -16,7 +18,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
public class BlocController {
private final BlocService blocService;
private static final Logger logger = LoggerFactory.getLogger(BlocController.class);
public BlocController(BlocService blocService) {
this.blocService = blocService;
@@ -40,11 +43,19 @@ public class BlocController {
new ApiResponse<>(true, bloc, "Bloc créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -55,11 +66,19 @@ public class BlocController {
new ApiResponse<>(true, blocService.updateBloc(id, bloc), "Bloc mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -71,62 +90,165 @@ public class BlocController {
new ApiResponse<>(true, "Bloc supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllBlocList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, blocService.getBlocList(), "Liste des blocs chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/list-by-arrondissement")
public ResponseEntity<?> getAllBlocListByArrondissement(@RequestParam Long idArrondissement) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, blocService.getBlocsByArrondissement(idArrondissement), "Liste des blocs chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/list-by-structure")
public ResponseEntity<?> getAllBlocListByStructure(@RequestParam Long idStructure) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, blocService.getBlocsByStructure(idStructure), "Liste des blocs chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/list-by-secteur")
@Tag(name = "Liste blocs", description = "Liste des blocs d'un secteur")
public ResponseEntity<?> getAllBlocListBySecteur(@RequestParam Long idSecteur) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, blocService.getBlocsBySecteur(idSecteur), "Liste des blocs chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllBlocPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, blocService.getBlocList(pageable), "Liste des blocs chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getBlocById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, blocService.getBlocById(id), "Bloc trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.ModeAcquisitionService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -26,6 +29,8 @@ public class ModeAcquisitionController {
private final ModeAcquisitionService modeAcquisitionService;
private static final Logger logger = LoggerFactory.getLogger(ModeAcquisitionController.class);
public ModeAcquisitionController(ModeAcquisitionService modeAcquisitionService) {
this.modeAcquisitionService = modeAcquisitionService;
}
@@ -38,11 +43,19 @@ public class ModeAcquisitionController {
new ApiResponse<>(true, modeAcquisition, "Mode acquisition créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +66,19 @@ public class ModeAcquisitionController {
new ApiResponse<>(true, modeAcquisitionService.updateModeAcquisition(id, modeAcquisition), "Mode d'acquisition mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +90,89 @@ public class ModeAcquisitionController {
new ApiResponse<>(true, "Mode d'acquisition supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllModeAcquisitionList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(), "Liste des modes d'acquisitions chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllModeAcquisitionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(pageable), "Liste des modes d'acquisitions chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getModeAcquisitionById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionById(id), "Mode d'acquisition trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.NatureDomaineService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class NatureDomaineController {
private final NatureDomaineService natureDomaineService;
private static final Logger logger = LoggerFactory.getLogger(NatureDomaineController.class);
public NatureDomaineController(NatureDomaineService natureDomaineService) {
this.natureDomaineService = natureDomaineService;
@@ -38,11 +42,19 @@ public class NatureDomaineController {
new ApiResponse<>(true, natureDomaine, "Nature Domaine créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class NatureDomaineController {
new ApiResponse<>(true, natureDomaineService.updateNatureDomaine(id, natureDomaine), "Nature Domaine mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,89 @@ public class NatureDomaineController {
new ApiResponse<>(true, "Nature Domaine supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllNatureDomaineList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(), "Liste des natures de domaine chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllNatureDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(pageable), "Liste des natures de domaine chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getNatureDomaineById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, natureDomaineService.getNatureDomaineById(id), "Nature Domaine trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.PositionRepresentation;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.PositionRepresentationService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class PositionRepresentationController {
private final PositionRepresentationService positionRepresentationService;
private static final Logger logger = LoggerFactory.getLogger(PositionRepresentationController.class);
public PositionRepresentationController(PositionRepresentationService positionRepresentationService) {
this.positionRepresentationService = positionRepresentationService;
@@ -37,11 +42,19 @@ public class PositionRepresentationController {
new ApiResponse<>(true, positionRepresentation, "Position de representation créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +65,19 @@ public class PositionRepresentationController {
new ApiResponse<>(true, positionRepresentationService.updatePositionRepresentation(id, positionRepresentation), "Position de representation mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +89,91 @@ public class PositionRepresentationController {
new ApiResponse<>(true, "Position de representation supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllPositionRepresentationList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(), "Liste des positions de representation chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllPositionRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(pageable), "Liste des positions de representation chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getPositionRepresentationById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationById(id), "Position de representation trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.Profession;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.ProfessionService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +29,8 @@ public class ProfessionController {
private final ProfessionService professionService;
private static final Logger logger = LoggerFactory.getLogger(ProfessionController.class);
public ProfessionController(ProfessionService professionService) {
this.professionService = professionService;
}
@@ -37,11 +43,19 @@ public class ProfessionController {
new ApiResponse<>(true, profession, "Profession créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +66,19 @@ public class ProfessionController {
new ApiResponse<>(true, professionService.updateProfession(id, profession), "Profession mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +90,91 @@ public class ProfessionController {
new ApiResponse<>(true, "Profession supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllProfessionList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, professionService.getProfessionList(), "Liste des professions chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllProfessionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, professionService.getProfessionList(pageable), "Liste des professions chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getProfessionById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, professionService.getProfessionById(id), "Profession trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.SituationGeographique;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.SituationGeographiqueService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class SituationGeographiqueController {
private final SituationGeographiqueService situationGeographiqueService;
private static final Logger logger = LoggerFactory.getLogger(SituationGeographiqueController.class);
public SituationGeographiqueController(SituationGeographiqueService situationGeographiqueService) {
this.situationGeographiqueService = situationGeographiqueService;
@@ -37,11 +42,19 @@ public class SituationGeographiqueController {
new ApiResponse<>(true, situationGeographique, "Situation géographique créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +65,19 @@ public class SituationGeographiqueController {
new ApiResponse<>(true, situationGeographiqueService.updateSituationGeographique(id, situationGeographique), "Situation géographique mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +89,89 @@ public class SituationGeographiqueController {
new ApiResponse<>(true, "Situation géographique supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllSituationGeographiqueList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(), "Liste des situations géographiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllSituationGeographiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(pageable), "Liste des situations géographiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getSituationGeographiqueById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueById(id), "Situation géographique trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.SituationMatrimoniale;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.SituationMatrimonialeService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class SituationMatrimonialeController {
private final SituationMatrimonialeService situationMatrimonialeService;
private static final Logger logger = LoggerFactory.getLogger(SituationMatrimonialeController.class);
public SituationMatrimonialeController(SituationMatrimonialeService situationMatrimonialeService) {
this.situationMatrimonialeService = situationMatrimonialeService;
@@ -37,11 +42,19 @@ public class SituationMatrimonialeController {
new ApiResponse<>(true, situationMatrimoniale, "Situation matrimoniale créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +65,19 @@ public class SituationMatrimonialeController {
new ApiResponse<>(true, situationMatrimonialeService.updateSituationMatrimoniale(id, situationMatrimoniale), "Situation matrimoniale mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +89,89 @@ public class SituationMatrimonialeController {
new ApiResponse<>(true, "Situation matrimoniale supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllSituationMatrimonialeList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(), "Liste des situations matrimoniales chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllSituationMatrimonialePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(pageable), "Liste des situations matrimoniales chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getSituationMatrimonialeById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeById(id), "Situation matrimoniale trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.SourceDroit;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.SourceDroitService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class SourceDroitController {
private final SourceDroitService sourceDroitService;
private static final Logger logger = LoggerFactory.getLogger(SourceDroitController.class);
public SourceDroitController(SourceDroitService sourceDroitService) {
this.sourceDroitService = sourceDroitService;
@@ -37,11 +42,19 @@ public class SourceDroitController {
new ApiResponse<>(true, sourceDroit, "Source de droit créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +65,19 @@ public class SourceDroitController {
new ApiResponse<>(true, sourceDroitService.updateSourceDroit(id, sourceDroit), "Source de droit mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +89,89 @@ public class SourceDroitController {
new ApiResponse<>(true, "Source de droit supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllSourceDroitList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(), "Liste des sources de droit chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllSourceDroitPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(pageable), "Liste des sources de droit chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getSourceDroitById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, sourceDroitService.getSourceDroitById(id), "Source de droit trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,12 +2,15 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.Structure;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.decoupage.ArrondissementService;
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -15,6 +18,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -26,6 +30,7 @@ public class StructureController {
private final StructureService structureService;
private final ArrondissementService arrondissementService;
private static final Logger logger = LoggerFactory.getLogger(StructureController.class);
public StructureController(StructureService structureService, ArrondissementService arrondissementService) {
this.structureService = structureService;
@@ -40,11 +45,19 @@ public class StructureController {
new ApiResponse<>(true, structure, "Structure créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -55,11 +68,19 @@ public class StructureController {
new ApiResponse<>(true, structureService.updateStructure(id, structure), "Structure mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -71,26 +92,49 @@ public class StructureController {
new ApiResponse<>(true, "Structure supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllStructureList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.getStructureList(), "Liste des structures chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-by-arrondissement")
public ResponseEntity<?> getAllStructureListByArrondissement(@RequestParam Long arrondissementId) {
try {
if (arrondissementService.getArrondissementById(arrondissementId).isPresent()) {
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.getStructuresByArrondissement(arrondissementId), "Liste des structures chargée avec succès."),
@@ -102,22 +146,67 @@ public class StructureController {
HttpStatus.OK
);
}
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllStructurePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.getStructureList(pageable), "Liste des structures chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, structureService.getStructureById(id), "Structure trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.TypeContestation;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.TypeContestationService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class TypeContestationController {
private final TypeContestationService typeContestationService;
private static final Logger logger = LoggerFactory.getLogger(TypeContestationController.class);
public TypeContestationController(TypeContestationService typeContestationService) {
this.typeContestationService = typeContestationService;
@@ -37,11 +42,19 @@ public class TypeContestationController {
new ApiResponse<>(true, typeContestation, "Type de contestation créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +65,19 @@ public class TypeContestationController {
new ApiResponse<>(true, typeContestationService.updateTypeContestation(id, typeContestation), "Type de contestation mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +89,89 @@ public class TypeContestationController {
new ApiResponse<>(true, "Type de contestation supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllTypeContestationList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeContestationService.getTypeContestationList(), "Liste des types de contestation chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllTypeContestationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, typeContestationService.getTypeContestationList(pageable), "Liste des types de contestation chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getTypeContestationById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeContestationService.getTypeContestationById(id), "Type de contestation trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.TypeDomaine;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.TypeDomaineService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class TypeDomaineController {
private final TypeDomaineService typeDomaineService;
private static final Logger logger = LoggerFactory.getLogger(TypeDomaineController.class);
public TypeDomaineController(TypeDomaineService typeDomaineService) {
this.typeDomaineService = typeDomaineService;
@@ -37,11 +42,19 @@ public class TypeDomaineController {
new ApiResponse<>(true, typeDomaine, "Type de domaine créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +65,19 @@ public class TypeDomaineController {
new ApiResponse<>(true, typeDomaineService.updateTypeDomaine(id, typeDomaine), "Type de domaine mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +89,89 @@ public class TypeDomaineController {
new ApiResponse<>(true, "Type de domaine supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllTypeDomaineList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(), "Liste des types de domaine chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllTypeDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(pageable), "Liste des types de domaine chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getTypeDomaineById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeDomaineService.getTypeDomaineById(id), "Type de domaine trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.TypePersonne;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.TypePersonneService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class TypePersonneController {
private final TypePersonneService typePersonneService;
private static final Logger logger = LoggerFactory.getLogger(TypePersonneController.class);
public TypePersonneController(TypePersonneService typePersonneService) {
this.typePersonneService = typePersonneService;
@@ -38,11 +42,19 @@ public class TypePersonneController {
new ApiResponse<>(true, typePersonne, "Type de personne créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class TypePersonneController {
new ApiResponse<>(true, typePersonneService.updateTypePersonne(id, typePersonne), "Type de personne mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,89 @@ public class TypePersonneController {
new ApiResponse<>(true, "Type de personne supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllTypePersonneList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typePersonneService.getTypePersonneList(), "Liste des types de personne chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllTypePersonnePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, typePersonneService.getTypePersonneList(pageable), "Liste des types de personne chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getTypePersonneById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typePersonneService.getTypePersonneById(id), "Type de personne trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.TypePiece;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.TypePieceService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class TypePieceController {
private final TypePieceService typePieceService;
private static final Logger logger = LoggerFactory.getLogger(TypePieceController.class);
public TypePieceController(TypePieceService typePieceService) {
this.typePieceService = typePieceService;
@@ -38,11 +42,19 @@ public class TypePieceController {
new ApiResponse<>(true, typePiece, "Type de piece créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class TypePieceController {
new ApiResponse<>(true, typePieceService.updateTypePiece(id, typePiece), "Type de piece mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,89 @@ public class TypePieceController {
new ApiResponse<>(true, "Type de piece supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllTypePieceList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typePieceService.getTypePieceList(), "Liste des types de piece chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllTypePiecePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, typePieceService.getTypePieceList(pageable), "Liste des types de piece chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getTypePieceById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typePieceService.getTypePieceById(id), "Type de piece trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
import io.gmss.fiscad.entities.infocad.parametre.TypeRepresentation;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.TypeRepresentationService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class TypeRepresentationController {
private final TypeRepresentationService typeRepresentationService;
private static final Logger logger = LoggerFactory.getLogger(TypeRepresentationController.class);
public TypeRepresentationController(TypeRepresentationService typeRepresentationService) {
this.typeRepresentationService = typeRepresentationService;
@@ -38,11 +42,19 @@ public class TypeRepresentationController {
new ApiResponse<>(true, typeRepresentation, "Type de representation créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class TypeRepresentationController {
new ApiResponse<>(true, typeRepresentationService.updateTypeRepresentation(id, typeRepresentation), "Type de representation mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,89 @@ public class TypeRepresentationController {
new ApiResponse<>(true, "Type de representation supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllTypeRepresentationList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(), "Liste des types de representation chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllTypeRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(pageable), "Liste des types de representation chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getTypeRepresentationById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationById(id), "Type de representation trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -4,6 +4,8 @@ import io.gmss.fiscad.interfaces.notification.EmailService;
import io.gmss.fiscad.paylaods.EmailDetails;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
public class EmailController {
private final EmailService emailService;
private static final Logger logger = LoggerFactory.getLogger(EmailController.class);
public EmailController(EmailService emailService) {
this.emailService = emailService;
@@ -22,16 +25,14 @@ public class EmailController {
// Sending a simple Email
@PostMapping("/sendMail")
public String sendMail(@RequestBody EmailDetails details)
{
public String sendMail(@RequestBody EmailDetails details) {
return emailService.sendSimpleMail(details);
}
// Sending email with attachment
@PostMapping("/sendMailWithAttachment")
public String sendMailWithAttachment(
@RequestBody EmailDetails details)
{
@RequestBody EmailDetails details) {
String status
= emailService.sendMailWithAttachment(details);

View File

@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
@CrossOrigin(origins = "*")
public class ReportingController {
private final ReportService reportService;
private final BlocRepository blocRepository;
private final StructureRepository structureRepository;
private static final Logger logger = LoggerFactory.getLogger(ReportingController.class);

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.Batiment;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.BatimentService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -26,6 +29,8 @@ public class BatimentController {
private final BatimentService batimentService;
private static final Logger logger = LoggerFactory.getLogger(BatimentController.class);
public BatimentController(BatimentService batimentService) {
this.batimentService = batimentService;
}
@@ -38,11 +43,19 @@ public class BatimentController {
new ApiResponse<>(true, batiment, "Batiment créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +66,19 @@ public class BatimentController {
new ApiResponse<>(true, batimentService.updateBatiment(id, batiment), "Batiment mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +90,89 @@ public class BatimentController {
new ApiResponse<>(true, "Batiment supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllBatimentList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, batimentService.getBatimentList(), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, batimentService.getBatimentList(pageable), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getBatimentById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, batimentService.getBatimentById(id), "Batiment trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueBatimentService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class CaracteristiqueBatimentController {
private final CaracteristiqueBatimentService caracteristiqueBatimentService;
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueBatimentController.class);
public CaracteristiqueBatimentController(CaracteristiqueBatimentService caracteristiqueBatimentService) {
this.caracteristiqueBatimentService = caracteristiqueBatimentService;
@@ -38,11 +42,19 @@ public class CaracteristiqueBatimentController {
new ApiResponse<>(true, caracteristiqueBatiment, "Caracteristique du batiment créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class CaracteristiqueBatimentController {
new ApiResponse<>(true, caracteristiqueBatimentService.updateCaracteristiqueBatiment(id, caracteristiqueBatiment), "Caracteristique du batiment mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,89 @@ public class CaracteristiqueBatimentController {
new ApiResponse<>(true, "CaracteristiqueBatiment supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllCaracteristiqueBatimentList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentList(), "Liste des Caracteristiques du batiment chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllCaracteristiqueBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentList(pageable), "Liste des Caracteristiques du batiment chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getCaracteristiqueBatimentById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentById(id), "Caracteristique du batiment trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueParcelleService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class CaracteristiqueParcelleController {
private final CaracteristiqueParcelleService caracteristiqueParcelleService;
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueParcelleController.class);
public CaracteristiqueParcelleController(CaracteristiqueParcelleService caracteristiqueParcelleService) {
this.caracteristiqueParcelleService = caracteristiqueParcelleService;
@@ -38,11 +42,19 @@ public class CaracteristiqueParcelleController {
new ApiResponse<>(true, caracteristiqueParcelle, "Caracteristique parcelle créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class CaracteristiqueParcelleController {
new ApiResponse<>(true, caracteristiqueParcelleService.updateCaracteristiqueParcelle(id, caracteristiqueParcelle), "Caracteristique parcelle mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,89 @@ public class CaracteristiqueParcelleController {
new ApiResponse<>(true, "Caracteristique parcelle supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllCaracteristiqueParcelleList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleList(), "Liste des Caracteristiques parcelles chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllCaracteristiqueParcellePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleList(pageable), "Liste des Caracteristiques parcelles chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getCaracteristiqueParcelleById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleById(id), "Caracteristiques parcelles trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueUniteLogement;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.CaracteristiqueUniteLogementService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class CaracteristiqueUniteLogementController {
private final CaracteristiqueUniteLogementService caracteristiqueUniteLogementService;
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueUniteLogementController.class);
public CaracteristiqueUniteLogementController(CaracteristiqueUniteLogementService caracteristiqueUniteLogementService) {
this.caracteristiqueUniteLogementService = caracteristiqueUniteLogementService;
@@ -38,11 +42,19 @@ public class CaracteristiqueUniteLogementController {
new ApiResponse<>(true, caracteristiqueUniteLogement, "Caracteristique Unite Logement créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class CaracteristiqueUniteLogementController {
new ApiResponse<>(true, caracteristiqueUniteLogementService.updateCaracteristiqueUniteLogement(id, caracteristiqueUniteLogement), "Caracteristique Unite Logement mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,89 @@ public class CaracteristiqueUniteLogementController {
new ApiResponse<>(true, "CaracteristiqueUniteLogement supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllCaracteristiqueUniteLogementList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementList(), "Liste des Caracteristiques Unite Logement chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllCaracteristiqueUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementList(pageable), "Liste des Caracteristiques Unite Logement chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getCaracteristiqueUniteLogementById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementById(id), "Caracteristique Unite Logement trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteBatimentService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class EnqueteBatimentController {
private final EnqueteBatimentService enqueteBatimentService;
private static final Logger logger = LoggerFactory.getLogger(EnqueteBatimentController.class);
public EnqueteBatimentController(EnqueteBatimentService enqueteBatimentService) {
this.enqueteBatimentService = enqueteBatimentService;
@@ -38,11 +42,19 @@ public class EnqueteBatimentController {
new ApiResponse<>(true, enqueteBatiment, "Enquete batiment créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class EnqueteBatimentController {
new ApiResponse<>(true, enqueteBatimentService.updateEnqueteBatiment(id, enqueteBatiment), "Enquete batiment mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,90 @@ public class EnqueteBatimentController {
new ApiResponse<>(true, "EnqueteBatiment supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllEnqueteBatimentList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentList(), "Liste des Enquetes batiments chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllEnqueteBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentList(pageable), "Liste des Enquetes batiments chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getEnqueteBatimentById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentById(id), "Enquete batiment trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.EnqueteUniteLogementService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class EnqueteUniteLogementController {
private final EnqueteUniteLogementService enqueteUniteLogementService;
private static final Logger logger = LoggerFactory.getLogger(EnqueteUniteLogementController.class);
public EnqueteUniteLogementController(EnqueteUniteLogementService enqueteUniteLogementService) {
this.enqueteUniteLogementService = enqueteUniteLogementService;
@@ -38,11 +42,19 @@ public class EnqueteUniteLogementController {
new ApiResponse<>(true, enqueteUniteLogement, "Enquete unite logement créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class EnqueteUniteLogementController {
new ApiResponse<>(true, enqueteUniteLogementService.updateEnqueteUniteLogement(id, enqueteUniteLogement), "Enquete unite logement mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,90 @@ public class EnqueteUniteLogementController {
new ApiResponse<>(true, "Enquete Unite Logement supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllEnqueteUniteLogementList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementList(), "Liste des Enquetes des unites Logements chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllEnqueteUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementList(pageable), "Liste des enquetes des unites de logements chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getEnqueteUniteLogementById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementById(id), "Enquete unite de logement trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
import io.gmss.fiscad.entities.rfu.metier.UniteLogement;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.metier.UniteLogementService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class UniteLogementController {
private final UniteLogementService enqueteUniteLogementService;
private static final Logger logger = LoggerFactory.getLogger(UniteLogementController.class);
public UniteLogementController(UniteLogementService enqueteUniteLogementService) {
this.enqueteUniteLogementService = enqueteUniteLogementService;
@@ -38,11 +42,19 @@ public class UniteLogementController {
new ApiResponse<>(true, enqueteUniteLogement, "Unite de logement créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class UniteLogementController {
new ApiResponse<>(true, enqueteUniteLogementService.updateUniteLogement(id, enqueteUniteLogement), "Unite de logement mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,36 +89,90 @@ public class UniteLogementController {
new ApiResponse<>(true, "Unite Logement supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllUniteLogementList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementList(), "Liste des Enquetes des unites Logements chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementList(pageable), "Liste des enquetes des unites de logements chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getUniteLogementById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementById(id), "Unite de de logement trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,12 +2,14 @@ package io.gmss.fiscad.controllers.rfu.parametre;
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
import io.gmss.fiscad.enums.TypeCampagne;
import io.gmss.fiscad.exceptions.NotFoundException;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.parametre.CampagneService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -15,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
public class CampagneController {
private final CampagneService campagneService;
private static final Logger logger = LoggerFactory.getLogger(CampagneController.class);
public CampagneController(CampagneService campagneService) {
this.campagneService = campagneService;
@@ -39,11 +42,19 @@ public class CampagneController {
new ApiResponse<>(true, campagne, "Campagne créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -54,11 +65,19 @@ public class CampagneController {
new ApiResponse<>(true, campagneService.updateCampagne(id, campagne), "Campagne mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -70,37 +89,91 @@ public class CampagneController {
new ApiResponse<>(true, "Campagne supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllCampagneList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, campagneService.getCampagneList(), "Liste des campagnes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllCampagnePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, campagneService.getCampagneList(pageable), "Liste des campagnes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getCampagneById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, campagneService.getCampagneById(id), "Campagne trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/type-campagne/{typeCampagne}")
@@ -111,11 +184,19 @@ public class CampagneController {
new ApiResponse<>(true, campagneService.getCampagnesByType(typeCampagne), "Liste des campagne par type chargée avec succès."),
HttpStatus.OK
);
}catch (NotFoundException e){
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.parametre;
import io.gmss.fiscad.entities.rfu.parametre.Caracteristique;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.parametre.CaracteristiqueService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
public class CaracteristiqueController {
private final CaracteristiqueService caracteristiqueService;
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueController.class);
public CaracteristiqueController(CaracteristiqueService caracteristiqueService) {
this.caracteristiqueService = caracteristiqueService;
@@ -37,11 +41,19 @@ public class CaracteristiqueController {
new ApiResponse<>(true, caracteristique, "Caracteristique créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -52,11 +64,19 @@ public class CaracteristiqueController {
new ApiResponse<>(true, caracteristiqueService.updateCaracteristique(id, caracteristique), "Caracteristique mise à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -68,36 +88,91 @@ public class CaracteristiqueController {
new ApiResponse<>(true, "Caracteristique supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllCaracteristiqueList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(pageable), "Liste des caractéristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getCaracteristiqueById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueById(id), "Caracteristique trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -1,12 +1,15 @@
package io.gmss.fiscad.controllers.rfu.parametre;
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.parametre.EquipeService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.EquipePayload;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
public class EquipeController {
private final EquipeService equipeService;
private static final Logger logger = LoggerFactory.getLogger(EquipeController.class);
public EquipeController(EquipeService equipeService) {
this.equipeService = equipeService;
@@ -38,11 +42,19 @@ public class EquipeController {
new ApiResponse<>(true, equipe, "Equipe créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -53,11 +65,19 @@ public class EquipeController {
new ApiResponse<>(true, equipeService.updateEquipe(id, equipePayload), "Equipe mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -69,37 +89,91 @@ public class EquipeController {
new ApiResponse<>(true, "Equipe supprimée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllEquipeList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, equipeService.getEquipeList(), "Liste des equipes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllEquipePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, equipeService.getEquipeList(pageable), "Liste des equipes chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getEquipeById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, equipeService.getEquipeById(id), "Equipe trouvée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.parametre;
import io.gmss.fiscad.entities.rfu.parametre.TypeCaracteristique;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.rfu.parametre.TypeCaracteristiqueService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -23,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
public class TypeCaracteristiqueController {
private final TypeCaracteristiqueService typeCaracteristiqueService;
private static final Logger logger = LoggerFactory.getLogger(TypeCaracteristiqueController.class);
public TypeCaracteristiqueController(TypeCaracteristiqueService typeCaracteristiqueService) {
this.typeCaracteristiqueService = typeCaracteristiqueService;
@@ -36,11 +41,19 @@ public class TypeCaracteristiqueController {
new ApiResponse<>(true, typeCaracteristique, "Type de caracteristique créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -51,11 +64,19 @@ public class TypeCaracteristiqueController {
new ApiResponse<>(true, typeCaracteristiqueService.updateTypeCaracteristique(id, typeCaracteristique), "Type caracteristique mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -67,36 +88,90 @@ public class TypeCaracteristiqueController {
new ApiResponse<>(true, "Type caracteristique supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAllTypeCaracteristiqueList() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(), "Liste des types caracteristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllTypeCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(pageable), "Liste des types caracteristiques chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getTypeCaracteristiqueById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueById(id), "Type caracteristique trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -1,13 +1,17 @@
package io.gmss.fiscad.controllers.statistique;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@RequestMapping(value = "api/statistique", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -17,38 +21,101 @@ import org.springframework.web.bind.annotation.*;
public class StatistiqueController {
private final StatistiquesService statistiquesService;
private static final Logger logger = LoggerFactory.getLogger(StatistiqueController.class);
public StatistiqueController(StatistiquesService statistiquesService) {
this.statistiquesService = statistiquesService;
}
@GetMapping(path = "/user/enquete-par-statut")
public ResponseEntity<?> getStatistiquesParStatut() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, statistiquesService.getStatEnqueteParStatut(), "Statistique des enquêtes par statut."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/enquete-par-arrondissement/{commune_id}")
public ResponseEntity<?> getStatistiquesParArrondissement(@PathVariable Long commune_id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminDecoupage(commune_id), "Statistique des enquêtes par arrondissement."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/user/enquete-par-structure")
public ResponseEntity<?> getStatistiquesParStructure() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminStructure(), "Statistique des enquêtes par structure."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/user/enquete-par-bloc")
public ResponseEntity<?> getStatistiquesParBloc() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, statistiquesService.getStatBloc(), "Statistique des enquêtes par bloc."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -1,13 +1,17 @@
package io.gmss.fiscad.controllers.synchronisation;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.synchronisation.RestaurationService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@RequestMapping(value = "api/restauration", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -17,107 +21,289 @@ import org.springframework.web.bind.annotation.*;
public class RestaurationController {
public final RestaurationService restaurationService;
private static final Logger logger = LoggerFactory.getLogger(RestaurationController.class);
public RestaurationController(RestaurationService restaurationService) {
this.restaurationService = restaurationService;
}
@GetMapping(path = "/enquete/{terminalId}")
public ResponseEntity<?> getEnquetes(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getEnquete(terminalId), "liste des enquetes avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/acteur-concerne/{terminalId}")
public ResponseEntity<?> getActeurConcerne(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getActeurConcernes(terminalId), "liste des acteurs concernés avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/personne/{terminalId}") // ok
public ResponseEntity<?> getPersonnes(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getPersonne(terminalId), "liste des personnes avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/membre-groupe/{terminalId}")
public ResponseEntity<?> getMembrePersonnes(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getMembreGroupe(terminalId), "liste des membres groupe avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/parcelle/{terminalId}")
public ResponseEntity<?> getParcelle(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getParcelle(terminalId), "liste des parcelle avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/piece/{terminalId}")
public ResponseEntity<?> getPieces(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getPieces(terminalId), "liste des enquetes avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/upload/{terminalId}")
public ResponseEntity<?> getUpload(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getUpload(terminalId), "liste des enquetes avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/current-user-tpes")
public ResponseEntity<?> getCurrentUserTpe() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getTpeListByCurrentUser(), "liste des enquetes avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/batiment/{terminalId}")
public ResponseEntity<?> getBatiments(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getBatiment(terminalId), "liste des batiments avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/enquete-batiment/{terminalId}")
public ResponseEntity<?> getEnqueteBatiment(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getEnqueteBatiment(terminalId), "liste des enquetes batiments avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/caracteristique-batiment/{terminalId}")
public ResponseEntity<?> getCaracteristiqueBatiment(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getCaracateristiqueBatiment(terminalId), "liste des caractéristiques batiments avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping(path = "/caracteristique-unite-logement/{terminalId}")
public ResponseEntity<?> getCaracteristiqueUniteLogement(@PathVariable Long terminalId) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, restaurationService.getCaracateristiqueUniteLogement(terminalId), "liste des caractéristiques des unités de logement avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}

View File

@@ -1,14 +1,18 @@
package io.gmss.fiscad.controllers.synchronisation;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.request.*;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@@ -20,6 +24,7 @@ import java.util.List;
@CrossOrigin(origins = "*")
public class SynchronisationController {
private final SynchronisationService synchronisationService;
private static final Logger logger = LoggerFactory.getLogger(SynchronisationController.class);
public SynchronisationController(SynchronisationService synchronisationService) {
this.synchronisationService = synchronisationService;
@@ -27,61 +32,186 @@ public class SynchronisationController {
@GetMapping("/user-decoupage-territorial")
public ResponseEntity<?> getUserDecoupageTerritorial() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.getDecoupageAdminUserConnecter(), "Liste des découpages territoriaux chargés avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/references")
public ResponseEntity<?> getAllReferences() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.getReferencesSyncResponses(), "Liste des données de référence chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/personnes")
public ResponseEntity<?> syncPersonne(@RequestBody List<PersonnePayLoad> personnePayLoads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncPersonnes(personnePayLoads), "Liste des personnes synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/membre-groupe")
public ResponseEntity<?> syncMembreGroupe(@RequestBody List<MembreGroupePayLoad> membreGroupePayLoads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncMembreGroupe(membreGroupePayLoads), "Liste des membres de groupes de personnes synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/enquete")
public ResponseEntity<?> syncEnquete(@RequestBody List<EnquetePayLoad> enquetePayLoads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncEnquete(enquetePayLoads), "Liste des enquêtes synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/parcelle")
public ResponseEntity<?> syncParcelle(@RequestBody List<ParcellePayLoad> parcellePayLoads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncParcelle(parcellePayLoads), "Liste des parceclles synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/piece")
public ResponseEntity<?> syncPiece(@RequestBody List<PiecePayLoad> piecePayLoads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncPiece(piecePayLoads), "Liste des pièces synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/acteur-concerne")
public ResponseEntity<?> syncActeurConcerne(@RequestBody List<ActeurConcernePayLoad> piecePayLoads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncActeurConcerne(piecePayLoads), "Liste des acteurs concernes synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
//@PostMapping("/files")
@@ -101,6 +231,7 @@ public class SynchronisationController {
@RequestParam(required = false) Long enqueteBatimentId,
@RequestParam(required = false) Long enqueteUniteLogementId
) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncFiles(file,
idBackend,
@@ -116,22 +247,66 @@ public class SynchronisationController {
enqueteId, enqueteBatimentId, enqueteUniteLogementId), "Liste des fichiers synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping(path = "/synchronise/all-enquete-data")
public ResponseEntity<?> syncAllEnqueteData(@ModelAttribute EnqueteAllDataPayload enqueteAllDataPayload) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncEnqueteAllData(enqueteAllDataPayload), "Les enquetes sont synchronisées avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping(path = "/synchronise/enquete/confirme-from-mobile")
public ResponseEntity<?> syncAllEnqueteData(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Synchronisation confirmée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -143,58 +318,163 @@ public class SynchronisationController {
@PostMapping(path = "/batiment")
public ResponseEntity<?> syncBatiment(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Liste des batiments synchronisées avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping(path = "/unite-logement")
public ResponseEntity<?> syncUniteLogement(@RequestBody List<UniteLogementPaylaod> uniteLogementPaylaods) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncUniteLogement(uniteLogementPaylaods), "Liste des unités de logement synchronisées avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping(path = "/caracteristique-batiment")
public ResponseEntity<?> syncCaracteristiqueBatiment(@RequestBody List<CaracteristiqueBatimentPaylod> caracteristiqueBatimentPaylods) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueBatiment(caracteristiqueBatimentPaylods), "Liste des caractéristiques des bâtiments synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping(path = "/caracteristique-parcelle")
public ResponseEntity<?> syncCaracteristiqueParcelle(@RequestBody List<CaracteristiqueParcellePaylod> caracteristiqueParcellePaylods) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueParcelle(caracteristiqueParcellePaylods), "Liste des caractéristiques des parcelles synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping(path = "/caracteristique-unite-logement")
public ResponseEntity<?> syncCaracteristiqueUniteLogement(@RequestBody List<CaracteristiqueUniteLogementPaylod> caracteristiqueUniteLogementPaylods) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueUniteLogement(caracteristiqueUniteLogementPaylods), "Liste des caractéristiques des unités de logement synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/enquete-batiment")
public ResponseEntity<?> syncEnqueteBatiment(@RequestBody List<EnqueteBatimentPayload> enqueteBatimentPayloads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncEnqueteBatiment(enqueteBatimentPayloads), "Liste des enquêtes des batiments synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@PostMapping("/enquete-unite-logement")
public ResponseEntity<?> syncEnqueteUniteLogement(@RequestBody List<EnqueteUniteLogementPayload> enqueteUniteLogementPayloads) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, synchronisationService.syncEnqueteUniteLogement(enqueteUniteLogementPayloads), "Liste des enquêtes des unités de logement synchronisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -3,6 +3,7 @@ package io.gmss.fiscad.controllers.user;
import io.gmss.fiscad.entities.user.Role;
import io.gmss.fiscad.entities.user.User;
import io.gmss.fiscad.enums.UserRole;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
import io.gmss.fiscad.interfaces.user.RoleService;
import io.gmss.fiscad.interfaces.user.UserService;
@@ -13,11 +14,14 @@ import io.gmss.fiscad.paylaods.UserRequest;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
import java.util.HashSet;
import java.util.Set;
@@ -32,6 +36,7 @@ public class AuthController {
private final UserService userService;
private final RoleService roleService;
private final StructureService structureService;
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
public AuthController(UserService userService, RoleService roleService, StructureService structureService) {
this.userService = userService;
@@ -63,12 +68,19 @@ public class AuthController {
HttpStatus.OK
);
}
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity<>(
new ApiResponse<User>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -82,11 +94,19 @@ public class AuthController {
new ApiResponse<>(true, user, "User created successully."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}

View File

@@ -4,6 +4,7 @@ package io.gmss.fiscad.controllers.user;
import io.gmss.fiscad.entities.user.DemandeReinitialisationMP;
import io.gmss.fiscad.entities.user.User;
import io.gmss.fiscad.enums.UserRole;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.user.DemandeReinitialisationMPService;
import io.gmss.fiscad.interfaces.user.RoleService;
import io.gmss.fiscad.interfaces.user.UserService;
@@ -13,12 +14,15 @@ import io.gmss.fiscad.security.CurrentUser;
import io.gmss.fiscad.security.UserPrincipal;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@RequestMapping(value = "api/demande-reinitialisation-mp", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -28,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
public class DemandeReinitialisationMPController {
private final DemandeReinitialisationMPService demandeReinitialisationMPService;
private static final Logger logger = LoggerFactory.getLogger(DemandeReinitialisationMPController.class);
private final UserService userService;
private final RoleService roleService;
@@ -45,11 +50,19 @@ public class DemandeReinitialisationMPController {
new ApiResponse<>(true, "DemandeReinitialisation MP créé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -60,11 +73,19 @@ public class DemandeReinitialisationMPController {
new ApiResponse<>(true, demandeReinitialisationMPService.updateDemandeReinitialisationMP(id, demandeReinitialisationMP), "DemandeReinitialisationMP mis à jour avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -76,11 +97,19 @@ public class DemandeReinitialisationMPController {
new ApiResponse<>(true, "Demande de Reinitialisation de mot de passe supprimé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -121,35 +150,76 @@ public class DemandeReinitialisationMPController {
// );
// }
// }
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllDemandeReinitialisationMPPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPList(pageable), "Liste des demandeReinitialisationMP chargée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/id/{id}")
public ResponseEntity<?> getDemandeReinitialisationMPById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPById(id), "DemandeReinitialisationMP trouvé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/reset")
public ResponseEntity<?> traiterDemande(@RequestParam Long id, @RequestParam String password) {
try {
DemandeReinitialisationMP demandeReinitialisationMP = demandeReinitialisationMPService.traiterDemandeReinitialisation(id, password);
return new ResponseEntity<>(
new ApiResponse<>(true,
new DemandeReinitialisationMPResponse(
@@ -159,5 +229,19 @@ public class DemandeReinitialisationMPController {
"Traitement effectué avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.user;
import io.gmss.fiscad.entities.user.Role;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.user.RoleService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
public class RoleController {
private final RoleService roleService;
private static final Logger logger = LoggerFactory.getLogger(RoleController.class);
public RoleController(RoleService roleService) {
this.roleService = roleService;
@@ -38,11 +43,19 @@ public class RoleController {
new ApiResponse<>(true, role, "Role created successully."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -54,11 +67,19 @@ public class RoleController {
new ApiResponse<>(true, roleService.updateRole(id, role), "Role updated successully."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -70,29 +91,68 @@ public class RoleController {
new ApiResponse<>(true, "Role deleted successully"),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAll() {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, roleService.getRoleList(), "Liste des roles."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-paged")
public ResponseEntity<?> getAllPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
try {
Pageable pageable = PageRequest.of(pageNo, pageSize);
return new ResponseEntity<>(
new ApiResponse<>(true, roleService.getRoleList(pageable), "Liste des roles."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
}

View File

@@ -3,6 +3,7 @@ package io.gmss.fiscad.controllers.user;
import io.gmss.fiscad.entities.user.User;
import io.gmss.fiscad.enums.UserRole;
import io.gmss.fiscad.exceptions.*;
import io.gmss.fiscad.interfaces.user.UserService;
import io.gmss.fiscad.paylaods.ApiResponse;
import io.gmss.fiscad.paylaods.Login;
@@ -11,12 +12,14 @@ import io.gmss.fiscad.security.UserPrincipal;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
@RestController
@@ -27,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
public class UserController {
private final UserService userService;
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
public UserController(UserService userService) {
@@ -42,11 +46,19 @@ public class UserController {
new ApiResponse<>(true, user, "Utilisateur créé avec succès"),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -58,11 +70,19 @@ public class UserController {
new ApiResponse<>(true, "Votre mot de passe à été modifiée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -74,11 +94,19 @@ public class UserController {
new ApiResponse<>(true, user, "Votre mot de passe à été réinitialisée avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -90,11 +118,19 @@ public class UserController {
new ApiResponse<>(true, user, "Cet utilisateur à été activé avec succès."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -106,11 +142,19 @@ public class UserController {
new ApiResponse<>(true, userService.updateUser(id, user), "User updated successully."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -127,11 +171,19 @@ public class UserController {
new ApiResponse<>(true, user, message),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@@ -143,17 +195,26 @@ public class UserController {
new ApiResponse<>(true, "User deleted successully"),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(
new ApiResponse<>(false, e.getMessage()),
HttpStatus.OK
);
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all")
public ResponseEntity<?> getAll(@CurrentUser UserPrincipal userPrincipal) {
try {
User user = userPrincipal.getUser();
@@ -168,11 +229,25 @@ public class UserController {
HttpStatus.OK
);
}
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-by-structure")
public ResponseEntity<?> getAllByStructure(@CurrentUser UserPrincipal userPrincipal) {
try {
if (userPrincipal.getUser().getStructure() != null) {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getListUserByStructure(userPrincipal.getUser().getStructure().getId()), "Liste des utilisateurs chargée avec succès."),
@@ -184,6 +259,21 @@ public class UserController {
HttpStatus.OK
);
}
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
// @GetMapping("/all-paged")
@@ -197,26 +287,71 @@ public class UserController {
@GetMapping("/id/{id}")
public ResponseEntity<?> getUserById(@PathVariable Long id) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getUserById(id), "User found."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/username/{username}")
public ResponseEntity<?> getUserByUsername(@PathVariable String username) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getUserByUsername(username), "User found."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}
@GetMapping("/all-by-role/{userrole}")
public ResponseEntity<?> getUserByUserRole(@PathVariable UserRole userrole) {
try {
return new ResponseEntity<>(
new ApiResponse<>(true, userService.getUserByProfil(userrole), "Users found."),
HttpStatus.OK
);
} catch (HttpClientErrorException.MethodNotAllowed e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
FileStorageException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
} catch (NullPointerException e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getLocalizedMessage());
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
}
}

View File

@@ -163,12 +163,12 @@ public class Enquete extends BaseEntity implements Serializable {
}
public String getNomPrenomEnqueteur() {
if (this.user != null) {
return this.user.getNom() + " " + this.user.getPrenom();
} else return "";
}
public String getNomBloc() {
if (this.bloc != null) {
return this.bloc.getNom();
@@ -180,6 +180,7 @@ public class Enquete extends BaseEntity implements Serializable {
return this.bloc.getCote();
} else return "";
}
public String getDepartement() {
if (this.bloc != null) {
Arrondissement arrondissement = this.bloc.getArrondissement();
@@ -188,6 +189,7 @@ public class Enquete extends BaseEntity implements Serializable {
} else return "";
} else return "";
}
public String getCommune() {
if (this.bloc != null) {
Arrondissement arrondissement = this.bloc.getArrondissement();
@@ -205,6 +207,7 @@ public class Enquete extends BaseEntity implements Serializable {
} else return "";
} else return "";
}
public String getTypeDomaine() {
if (this.parcelle != null) {
NatureDomaine natureDomaine = this.parcelle.getNatureDomaine();

View File

@@ -5,6 +5,7 @@ import jakarta.persistence.Id;
import lombok.Data;
import java.time.LocalDate;
@Entity
@Data
public class EnqueteFiltreResponse {

View File

@@ -87,6 +87,4 @@ public class Parcelle extends BaseEntity implements Serializable {
// private Point geometry32631;
}

View File

@@ -1,12 +1,8 @@
package io.gmss.fiscad.entities.infocad.metier;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.gmss.fiscad.entities.BaseEntity;
import io.gmss.fiscad.entities.decoupage.Quartier;
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
import io.gmss.fiscad.entities.rfu.metier.Batiment;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -16,12 +12,10 @@ import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;
import org.n52.jackson.datatype.jts.GeometryDeserializer;
import org.n52.jackson.datatype.jts.GeometrySerializer;
import java.io.Serializable;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Entity

View File

@@ -84,6 +84,4 @@ public class Personne extends BaseEntity implements Serializable {
private boolean synchronise;
}

View File

@@ -1,4 +1,5 @@
package io.gmss.fiscad.exceptions;
public class FileStorageException extends RuntimeException {
public FileStorageException(String message) {
super(message);

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class NationaliteServiceImpl implements NationaliteService {

View File

@@ -60,7 +60,6 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
}
@Override
public Optional<SecteurDecoupage> getSecteurDecoupageById(Long id) {
return secteurDecoupageRepository.findById(id);

View File

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
@RequiredArgsConstructor
public class ActeurConcerneServiceImpl implements ActeurConcerneService {

View File

@@ -182,7 +182,6 @@ public class EnqueteServiceImpl implements EnqueteService {
}
System.out.println(condition);
StringBuilder sb = new StringBuilder(sql).append(condition);
query = em.createNativeQuery(sb.toString(), EnqueteFiltreResponse.class);

View File

@@ -111,6 +111,7 @@ public class ParcelleServiceImpl implements ParcelleService {
throw new NotFoundException("Impossible de trouver l'enquête.");
}
}
private Parcelle getParcelle(ParcellePayLoad parcellePayLoad, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
StringBuilder coordonnees = new StringBuilder();
Parcelle parcelle = new Parcelle();
@@ -145,6 +146,7 @@ public class ParcelleServiceImpl implements ParcelleService {
// }
return parcelle;
}
private Parcelle getParcelle(Parcelle parcelle, ParcellePayLoad parcellePayLoad, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
StringBuilder coordonnees = new StringBuilder();
parcelle.setP(parcellePayLoad.getP());
@@ -180,6 +182,4 @@ public class ParcelleServiceImpl implements ParcelleService {
}
}

View File

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class TpeServiceImpl implements TpeService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class ModeAcquisitionServiceImpl implements ModeAcquisitionService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class NatureDomaineServiceImpl implements NatureDomaineService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class PositionRepresentationServiceImpl implements PositionRepresentationService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class ProfessionServiceImpl implements ProfessionService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class SituationGeographiqueServiceImpl implements SituationGeographiqueService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class SituationMatrimonialeServiceImpl implements SituationMatrimonialeService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class SourceDroitServiceImpl implements SourceDroitService {

View File

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class StructureServiceImpl implements StructureService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class TypeContestationServiceImpl implements TypeContestationService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class TypeDomaineServiceImpl implements TypeDomaineService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class TypePersonneServiceImpl implements TypePersonneService {

View File

@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class TypeRepresentationServiceImpl implements TypeRepresentationService {

View File

@@ -28,8 +28,7 @@ public class EmailServiceImpl implements EmailService {
}
// To send a simple email
public String sendSimpleMail(EmailDetails details)
{
public String sendSimpleMail(EmailDetails details) {
// Try block to check for exceptions
try {
@@ -470,8 +469,7 @@ public class EmailServiceImpl implements EmailService {
// To send an email with attachment
public String
sendMailWithAttachment(EmailDetails details)
{
sendMailWithAttachment(EmailDetails details) {
// Creating a mime message
MimeMessage mimeMessage
= javaMailSender.createMimeMessage();

View File

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class CampagneServiceImpl implements CampagneService {
private final CampagneRepository campagneRepository;

View File

@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
@Service
@RequiredArgsConstructor
public class RestaurationServiceImpl implements RestaurationService {

View File

@@ -14,11 +14,13 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class StatistiquesServiceImpl implements StatistiquesService {
private Authentication authentication;
private final UserService userService;
private final EnqueteRepository enqueteRepository;
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository) {
this.userService = userService;
this.enqueteRepository = enqueteRepository;

View File

@@ -699,7 +699,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
}
batiment.setNub(batimentPaylaod.getNub());
batiment.setCode(batimentPaylaod.getCode());
batiment.setDateConstruction(batimentPaylaod.getDateConstruction());
@@ -1334,7 +1333,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
}
@Override
public List<SyncResponse> syncBatiment(List<BatimentPaylaod> batimentPaylaods) {
@@ -1412,7 +1410,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
}
@Override
public List<SyncResponse> syncUniteLogement(List<UniteLogementPaylaod> uniteLogementPaylaods) {
@@ -1773,7 +1770,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
}
@Override
public List<SyncResponse> syncEnqueteBatiment(List<EnqueteBatimentPayload> enqueteBatimentPayLoads) {
List<SyncResponse> syncResponses = new ArrayList<>();

View File

@@ -12,10 +12,15 @@ import java.util.Optional;
public interface ArrondissementService {
Arrondissement createArrondissement(Arrondissement arrondissement) throws BadRequestException;
Arrondissement updateArrondissement(Long id, Arrondissement arrondissement) throws NotFoundException;
void deleteArrondissement(Long id) throws NotFoundException;
Page<Arrondissement> getArrondissementList(Pageable pageable);
List<Arrondissement> getArrondissementList();
Optional<Arrondissement> getArrondissementById(Long id);
List<Arrondissement> getArrondissementByComune(Long communeId);

View File

@@ -12,10 +12,16 @@ import java.util.Optional;
public interface CommuneService {
Commune createCommune(Commune commune) throws BadRequestException;
Commune updateCommune(Long id, Commune commune) throws NotFoundException;
void deleteCommune(Long id) throws NotFoundException;
Page<Commune> getCommuneList(Pageable pageable);
List<Commune> getCommuneList();
List<Commune> getCommunesByDepartement(Long departementId);
Optional<Commune> getCommuneById(Long id);
}

View File

@@ -12,9 +12,14 @@ import java.util.Optional;
public interface DepartementService {
Departement createDepartement(Departement departement) throws BadRequestException;
Departement updateDepartement(Long id, Departement departement) throws NotFoundException;
void deleteDepartement(Long id) throws NotFoundException;
Page<Departement> getDepartementList(Pageable pageable);
List<Departement> getDepartementList();
Optional<Departement> getDepartementById(Long id);
}

View File

@@ -12,9 +12,14 @@ import java.util.Optional;
public interface NationaliteService {
Nationalite createNationalite(Nationalite nationalite) throws BadRequestException;
Nationalite updateNationalite(Long id, Nationalite nationalite) throws NotFoundException;
void deleteNationalite(Long id) throws NotFoundException;
Page<Nationalite> getNationaliteList(Pageable pageable);
List<Nationalite> getNationaliteList();
Optional<Nationalite> getNationaliteById(Long id);
}

View File

@@ -12,10 +12,16 @@ import java.util.Optional;
public interface QuartierService {
Quartier createQuartier(Quartier quartier) throws BadRequestException;
Quartier updateQuartier(Long id, Quartier quartier) throws NotFoundException;
void deleteQuartier(Long id) throws NotFoundException;
Page<Quartier> getQuartierList(Pageable pageable);
List<Quartier> getQuartierList();
Optional<Quartier> getQuartierById(Long id);
List<Quartier> getQuartierByArrondissement(Long arrondissementId);
}

View File

@@ -12,9 +12,13 @@ import java.util.Optional;
public interface SecteurDecoupageService {
SecteurDecoupage createSecteurDecoupage(SecteurDecoupage secteurDecoupage) throws BadRequestException;
SecteurDecoupage updateSecteurDecoupage(Long id, SecteurDecoupage secteurDecoupage) throws NotFoundException;
void deleteSecteurDecoupage(Long id) throws NotFoundException;
Page<SecteurDecoupage> getSecteurDecoupageList(Pageable pageable);
List<SecteurDecoupage> getSecteurDecoupageList();
Optional<SecteurDecoupage> getSecteurDecoupageById(Long id);

View File

@@ -13,10 +13,15 @@ import java.util.Optional;
public interface SecteurService {
Secteur createSecteur(SecteurPayload secteur) throws BadRequestException;
Secteur updateSecteur(Long id, SecteurPayload secteur) throws NotFoundException;
void deleteSecteur(Long id) throws NotFoundException;
Page<Secteur> getSecteurList(Pageable pageable);
List<Secteur> getSecteurList();
List<Secteur> getSecteurListUneStruture(Long structureId);
Optional<Secteur> getSecteurById(Long id);

View File

@@ -12,9 +12,14 @@ import java.util.Optional;
public interface ActeurConcerneService {
ActeurConcerne createActeurConcerne(ActeurConcerne acteurConcerne) throws BadRequestException;
ActeurConcerne updateActeurConcerne(Long id, ActeurConcerne acteurConcerne) throws NotFoundException;
void deleteActeurConcerne(Long id) throws NotFoundException;
Page<ActeurConcerne> getActeurConcerneList(Pageable pageable);
List<ActeurConcerne> getActeurConcerneList();
Optional<ActeurConcerne> getActeurConcerneById(Long id);
}

View File

@@ -13,15 +13,25 @@ import java.util.Optional;
public interface CommentaireService {
Commentaire createCommentaire(Commentaire commentaire) throws BadRequestException;
Commentaire updateCommentaire(Long id, Commentaire commentaire) throws NotFoundException;
void deleteCommentaire(Long id) throws NotFoundException;
List<Commentaire> getCommentairesByEnqueteAndTerminal(Long idEnquete, Long terminalId);
List<Commentaire> getCommentairesByEnqueteAndLu(Long idEnquete, boolean lu);
List<Commentaire> getCommentairesByOrigineAndStateReadAndTerminalId(Origine origine, boolean lu, Long terminalId);
List<Commentaire> getCommentairesByOrigineAndStateSynchronizedAndTerminalId(Origine origine, boolean synchronise, Long terminalId);
Optional<Commentaire> getCommentaireByNup(String nup);
List<Commentaire> getCommentaireList();
Optional<Commentaire> getCommentaireById(Long id);
boolean setCommentaireRead(Long id);
List<CommentaireResponse> saveAllCommentairesFromMobile(List<Commentaire> commentaires);

View File

@@ -20,23 +20,38 @@ import java.util.Optional;
public interface EnqueteService {
Enquete createEnquete(EnquetePayLoad enquetePayLoad) throws BadRequestException;
Enquete updateEnquete(EnquetePayLoad enquetePayLoad) throws NotFoundException;
void deleteEnquete(Long id) throws NotFoundException;
Page<Enquete> getEnqueteList(Pageable pageable);
List<Enquete> getEnqueteList();
List<EnqueteResponse> getEnqueteCommuneArrondBloc();
List<EnqueteFiltreResponse> getEnqueteCommuneArrondBlocFiltre(FiltreEnquetePayLoad filtreEnquetePayLoad);
Optional<Enquete> getEnqueteById(Long id);
Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
Enquete finaliserEnquete(Long enqueteId);
Enquete reglerLitigeEnquete(Long enqueteId);
public UserDecoupageEnqResponses getDecoupageAdminUserConnecterAndStat();
public FicheEnqueteResponse getFicheEnquete(Long EnqueteId);
public List<EnqueteNonSyncResponse> getEnqueteValideNonSynch(Long terminalId);
}

View File

@@ -12,9 +12,14 @@ import java.util.Optional;
public interface MembreGroupeService {
MembreGroupe createMembreGroupe(MembreGroupe membreGroupe) throws BadRequestException;
MembreGroupe updateMembreGroupe(Long id, MembreGroupe membreGroupe) throws NotFoundException;
void deleteMembreGroupe(Long id) throws NotFoundException;
Page<MembreGroupe> getMembreGroupeList(Pageable pageable);
List<MembreGroupe> getMembreGroupeList();
Optional<MembreGroupe> getMembreGroupeById(Long id);
}

View File

@@ -14,9 +14,14 @@ public interface ParcelleService {
Parcelle createParcelle(ParcellePayLoad parcellePayLoad) throws BadRequestException;
Parcelle updateParcelle(ParcellePayLoad parcellePayLoad) throws NotFoundException;
void deleteParcelle(Long id) throws NotFoundException;
Page<Parcelle> getParcelleList(Pageable pageable);
List<Parcelle> getParcelleList();
Optional<Parcelle> getParcelleById(Long id);
}

View File

@@ -12,9 +12,14 @@ import java.util.Optional;
public interface PieceService {
Piece createPiece(Piece piece) throws BadRequestException;
Piece updatePiece(Long id, Piece piece) throws NotFoundException;
void deletePiece(Long id) throws NotFoundException;
Page<Piece> getPieceList(Pageable pageable);
List<Piece> getPieceList();
Optional<Piece> getPieceById(Long id);
}

Some files were not shown because too many files have changed in this diff Show More