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:
1
.mvn/wrapper/MavenWrapperDownloader.java
vendored
1
.mvn/wrapper/MavenWrapperDownloader.java
vendored
@@ -13,6 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.channels.*;
|
import java.nio.channels.*;
|
||||||
|
|||||||
1
HELP.md
1
HELP.md
@@ -1,6 +1,7 @@
|
|||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
### Reference Documentation
|
### Reference Documentation
|
||||||
|
|
||||||
For further reference, please consider the following sections:
|
For further reference, please consider the following sections:
|
||||||
|
|
||||||
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
|
<!-- 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.data.defaultdataadapter" value="One Empty Record"/>
|
||||||
<property name="com.jaspersoft.studio.unit." value="pixel"/>
|
<property name="com.jaspersoft.studio.unit." value="pixel"/>
|
||||||
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
|
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
|
||||||
@@ -64,8 +69,10 @@
|
|||||||
<columnHeader>
|
<columnHeader>
|
||||||
<band height="20" splitType="Stretch">
|
<band height="20" splitType="Stretch">
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3" uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
|
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -80,8 +87,10 @@
|
|||||||
<text><![CDATA[Code]]></text>
|
<text><![CDATA[Code]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="110" y="0" width="220" height="20" backcolor="#E6E3E3" uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
|
<reportElement mode="Opaque" x="110" y="0" width="220" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -96,8 +105,10 @@
|
|||||||
<text><![CDATA[Nom]]></text>
|
<text><![CDATA[Nom]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="330" y="0" width="185" height="20" backcolor="#E6E3E3" uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
|
<reportElement mode="Opaque" x="330" y="0" width="185" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -113,8 +124,10 @@
|
|||||||
<text><![CDATA[Arrondissement]]></text>
|
<text><![CDATA[Arrondissement]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="515" y="0" width="145" height="20" backcolor="#E6E3E3" uuid="86774042-75a8-480b-8cee-b051aaf448f3">
|
<reportElement mode="Opaque" x="515" y="0" width="145" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -130,8 +143,10 @@
|
|||||||
<text><![CDATA[Commune]]></text>
|
<text><![CDATA[Commune]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="660" y="0" width="140" height="20" backcolor="#E6E3E3" uuid="c083896b-34f1-4034-8422-171bac20fa8b">
|
<reportElement mode="Opaque" x="660" y="0" width="140" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -151,8 +166,10 @@
|
|||||||
<detail>
|
<detail>
|
||||||
<band height="20" splitType="Stretch">
|
<band height="20" splitType="Stretch">
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20" uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
|
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -167,8 +184,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ContainerHeight" x="110" y="0" width="220" height="20" uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
|
<reportElement stretchType="ContainerHeight" x="110" y="0" width="220" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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.leftIndent" value="px"/>
|
||||||
<property name="com.jaspersoft.studio.unit.width" value="px"/>
|
<property name="com.jaspersoft.studio.unit.width" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
@@ -184,8 +203,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{nom}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{nom}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="330" y="0" width="185" height="20" uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
|
<reportElement stretchType="ElementGroupHeight" x="330" y="0" width="185" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -200,8 +221,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{arrondissement}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{arrondissement}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="515" y="0" width="145" height="20" uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
|
<reportElement stretchType="ElementGroupHeight" x="515" y="0" width="145" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -216,8 +239,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{commune}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{commune}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="660" y="0" width="140" height="20" uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
|
<reportElement stretchType="ElementGroupHeight" x="660" y="0" width="140" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
|
<!-- 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.data.defaultdataadapter" value="One Empty Record"/>
|
||||||
<property name="com.jaspersoft.studio.unit." value="pixel"/>
|
<property name="com.jaspersoft.studio.unit." value="pixel"/>
|
||||||
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
|
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
|
||||||
@@ -110,8 +115,10 @@
|
|||||||
<columnHeader>
|
<columnHeader>
|
||||||
<band height="20" splitType="Stretch">
|
<band height="20" splitType="Stretch">
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3" uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
|
<reportElement mode="Opaque" x="0" y="0" width="110" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -126,8 +133,10 @@
|
|||||||
<text><![CDATA[NUP Provisoire]]></text>
|
<text><![CDATA[NUP Provisoire]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="110" y="0" width="120" height="20" backcolor="#E6E3E3" uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
|
<reportElement mode="Opaque" x="110" y="0" width="120" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -142,8 +151,10 @@
|
|||||||
<text><![CDATA[Quartier]]></text>
|
<text><![CDATA[Quartier]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="230" y="0" width="50" height="20" backcolor="#E6E3E3" uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
|
<reportElement mode="Opaque" x="230" y="0" width="50" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -159,8 +170,10 @@
|
|||||||
<text><![CDATA[Q]]></text>
|
<text><![CDATA[Q]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="280" y="0" width="40" height="20" backcolor="#E6E3E3" uuid="86774042-75a8-480b-8cee-b051aaf448f3">
|
<reportElement mode="Opaque" x="280" y="0" width="40" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -176,8 +189,10 @@
|
|||||||
<text><![CDATA[I]]></text>
|
<text><![CDATA[I]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="320" y="0" width="50" height="20" backcolor="#E6E3E3" uuid="c083896b-34f1-4034-8422-171bac20fa8b">
|
<reportElement mode="Opaque" x="320" y="0" width="50" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -193,8 +208,10 @@
|
|||||||
<text><![CDATA[P]]></text>
|
<text><![CDATA[P]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="370" y="0" width="60" height="20" backcolor="#E6E3E3" uuid="43fae784-98c5-4c75-bb0a-11f364bce22f">
|
<reportElement mode="Opaque" x="370" y="0" width="60" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -209,8 +226,10 @@
|
|||||||
<text><![CDATA[Litige]]></text>
|
<text><![CDATA[Litige]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="430" y="0" width="114" height="20" backcolor="#E6E3E3" uuid="6fb97069-4150-4b4d-a7e4-110f7275e530">
|
<reportElement mode="Opaque" x="430" y="0" width="114" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -225,8 +244,10 @@
|
|||||||
<text><![CDATA[Nature Domaine]]></text>
|
<text><![CDATA[Nature Domaine]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="544" y="0" width="156" height="20" backcolor="#E6E3E3" uuid="b609f024-82e7-491d-8558-ad6010c18cb6">
|
<reportElement mode="Opaque" x="544" y="0" width="156" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -241,8 +262,10 @@
|
|||||||
<text><![CDATA[Nom Propriétaire]]></text>
|
<text><![CDATA[Nom Propriétaire]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3" uuid="4f3d245d-16c5-4992-81b9-f7de8d10ed45">
|
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -261,8 +284,10 @@
|
|||||||
<detail>
|
<detail>
|
||||||
<band height="20" splitType="Stretch">
|
<band height="20" splitType="Stretch">
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20" uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
|
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="110" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -277,8 +302,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{nupProvisoire}==null ? "" : $F{nupProvisoire}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{nupProvisoire}==null ? "" : $F{nupProvisoire}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ContainerHeight" x="110" y="0" width="120" height="20" uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
|
<reportElement stretchType="ContainerHeight" x="110" y="0" width="120" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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.leftIndent" value="px"/>
|
||||||
<property name="com.jaspersoft.studio.unit.width" value="px"/>
|
<property name="com.jaspersoft.studio.unit.width" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
@@ -294,8 +321,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{quartier}==null ? "": $F{quartier}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{quartier}==null ? "": $F{quartier}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="230" y="0" width="50" height="20" uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
|
<reportElement stretchType="ElementGroupHeight" x="230" y="0" width="50" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -310,8 +339,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{q}==null ? "" : $F{q}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{q}==null ? "" : $F{q}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="280" y="0" width="40" height="20" uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
|
<reportElement stretchType="ElementGroupHeight" x="280" y="0" width="40" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -326,8 +357,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{i} == null ? "" : $F{i}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{i} == null ? "" : $F{i}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="320" y="0" width="50" height="20" uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
|
<reportElement stretchType="ElementGroupHeight" x="320" y="0" width="50" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -342,8 +375,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{p} == null ? "" : $F{p}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{p} == null ? "" : $F{p}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="370" y="0" width="60" height="20" uuid="5d6015a1-12af-4979-9b77-576cb6c99c05">
|
<reportElement stretchType="ElementGroupHeight" x="370" y="0" width="60" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -358,8 +393,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{litige}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{litige}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="114" height="20" uuid="5880e9de-e658-4cda-b737-0d1e791fff8c">
|
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="114" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -374,8 +411,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{nature}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{nature}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="544" y="0" width="156" height="20" uuid="34bb5d2b-4841-49b0-a7fa-83217ce30dda">
|
<reportElement stretchType="ElementGroupHeight" x="544" y="0" width="156" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -387,11 +426,14 @@
|
|||||||
<font size="12"/>
|
<font size="12"/>
|
||||||
<paragraph leftIndent="10"/>
|
<paragraph leftIndent="10"/>
|
||||||
</textElement>
|
</textElement>
|
||||||
<textFieldExpression><![CDATA[$F{nomProprietaire} == null ? "" : $F{nomProprietaire}]]></textFieldExpression>
|
<textFieldExpression>
|
||||||
|
<![CDATA[$F{nomProprietaire} == null ? "" : $F{nomProprietaire}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20" uuid="beeb4530-5e7b-4759-a5ff-b8f2a4115d6d">
|
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Created with Jaspersoft Studio version 6.21.3.final using JasperReports Library version 6.21.3-4a3078d20785ebe464f18037d738d12fc98c13cf -->
|
<!-- 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.data.defaultdataadapter" value="One Empty Record"/>
|
||||||
<property name="com.jaspersoft.studio.unit." value="pixel"/>
|
<property name="com.jaspersoft.studio.unit." value="pixel"/>
|
||||||
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
|
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
|
||||||
@@ -55,8 +60,10 @@
|
|||||||
<columnHeader>
|
<columnHeader>
|
||||||
<band height="20" splitType="Stretch">
|
<band height="20" splitType="Stretch">
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="0" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="331a2555-93cf-45c8-b0b5-7b2852a4d2f3">
|
<reportElement mode="Opaque" x="0" y="0" width="70" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -71,8 +78,10 @@
|
|||||||
<text><![CDATA[NUP Provisoire]]></text>
|
<text><![CDATA[NUP Provisoire]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="200" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="c4d92ed2-0221-46f2-927d-b475c27e868f">
|
<reportElement mode="Opaque" x="200" y="0" width="70" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -87,8 +96,10 @@
|
|||||||
<text><![CDATA[Commune]]></text>
|
<text><![CDATA[Commune]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="270" y="0" width="80" height="20" backcolor="#E6E3E3" uuid="2afc91ad-3b7c-4095-a7fc-971d233e3a80">
|
<reportElement mode="Opaque" x="270" y="0" width="80" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -104,8 +115,10 @@
|
|||||||
<text><![CDATA[Arrondissement]]></text>
|
<text><![CDATA[Arrondissement]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="350" y="0" width="80" height="20" backcolor="#E6E3E3" uuid="86774042-75a8-480b-8cee-b051aaf448f3">
|
<reportElement mode="Opaque" x="350" y="0" width="80" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -121,8 +134,10 @@
|
|||||||
<text><![CDATA[Bloc]]></text>
|
<text><![CDATA[Bloc]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="430" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="c083896b-34f1-4034-8422-171bac20fa8b">
|
<reportElement mode="Opaque" x="430" y="0" width="70" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -138,8 +153,10 @@
|
|||||||
<text><![CDATA[Structure]]></text>
|
<text><![CDATA[Structure]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="140" y="0" width="60" height="20" backcolor="#E6E3E3" uuid="43fae784-98c5-4c75-bb0a-11f364bce22f">
|
<reportElement mode="Opaque" x="140" y="0" width="60" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -154,8 +171,10 @@
|
|||||||
<text><![CDATA[Litige]]></text>
|
<text><![CDATA[Litige]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="70" y="0" width="70" height="20" backcolor="#E6E3E3" uuid="6fb97069-4150-4b4d-a7e4-110f7275e530">
|
<reportElement mode="Opaque" x="70" y="0" width="70" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -170,8 +189,10 @@
|
|||||||
<text><![CDATA[Nature Domaine]]></text>
|
<text><![CDATA[Nature Domaine]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="590" y="0" width="110" height="20" backcolor="#E6E3E3" uuid="b609f024-82e7-491d-8558-ad6010c18cb6">
|
<reportElement mode="Opaque" x="590" y="0" width="110" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -186,8 +207,10 @@
|
|||||||
<text><![CDATA[Nom Propriétaire]]></text>
|
<text><![CDATA[Nom Propriétaire]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3" uuid="4f3d245d-16c5-4992-81b9-f7de8d10ed45">
|
<reportElement mode="Opaque" x="700" y="0" width="100" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -202,8 +225,10 @@
|
|||||||
<text><![CDATA[Statut]]></text>
|
<text><![CDATA[Statut]]></text>
|
||||||
</staticText>
|
</staticText>
|
||||||
<staticText>
|
<staticText>
|
||||||
<reportElement mode="Opaque" x="500" y="0" width="90" height="20" backcolor="#E6E3E3" uuid="3a10eece-e81b-408b-b680-d7f31c9931a1">
|
<reportElement mode="Opaque" x="500" y="0" width="90" height="20" backcolor="#E6E3E3"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -222,8 +247,10 @@
|
|||||||
<detail>
|
<detail>
|
||||||
<band height="20" splitType="Stretch">
|
<band height="20" splitType="Stretch">
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="70" height="20" uuid="1d95f143-1f8d-4f69-a9fe-e35b552a3e90">
|
<reportElement stretchType="ElementGroupHeight" x="0" y="0" width="70" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6ac9f7a7-6945-49f9-bb3f-304b676fe0cc"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -238,8 +265,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{nupprovisoire}==null ? "" : $F{nupprovisoire}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{nupprovisoire}==null ? "" : $F{nupprovisoire}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ContainerHeight" x="200" y="0" width="70" height="20" uuid="06de3fd6-c3fd-4316-abcb-1a753e951b30">
|
<reportElement stretchType="ContainerHeight" x="200" y="0" width="70" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="6a576dff-c575-4984-bac4-07e6f9e677d7"/>
|
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.leftIndent" value="px"/>
|
||||||
<property name="com.jaspersoft.studio.unit.width" value="px"/>
|
<property name="com.jaspersoft.studio.unit.width" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
@@ -255,8 +284,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{communenom}==null ? "": $F{communenom}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{communenom}==null ? "": $F{communenom}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="270" y="0" width="80" height="20" uuid="2d7a2c15-346a-4977-896c-1ba29cfd5d53">
|
<reportElement stretchType="ElementGroupHeight" x="270" y="0" width="80" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -268,11 +299,14 @@
|
|||||||
<font size="8"/>
|
<font size="8"/>
|
||||||
<paragraph leftIndent="10"/>
|
<paragraph leftIndent="10"/>
|
||||||
</textElement>
|
</textElement>
|
||||||
<textFieldExpression><![CDATA[$F{arrondissementnom}==null ? "" : $F{arrondissementnom}]]></textFieldExpression>
|
<textFieldExpression>
|
||||||
|
<![CDATA[$F{arrondissementnom}==null ? "" : $F{arrondissementnom}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="350" y="0" width="80" height="20" uuid="4e3f26b4-15fe-4bb0-9fae-c912f47021fc">
|
<reportElement stretchType="ElementGroupHeight" x="350" y="0" width="80" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -287,8 +321,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{blocnom} == null ? "" : $F{blocnom}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{blocnom} == null ? "" : $F{blocnom}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="70" height="20" uuid="0dcd7c23-f011-457e-a503-ce58f0bc710c">
|
<reportElement stretchType="ElementGroupHeight" x="430" y="0" width="70" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -303,8 +339,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{structurenom}== null ? "" : $F{structurenom}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{structurenom}== null ? "" : $F{structurenom}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="140" y="0" width="60" height="20" uuid="5d6015a1-12af-4979-9b77-576cb6c99c05">
|
<reportElement stretchType="ElementGroupHeight" x="140" y="0" width="60" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -319,8 +357,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{litige}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{litige}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="70" y="0" width="70" height="20" uuid="5880e9de-e658-4cda-b737-0d1e791fff8c">
|
<reportElement stretchType="ElementGroupHeight" x="70" y="0" width="70" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -335,8 +375,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{naturedomaine}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{naturedomaine}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="590" y="0" width="110" height="20" uuid="34bb5d2b-4841-49b0-a7fa-83217ce30dda">
|
<reportElement stretchType="ElementGroupHeight" x="590" y="0" width="110" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -351,8 +393,10 @@
|
|||||||
<textFieldExpression><![CDATA[$F{prenomraisonsociale} +" "+ $F{nomsigle}]]></textFieldExpression>
|
<textFieldExpression><![CDATA[$F{prenomraisonsociale} +" "+ $F{nomsigle}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20" uuid="beeb4530-5e7b-4759-a5ff-b8f2a4115d6d">
|
<reportElement stretchType="ElementGroupHeight" x="700" y="0" width="100" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
@@ -364,11 +408,14 @@
|
|||||||
<font size="8"/>
|
<font size="8"/>
|
||||||
<paragraph leftIndent="10"/>
|
<paragraph leftIndent="10"/>
|
||||||
</textElement>
|
</textElement>
|
||||||
<textFieldExpression><![CDATA[$F{statusenquete} == null ? "" : $F{statusenquete}]]></textFieldExpression>
|
<textFieldExpression>
|
||||||
|
<![CDATA[$F{statusenquete} == null ? "" : $F{statusenquete}]]></textFieldExpression>
|
||||||
</textField>
|
</textField>
|
||||||
<textField>
|
<textField>
|
||||||
<reportElement stretchType="ElementGroupHeight" x="500" y="0" width="90" height="20" uuid="28eac03c-0024-4451-9e95-b755a6cb6cb7">
|
<reportElement stretchType="ElementGroupHeight" x="500" y="0" width="90" height="20"
|
||||||
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bbc2af97-f9e1-4d01-8bda-9ea636f952d0"/>
|
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"/>
|
<property name="com.jaspersoft.studio.unit.leftIndent" value="px"/>
|
||||||
</reportElement>
|
</reportElement>
|
||||||
<box>
|
<box>
|
||||||
|
|||||||
1
pom.xml
1
pom.xml
@@ -98,7 +98,6 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.locationtech.jts</groupId>
|
<groupId>org.locationtech.jts</groupId>
|
||||||
<artifactId>jts-core</artifactId>
|
<artifactId>jts-core</artifactId>
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ public class DataLoadConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void loadRoles() {
|
public void loadRoles() {
|
||||||
|
|
||||||
if (roleRepository.count() > 0) return;
|
if (roleRepository.count() > 0) return;
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.authentication.AuthenticationProvider;
|
import org.springframework.security.authentication.AuthenticationProvider;
|
||||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
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.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.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
@@ -18,6 +21,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
|||||||
public class ApplicationConfig {
|
public class ApplicationConfig {
|
||||||
|
|
||||||
private final CustomUserDetailsService customUserDetailsService;
|
private final CustomUserDetailsService customUserDetailsService;
|
||||||
|
private final UserDetailsService userDetailsService;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public AuthenticationProvider authenticationProvider() {
|
public AuthenticationProvider authenticationProvider() {
|
||||||
@@ -37,13 +41,27 @@ public class ApplicationConfig {
|
|||||||
return new JwtAuthenticationFilter();
|
return new JwtAuthenticationFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
// @Bean
|
||||||
public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
|
// public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception {
|
||||||
return config.getAuthenticationManager();
|
// return config.getAuthenticationManager();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ModelMapper modelMapper() {
|
public ModelMapper modelMapper() {
|
||||||
return new 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import javax.sql.DataSource;
|
|||||||
@Configuration
|
@Configuration
|
||||||
public class JdbcConfig {
|
public class JdbcConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public JdbcTemplate jdbcTemplate(DataSource dataSource)
|
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
|
||||||
{
|
|
||||||
return new JdbcTemplate(dataSource);
|
return new JdbcTemplate(dataSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class SpringSecurityConfig {
|
|||||||
// .csrf(csrf -> {
|
// .csrf(csrf -> {
|
||||||
// csrf.ignoringRequestMatchers("/api/**");
|
// csrf.ignoringRequestMatchers("/api/**");
|
||||||
// })
|
// })
|
||||||
|
.exceptionHandling(ex -> ex.authenticationEntryPoint(jwtAuthenticationEntryPoint))
|
||||||
.authorizeHttpRequests(req ->
|
.authorizeHttpRequests(req ->
|
||||||
req
|
req
|
||||||
//.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
//.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||||
@@ -65,10 +66,11 @@ public class SpringSecurityConfig {
|
|||||||
.authenticationProvider(authenticationProvider)
|
.authenticationProvider(authenticationProvider)
|
||||||
.sessionManagement(session -> session.sessionCreationPolicy(STATELESS))
|
.sessionManagement(session -> session.sessionCreationPolicy(STATELESS))
|
||||||
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
|
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class)
|
||||||
.exceptionHandling(ex -> ex.authenticationEntryPoint(jwtAuthenticationEntryPoint))
|
|
||||||
;
|
;
|
||||||
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,6 @@ public class SwaggerOAS3Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public GroupedOpenApi infocadMetierApi() {
|
public GroupedOpenApi infocadMetierApi() {
|
||||||
return GroupedOpenApi.builder()
|
return GroupedOpenApi.builder()
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import net.sf.jasperreports.engine.JasperCompileManager;
|
import net.sf.jasperreports.engine.JasperCompileManager;
|
||||||
import net.sf.jasperreports.engine.JasperReport;
|
import net.sf.jasperreports.engine.JasperReport;
|
||||||
import net.sf.jasperreports.engine.util.JRSaver;
|
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.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
@@ -23,6 +25,8 @@ public class OpenController {
|
|||||||
@Value("${file.jasper-reports}")
|
@Value("${file.jasper-reports}")
|
||||||
private String jaspersDir;
|
private String jaspersDir;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(OpenController.class);
|
||||||
|
|
||||||
@GetMapping("/compile-report")
|
@GetMapping("/compile-report")
|
||||||
public ResponseEntity<?> compile(@RequestParam String jrxmlFileName) {
|
public ResponseEntity<?> compile(@RequestParam String jrxmlFileName) {
|
||||||
try {
|
try {
|
||||||
@@ -43,5 +47,4 @@ public class OpenController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ package io.gmss.fiscad.controllers.decoupage;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
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.interfaces.decoupage.ArrondissementService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -16,7 +18,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class ArrondissementController {
|
public class ArrondissementController {
|
||||||
|
|
||||||
private final ArrondissementService arrondissementService;
|
private final ArrondissementService arrondissementService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ArrondissementController.class);
|
||||||
|
|
||||||
public ArrondissementController(ArrondissementService arrondissementService) {
|
public ArrondissementController(ArrondissementService arrondissementService) {
|
||||||
this.arrondissementService = arrondissementService;
|
this.arrondissementService = arrondissementService;
|
||||||
@@ -47,11 +50,19 @@ public class ArrondissementController {
|
|||||||
new ApiResponse<>(true, arrondissement, "Arrondissement créé avec succès."),
|
new ApiResponse<>(true, arrondissement, "Arrondissement créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,11 +80,19 @@ public class ArrondissementController {
|
|||||||
new ApiResponse<>(true, arrondissementService.updateArrondissement(id, arrondissement), "Arrondissement mis à jour avec succès."),
|
new ApiResponse<>(true, arrondissementService.updateArrondissement(id, arrondissement), "Arrondissement mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,52 +104,115 @@ public class ArrondissementController {
|
|||||||
new ApiResponse<>(true, "Arrondissement supprimée avec succès."),
|
new ApiResponse<>(true, "Arrondissement supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllArrondissementList() {
|
public ResponseEntity<?> getAllArrondissementList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, arrondissementService.getArrondissementList(), "Liste des arrondissements chargée avec succès."),
|
new ApiResponse<>(true, arrondissementService.getArrondissementList(), "Liste des arrondissements chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllArrondissementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllArrondissementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, arrondissementService.getArrondissementList(pageable), "Liste des arrondissements chargée avec succès."),
|
new ApiResponse<>(true, arrondissementService.getArrondissementList(pageable), "Liste des arrondissements chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
|
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, arrondissementService.getArrondissementById(id), "Arrondissement trouvé avec succès."),
|
new ApiResponse<>(true, arrondissementService.getArrondissementById(id), "Arrondissement trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/commune/{communeId}")
|
||||||
public ResponseEntity<?> getArrondissementByCommune(@PathVariable Long communeId) {
|
public ResponseEntity<?> getArrondissementByCommune(@PathVariable Long communeId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, arrondissementService.getArrondissementByComune(communeId), "Liste des arrondissements par commune chargée avec succès."),
|
new ApiResponse<>(true, arrondissementService.getArrondissementByComune(communeId), "Liste des arrondissements par commune chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}catch (NotFoundException e){
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
);
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
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.interfaces.decoupage.CommuneService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -15,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -27,6 +29,8 @@ public class CommuneController {
|
|||||||
|
|
||||||
private final CommuneService communeService;
|
private final CommuneService communeService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CommuneController.class);
|
||||||
|
|
||||||
public CommuneController(CommuneService communeService) {
|
public CommuneController(CommuneService communeService) {
|
||||||
this.communeService = communeService;
|
this.communeService = communeService;
|
||||||
}
|
}
|
||||||
@@ -39,11 +43,19 @@ public class CommuneController {
|
|||||||
new ApiResponse<>(true, commune, "Commune créé avec succès."),
|
new ApiResponse<>(true, commune, "Commune créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,11 +66,19 @@ public class CommuneController {
|
|||||||
new ApiResponse<>(true, communeService.updateCommune(id, commune), "Commune mis à jour avec succès."),
|
new ApiResponse<>(true, communeService.updateCommune(id, commune), "Commune mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,37 +90,92 @@ public class CommuneController {
|
|||||||
new ApiResponse<>(true, "Commune supprimée avec succès."),
|
new ApiResponse<>(true, "Commune supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllCommuneList() {
|
public ResponseEntity<?> getAllCommuneList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, communeService.getCommuneList(), "Liste des communes chargée avec succès."),
|
new ApiResponse<>(true, communeService.getCommuneList(), "Liste des communes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllCommunePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllCommunePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, communeService.getCommuneList(pageable), "Liste des communes chargée avec succès."),
|
new ApiResponse<>(true, communeService.getCommuneList(pageable), "Liste des communes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getCommuneById(@PathVariable Long id) {
|
public ResponseEntity<?> getCommuneById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, communeService.getCommuneById(id), "Commune trouvée avec succès."),
|
new ApiResponse<>(true, communeService.getCommuneById(id), "Commune trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@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."),
|
new ApiResponse<>(true, communeService.getCommunesByDepartement(departementId), "Liste des communes par département chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}catch (NotFoundException e){
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
);
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Departement;
|
import io.gmss.fiscad.entities.decoupage.Departement;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.DepartementService;
|
import io.gmss.fiscad.interfaces.decoupage.DepartementService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class DepartementController {
|
public class DepartementController {
|
||||||
|
|
||||||
private final DepartementService departementService;
|
private final DepartementService departementService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(DepartementController.class);
|
||||||
|
|
||||||
public DepartementController(DepartementService departementService) {
|
public DepartementController(DepartementService departementService) {
|
||||||
this.departementService = departementService;
|
this.departementService = departementService;
|
||||||
@@ -38,11 +42,19 @@ public class DepartementController {
|
|||||||
new ApiResponse<>(true, departement, "Departement créé avec succès."),
|
new ApiResponse<>(true, departement, "Departement créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class DepartementController {
|
|||||||
new ApiResponse<>(true, departementService.updateDepartement(id, departement), "Département mis à jour avec succès."),
|
new ApiResponse<>(true, departementService.updateDepartement(id, departement), "Département mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,91 @@ public class DepartementController {
|
|||||||
new ApiResponse<>(true, "Département supprimé avec succès."),
|
new ApiResponse<>(true, "Département supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllDepartementList() {
|
public ResponseEntity<?> getAllDepartementList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, departementService.getDepartementList(), "Liste des département chargée avec succès."),
|
new ApiResponse<>(true, departementService.getDepartementList(), "Liste des département chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllDepartementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllDepartementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, departementService.getDepartementList(pageable), "Liste des département chargée avec succès."),
|
new ApiResponse<>(true, departementService.getDepartementList(pageable), "Liste des département chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getDepartementById(@PathVariable Long id) {
|
public ResponseEntity<?> getDepartementById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, departementService.getDepartementById(id), "Département trouvé avec succès."),
|
new ApiResponse<>(true, departementService.getDepartementById(id), "Département trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Nationalite;
|
import io.gmss.fiscad.entities.decoupage.Nationalite;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.NationaliteService;
|
import io.gmss.fiscad.interfaces.decoupage.NationaliteService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class NationaliteController {
|
public class NationaliteController {
|
||||||
|
|
||||||
private final NationaliteService nationaliteService;
|
private final NationaliteService nationaliteService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(NationaliteController.class);
|
||||||
|
|
||||||
public NationaliteController(NationaliteService nationaliteService) {
|
public NationaliteController(NationaliteService nationaliteService) {
|
||||||
this.nationaliteService = nationaliteService;
|
this.nationaliteService = nationaliteService;
|
||||||
@@ -38,11 +42,19 @@ public class NationaliteController {
|
|||||||
new ApiResponse<>(true, nationalite, "Nationalite créé avec succès."),
|
new ApiResponse<>(true, nationalite, "Nationalite créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class NationaliteController {
|
|||||||
new ApiResponse<>(true, nationaliteService.updateNationalite(id, nationalite), "Nationalités mis à jour avec succès."),
|
new ApiResponse<>(true, nationaliteService.updateNationalite(id, nationalite), "Nationalités mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,90 @@ public class NationaliteController {
|
|||||||
new ApiResponse<>(true, "Nationalités supprimé avec succès."),
|
new ApiResponse<>(true, "Nationalités supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllNationaliteList() {
|
public ResponseEntity<?> getAllNationaliteList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, nationaliteService.getNationaliteList(), "Liste des nationalités chargée avec succès."),
|
new ApiResponse<>(true, nationaliteService.getNationaliteList(), "Liste des nationalités chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllNationalitePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllNationalitePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, nationaliteService.getNationaliteList(pageable), "Liste des nationalités chargée avec succès."),
|
new ApiResponse<>(true, nationaliteService.getNationaliteList(pageable), "Liste des nationalités chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getNationaliteById(@PathVariable Long id) {
|
public ResponseEntity<?> getNationaliteById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, nationaliteService.getNationaliteById(id), "Nationalités trouvées avec succès."),
|
new ApiResponse<>(true, nationaliteService.getNationaliteById(id), "Nationalités trouvées avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package io.gmss.fiscad.controllers.decoupage;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
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.interfaces.decoupage.QuartierService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -15,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class QuartierController {
|
public class QuartierController {
|
||||||
|
|
||||||
private final QuartierService quartierService;
|
private final QuartierService quartierService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(QuartierController.class);
|
||||||
|
|
||||||
public QuartierController(QuartierService quartierService) {
|
public QuartierController(QuartierService quartierService) {
|
||||||
this.quartierService = quartierService;
|
this.quartierService = quartierService;
|
||||||
@@ -38,11 +42,19 @@ public class QuartierController {
|
|||||||
new ApiResponse<>(true, quartier, "Quartier créé avec succès."),
|
new ApiResponse<>(true, quartier, "Quartier créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class QuartierController {
|
|||||||
new ApiResponse<>(true, quartierService.updateQuartier(id, quartier), "Quartier mis à jour avec succès."),
|
new ApiResponse<>(true, quartierService.updateQuartier(id, quartier), "Quartier mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,37 +89,90 @@ public class QuartierController {
|
|||||||
new ApiResponse<>(true, "Quartier supprimé avec succès."),
|
new ApiResponse<>(true, "Quartier supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllQuartierList() {
|
public ResponseEntity<?> getAllQuartierList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, quartierService.getQuartierList(), "Liste des quartiers chargée avec succès."),
|
new ApiResponse<>(true, quartierService.getQuartierList(), "Liste des quartiers chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllQuartierPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllQuartierPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, quartierService.getQuartierList(pageable), "Liste des quartiers chargée avec succès."),
|
new ApiResponse<>(true, quartierService.getQuartierList(pageable), "Liste des quartiers chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getQuartierById(@PathVariable Long id) {
|
public ResponseEntity<?> getQuartierById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, quartierService.getQuartierById(id), "Quartier trouvé avec succès."),
|
new ApiResponse<>(true, quartierService.getQuartierById(id), "Quartier trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@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."),
|
new ApiResponse<>(true, quartierService.getQuartierByArrondissement(arrondissementId), "Liste des quartiers par commune chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}catch (NotFoundException e){
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
);
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package io.gmss.fiscad.controllers.decoupage;
|
package io.gmss.fiscad.controllers.decoupage;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.Secteur;
|
import io.gmss.fiscad.entities.decoupage.Secteur;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
import io.gmss.fiscad.interfaces.decoupage.SecteurService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.SecteurPayload;
|
import io.gmss.fiscad.paylaods.request.SecteurPayload;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -23,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class SecteurController {
|
public class SecteurController {
|
||||||
|
|
||||||
private final SecteurService secteurService;
|
private final SecteurService secteurService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SecteurController.class);
|
||||||
|
|
||||||
public SecteurController(SecteurService secteurService) {
|
public SecteurController(SecteurService secteurService) {
|
||||||
this.secteurService = secteurService;
|
this.secteurService = secteurService;
|
||||||
@@ -38,16 +43,23 @@ public class SecteurController {
|
|||||||
new ApiResponse<>(true, secteur, "Secteur créé avec succès."),
|
new ApiResponse<>(true, secteur, "Secteur créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PutMapping("/update/{id}")
|
@PutMapping("/update/{id}")
|
||||||
public ResponseEntity<?> updateSecteur(@PathVariable Long id, @RequestBody SecteurPayload secteurPayload) {
|
public ResponseEntity<?> updateSecteur(@PathVariable Long id, @RequestBody SecteurPayload secteurPayload) {
|
||||||
try {
|
try {
|
||||||
@@ -55,11 +67,19 @@ public class SecteurController {
|
|||||||
new ApiResponse<>(true, secteurService.updateSecteur(id, secteurPayload), "Secteur mis à jour avec succès."),
|
new ApiResponse<>(true, secteurService.updateSecteur(id, secteurPayload), "Secteur mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,46 +91,114 @@ public class SecteurController {
|
|||||||
new ApiResponse<>(true, "Secteur supprimée avec succès."),
|
new ApiResponse<>(true, "Secteur supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllSecteurList() {
|
public ResponseEntity<?> getAllSecteurList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, secteurService.getSecteurList(), "Liste des secteurs chargée avec succès."),
|
new ApiResponse<>(true, secteurService.getSecteurList(), "Liste des secteurs chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllSecteurPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllSecteurPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, secteurService.getSecteurList(pageable), "Liste des secteurs chargée avec succès."),
|
new ApiResponse<>(true, secteurService.getSecteurList(pageable), "Liste des secteurs chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getSecteurById(@PathVariable Long id) {
|
public ResponseEntity<?> getSecteurById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, secteurService.getSecteurById(id), "Secteur trouvée avec succès."),
|
new ApiResponse<>(true, secteurService.getSecteurById(id), "Secteur trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/by-structure-id/{structureId}")
|
||||||
public ResponseEntity<?> getSecteurByStructureId(@PathVariable Long structureId) {
|
public ResponseEntity<?> getSecteurByStructureId(@PathVariable Long structureId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, secteurService.getSecteurById(structureId), "Secteur trouvée avec succès."),
|
new ApiResponse<>(true, secteurService.getSecteurById(structureId), "Secteur trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package io.gmss.fiscad.controllers.decoupage;
|
package io.gmss.fiscad.controllers.decoupage;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
import io.gmss.fiscad.interfaces.decoupage.SecteurDecoupageService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -13,6 +16,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -22,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class SecteurDecoupageController {
|
public class SecteurDecoupageController {
|
||||||
|
|
||||||
private final SecteurDecoupageService secteurDecoupageService;
|
private final SecteurDecoupageService secteurDecoupageService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SecteurDecoupageController.class);
|
||||||
|
|
||||||
public SecteurDecoupageController(SecteurDecoupageService secteurDecoupageService) {
|
public SecteurDecoupageController(SecteurDecoupageService secteurDecoupageService) {
|
||||||
this.secteurDecoupageService = secteurDecoupageService;
|
this.secteurDecoupageService = secteurDecoupageService;
|
||||||
@@ -36,11 +41,19 @@ public class SecteurDecoupageController {
|
|||||||
new ApiResponse<>(true, secteurDecoupage, "SecteurDecoupage créé avec succès."),
|
new ApiResponse<>(true, secteurDecoupage, "SecteurDecoupage créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,11 +64,19 @@ public class SecteurDecoupageController {
|
|||||||
new ApiResponse<>(true, secteurDecoupageService.updateSecteurDecoupage(id, secteurDecoupage), "SecteurDecoupage mis à jour avec succès."),
|
new ApiResponse<>(true, secteurDecoupageService.updateSecteurDecoupage(id, secteurDecoupage), "SecteurDecoupage mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,37 +88,90 @@ public class SecteurDecoupageController {
|
|||||||
new ApiResponse<>(true, "Secteur découpage supprimée avec succès."),
|
new ApiResponse<>(true, "Secteur découpage supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllSecteurDecoupageList() {
|
public ResponseEntity<?> getAllSecteurDecoupageList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(), "Liste des secteurDecoupages chargée avec succès."),
|
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(), "Liste des secteurDecoupages chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllSecteurDecoupagePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllSecteurDecoupagePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(pageable), "Liste des secteurDecoupages chargée avec succès."),
|
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageList(pageable), "Liste des secteurDecoupages chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getSecteurDecoupageById(@PathVariable Long id) {
|
public ResponseEntity<?> getSecteurDecoupageById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageById(id), "SecteurDecoupage trouvée avec succès."),
|
new ApiResponse<>(true, secteurDecoupageService.getSecteurDecoupageById(id), "SecteurDecoupage trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
package io.gmss.fiscad.controllers.infocad.metier;
|
package io.gmss.fiscad.controllers.infocad.metier;
|
||||||
|
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.infocad.metier.ActeurConcerneService;
|
import io.gmss.fiscad.interfaces.infocad.metier.ActeurConcerneService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "api/acteur-concerne", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "api/acteur-concerne", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@@ -18,6 +22,8 @@ public class ActeurConcerneController {
|
|||||||
|
|
||||||
private final ActeurConcerneService acteurConcerneService;
|
private final ActeurConcerneService acteurConcerneService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ActeurConcerneController.class);
|
||||||
|
|
||||||
public ActeurConcerneController(ActeurConcerneService acteurConcerneService) {
|
public ActeurConcerneController(ActeurConcerneService acteurConcerneService) {
|
||||||
this.acteurConcerneService = acteurConcerneService;
|
this.acteurConcerneService = acteurConcerneService;
|
||||||
}
|
}
|
||||||
@@ -25,10 +31,25 @@ public class ActeurConcerneController {
|
|||||||
|
|
||||||
@GetMapping("/id/{id}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
|
public ResponseEntity<?> getArrondissementById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, acteurConcerneService.getActeurConcerneById(id).get(), "Arrondissement trouvé avec succès."),
|
new ApiResponse<>(true, acteurConcerneService.getActeurConcerneById(id).get(), "Arrondissement trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.gmss.fiscad.controllers.infocad.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Commentaire;
|
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.interfaces.infocad.metier.CommentaireService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.CommentaireRequest;
|
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.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -27,6 +31,8 @@ public class CommentaireController {
|
|||||||
|
|
||||||
private final CommentaireService commentaireService;
|
private final CommentaireService commentaireService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CommentaireController.class);
|
||||||
|
|
||||||
public CommentaireController(CommentaireService commentaireService) {
|
public CommentaireController(CommentaireService commentaireService) {
|
||||||
this.commentaireService = commentaireService;
|
this.commentaireService = commentaireService;
|
||||||
}
|
}
|
||||||
@@ -41,11 +47,19 @@ public class CommentaireController {
|
|||||||
new ApiResponse<>(true, commentaire, "Commentaire créé avec succès."),
|
new ApiResponse<>(true, commentaire, "Commentaire créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,11 +70,19 @@ public class CommentaireController {
|
|||||||
new ApiResponse<>(true, commentaireService.updateCommentaire(id, commentaire), "commentaire mis à jour avec succès."),
|
new ApiResponse<>(true, commentaireService.updateCommentaire(id, commentaire), "commentaire mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,89 +94,232 @@ public class CommentaireController {
|
|||||||
new ApiResponse<>(true, "Commentaire supprimé avec succès."),
|
new ApiResponse<>(true, "Commentaire supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllcommentaireList() {
|
public ResponseEntity<?> getAllcommentaireList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.getCommentaireList(), "Liste des commentaires chargée avec succès."),
|
new ApiResponse<>(true, commentaireService.getCommentaireList(), "Liste des commentaires chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getcommentaireById(@PathVariable Long id) {
|
public ResponseEntity<?> getcommentaireById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.getCommentaireById(id), "commentaire trouvée avec succès."),
|
new ApiResponse<>(true, commentaireService.getCommentaireById(id), "commentaire trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/nup/{nup}")
|
||||||
public ResponseEntity<?> getcommentaireByNup(@PathVariable String nup) {
|
public ResponseEntity<?> getcommentaireByNup(@PathVariable String nup) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.getCommentaireByNup(nup), "commentaire trouvée avec succès."),
|
new ApiResponse<>(true, commentaireService.getCommentaireByNup(nup), "commentaire trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/enquete")
|
||||||
public ResponseEntity<?> getcommentaireByEnquete(@RequestBody Commentaire commentaire) {
|
public ResponseEntity<?> getcommentaireByEnquete(@RequestBody Commentaire commentaire) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndTerminal(commentaire.getIdEnquete(), commentaire.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndTerminal(commentaire.getIdEnquete(), commentaire.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@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")
|
//@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) {
|
public ResponseEntity<?> getcommentaireByEnqueteAndStatut(@RequestBody Commentaire commentaire) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndLu(commentaire.getIdEnquete(), commentaire.isLu()), "Liste des commentaires chargée avec succès."),
|
new ApiResponse<>(true, commentaireService.getCommentairesByEnqueteAndLu(commentaire.getIdEnquete(), commentaire.isLu()), "Liste des commentaires chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@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")
|
//@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) {
|
public ResponseEntity<?> getcommentaireByParams(@RequestBody CommentaireRequest commentaireRequest) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateReadAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isLu(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateReadAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isLu(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("synchronise/from-mobile")
|
||||||
//@ApiOperation(value = "Cette ressource permet de synchroniser tous les commentaires effectués sur le mobile vers le backend.")
|
//@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) {
|
public ResponseEntity<?> synchroniseCommentairesFromMobile(@RequestBody List<Commentaire> commentaires) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.saveAllCommentairesFromMobile(commentaires), "Liste des commentaires synchronisée avec succès."),
|
new ApiResponse<>(true, commentaireService.saveAllCommentairesFromMobile(commentaires), "Liste des commentaires synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@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")
|
//@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) {
|
public ResponseEntity<?> synchroniseCommentairesFromWeb(@RequestBody CommentaireRequest commentaireRequest) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateSynchronizedAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isSynchronise(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
new ApiResponse<>(true, commentaireService.getCommentairesByOrigineAndStateSynchronizedAndTerminalId(commentaireRequest.getOrigine(), commentaireRequest.isSynchronise(), commentaireRequest.getTerminalId()), "Liste des commentaires chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@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. ")
|
//@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) {
|
public ResponseEntity<?> notifyDoneSynchronizedFromMobile(@RequestBody List<SyncCommentaireRequest> syncCommentaireRequests) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, commentaireService.notifySynchronizedDoneFromMobile(syncCommentaireRequests), "Synchronisation terminée."),
|
new ApiResponse<>(true, commentaireService.notifySynchronizedDoneFromMobile(syncCommentaireRequests), "Synchronisation terminée."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.gmss.fiscad.controllers.infocad.metier;
|
package io.gmss.fiscad.controllers.infocad.metier;
|
||||||
|
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
import io.gmss.fiscad.interfaces.infocad.metier.EnqueteService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.EnquetePayLoad;
|
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.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -15,6 +18,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -27,6 +31,8 @@ public class EnqueteController {
|
|||||||
|
|
||||||
private final EnqueteService enqueteService;
|
private final EnqueteService enqueteService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(EnqueteController.class);
|
||||||
|
|
||||||
public EnqueteController(EnqueteService enqueteService) {
|
public EnqueteController(EnqueteService enqueteService) {
|
||||||
this.enqueteService = enqueteService;
|
this.enqueteService = enqueteService;
|
||||||
}
|
}
|
||||||
@@ -56,11 +62,19 @@ public class EnqueteController {
|
|||||||
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoad), "Validation effectuée avec succès."),
|
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoad), "Validation effectuée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,11 +85,19 @@ public class EnqueteController {
|
|||||||
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoad), "Rejet effectuée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,11 +108,19 @@ public class EnqueteController {
|
|||||||
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoads), "Validation effectuée avec succès."),
|
new ApiResponse<>(true, enqueteService.validerEnquete(enqueteTraitementPayLoads), "Validation effectuée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false,"Impossible de valider l'enquête : " + e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,20 +131,43 @@ public class EnqueteController {
|
|||||||
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectuée avec succès."),
|
new ApiResponse<>(true, enqueteService.rejeterEnquete(enqueteTraitementPayLoads), "Rejet effectuée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false,"Impossible de valider l'enquête : "+e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all/decoupage-admin-for-enquete")
|
@GetMapping("/all/decoupage-admin-for-enquete")
|
||||||
public ResponseEntity<?> getAllByEnqueteDecoupageAdmin() {
|
public ResponseEntity<?> getAllByEnqueteDecoupageAdmin() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getDecoupageAdminUserConnecterAndStat(), "Liste des enquetes chargée avec succès."),
|
new ApiResponse<>(true, enqueteService.getDecoupageAdminUserConnecterAndStat(), "Liste des enquetes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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."),
|
new ApiResponse<>(true, "enquete supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllStructureList() {
|
public ResponseEntity<?> getAllStructureList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getEnqueteList(), "Liste des enquetes chargée avec succès."),
|
new ApiResponse<>(true, enqueteService.getEnqueteList(), "Liste des enquetes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all/com-arrond-bloc")
|
||||||
public ResponseEntity<?> getAllByCommuneArrondBloc() {
|
public ResponseEntity<?> getAllByCommuneArrondBloc() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBloc(), "Liste des enquetes chargée avec succès."),
|
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBloc(), "Liste des enquetes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/all/com-arrond-bloc/filtre")
|
||||||
public ResponseEntity<?> getAllByCommuneArrondBlocFiltre(@RequestBody FiltreEnquetePayLoad filtreEnquetePayLoad) {
|
public ResponseEntity<?> getAllByCommuneArrondBlocFiltre(@RequestBody FiltreEnquetePayLoad filtreEnquetePayLoad) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBlocFiltre(filtreEnquetePayLoad), "Liste des enquetes chargée avec succès."),
|
new ApiResponse<>(true, enqueteService.getEnqueteCommuneArrondBlocFiltre(filtreEnquetePayLoad), "Liste des enquetes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllEnquetePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllEnquetePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getEnqueteList(pageable), "Liste des enquetes chargée avec succès."),
|
new ApiResponse<>(true, enqueteService.getEnqueteList(pageable), "Liste des enquetes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/fiche/id/{id}")
|
||||||
public ResponseEntity<?> getFicheEnqueteById(@PathVariable Long id) {
|
public ResponseEntity<?> getFicheEnqueteById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getFicheEnquete(id), "enquete trouvé avec succès."),
|
new ApiResponse<>(true, enqueteService.getFicheEnquete(id), "enquete trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getEnqueteById(id), "enquete trouvé avec succès."),
|
new ApiResponse<>(true, enqueteService.getEnqueteById(id), "enquete trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/traiter-non-synch-to-mobile/{terminalId}")
|
||||||
public ResponseEntity<?> getEnqueteValideNonSynch(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getEnqueteValideNonSynch(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteService.getEnqueteValideNonSynch(terminalId), "Liste des enquetes traitées non synchronisées sur le termianl."),
|
new ApiResponse<>(true, enqueteService.getEnqueteValideNonSynch(terminalId), "Liste des enquetes traitées non synchronisées sur le termianl."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.metier.Tpe;
|
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.interfaces.infocad.metier.TpeService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class TpeController {
|
public class TpeController {
|
||||||
|
|
||||||
private final TpeService tpeService;
|
private final TpeService tpeService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TpeController.class);
|
||||||
|
|
||||||
public TpeController(TpeService tpeService) {
|
public TpeController(TpeService tpeService) {
|
||||||
this.tpeService = tpeService;
|
this.tpeService = tpeService;
|
||||||
@@ -37,11 +42,19 @@ public class TpeController {
|
|||||||
new ApiResponse<>(true, tpe, "Tpe créé avec succès."),
|
new ApiResponse<>(true, tpe, "Tpe créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +65,19 @@ public class TpeController {
|
|||||||
new ApiResponse<>(true, tpeService.updateTpe(id, tpe), "Tpe mis à jour avec succès."),
|
new ApiResponse<>(true, tpeService.updateTpe(id, tpe), "Tpe mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,61 +89,159 @@ public class TpeController {
|
|||||||
new ApiResponse<>(true, "Tpe supprimé avec succès."),
|
new ApiResponse<>(true, "Tpe supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllTpeList() {
|
public ResponseEntity<?> getAllTpeList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, tpeService.getTpeList(), "Liste des tpe chargée avec succès."),
|
new ApiResponse<>(true, tpeService.getTpeList(), "Liste des tpe chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/all-by-model/{model}")
|
||||||
public ResponseEntity<?> getAllTpeListByModel(@PathVariable String model) {
|
public ResponseEntity<?> getAllTpeListByModel(@PathVariable String model) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, tpeService.getTpeListByModel(model), "Liste des tpe chargée avec succès."),
|
new ApiResponse<>(true, tpeService.getTpeListByModel(model), "Liste des tpe chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/all-by-userId/{userId}")
|
||||||
public ResponseEntity<?> getAllTpeListByUserId(@PathVariable Long userId) {
|
public ResponseEntity<?> getAllTpeListByUserId(@PathVariable Long userId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, tpeService.getTpeListByUserId(userId), "Liste des tpe de l'utilisateurs."),
|
new ApiResponse<>(true, tpeService.getTpeListByUserId(userId), "Liste des tpe de l'utilisateurs."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllTpePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllTpePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, tpeService.getTpeList(pageable), "Liste des tpe chargée avec succès."),
|
new ApiResponse<>(true, tpeService.getTpeList(pageable), "Liste des tpe chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getTpeById(@PathVariable Long id) {
|
public ResponseEntity<?> getTpeById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, tpeService.getTpeById(id), "Tpe trouvé avec succès."),
|
new ApiResponse<>(true, tpeService.getTpeById(id), "Tpe trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/identifier/{identifier}")
|
||||||
public ResponseEntity<?> getTpeByIdentifier(@PathVariable String identifier) {
|
public ResponseEntity<?> getTpeByIdentifier(@PathVariable String identifier) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, tpeService.getTepByIdentifier(identifier), "Tpe trouvé avec succès."),
|
new ApiResponse<>(true, tpeService.getTepByIdentifier(identifier), "Tpe trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class UploadController {
|
|||||||
private UploadRepository uploadRepository;
|
private UploadRepository uploadRepository;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FileStorageService fileStorageService;
|
private FileStorageService fileStorageService;
|
||||||
|
|
||||||
@@ -55,9 +54,6 @@ public class UploadController {
|
|||||||
// private ActeurRepository proprietaireRepository;
|
// private ActeurRepository proprietaireRepository;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private int firstLineColumnNumber = 0;
|
private int firstLineColumnNumber = 0;
|
||||||
private String fileHeader;
|
private String fileHeader;
|
||||||
private String fileHeaderType;
|
private String fileHeaderType;
|
||||||
@@ -65,14 +61,10 @@ public class UploadController {
|
|||||||
private int indiceOfFile = 0;
|
private int indiceOfFile = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMDD");
|
private SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMDD");
|
||||||
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYYMMDD");
|
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYYMMDD");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> all() {
|
public ResponseEntity<?> all() {
|
||||||
try {
|
try {
|
||||||
@@ -114,8 +106,6 @@ public class UploadController {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/id/{id}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> one(@PathVariable Long id) {
|
public ResponseEntity<?> one(@PathVariable Long id) {
|
||||||
|
|
||||||
@@ -137,7 +127,6 @@ public class UploadController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @param request
|
* @param request
|
||||||
@@ -201,8 +190,6 @@ public class UploadController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@DeleteMapping("/delete/id/{id}")
|
@DeleteMapping("/delete/id/{id}")
|
||||||
public ResponseEntity<?> delete(@PathVariable Long id) {
|
public ResponseEntity<?> delete(@PathVariable Long id) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -2,13 +2,15 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Bloc;
|
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.interfaces.infocad.parametre.BlocService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.security.CurrentUser;
|
import io.gmss.fiscad.security.CurrentUser;
|
||||||
import io.gmss.fiscad.security.UserPrincipal;
|
import io.gmss.fiscad.security.UserPrincipal;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -16,7 +18,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class BlocController {
|
public class BlocController {
|
||||||
|
|
||||||
private final BlocService blocService;
|
private final BlocService blocService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(BlocController.class);
|
||||||
|
|
||||||
public BlocController(BlocService blocService) {
|
public BlocController(BlocService blocService) {
|
||||||
this.blocService = blocService;
|
this.blocService = blocService;
|
||||||
@@ -40,11 +43,19 @@ public class BlocController {
|
|||||||
new ApiResponse<>(true, bloc, "Bloc créé avec succès."),
|
new ApiResponse<>(true, bloc, "Bloc créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +66,19 @@ public class BlocController {
|
|||||||
new ApiResponse<>(true, blocService.updateBloc(id, bloc), "Bloc mis à jour avec succès."),
|
new ApiResponse<>(true, blocService.updateBloc(id, bloc), "Bloc mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,62 +90,165 @@ public class BlocController {
|
|||||||
new ApiResponse<>(true, "Bloc supprimé avec succès."),
|
new ApiResponse<>(true, "Bloc supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllBlocList() {
|
public ResponseEntity<?> getAllBlocList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, blocService.getBlocList(), "Liste des blocs chargée avec succès."),
|
new ApiResponse<>(true, blocService.getBlocList(), "Liste des blocs chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/list-by-arrondissement")
|
||||||
public ResponseEntity<?> getAllBlocListByArrondissement(@RequestParam Long idArrondissement) {
|
public ResponseEntity<?> getAllBlocListByArrondissement(@RequestParam Long idArrondissement) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, blocService.getBlocsByArrondissement(idArrondissement), "Liste des blocs chargée avec succès."),
|
new ApiResponse<>(true, blocService.getBlocsByArrondissement(idArrondissement), "Liste des blocs chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/list-by-structure")
|
||||||
public ResponseEntity<?> getAllBlocListByStructure(@RequestParam Long idStructure) {
|
public ResponseEntity<?> getAllBlocListByStructure(@RequestParam Long idStructure) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, blocService.getBlocsByStructure(idStructure), "Liste des blocs chargée avec succès."),
|
new ApiResponse<>(true, blocService.getBlocsByStructure(idStructure), "Liste des blocs chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/list-by-secteur")
|
||||||
@Tag(name = "Liste blocs", description = "Liste des blocs d'un secteur")
|
@Tag(name = "Liste blocs", description = "Liste des blocs d'un secteur")
|
||||||
public ResponseEntity<?> getAllBlocListBySecteur(@RequestParam Long idSecteur) {
|
public ResponseEntity<?> getAllBlocListBySecteur(@RequestParam Long idSecteur) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, blocService.getBlocsBySecteur(idSecteur), "Liste des blocs chargée avec succès."),
|
new ApiResponse<>(true, blocService.getBlocsBySecteur(idSecteur), "Liste des blocs chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllBlocPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllBlocPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, blocService.getBlocList(pageable), "Liste des blocs chargée avec succès."),
|
new ApiResponse<>(true, blocService.getBlocList(pageable), "Liste des blocs chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getBlocById(@PathVariable Long id) {
|
public ResponseEntity<?> getBlocById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, blocService.getBlocById(id), "Bloc trouvé avec succès."),
|
new ApiResponse<>(true, blocService.getBlocById(id), "Bloc trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.ModeAcquisition;
|
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.interfaces.infocad.parametre.ModeAcquisitionService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -26,6 +29,8 @@ public class ModeAcquisitionController {
|
|||||||
|
|
||||||
private final ModeAcquisitionService modeAcquisitionService;
|
private final ModeAcquisitionService modeAcquisitionService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ModeAcquisitionController.class);
|
||||||
|
|
||||||
public ModeAcquisitionController(ModeAcquisitionService modeAcquisitionService) {
|
public ModeAcquisitionController(ModeAcquisitionService modeAcquisitionService) {
|
||||||
this.modeAcquisitionService = modeAcquisitionService;
|
this.modeAcquisitionService = modeAcquisitionService;
|
||||||
}
|
}
|
||||||
@@ -38,11 +43,19 @@ public class ModeAcquisitionController {
|
|||||||
new ApiResponse<>(true, modeAcquisition, "Mode acquisition créé avec succès."),
|
new ApiResponse<>(true, modeAcquisition, "Mode acquisition créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +66,19 @@ public class ModeAcquisitionController {
|
|||||||
new ApiResponse<>(true, modeAcquisitionService.updateModeAcquisition(id, modeAcquisition), "Mode d'acquisition mis à jour avec succès."),
|
new ApiResponse<>(true, modeAcquisitionService.updateModeAcquisition(id, modeAcquisition), "Mode d'acquisition mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +90,89 @@ public class ModeAcquisitionController {
|
|||||||
new ApiResponse<>(true, "Mode d'acquisition supprimé avec succès."),
|
new ApiResponse<>(true, "Mode d'acquisition supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllModeAcquisitionList() {
|
public ResponseEntity<?> getAllModeAcquisitionList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(), "Liste des modes d'acquisitions chargée avec succès."),
|
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(), "Liste des modes d'acquisitions chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllModeAcquisitionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllModeAcquisitionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(pageable), "Liste des modes d'acquisitions chargée avec succès."),
|
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionList(pageable), "Liste des modes d'acquisitions chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getModeAcquisitionById(@PathVariable Long id) {
|
public ResponseEntity<?> getModeAcquisitionById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionById(id), "Mode d'acquisition trouvé avec succès."),
|
new ApiResponse<>(true, modeAcquisitionService.getModeAcquisitionById(id), "Mode d'acquisition trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
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.interfaces.infocad.parametre.NatureDomaineService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class NatureDomaineController {
|
public class NatureDomaineController {
|
||||||
|
|
||||||
private final NatureDomaineService natureDomaineService;
|
private final NatureDomaineService natureDomaineService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(NatureDomaineController.class);
|
||||||
|
|
||||||
public NatureDomaineController(NatureDomaineService natureDomaineService) {
|
public NatureDomaineController(NatureDomaineService natureDomaineService) {
|
||||||
this.natureDomaineService = natureDomaineService;
|
this.natureDomaineService = natureDomaineService;
|
||||||
@@ -38,11 +42,19 @@ public class NatureDomaineController {
|
|||||||
new ApiResponse<>(true, natureDomaine, "Nature Domaine créé avec succès."),
|
new ApiResponse<>(true, natureDomaine, "Nature Domaine créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class NatureDomaineController {
|
|||||||
new ApiResponse<>(true, natureDomaineService.updateNatureDomaine(id, natureDomaine), "Nature Domaine mise à jour avec succès."),
|
new ApiResponse<>(true, natureDomaineService.updateNatureDomaine(id, natureDomaine), "Nature Domaine mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,89 @@ public class NatureDomaineController {
|
|||||||
new ApiResponse<>(true, "Nature Domaine supprimée avec succès."),
|
new ApiResponse<>(true, "Nature Domaine supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllNatureDomaineList() {
|
public ResponseEntity<?> getAllNatureDomaineList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(), "Liste des natures de domaine chargée avec succès."),
|
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(), "Liste des natures de domaine chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllNatureDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllNatureDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(pageable), "Liste des natures de domaine chargée avec succès."),
|
new ApiResponse<>(true, natureDomaineService.getNatureDomaineList(pageable), "Liste des natures de domaine chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getNatureDomaineById(@PathVariable Long id) {
|
public ResponseEntity<?> getNatureDomaineById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, natureDomaineService.getNatureDomaineById(id), "Nature Domaine trouvé avec succès."),
|
new ApiResponse<>(true, natureDomaineService.getNatureDomaineById(id), "Nature Domaine trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.PositionRepresentation;
|
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.interfaces.infocad.parametre.PositionRepresentationService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class PositionRepresentationController {
|
public class PositionRepresentationController {
|
||||||
|
|
||||||
private final PositionRepresentationService positionRepresentationService;
|
private final PositionRepresentationService positionRepresentationService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(PositionRepresentationController.class);
|
||||||
|
|
||||||
public PositionRepresentationController(PositionRepresentationService positionRepresentationService) {
|
public PositionRepresentationController(PositionRepresentationService positionRepresentationService) {
|
||||||
this.positionRepresentationService = positionRepresentationService;
|
this.positionRepresentationService = positionRepresentationService;
|
||||||
@@ -37,11 +42,19 @@ public class PositionRepresentationController {
|
|||||||
new ApiResponse<>(true, positionRepresentation, "Position de representation créé avec succès."),
|
new ApiResponse<>(true, positionRepresentation, "Position de representation créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +65,19 @@ public class PositionRepresentationController {
|
|||||||
new ApiResponse<>(true, positionRepresentationService.updatePositionRepresentation(id, positionRepresentation), "Position de representation mise à jour avec succès."),
|
new ApiResponse<>(true, positionRepresentationService.updatePositionRepresentation(id, positionRepresentation), "Position de representation mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +89,91 @@ public class PositionRepresentationController {
|
|||||||
new ApiResponse<>(true, "Position de representation supprimée avec succès."),
|
new ApiResponse<>(true, "Position de representation supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllPositionRepresentationList() {
|
public ResponseEntity<?> getAllPositionRepresentationList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(), "Liste des positions de representation chargée avec succès."),
|
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(), "Liste des positions de representation chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllPositionRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllPositionRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(pageable), "Liste des positions de representation chargée avec succès."),
|
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationList(pageable), "Liste des positions de representation chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getPositionRepresentationById(@PathVariable Long id) {
|
public ResponseEntity<?> getPositionRepresentationById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationById(id), "Position de representation trouvée avec succès."),
|
new ApiResponse<>(true, positionRepresentationService.getPositionRepresentationById(id), "Position de representation trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Profession;
|
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.interfaces.infocad.parametre.ProfessionService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +29,8 @@ public class ProfessionController {
|
|||||||
|
|
||||||
private final ProfessionService professionService;
|
private final ProfessionService professionService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ProfessionController.class);
|
||||||
|
|
||||||
public ProfessionController(ProfessionService professionService) {
|
public ProfessionController(ProfessionService professionService) {
|
||||||
this.professionService = professionService;
|
this.professionService = professionService;
|
||||||
}
|
}
|
||||||
@@ -37,11 +43,19 @@ public class ProfessionController {
|
|||||||
new ApiResponse<>(true, profession, "Profession créé avec succès."),
|
new ApiResponse<>(true, profession, "Profession créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +66,19 @@ public class ProfessionController {
|
|||||||
new ApiResponse<>(true, professionService.updateProfession(id, profession), "Profession mise à jour avec succès."),
|
new ApiResponse<>(true, professionService.updateProfession(id, profession), "Profession mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +90,91 @@ public class ProfessionController {
|
|||||||
new ApiResponse<>(true, "Profession supprimée avec succès."),
|
new ApiResponse<>(true, "Profession supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllProfessionList() {
|
public ResponseEntity<?> getAllProfessionList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, professionService.getProfessionList(), "Liste des professions chargée avec succès."),
|
new ApiResponse<>(true, professionService.getProfessionList(), "Liste des professions chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllProfessionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllProfessionPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, professionService.getProfessionList(pageable), "Liste des professions chargée avec succès."),
|
new ApiResponse<>(true, professionService.getProfessionList(pageable), "Liste des professions chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getProfessionById(@PathVariable Long id) {
|
public ResponseEntity<?> getProfessionById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, professionService.getProfessionById(id), "Profession trouvée avec succès."),
|
new ApiResponse<>(true, professionService.getProfessionById(id), "Profession trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.SituationGeographique;
|
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.interfaces.infocad.parametre.SituationGeographiqueService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class SituationGeographiqueController {
|
public class SituationGeographiqueController {
|
||||||
|
|
||||||
private final SituationGeographiqueService situationGeographiqueService;
|
private final SituationGeographiqueService situationGeographiqueService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SituationGeographiqueController.class);
|
||||||
|
|
||||||
public SituationGeographiqueController(SituationGeographiqueService situationGeographiqueService) {
|
public SituationGeographiqueController(SituationGeographiqueService situationGeographiqueService) {
|
||||||
this.situationGeographiqueService = situationGeographiqueService;
|
this.situationGeographiqueService = situationGeographiqueService;
|
||||||
@@ -37,11 +42,19 @@ public class SituationGeographiqueController {
|
|||||||
new ApiResponse<>(true, situationGeographique, "Situation géographique créé avec succès."),
|
new ApiResponse<>(true, situationGeographique, "Situation géographique créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +65,19 @@ public class SituationGeographiqueController {
|
|||||||
new ApiResponse<>(true, situationGeographiqueService.updateSituationGeographique(id, situationGeographique), "Situation géographique mis à jour avec succès."),
|
new ApiResponse<>(true, situationGeographiqueService.updateSituationGeographique(id, situationGeographique), "Situation géographique mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +89,89 @@ public class SituationGeographiqueController {
|
|||||||
new ApiResponse<>(true, "Situation géographique supprimée avec succès."),
|
new ApiResponse<>(true, "Situation géographique supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllSituationGeographiqueList() {
|
public ResponseEntity<?> getAllSituationGeographiqueList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(), "Liste des situations géographiques chargée avec succès."),
|
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(), "Liste des situations géographiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllSituationGeographiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllSituationGeographiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(pageable), "Liste des situations géographiques chargée avec succès."),
|
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueList(pageable), "Liste des situations géographiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getSituationGeographiqueById(@PathVariable Long id) {
|
public ResponseEntity<?> getSituationGeographiqueById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueById(id), "Situation géographique trouvée avec succès."),
|
new ApiResponse<>(true, situationGeographiqueService.getSituationGeographiqueById(id), "Situation géographique trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.SituationMatrimoniale;
|
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.interfaces.infocad.parametre.SituationMatrimonialeService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class SituationMatrimonialeController {
|
public class SituationMatrimonialeController {
|
||||||
|
|
||||||
private final SituationMatrimonialeService situationMatrimonialeService;
|
private final SituationMatrimonialeService situationMatrimonialeService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SituationMatrimonialeController.class);
|
||||||
|
|
||||||
public SituationMatrimonialeController(SituationMatrimonialeService situationMatrimonialeService) {
|
public SituationMatrimonialeController(SituationMatrimonialeService situationMatrimonialeService) {
|
||||||
this.situationMatrimonialeService = situationMatrimonialeService;
|
this.situationMatrimonialeService = situationMatrimonialeService;
|
||||||
@@ -37,11 +42,19 @@ public class SituationMatrimonialeController {
|
|||||||
new ApiResponse<>(true, situationMatrimoniale, "Situation matrimoniale créé avec succès."),
|
new ApiResponse<>(true, situationMatrimoniale, "Situation matrimoniale créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +65,19 @@ public class SituationMatrimonialeController {
|
|||||||
new ApiResponse<>(true, situationMatrimonialeService.updateSituationMatrimoniale(id, situationMatrimoniale), "Situation matrimoniale mise à jour avec succès."),
|
new ApiResponse<>(true, situationMatrimonialeService.updateSituationMatrimoniale(id, situationMatrimoniale), "Situation matrimoniale mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +89,89 @@ public class SituationMatrimonialeController {
|
|||||||
new ApiResponse<>(true, "Situation matrimoniale supprimé avec succès."),
|
new ApiResponse<>(true, "Situation matrimoniale supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllSituationMatrimonialeList() {
|
public ResponseEntity<?> getAllSituationMatrimonialeList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(), "Liste des situations matrimoniales chargée avec succès."),
|
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(), "Liste des situations matrimoniales chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllSituationMatrimonialePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllSituationMatrimonialePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(pageable), "Liste des situations matrimoniales chargée avec succès."),
|
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeList(pageable), "Liste des situations matrimoniales chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getSituationMatrimonialeById(@PathVariable Long id) {
|
public ResponseEntity<?> getSituationMatrimonialeById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeById(id), "Situation matrimoniale trouvé avec succès."),
|
new ApiResponse<>(true, situationMatrimonialeService.getSituationMatrimonialeById(id), "Situation matrimoniale trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.SourceDroit;
|
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.interfaces.infocad.parametre.SourceDroitService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class SourceDroitController {
|
public class SourceDroitController {
|
||||||
|
|
||||||
private final SourceDroitService sourceDroitService;
|
private final SourceDroitService sourceDroitService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SourceDroitController.class);
|
||||||
|
|
||||||
public SourceDroitController(SourceDroitService sourceDroitService) {
|
public SourceDroitController(SourceDroitService sourceDroitService) {
|
||||||
this.sourceDroitService = sourceDroitService;
|
this.sourceDroitService = sourceDroitService;
|
||||||
@@ -37,11 +42,19 @@ public class SourceDroitController {
|
|||||||
new ApiResponse<>(true, sourceDroit, "Source de droit créé avec succès."),
|
new ApiResponse<>(true, sourceDroit, "Source de droit créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +65,19 @@ public class SourceDroitController {
|
|||||||
new ApiResponse<>(true, sourceDroitService.updateSourceDroit(id, sourceDroit), "Source de droit mise à jour avec succès."),
|
new ApiResponse<>(true, sourceDroitService.updateSourceDroit(id, sourceDroit), "Source de droit mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +89,89 @@ public class SourceDroitController {
|
|||||||
new ApiResponse<>(true, "Source de droit supprimée avec succès."),
|
new ApiResponse<>(true, "Source de droit supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllSourceDroitList() {
|
public ResponseEntity<?> getAllSourceDroitList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(), "Liste des sources de droit chargée avec succès."),
|
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(), "Liste des sources de droit chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllSourceDroitPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllSourceDroitPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(pageable), "Liste des sources de droit chargée avec succès."),
|
new ApiResponse<>(true, sourceDroitService.getSourceDroitList(pageable), "Liste des sources de droit chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getSourceDroitById(@PathVariable Long id) {
|
public ResponseEntity<?> getSourceDroitById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, sourceDroitService.getSourceDroitById(id), "Source de droit trouvé avec succès."),
|
new ApiResponse<>(true, sourceDroitService.getSourceDroitById(id), "Source de droit trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.Structure;
|
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.decoupage.ArrondissementService;
|
||||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -15,6 +18,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -26,6 +30,7 @@ public class StructureController {
|
|||||||
|
|
||||||
private final StructureService structureService;
|
private final StructureService structureService;
|
||||||
private final ArrondissementService arrondissementService;
|
private final ArrondissementService arrondissementService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(StructureController.class);
|
||||||
|
|
||||||
public StructureController(StructureService structureService, ArrondissementService arrondissementService) {
|
public StructureController(StructureService structureService, ArrondissementService arrondissementService) {
|
||||||
this.structureService = structureService;
|
this.structureService = structureService;
|
||||||
@@ -40,11 +45,19 @@ public class StructureController {
|
|||||||
new ApiResponse<>(true, structure, "Structure créé avec succès."),
|
new ApiResponse<>(true, structure, "Structure créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +68,19 @@ public class StructureController {
|
|||||||
new ApiResponse<>(true, structureService.updateStructure(id, structure), "Structure mise à jour avec succès."),
|
new ApiResponse<>(true, structureService.updateStructure(id, structure), "Structure mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,26 +92,49 @@ public class StructureController {
|
|||||||
new ApiResponse<>(true, "Structure supprimée avec succès."),
|
new ApiResponse<>(true, "Structure supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllStructureList() {
|
public ResponseEntity<?> getAllStructureList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, structureService.getStructureList(), "Liste des structures chargée avec succès."),
|
new ApiResponse<>(true, structureService.getStructureList(), "Liste des structures chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-by-arrondissement")
|
||||||
public ResponseEntity<?> getAllStructureListByArrondissement(@RequestParam Long arrondissementId) {
|
public ResponseEntity<?> getAllStructureListByArrondissement(@RequestParam Long arrondissementId) {
|
||||||
|
try {
|
||||||
if (arrondissementService.getArrondissementById(arrondissementId).isPresent()) {
|
if (arrondissementService.getArrondissementById(arrondissementId).isPresent()) {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, structureService.getStructuresByArrondissement(arrondissementId), "Liste des structures chargée avec succès."),
|
new ApiResponse<>(true, structureService.getStructuresByArrondissement(arrondissementId), "Liste des structures chargée avec succès."),
|
||||||
@@ -102,22 +146,67 @@ public class StructureController {
|
|||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllStructurePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllStructurePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, structureService.getStructureList(pageable), "Liste des structures chargée avec succès."),
|
new ApiResponse<>(true, structureService.getStructureList(pageable), "Liste des structures chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
public ResponseEntity<?> getStructureById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, structureService.getStructureById(id), "Structure trouvé avec succès."),
|
new ApiResponse<>(true, structureService.getStructureById(id), "Structure trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.TypeContestation;
|
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.interfaces.infocad.parametre.TypeContestationService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class TypeContestationController {
|
public class TypeContestationController {
|
||||||
|
|
||||||
private final TypeContestationService typeContestationService;
|
private final TypeContestationService typeContestationService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TypeContestationController.class);
|
||||||
|
|
||||||
public TypeContestationController(TypeContestationService typeContestationService) {
|
public TypeContestationController(TypeContestationService typeContestationService) {
|
||||||
this.typeContestationService = typeContestationService;
|
this.typeContestationService = typeContestationService;
|
||||||
@@ -37,11 +42,19 @@ public class TypeContestationController {
|
|||||||
new ApiResponse<>(true, typeContestation, "Type de contestation créé avec succès."),
|
new ApiResponse<>(true, typeContestation, "Type de contestation créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +65,19 @@ public class TypeContestationController {
|
|||||||
new ApiResponse<>(true, typeContestationService.updateTypeContestation(id, typeContestation), "Type de contestation mis à jour avec succès."),
|
new ApiResponse<>(true, typeContestationService.updateTypeContestation(id, typeContestation), "Type de contestation mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +89,89 @@ public class TypeContestationController {
|
|||||||
new ApiResponse<>(true, "Type de contestation supprimé avec succès."),
|
new ApiResponse<>(true, "Type de contestation supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllTypeContestationList() {
|
public ResponseEntity<?> getAllTypeContestationList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeContestationService.getTypeContestationList(), "Liste des types de contestation chargée avec succès."),
|
new ApiResponse<>(true, typeContestationService.getTypeContestationList(), "Liste des types de contestation chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllTypeContestationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllTypeContestationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeContestationService.getTypeContestationList(pageable), "Liste des types de contestation chargée avec succès."),
|
new ApiResponse<>(true, typeContestationService.getTypeContestationList(pageable), "Liste des types de contestation chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getTypeContestationById(@PathVariable Long id) {
|
public ResponseEntity<?> getTypeContestationById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeContestationService.getTypeContestationById(id), "Type de contestation trouvé avec succès."),
|
new ApiResponse<>(true, typeContestationService.getTypeContestationById(id), "Type de contestation trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.TypeDomaine;
|
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.interfaces.infocad.parametre.TypeDomaineService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class TypeDomaineController {
|
public class TypeDomaineController {
|
||||||
|
|
||||||
private final TypeDomaineService typeDomaineService;
|
private final TypeDomaineService typeDomaineService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TypeDomaineController.class);
|
||||||
|
|
||||||
public TypeDomaineController(TypeDomaineService typeDomaineService) {
|
public TypeDomaineController(TypeDomaineService typeDomaineService) {
|
||||||
this.typeDomaineService = typeDomaineService;
|
this.typeDomaineService = typeDomaineService;
|
||||||
@@ -37,11 +42,19 @@ public class TypeDomaineController {
|
|||||||
new ApiResponse<>(true, typeDomaine, "Type de domaine créé avec succès."),
|
new ApiResponse<>(true, typeDomaine, "Type de domaine créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +65,19 @@ public class TypeDomaineController {
|
|||||||
new ApiResponse<>(true, typeDomaineService.updateTypeDomaine(id, typeDomaine), "Type de domaine mis à jour avec succès."),
|
new ApiResponse<>(true, typeDomaineService.updateTypeDomaine(id, typeDomaine), "Type de domaine mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +89,89 @@ public class TypeDomaineController {
|
|||||||
new ApiResponse<>(true, "Type de domaine supprimé avec succès."),
|
new ApiResponse<>(true, "Type de domaine supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllTypeDomaineList() {
|
public ResponseEntity<?> getAllTypeDomaineList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(), "Liste des types de domaine chargée avec succès."),
|
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(), "Liste des types de domaine chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllTypeDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllTypeDomainePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(pageable), "Liste des types de domaine chargée avec succès."),
|
new ApiResponse<>(true, typeDomaineService.getTypeDomaineList(pageable), "Liste des types de domaine chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getTypeDomaineById(@PathVariable Long id) {
|
public ResponseEntity<?> getTypeDomaineById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeDomaineService.getTypeDomaineById(id), "Type de domaine trouvé avec succès."),
|
new ApiResponse<>(true, typeDomaineService.getTypeDomaineById(id), "Type de domaine trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.TypePersonne;
|
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.interfaces.infocad.parametre.TypePersonneService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class TypePersonneController {
|
public class TypePersonneController {
|
||||||
|
|
||||||
private final TypePersonneService typePersonneService;
|
private final TypePersonneService typePersonneService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TypePersonneController.class);
|
||||||
|
|
||||||
public TypePersonneController(TypePersonneService typePersonneService) {
|
public TypePersonneController(TypePersonneService typePersonneService) {
|
||||||
this.typePersonneService = typePersonneService;
|
this.typePersonneService = typePersonneService;
|
||||||
@@ -38,11 +42,19 @@ public class TypePersonneController {
|
|||||||
new ApiResponse<>(true, typePersonne, "Type de personne créé avec succès."),
|
new ApiResponse<>(true, typePersonne, "Type de personne créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class TypePersonneController {
|
|||||||
new ApiResponse<>(true, typePersonneService.updateTypePersonne(id, typePersonne), "Type de personne mis à jour avec succès."),
|
new ApiResponse<>(true, typePersonneService.updateTypePersonne(id, typePersonne), "Type de personne mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,89 @@ public class TypePersonneController {
|
|||||||
new ApiResponse<>(true, "Type de personne supprimé avec succès."),
|
new ApiResponse<>(true, "Type de personne supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllTypePersonneList() {
|
public ResponseEntity<?> getAllTypePersonneList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typePersonneService.getTypePersonneList(), "Liste des types de personne chargée avec succès."),
|
new ApiResponse<>(true, typePersonneService.getTypePersonneList(), "Liste des types de personne chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllTypePersonnePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllTypePersonnePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typePersonneService.getTypePersonneList(pageable), "Liste des types de personne chargée avec succès."),
|
new ApiResponse<>(true, typePersonneService.getTypePersonneList(pageable), "Liste des types de personne chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getTypePersonneById(@PathVariable Long id) {
|
public ResponseEntity<?> getTypePersonneById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typePersonneService.getTypePersonneById(id), "Type de personne trouvé avec succès."),
|
new ApiResponse<>(true, typePersonneService.getTypePersonneById(id), "Type de personne trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.TypePiece;
|
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.interfaces.infocad.parametre.TypePieceService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class TypePieceController {
|
public class TypePieceController {
|
||||||
|
|
||||||
private final TypePieceService typePieceService;
|
private final TypePieceService typePieceService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TypePieceController.class);
|
||||||
|
|
||||||
public TypePieceController(TypePieceService typePieceService) {
|
public TypePieceController(TypePieceService typePieceService) {
|
||||||
this.typePieceService = typePieceService;
|
this.typePieceService = typePieceService;
|
||||||
@@ -38,11 +42,19 @@ public class TypePieceController {
|
|||||||
new ApiResponse<>(true, typePiece, "Type de piece créé avec succès."),
|
new ApiResponse<>(true, typePiece, "Type de piece créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class TypePieceController {
|
|||||||
new ApiResponse<>(true, typePieceService.updateTypePiece(id, typePiece), "Type de piece mis à jour avec succès."),
|
new ApiResponse<>(true, typePieceService.updateTypePiece(id, typePiece), "Type de piece mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,89 @@ public class TypePieceController {
|
|||||||
new ApiResponse<>(true, "Type de piece supprimé avec succès."),
|
new ApiResponse<>(true, "Type de piece supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllTypePieceList() {
|
public ResponseEntity<?> getAllTypePieceList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typePieceService.getTypePieceList(), "Liste des types de piece chargée avec succès."),
|
new ApiResponse<>(true, typePieceService.getTypePieceList(), "Liste des types de piece chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllTypePiecePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllTypePiecePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typePieceService.getTypePieceList(pageable), "Liste des types de piece chargée avec succès."),
|
new ApiResponse<>(true, typePieceService.getTypePieceList(pageable), "Liste des types de piece chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getTypePieceById(@PathVariable Long id) {
|
public ResponseEntity<?> getTypePieceById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typePieceService.getTypePieceById(id), "Type de piece trouvé avec succès."),
|
new ApiResponse<>(true, typePieceService.getTypePieceById(id), "Type de piece trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.infocad.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.infocad.parametre.TypeRepresentation;
|
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.interfaces.infocad.parametre.TypeRepresentationService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class TypeRepresentationController {
|
public class TypeRepresentationController {
|
||||||
|
|
||||||
private final TypeRepresentationService typeRepresentationService;
|
private final TypeRepresentationService typeRepresentationService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TypeRepresentationController.class);
|
||||||
|
|
||||||
public TypeRepresentationController(TypeRepresentationService typeRepresentationService) {
|
public TypeRepresentationController(TypeRepresentationService typeRepresentationService) {
|
||||||
this.typeRepresentationService = typeRepresentationService;
|
this.typeRepresentationService = typeRepresentationService;
|
||||||
@@ -38,11 +42,19 @@ public class TypeRepresentationController {
|
|||||||
new ApiResponse<>(true, typeRepresentation, "Type de representation créé avec succès."),
|
new ApiResponse<>(true, typeRepresentation, "Type de representation créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class TypeRepresentationController {
|
|||||||
new ApiResponse<>(true, typeRepresentationService.updateTypeRepresentation(id, typeRepresentation), "Type de representation mis à jour avec succès."),
|
new ApiResponse<>(true, typeRepresentationService.updateTypeRepresentation(id, typeRepresentation), "Type de representation mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,89 @@ public class TypeRepresentationController {
|
|||||||
new ApiResponse<>(true, "Type de representation supprimé avec succès."),
|
new ApiResponse<>(true, "Type de representation supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllTypeRepresentationList() {
|
public ResponseEntity<?> getAllTypeRepresentationList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(), "Liste des types de representation chargée avec succès."),
|
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(), "Liste des types de representation chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllTypeRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllTypeRepresentationPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(pageable), "Liste des types de representation chargée avec succès."),
|
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationList(pageable), "Liste des types de representation chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getTypeRepresentationById(@PathVariable Long id) {
|
public ResponseEntity<?> getTypeRepresentationById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationById(id), "Type de representation trouvé avec succès."),
|
new ApiResponse<>(true, typeRepresentationService.getTypeRepresentationById(id), "Type de representation trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import io.gmss.fiscad.interfaces.notification.EmailService;
|
|||||||
import io.gmss.fiscad.paylaods.EmailDetails;
|
import io.gmss.fiscad.paylaods.EmailDetails;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class EmailController {
|
public class EmailController {
|
||||||
|
|
||||||
private final EmailService emailService;
|
private final EmailService emailService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(EmailController.class);
|
||||||
|
|
||||||
public EmailController(EmailService emailService) {
|
public EmailController(EmailService emailService) {
|
||||||
this.emailService = emailService;
|
this.emailService = emailService;
|
||||||
@@ -22,16 +25,14 @@ public class EmailController {
|
|||||||
|
|
||||||
// Sending a simple Email
|
// Sending a simple Email
|
||||||
@PostMapping("/sendMail")
|
@PostMapping("/sendMail")
|
||||||
public String sendMail(@RequestBody EmailDetails details)
|
public String sendMail(@RequestBody EmailDetails details) {
|
||||||
{
|
|
||||||
return emailService.sendSimpleMail(details);
|
return emailService.sendSimpleMail(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sending email with attachment
|
// Sending email with attachment
|
||||||
@PostMapping("/sendMailWithAttachment")
|
@PostMapping("/sendMailWithAttachment")
|
||||||
public String sendMailWithAttachment(
|
public String sendMailWithAttachment(
|
||||||
@RequestBody EmailDetails details)
|
@RequestBody EmailDetails details) {
|
||||||
{
|
|
||||||
String status
|
String status
|
||||||
= emailService.sendMailWithAttachment(details);
|
= emailService.sendMailWithAttachment(details);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
public class ReportingController {
|
public class ReportingController {
|
||||||
private final ReportService reportService;
|
private final ReportService reportService;
|
||||||
|
|
||||||
private final BlocRepository blocRepository;
|
private final BlocRepository blocRepository;
|
||||||
private final StructureRepository structureRepository;
|
private final StructureRepository structureRepository;
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ReportingController.class);
|
private static final Logger logger = LoggerFactory.getLogger(ReportingController.class);
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
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.interfaces.rfu.metier.BatimentService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -26,6 +29,8 @@ public class BatimentController {
|
|||||||
|
|
||||||
private final BatimentService batimentService;
|
private final BatimentService batimentService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(BatimentController.class);
|
||||||
|
|
||||||
public BatimentController(BatimentService batimentService) {
|
public BatimentController(BatimentService batimentService) {
|
||||||
this.batimentService = batimentService;
|
this.batimentService = batimentService;
|
||||||
}
|
}
|
||||||
@@ -38,11 +43,19 @@ public class BatimentController {
|
|||||||
new ApiResponse<>(true, batiment, "Batiment créé avec succès."),
|
new ApiResponse<>(true, batiment, "Batiment créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +66,19 @@ public class BatimentController {
|
|||||||
new ApiResponse<>(true, batimentService.updateBatiment(id, batiment), "Batiment mise à jour avec succès."),
|
new ApiResponse<>(true, batimentService.updateBatiment(id, batiment), "Batiment mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +90,89 @@ public class BatimentController {
|
|||||||
new ApiResponse<>(true, "Batiment supprimée avec succès."),
|
new ApiResponse<>(true, "Batiment supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllBatimentList() {
|
public ResponseEntity<?> getAllBatimentList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, batimentService.getBatimentList(), "Liste des caractéristiques chargée avec succès."),
|
new ApiResponse<>(true, batimentService.getBatimentList(), "Liste des caractéristiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, batimentService.getBatimentList(pageable), "Liste des caractéristiques chargée avec succès."),
|
new ApiResponse<>(true, batimentService.getBatimentList(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getBatimentById(@PathVariable Long id) {
|
public ResponseEntity<?> getBatimentById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, batimentService.getBatimentById(id), "Batiment trouvée avec succès."),
|
new ApiResponse<>(true, batimentService.getBatimentById(id), "Batiment trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueBatiment;
|
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.interfaces.rfu.metier.CaracteristiqueBatimentService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class CaracteristiqueBatimentController {
|
public class CaracteristiqueBatimentController {
|
||||||
|
|
||||||
private final CaracteristiqueBatimentService caracteristiqueBatimentService;
|
private final CaracteristiqueBatimentService caracteristiqueBatimentService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueBatimentController.class);
|
||||||
|
|
||||||
public CaracteristiqueBatimentController(CaracteristiqueBatimentService caracteristiqueBatimentService) {
|
public CaracteristiqueBatimentController(CaracteristiqueBatimentService caracteristiqueBatimentService) {
|
||||||
this.caracteristiqueBatimentService = caracteristiqueBatimentService;
|
this.caracteristiqueBatimentService = caracteristiqueBatimentService;
|
||||||
@@ -38,11 +42,19 @@ public class CaracteristiqueBatimentController {
|
|||||||
new ApiResponse<>(true, caracteristiqueBatiment, "Caracteristique du batiment créé avec succès."),
|
new ApiResponse<>(true, caracteristiqueBatiment, "Caracteristique du batiment créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class CaracteristiqueBatimentController {
|
|||||||
new ApiResponse<>(true, caracteristiqueBatimentService.updateCaracteristiqueBatiment(id, caracteristiqueBatiment), "Caracteristique du batiment mise à jour avec succès."),
|
new ApiResponse<>(true, caracteristiqueBatimentService.updateCaracteristiqueBatiment(id, caracteristiqueBatiment), "Caracteristique du batiment mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,89 @@ public class CaracteristiqueBatimentController {
|
|||||||
new ApiResponse<>(true, "CaracteristiqueBatiment supprimée avec succès."),
|
new ApiResponse<>(true, "CaracteristiqueBatiment supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllCaracteristiqueBatimentList() {
|
public ResponseEntity<?> getAllCaracteristiqueBatimentList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentList(), "Liste des Caracteristiques du batiment chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentList(), "Liste des Caracteristiques du batiment chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllCaracteristiqueBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllCaracteristiqueBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentList(pageable), "Liste des Caracteristiques du batiment chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentList(pageable), "Liste des Caracteristiques du batiment chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getCaracteristiqueBatimentById(@PathVariable Long id) {
|
public ResponseEntity<?> getCaracteristiqueBatimentById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentById(id), "Caracteristique du batiment trouvée avec succès."),
|
new ApiResponse<>(true, caracteristiqueBatimentService.getCaracteristiqueBatimentById(id), "Caracteristique du batiment trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueParcelle;
|
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.interfaces.rfu.metier.CaracteristiqueParcelleService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class CaracteristiqueParcelleController {
|
public class CaracteristiqueParcelleController {
|
||||||
|
|
||||||
private final CaracteristiqueParcelleService caracteristiqueParcelleService;
|
private final CaracteristiqueParcelleService caracteristiqueParcelleService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueParcelleController.class);
|
||||||
|
|
||||||
public CaracteristiqueParcelleController(CaracteristiqueParcelleService caracteristiqueParcelleService) {
|
public CaracteristiqueParcelleController(CaracteristiqueParcelleService caracteristiqueParcelleService) {
|
||||||
this.caracteristiqueParcelleService = caracteristiqueParcelleService;
|
this.caracteristiqueParcelleService = caracteristiqueParcelleService;
|
||||||
@@ -38,11 +42,19 @@ public class CaracteristiqueParcelleController {
|
|||||||
new ApiResponse<>(true, caracteristiqueParcelle, "Caracteristique parcelle créé avec succès."),
|
new ApiResponse<>(true, caracteristiqueParcelle, "Caracteristique parcelle créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class CaracteristiqueParcelleController {
|
|||||||
new ApiResponse<>(true, caracteristiqueParcelleService.updateCaracteristiqueParcelle(id, caracteristiqueParcelle), "Caracteristique parcelle mise à jour avec succès."),
|
new ApiResponse<>(true, caracteristiqueParcelleService.updateCaracteristiqueParcelle(id, caracteristiqueParcelle), "Caracteristique parcelle mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,89 @@ public class CaracteristiqueParcelleController {
|
|||||||
new ApiResponse<>(true, "Caracteristique parcelle supprimée avec succès."),
|
new ApiResponse<>(true, "Caracteristique parcelle supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllCaracteristiqueParcelleList() {
|
public ResponseEntity<?> getAllCaracteristiqueParcelleList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleList(), "Liste des Caracteristiques parcelles chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleList(), "Liste des Caracteristiques parcelles chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllCaracteristiqueParcellePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllCaracteristiqueParcellePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleList(pageable), "Liste des Caracteristiques parcelles chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleList(pageable), "Liste des Caracteristiques parcelles chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getCaracteristiqueParcelleById(@PathVariable Long id) {
|
public ResponseEntity<?> getCaracteristiqueParcelleById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleById(id), "Caracteristiques parcelles trouvée avec succès."),
|
new ApiResponse<>(true, caracteristiqueParcelleService.getCaracteristiqueParcelleById(id), "Caracteristiques parcelles trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.CaracteristiqueUniteLogement;
|
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.interfaces.rfu.metier.CaracteristiqueUniteLogementService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class CaracteristiqueUniteLogementController {
|
public class CaracteristiqueUniteLogementController {
|
||||||
|
|
||||||
private final CaracteristiqueUniteLogementService caracteristiqueUniteLogementService;
|
private final CaracteristiqueUniteLogementService caracteristiqueUniteLogementService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueUniteLogementController.class);
|
||||||
|
|
||||||
public CaracteristiqueUniteLogementController(CaracteristiqueUniteLogementService caracteristiqueUniteLogementService) {
|
public CaracteristiqueUniteLogementController(CaracteristiqueUniteLogementService caracteristiqueUniteLogementService) {
|
||||||
this.caracteristiqueUniteLogementService = caracteristiqueUniteLogementService;
|
this.caracteristiqueUniteLogementService = caracteristiqueUniteLogementService;
|
||||||
@@ -38,11 +42,19 @@ public class CaracteristiqueUniteLogementController {
|
|||||||
new ApiResponse<>(true, caracteristiqueUniteLogement, "Caracteristique Unite Logement créé avec succès."),
|
new ApiResponse<>(true, caracteristiqueUniteLogement, "Caracteristique Unite Logement créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class CaracteristiqueUniteLogementController {
|
|||||||
new ApiResponse<>(true, caracteristiqueUniteLogementService.updateCaracteristiqueUniteLogement(id, caracteristiqueUniteLogement), "Caracteristique Unite Logement mise à jour avec succès."),
|
new ApiResponse<>(true, caracteristiqueUniteLogementService.updateCaracteristiqueUniteLogement(id, caracteristiqueUniteLogement), "Caracteristique Unite Logement mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,89 @@ public class CaracteristiqueUniteLogementController {
|
|||||||
new ApiResponse<>(true, "CaracteristiqueUniteLogement supprimée avec succès."),
|
new ApiResponse<>(true, "CaracteristiqueUniteLogement supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllCaracteristiqueUniteLogementList() {
|
public ResponseEntity<?> getAllCaracteristiqueUniteLogementList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementList(), "Liste des Caracteristiques Unite Logement chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementList(), "Liste des Caracteristiques Unite Logement chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllCaracteristiqueUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllCaracteristiqueUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementList(pageable), "Liste des Caracteristiques Unite Logement chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementList(pageable), "Liste des Caracteristiques Unite Logement chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getCaracteristiqueUniteLogementById(@PathVariable Long id) {
|
public ResponseEntity<?> getCaracteristiqueUniteLogementById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementById(id), "Caracteristique Unite Logement trouvée avec succès."),
|
new ApiResponse<>(true, caracteristiqueUniteLogementService.getCaracteristiqueUniteLogementById(id), "Caracteristique Unite Logement trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteBatiment;
|
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.interfaces.rfu.metier.EnqueteBatimentService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class EnqueteBatimentController {
|
public class EnqueteBatimentController {
|
||||||
|
|
||||||
private final EnqueteBatimentService enqueteBatimentService;
|
private final EnqueteBatimentService enqueteBatimentService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(EnqueteBatimentController.class);
|
||||||
|
|
||||||
public EnqueteBatimentController(EnqueteBatimentService enqueteBatimentService) {
|
public EnqueteBatimentController(EnqueteBatimentService enqueteBatimentService) {
|
||||||
this.enqueteBatimentService = enqueteBatimentService;
|
this.enqueteBatimentService = enqueteBatimentService;
|
||||||
@@ -38,11 +42,19 @@ public class EnqueteBatimentController {
|
|||||||
new ApiResponse<>(true, enqueteBatiment, "Enquete batiment créé avec succès."),
|
new ApiResponse<>(true, enqueteBatiment, "Enquete batiment créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class EnqueteBatimentController {
|
|||||||
new ApiResponse<>(true, enqueteBatimentService.updateEnqueteBatiment(id, enqueteBatiment), "Enquete batiment mise à jour avec succès."),
|
new ApiResponse<>(true, enqueteBatimentService.updateEnqueteBatiment(id, enqueteBatiment), "Enquete batiment mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,90 @@ public class EnqueteBatimentController {
|
|||||||
new ApiResponse<>(true, "EnqueteBatiment supprimée avec succès."),
|
new ApiResponse<>(true, "EnqueteBatiment supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllEnqueteBatimentList() {
|
public ResponseEntity<?> getAllEnqueteBatimentList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentList(), "Liste des Enquetes batiments chargée avec succès."),
|
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentList(), "Liste des Enquetes batiments chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllEnqueteBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllEnqueteBatimentPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentList(pageable), "Liste des Enquetes batiments chargée avec succès."),
|
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentList(pageable), "Liste des Enquetes batiments chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getEnqueteBatimentById(@PathVariable Long id) {
|
public ResponseEntity<?> getEnqueteBatimentById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentById(id), "Enquete batiment trouvée avec succès."),
|
new ApiResponse<>(true, enqueteBatimentService.getEnqueteBatimentById(id), "Enquete batiment trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.EnqueteUniteLogement;
|
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.interfaces.rfu.metier.EnqueteUniteLogementService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class EnqueteUniteLogementController {
|
public class EnqueteUniteLogementController {
|
||||||
|
|
||||||
private final EnqueteUniteLogementService enqueteUniteLogementService;
|
private final EnqueteUniteLogementService enqueteUniteLogementService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(EnqueteUniteLogementController.class);
|
||||||
|
|
||||||
public EnqueteUniteLogementController(EnqueteUniteLogementService enqueteUniteLogementService) {
|
public EnqueteUniteLogementController(EnqueteUniteLogementService enqueteUniteLogementService) {
|
||||||
this.enqueteUniteLogementService = enqueteUniteLogementService;
|
this.enqueteUniteLogementService = enqueteUniteLogementService;
|
||||||
@@ -38,11 +42,19 @@ public class EnqueteUniteLogementController {
|
|||||||
new ApiResponse<>(true, enqueteUniteLogement, "Enquete unite logement créé avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogement, "Enquete unite logement créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class EnqueteUniteLogementController {
|
|||||||
new ApiResponse<>(true, enqueteUniteLogementService.updateEnqueteUniteLogement(id, enqueteUniteLogement), "Enquete unite logement mise à jour avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.updateEnqueteUniteLogement(id, enqueteUniteLogement), "Enquete unite logement mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,90 @@ public class EnqueteUniteLogementController {
|
|||||||
new ApiResponse<>(true, "Enquete Unite Logement supprimée avec succès."),
|
new ApiResponse<>(true, "Enquete Unite Logement supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllEnqueteUniteLogementList() {
|
public ResponseEntity<?> getAllEnqueteUniteLogementList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementList(), "Liste des Enquetes des unites Logements chargée avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementList(), "Liste des Enquetes des unites Logements chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllEnqueteUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllEnqueteUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementList(pageable), "Liste des enquetes des unites de logements chargée avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementList(pageable), "Liste des enquetes des unites de logements chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getEnqueteUniteLogementById(@PathVariable Long id) {
|
public ResponseEntity<?> getEnqueteUniteLogementById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementById(id), "Enquete unite de logement trouvée avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.getEnqueteUniteLogementById(id), "Enquete unite de logement trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.metier;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.metier.UniteLogement;
|
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.interfaces.rfu.metier.UniteLogementService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class UniteLogementController {
|
public class UniteLogementController {
|
||||||
|
|
||||||
private final UniteLogementService enqueteUniteLogementService;
|
private final UniteLogementService enqueteUniteLogementService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(UniteLogementController.class);
|
||||||
|
|
||||||
public UniteLogementController(UniteLogementService enqueteUniteLogementService) {
|
public UniteLogementController(UniteLogementService enqueteUniteLogementService) {
|
||||||
this.enqueteUniteLogementService = enqueteUniteLogementService;
|
this.enqueteUniteLogementService = enqueteUniteLogementService;
|
||||||
@@ -38,11 +42,19 @@ public class UniteLogementController {
|
|||||||
new ApiResponse<>(true, enqueteUniteLogement, "Unite de logement créé avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogement, "Unite de logement créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class UniteLogementController {
|
|||||||
new ApiResponse<>(true, enqueteUniteLogementService.updateUniteLogement(id, enqueteUniteLogement), "Unite de logement mise à jour avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.updateUniteLogement(id, enqueteUniteLogement), "Unite de logement mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,36 +89,90 @@ public class UniteLogementController {
|
|||||||
new ApiResponse<>(true, "Unite Logement supprimée avec succès."),
|
new ApiResponse<>(true, "Unite Logement supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllUniteLogementList() {
|
public ResponseEntity<?> getAllUniteLogementList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementList(), "Liste des Enquetes des unites Logements chargée avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementList(), "Liste des Enquetes des unites Logements chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllUniteLogementPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementList(pageable), "Liste des enquetes des unites de logements chargée avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementList(pageable), "Liste des enquetes des unites de logements chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getUniteLogementById(@PathVariable Long id) {
|
public ResponseEntity<?> getUniteLogementById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementById(id), "Unite de de logement trouvée avec succès."),
|
new ApiResponse<>(true, enqueteUniteLogementService.getUniteLogementById(id), "Unite de de logement trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package io.gmss.fiscad.controllers.rfu.parametre;
|
|||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
import io.gmss.fiscad.entities.rfu.parametre.Campagne;
|
||||||
import io.gmss.fiscad.enums.TypeCampagne;
|
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.interfaces.rfu.parametre.CampagneService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -15,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class CampagneController {
|
public class CampagneController {
|
||||||
|
|
||||||
private final CampagneService campagneService;
|
private final CampagneService campagneService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CampagneController.class);
|
||||||
|
|
||||||
public CampagneController(CampagneService campagneService) {
|
public CampagneController(CampagneService campagneService) {
|
||||||
this.campagneService = campagneService;
|
this.campagneService = campagneService;
|
||||||
@@ -39,11 +42,19 @@ public class CampagneController {
|
|||||||
new ApiResponse<>(true, campagne, "Campagne créé avec succès."),
|
new ApiResponse<>(true, campagne, "Campagne créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,11 +65,19 @@ public class CampagneController {
|
|||||||
new ApiResponse<>(true, campagneService.updateCampagne(id, campagne), "Campagne mis à jour avec succès."),
|
new ApiResponse<>(true, campagneService.updateCampagne(id, campagne), "Campagne mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,37 +89,91 @@ public class CampagneController {
|
|||||||
new ApiResponse<>(true, "Campagne supprimée avec succès."),
|
new ApiResponse<>(true, "Campagne supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllCampagneList() {
|
public ResponseEntity<?> getAllCampagneList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, campagneService.getCampagneList(), "Liste des campagnes chargée avec succès."),
|
new ApiResponse<>(true, campagneService.getCampagneList(), "Liste des campagnes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllCampagnePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllCampagnePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, campagneService.getCampagneList(pageable), "Liste des campagnes chargée avec succès."),
|
new ApiResponse<>(true, campagneService.getCampagneList(pageable), "Liste des campagnes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getCampagneById(@PathVariable Long id) {
|
public ResponseEntity<?> getCampagneById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, campagneService.getCampagneById(id), "Campagne trouvée avec succès."),
|
new ApiResponse<>(true, campagneService.getCampagneById(id), "Campagne trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@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."),
|
new ApiResponse<>(true, campagneService.getCampagnesByType(typeCampagne), "Liste des campagne par type chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}catch (NotFoundException e){
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
);
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Caracteristique;
|
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.interfaces.rfu.parametre.CaracteristiqueService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class CaracteristiqueController {
|
public class CaracteristiqueController {
|
||||||
|
|
||||||
private final CaracteristiqueService caracteristiqueService;
|
private final CaracteristiqueService caracteristiqueService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CaracteristiqueController.class);
|
||||||
|
|
||||||
public CaracteristiqueController(CaracteristiqueService caracteristiqueService) {
|
public CaracteristiqueController(CaracteristiqueService caracteristiqueService) {
|
||||||
this.caracteristiqueService = caracteristiqueService;
|
this.caracteristiqueService = caracteristiqueService;
|
||||||
@@ -37,11 +41,19 @@ public class CaracteristiqueController {
|
|||||||
new ApiResponse<>(true, caracteristique, "Caracteristique créé avec succès."),
|
new ApiResponse<>(true, caracteristique, "Caracteristique créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +64,19 @@ public class CaracteristiqueController {
|
|||||||
new ApiResponse<>(true, caracteristiqueService.updateCaracteristique(id, caracteristique), "Caracteristique mise à jour avec succès."),
|
new ApiResponse<>(true, caracteristiqueService.updateCaracteristique(id, caracteristique), "Caracteristique mise à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,36 +88,91 @@ public class CaracteristiqueController {
|
|||||||
new ApiResponse<>(true, "Caracteristique supprimée avec succès."),
|
new ApiResponse<>(true, "Caracteristique supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllCaracteristiqueList() {
|
public ResponseEntity<?> getAllCaracteristiqueList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(), "Liste des caractéristiques chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(), "Liste des caractéristiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(pageable), "Liste des caractéristiques chargée avec succès."),
|
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueList(pageable), "Liste des caractéristiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getCaracteristiqueById(@PathVariable Long id) {
|
public ResponseEntity<?> getCaracteristiqueById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueById(id), "Caracteristique trouvée avec succès."),
|
new ApiResponse<>(true, caracteristiqueService.getCaracteristiqueById(id), "Caracteristique trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package io.gmss.fiscad.controllers.rfu.parametre;
|
package io.gmss.fiscad.controllers.rfu.parametre;
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.Equipe;
|
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.interfaces.rfu.parametre.EquipeService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.EquipePayload;
|
import io.gmss.fiscad.paylaods.request.EquipePayload;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class EquipeController {
|
public class EquipeController {
|
||||||
|
|
||||||
private final EquipeService equipeService;
|
private final EquipeService equipeService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(EquipeController.class);
|
||||||
|
|
||||||
public EquipeController(EquipeService equipeService) {
|
public EquipeController(EquipeService equipeService) {
|
||||||
this.equipeService = equipeService;
|
this.equipeService = equipeService;
|
||||||
@@ -38,11 +42,19 @@ public class EquipeController {
|
|||||||
new ApiResponse<>(true, equipe, "Equipe créé avec succès."),
|
new ApiResponse<>(true, equipe, "Equipe créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +65,19 @@ public class EquipeController {
|
|||||||
new ApiResponse<>(true, equipeService.updateEquipe(id, equipePayload), "Equipe mis à jour avec succès."),
|
new ApiResponse<>(true, equipeService.updateEquipe(id, equipePayload), "Equipe mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,37 +89,91 @@ public class EquipeController {
|
|||||||
new ApiResponse<>(true, "Equipe supprimée avec succès."),
|
new ApiResponse<>(true, "Equipe supprimée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllEquipeList() {
|
public ResponseEntity<?> getAllEquipeList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipeService.getEquipeList(), "Liste des equipes chargée avec succès."),
|
new ApiResponse<>(true, equipeService.getEquipeList(), "Liste des equipes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllEquipePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllEquipePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipeService.getEquipeList(pageable), "Liste des equipes chargée avec succès."),
|
new ApiResponse<>(true, equipeService.getEquipeList(pageable), "Liste des equipes chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getEquipeById(@PathVariable Long id) {
|
public ResponseEntity<?> getEquipeById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, equipeService.getEquipeById(id), "Equipe trouvée avec succès."),
|
new ApiResponse<>(true, equipeService.getEquipeById(id), "Equipe trouvée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.rfu.parametre;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.rfu.parametre.TypeCaracteristique;
|
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.interfaces.rfu.parametre.TypeCaracteristiqueService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -23,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class TypeCaracteristiqueController {
|
public class TypeCaracteristiqueController {
|
||||||
|
|
||||||
private final TypeCaracteristiqueService typeCaracteristiqueService;
|
private final TypeCaracteristiqueService typeCaracteristiqueService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TypeCaracteristiqueController.class);
|
||||||
|
|
||||||
public TypeCaracteristiqueController(TypeCaracteristiqueService typeCaracteristiqueService) {
|
public TypeCaracteristiqueController(TypeCaracteristiqueService typeCaracteristiqueService) {
|
||||||
this.typeCaracteristiqueService = typeCaracteristiqueService;
|
this.typeCaracteristiqueService = typeCaracteristiqueService;
|
||||||
@@ -36,11 +41,19 @@ public class TypeCaracteristiqueController {
|
|||||||
new ApiResponse<>(true, typeCaracteristique, "Type de caracteristique créé avec succès."),
|
new ApiResponse<>(true, typeCaracteristique, "Type de caracteristique créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,11 +64,19 @@ public class TypeCaracteristiqueController {
|
|||||||
new ApiResponse<>(true, typeCaracteristiqueService.updateTypeCaracteristique(id, typeCaracteristique), "Type caracteristique mis à jour avec succès."),
|
new ApiResponse<>(true, typeCaracteristiqueService.updateTypeCaracteristique(id, typeCaracteristique), "Type caracteristique mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,36 +88,90 @@ public class TypeCaracteristiqueController {
|
|||||||
new ApiResponse<>(true, "Type caracteristique supprimé avec succès."),
|
new ApiResponse<>(true, "Type caracteristique supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAllTypeCaracteristiqueList() {
|
public ResponseEntity<?> getAllTypeCaracteristiqueList() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(), "Liste des types caracteristiques chargée avec succès."),
|
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(), "Liste des types caracteristiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllTypeCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllTypeCaracteristiquePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(pageable), "Liste des types caracteristiques chargée avec succès."),
|
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueList(pageable), "Liste des types caracteristiques chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getTypeCaracteristiqueById(@PathVariable Long id) {
|
public ResponseEntity<?> getTypeCaracteristiqueById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueById(id), "Type caracteristique trouvé avec succès."),
|
new ApiResponse<>(true, typeCaracteristiqueService.getTypeCaracteristiqueById(id), "Type caracteristique trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
package io.gmss.fiscad.controllers.statistique;
|
package io.gmss.fiscad.controllers.statistique;
|
||||||
|
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
import io.gmss.fiscad.interfaces.statistique.StatistiquesService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "api/statistique", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "api/statistique", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@@ -17,38 +21,101 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class StatistiqueController {
|
public class StatistiqueController {
|
||||||
private final StatistiquesService statistiquesService;
|
private final StatistiquesService statistiquesService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(StatistiqueController.class);
|
||||||
|
|
||||||
public StatistiqueController(StatistiquesService statistiquesService) {
|
public StatistiqueController(StatistiquesService statistiquesService) {
|
||||||
this.statistiquesService = statistiquesService;
|
this.statistiquesService = statistiquesService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/user/enquete-par-statut")
|
@GetMapping(path = "/user/enquete-par-statut")
|
||||||
public ResponseEntity<?> getStatistiquesParStatut() {
|
public ResponseEntity<?> getStatistiquesParStatut() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, statistiquesService.getStatEnqueteParStatut(), "Statistique des enquêtes par statut."),
|
new ApiResponse<>(true, statistiquesService.getStatEnqueteParStatut(), "Statistique des enquêtes par statut."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/enquete-par-arrondissement/{commune_id}")
|
||||||
public ResponseEntity<?> getStatistiquesParArrondissement(@PathVariable Long commune_id) {
|
public ResponseEntity<?> getStatistiquesParArrondissement(@PathVariable Long commune_id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminDecoupage(commune_id), "Statistique des enquêtes par arrondissement."),
|
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminDecoupage(commune_id), "Statistique des enquêtes par arrondissement."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping(path = "/user/enquete-par-structure")
|
||||||
public ResponseEntity<?> getStatistiquesParStructure() {
|
public ResponseEntity<?> getStatistiquesParStructure() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminStructure(), "Statistique des enquêtes par structure."),
|
new ApiResponse<>(true, statistiquesService.getStatEnqueteAdminStructure(), "Statistique des enquêtes par structure."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping(path = "/user/enquete-par-bloc")
|
||||||
public ResponseEntity<?> getStatistiquesParBloc() {
|
public ResponseEntity<?> getStatistiquesParBloc() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, statistiquesService.getStatBloc(), "Statistique des enquêtes par bloc."),
|
new ApiResponse<>(true, statistiquesService.getStatBloc(), "Statistique des enquêtes par bloc."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
package io.gmss.fiscad.controllers.synchronisation;
|
package io.gmss.fiscad.controllers.synchronisation;
|
||||||
|
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.synchronisation.RestaurationService;
|
import io.gmss.fiscad.interfaces.synchronisation.RestaurationService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "api/restauration", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "api/restauration", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@@ -17,107 +21,289 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class RestaurationController {
|
public class RestaurationController {
|
||||||
public final RestaurationService restaurationService;
|
public final RestaurationService restaurationService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(RestaurationController.class);
|
||||||
|
|
||||||
public RestaurationController(RestaurationService restaurationService) {
|
public RestaurationController(RestaurationService restaurationService) {
|
||||||
this.restaurationService = restaurationService;
|
this.restaurationService = restaurationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/enquete/{terminalId}")
|
@GetMapping(path = "/enquete/{terminalId}")
|
||||||
public ResponseEntity<?> getEnquetes(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getEnquetes(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getEnquete(terminalId), "liste des enquetes avec succès."),
|
new ApiResponse<>(true, restaurationService.getEnquete(terminalId), "liste des enquetes avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/acteur-concerne/{terminalId}")
|
||||||
public ResponseEntity<?> getActeurConcerne(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getActeurConcerne(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getActeurConcernes(terminalId), "liste des acteurs concernés avec succès."),
|
new ApiResponse<>(true, restaurationService.getActeurConcernes(terminalId), "liste des acteurs concernés avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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
|
@GetMapping(path = "/personne/{terminalId}") // ok
|
||||||
public ResponseEntity<?> getPersonnes(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getPersonnes(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getPersonne(terminalId), "liste des personnes avec succès."),
|
new ApiResponse<>(true, restaurationService.getPersonne(terminalId), "liste des personnes avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/membre-groupe/{terminalId}")
|
||||||
public ResponseEntity<?> getMembrePersonnes(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getMembrePersonnes(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getMembreGroupe(terminalId), "liste des membres groupe avec succès."),
|
new ApiResponse<>(true, restaurationService.getMembreGroupe(terminalId), "liste des membres groupe avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/parcelle/{terminalId}")
|
||||||
public ResponseEntity<?> getParcelle(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getParcelle(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getParcelle(terminalId), "liste des parcelle avec succès."),
|
new ApiResponse<>(true, restaurationService.getParcelle(terminalId), "liste des parcelle avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/piece/{terminalId}")
|
||||||
public ResponseEntity<?> getPieces(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getPieces(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getPieces(terminalId), "liste des enquetes avec succès."),
|
new ApiResponse<>(true, restaurationService.getPieces(terminalId), "liste des enquetes avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/upload/{terminalId}")
|
||||||
public ResponseEntity<?> getUpload(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getUpload(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getUpload(terminalId), "liste des enquetes avec succès."),
|
new ApiResponse<>(true, restaurationService.getUpload(terminalId), "liste des enquetes avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping(path = "/current-user-tpes")
|
||||||
public ResponseEntity<?> getCurrentUserTpe() {
|
public ResponseEntity<?> getCurrentUserTpe() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getTpeListByCurrentUser(), "liste des enquetes avec succès."),
|
new ApiResponse<>(true, restaurationService.getTpeListByCurrentUser(), "liste des enquetes avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/batiment/{terminalId}")
|
||||||
public ResponseEntity<?> getBatiments(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getBatiments(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getBatiment(terminalId), "liste des batiments avec succès."),
|
new ApiResponse<>(true, restaurationService.getBatiment(terminalId), "liste des batiments avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/enquete-batiment/{terminalId}")
|
||||||
public ResponseEntity<?> getEnqueteBatiment(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getEnqueteBatiment(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getEnqueteBatiment(terminalId), "liste des enquetes batiments avec succès."),
|
new ApiResponse<>(true, restaurationService.getEnqueteBatiment(terminalId), "liste des enquetes batiments avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/caracteristique-batiment/{terminalId}")
|
||||||
public ResponseEntity<?> getCaracteristiqueBatiment(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getCaracteristiqueBatiment(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getCaracateristiqueBatiment(terminalId), "liste des caractéristiques batiments avec succès."),
|
new ApiResponse<>(true, restaurationService.getCaracateristiqueBatiment(terminalId), "liste des caractéristiques batiments avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping(path = "/caracteristique-unite-logement/{terminalId}")
|
||||||
public ResponseEntity<?> getCaracteristiqueUniteLogement(@PathVariable Long terminalId) {
|
public ResponseEntity<?> getCaracteristiqueUniteLogement(@PathVariable Long terminalId) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, restaurationService.getCaracateristiqueUniteLogement(terminalId), "liste des caractéristiques des unités de logement avec succès."),
|
new ApiResponse<>(true, restaurationService.getCaracateristiqueUniteLogement(terminalId), "liste des caractéristiques des unités de logement avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
package io.gmss.fiscad.controllers.synchronisation;
|
package io.gmss.fiscad.controllers.synchronisation;
|
||||||
|
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
|
import io.gmss.fiscad.interfaces.synchronisation.SynchronisationService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.request.*;
|
import io.gmss.fiscad.paylaods.request.*;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -20,6 +24,7 @@ import java.util.List;
|
|||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
public class SynchronisationController {
|
public class SynchronisationController {
|
||||||
private final SynchronisationService synchronisationService;
|
private final SynchronisationService synchronisationService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SynchronisationController.class);
|
||||||
|
|
||||||
public SynchronisationController(SynchronisationService synchronisationService) {
|
public SynchronisationController(SynchronisationService synchronisationService) {
|
||||||
this.synchronisationService = synchronisationService;
|
this.synchronisationService = synchronisationService;
|
||||||
@@ -27,61 +32,186 @@ public class SynchronisationController {
|
|||||||
|
|
||||||
@GetMapping("/user-decoupage-territorial")
|
@GetMapping("/user-decoupage-territorial")
|
||||||
public ResponseEntity<?> getUserDecoupageTerritorial() {
|
public ResponseEntity<?> getUserDecoupageTerritorial() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.getDecoupageAdminUserConnecter(), "Liste des découpages territoriaux chargés avec succès."),
|
new ApiResponse<>(true, synchronisationService.getDecoupageAdminUserConnecter(), "Liste des découpages territoriaux chargés avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/references")
|
||||||
public ResponseEntity<?> getAllReferences() {
|
public ResponseEntity<?> getAllReferences() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.getReferencesSyncResponses(), "Liste des données de référence chargée avec succès."),
|
new ApiResponse<>(true, synchronisationService.getReferencesSyncResponses(), "Liste des données de référence chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/personnes")
|
||||||
public ResponseEntity<?> syncPersonne(@RequestBody List<PersonnePayLoad> personnePayLoads) {
|
public ResponseEntity<?> syncPersonne(@RequestBody List<PersonnePayLoad> personnePayLoads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncPersonnes(personnePayLoads), "Liste des personnes synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncPersonnes(personnePayLoads), "Liste des personnes synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/membre-groupe")
|
||||||
public ResponseEntity<?> syncMembreGroupe(@RequestBody List<MembreGroupePayLoad> membreGroupePayLoads) {
|
public ResponseEntity<?> syncMembreGroupe(@RequestBody List<MembreGroupePayLoad> membreGroupePayLoads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncMembreGroupe(membreGroupePayLoads), "Liste des membres de groupes de personnes synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncMembreGroupe(membreGroupePayLoads), "Liste des membres de groupes de personnes synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/enquete")
|
||||||
public ResponseEntity<?> syncEnquete(@RequestBody List<EnquetePayLoad> enquetePayLoads) {
|
public ResponseEntity<?> syncEnquete(@RequestBody List<EnquetePayLoad> enquetePayLoads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncEnquete(enquetePayLoads), "Liste des enquêtes synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncEnquete(enquetePayLoads), "Liste des enquêtes synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/parcelle")
|
||||||
public ResponseEntity<?> syncParcelle(@RequestBody List<ParcellePayLoad> parcellePayLoads) {
|
public ResponseEntity<?> syncParcelle(@RequestBody List<ParcellePayLoad> parcellePayLoads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncParcelle(parcellePayLoads), "Liste des parceclles synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncParcelle(parcellePayLoads), "Liste des parceclles synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/piece")
|
||||||
public ResponseEntity<?> syncPiece(@RequestBody List<PiecePayLoad> piecePayLoads) {
|
public ResponseEntity<?> syncPiece(@RequestBody List<PiecePayLoad> piecePayLoads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncPiece(piecePayLoads), "Liste des pièces synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncPiece(piecePayLoads), "Liste des pièces synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/acteur-concerne")
|
||||||
public ResponseEntity<?> syncActeurConcerne(@RequestBody List<ActeurConcernePayLoad> piecePayLoads) {
|
public ResponseEntity<?> syncActeurConcerne(@RequestBody List<ActeurConcernePayLoad> piecePayLoads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncActeurConcerne(piecePayLoads), "Liste des acteurs concernes synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncActeurConcerne(piecePayLoads), "Liste des acteurs concernes synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
//@PostMapping("/files")
|
||||||
@@ -101,6 +231,7 @@ public class SynchronisationController {
|
|||||||
@RequestParam(required = false) Long enqueteBatimentId,
|
@RequestParam(required = false) Long enqueteBatimentId,
|
||||||
@RequestParam(required = false) Long enqueteUniteLogementId
|
@RequestParam(required = false) Long enqueteUniteLogementId
|
||||||
) {
|
) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncFiles(file,
|
new ApiResponse<>(true, synchronisationService.syncFiles(file,
|
||||||
idBackend,
|
idBackend,
|
||||||
@@ -116,22 +247,66 @@ public class SynchronisationController {
|
|||||||
enqueteId, enqueteBatimentId, enqueteUniteLogementId), "Liste des fichiers synchronisée avec succès."),
|
enqueteId, enqueteBatimentId, enqueteUniteLogementId), "Liste des fichiers synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping(path = "/synchronise/all-enquete-data")
|
||||||
public ResponseEntity<?> syncAllEnqueteData(@ModelAttribute EnqueteAllDataPayload enqueteAllDataPayload) {
|
public ResponseEntity<?> syncAllEnqueteData(@ModelAttribute EnqueteAllDataPayload enqueteAllDataPayload) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncEnqueteAllData(enqueteAllDataPayload), "Les enquetes sont synchronisées avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncEnqueteAllData(enqueteAllDataPayload), "Les enquetes sont synchronisées avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping(path = "/synchronise/enquete/confirme-from-mobile")
|
||||||
public ResponseEntity<?> syncAllEnqueteData(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
|
public ResponseEntity<?> syncAllEnqueteData(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Synchronisation confirmée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Synchronisation confirmée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping(path = "/batiment")
|
||||||
public ResponseEntity<?> syncBatiment(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
|
public ResponseEntity<?> syncBatiment(@RequestBody List<BatimentPaylaod> batimentPaylaods) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Liste des batiments synchronisées avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncBatiment(batimentPaylaods), "Liste des batiments synchronisées avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping(path = "/unite-logement")
|
||||||
public ResponseEntity<?> syncUniteLogement(@RequestBody List<UniteLogementPaylaod> uniteLogementPaylaods) {
|
public ResponseEntity<?> syncUniteLogement(@RequestBody List<UniteLogementPaylaod> uniteLogementPaylaods) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncUniteLogement(uniteLogementPaylaods), "Liste des unités de logement synchronisées avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncUniteLogement(uniteLogementPaylaods), "Liste des unités de logement synchronisées avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping(path = "/caracteristique-batiment")
|
||||||
public ResponseEntity<?> syncCaracteristiqueBatiment(@RequestBody List<CaracteristiqueBatimentPaylod> caracteristiqueBatimentPaylods) {
|
public ResponseEntity<?> syncCaracteristiqueBatiment(@RequestBody List<CaracteristiqueBatimentPaylod> caracteristiqueBatimentPaylods) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueBatiment(caracteristiqueBatimentPaylods), "Liste des caractéristiques des bâtiments synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueBatiment(caracteristiqueBatimentPaylods), "Liste des caractéristiques des bâtiments synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping(path = "/caracteristique-parcelle")
|
||||||
public ResponseEntity<?> syncCaracteristiqueParcelle(@RequestBody List<CaracteristiqueParcellePaylod> caracteristiqueParcellePaylods) {
|
public ResponseEntity<?> syncCaracteristiqueParcelle(@RequestBody List<CaracteristiqueParcellePaylod> caracteristiqueParcellePaylods) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueParcelle(caracteristiqueParcellePaylods), "Liste des caractéristiques des parcelles synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueParcelle(caracteristiqueParcellePaylods), "Liste des caractéristiques des parcelles synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping(path = "/caracteristique-unite-logement")
|
||||||
public ResponseEntity<?> syncCaracteristiqueUniteLogement(@RequestBody List<CaracteristiqueUniteLogementPaylod> caracteristiqueUniteLogementPaylods) {
|
public ResponseEntity<?> syncCaracteristiqueUniteLogement(@RequestBody List<CaracteristiqueUniteLogementPaylod> caracteristiqueUniteLogementPaylods) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueUniteLogement(caracteristiqueUniteLogementPaylods), "Liste des caractéristiques des unités de logement synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncCaracteristiqueUniteLogement(caracteristiqueUniteLogementPaylods), "Liste des caractéristiques des unités de logement synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/enquete-batiment")
|
||||||
public ResponseEntity<?> syncEnqueteBatiment(@RequestBody List<EnqueteBatimentPayload> enqueteBatimentPayloads) {
|
public ResponseEntity<?> syncEnqueteBatiment(@RequestBody List<EnqueteBatimentPayload> enqueteBatimentPayloads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncEnqueteBatiment(enqueteBatimentPayloads), "Liste des enquêtes des batiments synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncEnqueteBatiment(enqueteBatimentPayloads), "Liste des enquêtes des batiments synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@PostMapping("/enquete-unite-logement")
|
||||||
public ResponseEntity<?> syncEnqueteUniteLogement(@RequestBody List<EnqueteUniteLogementPayload> enqueteUniteLogementPayloads) {
|
public ResponseEntity<?> syncEnqueteUniteLogement(@RequestBody List<EnqueteUniteLogementPayload> enqueteUniteLogementPayloads) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, synchronisationService.syncEnqueteUniteLogement(enqueteUniteLogementPayloads), "Liste des enquêtes des unités de logement synchronisée avec succès."),
|
new ApiResponse<>(true, synchronisationService.syncEnqueteUniteLogement(enqueteUniteLogementPayloads), "Liste des enquêtes des unités de logement synchronisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.controllers.user;
|
|||||||
import io.gmss.fiscad.entities.user.Role;
|
import io.gmss.fiscad.entities.user.Role;
|
||||||
import io.gmss.fiscad.entities.user.User;
|
import io.gmss.fiscad.entities.user.User;
|
||||||
import io.gmss.fiscad.enums.UserRole;
|
import io.gmss.fiscad.enums.UserRole;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
import io.gmss.fiscad.interfaces.infocad.parametre.StructureService;
|
||||||
import io.gmss.fiscad.interfaces.user.RoleService;
|
import io.gmss.fiscad.interfaces.user.RoleService;
|
||||||
import io.gmss.fiscad.interfaces.user.UserService;
|
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.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -32,6 +36,7 @@ public class AuthController {
|
|||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final RoleService roleService;
|
private final RoleService roleService;
|
||||||
private final StructureService structureService;
|
private final StructureService structureService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||||
|
|
||||||
public AuthController(UserService userService, RoleService roleService, StructureService structureService) {
|
public AuthController(UserService userService, RoleService roleService, StructureService structureService) {
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
@@ -63,12 +68,19 @@ public class AuthController {
|
|||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
logger.error(e.getLocalizedMessage());
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
new ApiResponse<User>(false, e.getMessage()),
|
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,11 +94,19 @@ public class AuthController {
|
|||||||
new ApiResponse<>(true, user, "User created successully."),
|
new ApiResponse<>(true, user, "User created successully."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package io.gmss.fiscad.controllers.user;
|
|||||||
import io.gmss.fiscad.entities.user.DemandeReinitialisationMP;
|
import io.gmss.fiscad.entities.user.DemandeReinitialisationMP;
|
||||||
import io.gmss.fiscad.entities.user.User;
|
import io.gmss.fiscad.entities.user.User;
|
||||||
import io.gmss.fiscad.enums.UserRole;
|
import io.gmss.fiscad.enums.UserRole;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.user.DemandeReinitialisationMPService;
|
import io.gmss.fiscad.interfaces.user.DemandeReinitialisationMPService;
|
||||||
import io.gmss.fiscad.interfaces.user.RoleService;
|
import io.gmss.fiscad.interfaces.user.RoleService;
|
||||||
import io.gmss.fiscad.interfaces.user.UserService;
|
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.gmss.fiscad.security.UserPrincipal;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
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.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "api/demande-reinitialisation-mp", produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "api/demande-reinitialisation-mp", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@@ -28,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class DemandeReinitialisationMPController {
|
public class DemandeReinitialisationMPController {
|
||||||
|
|
||||||
private final DemandeReinitialisationMPService demandeReinitialisationMPService;
|
private final DemandeReinitialisationMPService demandeReinitialisationMPService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(DemandeReinitialisationMPController.class);
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final RoleService roleService;
|
private final RoleService roleService;
|
||||||
|
|
||||||
@@ -45,11 +50,19 @@ public class DemandeReinitialisationMPController {
|
|||||||
new ApiResponse<>(true, "DemandeReinitialisation MP créé avec succès."),
|
new ApiResponse<>(true, "DemandeReinitialisation MP créé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,11 +73,19 @@ public class DemandeReinitialisationMPController {
|
|||||||
new ApiResponse<>(true, demandeReinitialisationMPService.updateDemandeReinitialisationMP(id, demandeReinitialisationMP), "DemandeReinitialisationMP mis à jour avec succès."),
|
new ApiResponse<>(true, demandeReinitialisationMPService.updateDemandeReinitialisationMP(id, demandeReinitialisationMP), "DemandeReinitialisationMP mis à jour avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +97,19 @@ public class DemandeReinitialisationMPController {
|
|||||||
new ApiResponse<>(true, "Demande de Reinitialisation de mot de passe supprimé avec succès."),
|
new ApiResponse<>(true, "Demande de Reinitialisation de mot de passe supprimé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
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) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all-paged")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllDemandeReinitialisationMPPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllDemandeReinitialisationMPPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPList(pageable), "Liste des demandeReinitialisationMP chargée avec succès."),
|
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPList(pageable), "Liste des demandeReinitialisationMP chargée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getDemandeReinitialisationMPById(@PathVariable Long id) {
|
public ResponseEntity<?> getDemandeReinitialisationMPById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPById(id), "DemandeReinitialisationMP trouvé avec succès."),
|
new ApiResponse<>(true, demandeReinitialisationMPService.getDemandeReinitialisationMPById(id), "DemandeReinitialisationMP trouvé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/reset")
|
||||||
public ResponseEntity<?> traiterDemande(@RequestParam Long id, @RequestParam String password) {
|
public ResponseEntity<?> traiterDemande(@RequestParam Long id, @RequestParam String password) {
|
||||||
|
try {
|
||||||
DemandeReinitialisationMP demandeReinitialisationMP = demandeReinitialisationMPService.traiterDemandeReinitialisation(id, password);
|
DemandeReinitialisationMP demandeReinitialisationMP = demandeReinitialisationMPService.traiterDemandeReinitialisation(id, password);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true,
|
new ApiResponse<>(true,
|
||||||
new DemandeReinitialisationMPResponse(
|
new DemandeReinitialisationMPResponse(
|
||||||
@@ -159,5 +229,19 @@ public class DemandeReinitialisationMPController {
|
|||||||
"Traitement effectué avec succès."),
|
"Traitement effectué avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package io.gmss.fiscad.controllers.user;
|
|||||||
|
|
||||||
|
|
||||||
import io.gmss.fiscad.entities.user.Role;
|
import io.gmss.fiscad.entities.user.Role;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.user.RoleService;
|
import io.gmss.fiscad.interfaces.user.RoleService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,6 +17,7 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class RoleController {
|
public class RoleController {
|
||||||
|
|
||||||
private final RoleService roleService;
|
private final RoleService roleService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(RoleController.class);
|
||||||
|
|
||||||
public RoleController(RoleService roleService) {
|
public RoleController(RoleService roleService) {
|
||||||
this.roleService = roleService;
|
this.roleService = roleService;
|
||||||
@@ -38,11 +43,19 @@ public class RoleController {
|
|||||||
new ApiResponse<>(true, role, "Role created successully."),
|
new ApiResponse<>(true, role, "Role created successully."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,11 +67,19 @@ public class RoleController {
|
|||||||
new ApiResponse<>(true, roleService.updateRole(id, role), "Role updated successully."),
|
new ApiResponse<>(true, roleService.updateRole(id, role), "Role updated successully."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,29 +91,68 @@ public class RoleController {
|
|||||||
new ApiResponse<>(true, "Role deleted successully"),
|
new ApiResponse<>(true, "Role deleted successully"),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAll() {
|
public ResponseEntity<?> getAll() {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, roleService.getRoleList(), "Liste des roles."),
|
new ApiResponse<>(true, roleService.getRoleList(), "Liste des roles."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-paged")
|
||||||
public ResponseEntity<?> getAllPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
public ResponseEntity<?> getAllPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||||
|
try {
|
||||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||||
|
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, roleService.getRoleList(pageable), "Liste des roles."),
|
new ApiResponse<>(true, roleService.getRoleList(pageable), "Liste des roles."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.controllers.user;
|
|||||||
|
|
||||||
import io.gmss.fiscad.entities.user.User;
|
import io.gmss.fiscad.entities.user.User;
|
||||||
import io.gmss.fiscad.enums.UserRole;
|
import io.gmss.fiscad.enums.UserRole;
|
||||||
|
import io.gmss.fiscad.exceptions.*;
|
||||||
import io.gmss.fiscad.interfaces.user.UserService;
|
import io.gmss.fiscad.interfaces.user.UserService;
|
||||||
import io.gmss.fiscad.paylaods.ApiResponse;
|
import io.gmss.fiscad.paylaods.ApiResponse;
|
||||||
import io.gmss.fiscad.paylaods.Login;
|
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.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -27,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||||
|
|
||||||
|
|
||||||
public UserController(UserService userService) {
|
public UserController(UserService userService) {
|
||||||
@@ -42,11 +46,19 @@ public class UserController {
|
|||||||
new ApiResponse<>(true, user, "Utilisateur créé avec succès"),
|
new ApiResponse<>(true, user, "Utilisateur créé avec succès"),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,11 +70,19 @@ public class UserController {
|
|||||||
new ApiResponse<>(true, "Votre mot de passe à été modifiée avec succès."),
|
new ApiResponse<>(true, "Votre mot de passe à été modifiée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,11 +94,19 @@ public class UserController {
|
|||||||
new ApiResponse<>(true, user, "Votre mot de passe à été réinitialisée avec succès."),
|
new ApiResponse<>(true, user, "Votre mot de passe à été réinitialisée avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,11 +118,19 @@ public class UserController {
|
|||||||
new ApiResponse<>(true, user, "Cet utilisateur à été activé avec succès."),
|
new ApiResponse<>(true, user, "Cet utilisateur à été activé avec succès."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,11 +142,19 @@ public class UserController {
|
|||||||
new ApiResponse<>(true, userService.updateUser(id, user), "User updated successully."),
|
new ApiResponse<>(true, userService.updateUser(id, user), "User updated successully."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,11 +171,19 @@ public class UserController {
|
|||||||
new ApiResponse<>(true, user, message),
|
new ApiResponse<>(true, user, message),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,17 +195,26 @@ public class UserController {
|
|||||||
new ApiResponse<>(true, "User deleted successully"),
|
new ApiResponse<>(true, "User deleted successully"),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Null value has been detected {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(
|
logger.error(e.getLocalizedMessage());
|
||||||
new ApiResponse<>(false, e.getMessage()),
|
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||||
HttpStatus.OK
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public ResponseEntity<?> getAll(@CurrentUser UserPrincipal userPrincipal) {
|
public ResponseEntity<?> getAll(@CurrentUser UserPrincipal userPrincipal) {
|
||||||
|
try {
|
||||||
|
|
||||||
User user = userPrincipal.getUser();
|
User user = userPrincipal.getUser();
|
||||||
|
|
||||||
@@ -168,11 +229,25 @@ public class UserController {
|
|||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
@GetMapping("/all-by-structure")
|
||||||
public ResponseEntity<?> getAllByStructure(@CurrentUser UserPrincipal userPrincipal) {
|
public ResponseEntity<?> getAllByStructure(@CurrentUser UserPrincipal userPrincipal) {
|
||||||
|
try {
|
||||||
if (userPrincipal.getUser().getStructure() != null) {
|
if (userPrincipal.getUser().getStructure() != null) {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, userService.getListUserByStructure(userPrincipal.getUser().getStructure().getId()), "Liste des utilisateurs chargée avec succès."),
|
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
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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")
|
// @GetMapping("/all-paged")
|
||||||
@@ -197,26 +287,71 @@ public class UserController {
|
|||||||
|
|
||||||
@GetMapping("/id/{id}")
|
@GetMapping("/id/{id}")
|
||||||
public ResponseEntity<?> getUserById(@PathVariable Long id) {
|
public ResponseEntity<?> getUserById(@PathVariable Long id) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, userService.getUserById(id), "User found."),
|
new ApiResponse<>(true, userService.getUserById(id), "User found."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/username/{username}")
|
||||||
public ResponseEntity<?> getUserByUsername(@PathVariable String username) {
|
public ResponseEntity<?> getUserByUsername(@PathVariable String username) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, userService.getUserByUsername(username), "User found."),
|
new ApiResponse<>(true, userService.getUserByUsername(username), "User found."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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}")
|
@GetMapping("/all-by-role/{userrole}")
|
||||||
public ResponseEntity<?> getUserByUserRole(@PathVariable UserRole userrole) {
|
public ResponseEntity<?> getUserByUserRole(@PathVariable UserRole userrole) {
|
||||||
|
try {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
new ApiResponse<>(true, userService.getUserByProfil(userrole), "Users found."),
|
new ApiResponse<>(true, userService.getUserByProfil(userrole), "Users found."),
|
||||||
HttpStatus.OK
|
HttpStatus.OK
|
||||||
);
|
);
|
||||||
|
} catch (HttpClientErrorException.MethodNotAllowed e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, "Method POST/GET is required."), HttpStatus.OK);
|
||||||
|
} catch (NotFoundException | BadRequestException | MyFileNotFoundException | ResourceNotFoundException |
|
||||||
|
FileStorageException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
return new ResponseEntity<>(new ApiResponse(false, null, e.getMessage()), HttpStatus.OK);
|
||||||
|
} catch (NullPointerException 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -163,12 +163,12 @@ public class Enquete extends BaseEntity implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getNomPrenomEnqueteur() {
|
public String getNomPrenomEnqueteur() {
|
||||||
if (this.user != null) {
|
if (this.user != null) {
|
||||||
return this.user.getNom() + " " + this.user.getPrenom();
|
return this.user.getNom() + " " + this.user.getPrenom();
|
||||||
} else return "";
|
} else return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNomBloc() {
|
public String getNomBloc() {
|
||||||
if (this.bloc != null) {
|
if (this.bloc != null) {
|
||||||
return this.bloc.getNom();
|
return this.bloc.getNom();
|
||||||
@@ -180,6 +180,7 @@ public class Enquete extends BaseEntity implements Serializable {
|
|||||||
return this.bloc.getCote();
|
return this.bloc.getCote();
|
||||||
} else return "";
|
} else return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDepartement() {
|
public String getDepartement() {
|
||||||
if (this.bloc != null) {
|
if (this.bloc != null) {
|
||||||
Arrondissement arrondissement = this.bloc.getArrondissement();
|
Arrondissement arrondissement = this.bloc.getArrondissement();
|
||||||
@@ -188,6 +189,7 @@ public class Enquete extends BaseEntity implements Serializable {
|
|||||||
} else return "";
|
} else return "";
|
||||||
} else return "";
|
} else return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCommune() {
|
public String getCommune() {
|
||||||
if (this.bloc != null) {
|
if (this.bloc != null) {
|
||||||
Arrondissement arrondissement = this.bloc.getArrondissement();
|
Arrondissement arrondissement = this.bloc.getArrondissement();
|
||||||
@@ -205,6 +207,7 @@ public class Enquete extends BaseEntity implements Serializable {
|
|||||||
} else return "";
|
} else return "";
|
||||||
} else return "";
|
} else return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTypeDomaine() {
|
public String getTypeDomaine() {
|
||||||
if (this.parcelle != null) {
|
if (this.parcelle != null) {
|
||||||
NatureDomaine natureDomaine = this.parcelle.getNatureDomaine();
|
NatureDomaine natureDomaine = this.parcelle.getNatureDomaine();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import jakarta.persistence.Id;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
public class EnqueteFiltreResponse {
|
public class EnqueteFiltreResponse {
|
||||||
|
|||||||
@@ -87,6 +87,4 @@ public class Parcelle extends BaseEntity implements Serializable {
|
|||||||
// private Point geometry32631;
|
// private Point geometry32631;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
package io.gmss.fiscad.entities.infocad.metier;
|
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.JsonDeserialize;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import io.gmss.fiscad.entities.BaseEntity;
|
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 jakarta.persistence.*;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -16,12 +12,10 @@ import org.hibernate.annotations.ColumnDefault;
|
|||||||
import org.hibernate.annotations.SQLDelete;
|
import org.hibernate.annotations.SQLDelete;
|
||||||
import org.hibernate.annotations.Where;
|
import org.hibernate.annotations.Where;
|
||||||
import org.locationtech.jts.geom.MultiPolygon;
|
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.GeometryDeserializer;
|
||||||
import org.n52.jackson.datatype.jts.GeometrySerializer;
|
import org.n52.jackson.datatype.jts.GeometrySerializer;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Entity
|
@Entity
|
||||||
|
|||||||
@@ -84,6 +84,4 @@ public class Personne extends BaseEntity implements Serializable {
|
|||||||
private boolean synchronise;
|
private boolean synchronise;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
package io.gmss.fiscad.exceptions;
|
package io.gmss.fiscad.exceptions;
|
||||||
|
|
||||||
public class FileStorageException extends RuntimeException {
|
public class FileStorageException extends RuntimeException {
|
||||||
public FileStorageException(String message) {
|
public FileStorageException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class NationaliteServiceImpl implements NationaliteService {
|
public class NationaliteServiceImpl implements NationaliteService {
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ public class SecteurDecoupageServiceImpl implements SecteurDecoupageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<SecteurDecoupage> getSecteurDecoupageById(Long id) {
|
public Optional<SecteurDecoupage> getSecteurDecoupageById(Long id) {
|
||||||
return secteurDecoupageRepository.findById(id);
|
return secteurDecoupageRepository.findById(id);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class ActeurConcerneServiceImpl implements ActeurConcerneService {
|
public class ActeurConcerneServiceImpl implements ActeurConcerneService {
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ public class EnqueteServiceImpl implements EnqueteService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println(condition);
|
System.out.println(condition);
|
||||||
StringBuilder sb = new StringBuilder(sql).append(condition);
|
StringBuilder sb = new StringBuilder(sql).append(condition);
|
||||||
query = em.createNativeQuery(sb.toString(), EnqueteFiltreResponse.class);
|
query = em.createNativeQuery(sb.toString(), EnqueteFiltreResponse.class);
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public class ParcelleServiceImpl implements ParcelleService {
|
|||||||
throw new NotFoundException("Impossible de trouver l'enquête.");
|
throw new NotFoundException("Impossible de trouver l'enquête.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Parcelle getParcelle(ParcellePayLoad parcellePayLoad, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
|
private Parcelle getParcelle(ParcellePayLoad parcellePayLoad, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
|
||||||
StringBuilder coordonnees = new StringBuilder();
|
StringBuilder coordonnees = new StringBuilder();
|
||||||
Parcelle parcelle = new Parcelle();
|
Parcelle parcelle = new Parcelle();
|
||||||
@@ -145,6 +146,7 @@ public class ParcelleServiceImpl implements ParcelleService {
|
|||||||
// }
|
// }
|
||||||
return parcelle;
|
return parcelle;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Parcelle getParcelle(Parcelle parcelle, ParcellePayLoad parcellePayLoad, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
|
private Parcelle getParcelle(Parcelle parcelle, ParcellePayLoad parcellePayLoad, Optional<SituationGeographique> optionalSituationGeographique, Optional<NatureDomaine> optionalNatureDomaine) {
|
||||||
StringBuilder coordonnees = new StringBuilder();
|
StringBuilder coordonnees = new StringBuilder();
|
||||||
parcelle.setP(parcellePayLoad.getP());
|
parcelle.setP(parcellePayLoad.getP());
|
||||||
@@ -180,6 +182,4 @@ public class ParcelleServiceImpl implements ParcelleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TpeServiceImpl implements TpeService {
|
public class TpeServiceImpl implements TpeService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ModeAcquisitionServiceImpl implements ModeAcquisitionService {
|
public class ModeAcquisitionServiceImpl implements ModeAcquisitionService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class NatureDomaineServiceImpl implements NatureDomaineService {
|
public class NatureDomaineServiceImpl implements NatureDomaineService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class PositionRepresentationServiceImpl implements PositionRepresentationService {
|
public class PositionRepresentationServiceImpl implements PositionRepresentationService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ProfessionServiceImpl implements ProfessionService {
|
public class ProfessionServiceImpl implements ProfessionService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SituationGeographiqueServiceImpl implements SituationGeographiqueService {
|
public class SituationGeographiqueServiceImpl implements SituationGeographiqueService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SituationMatrimonialeServiceImpl implements SituationMatrimonialeService {
|
public class SituationMatrimonialeServiceImpl implements SituationMatrimonialeService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SourceDroitServiceImpl implements SourceDroitService {
|
public class SourceDroitServiceImpl implements SourceDroitService {
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class StructureServiceImpl implements StructureService {
|
public class StructureServiceImpl implements StructureService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TypeContestationServiceImpl implements TypeContestationService {
|
public class TypeContestationServiceImpl implements TypeContestationService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TypeDomaineServiceImpl implements TypeDomaineService {
|
public class TypeDomaineServiceImpl implements TypeDomaineService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TypePersonneServiceImpl implements TypePersonneService {
|
public class TypePersonneServiceImpl implements TypePersonneService {
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TypeRepresentationServiceImpl implements TypeRepresentationService {
|
public class TypeRepresentationServiceImpl implements TypeRepresentationService {
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ public class EmailServiceImpl implements EmailService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To send a simple email
|
// To send a simple email
|
||||||
public String sendSimpleMail(EmailDetails details)
|
public String sendSimpleMail(EmailDetails details) {
|
||||||
{
|
|
||||||
|
|
||||||
// Try block to check for exceptions
|
// Try block to check for exceptions
|
||||||
try {
|
try {
|
||||||
@@ -470,8 +469,7 @@ public class EmailServiceImpl implements EmailService {
|
|||||||
|
|
||||||
// To send an email with attachment
|
// To send an email with attachment
|
||||||
public String
|
public String
|
||||||
sendMailWithAttachment(EmailDetails details)
|
sendMailWithAttachment(EmailDetails details) {
|
||||||
{
|
|
||||||
// Creating a mime message
|
// Creating a mime message
|
||||||
MimeMessage mimeMessage
|
MimeMessage mimeMessage
|
||||||
= javaMailSender.createMimeMessage();
|
= javaMailSender.createMimeMessage();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class CampagneServiceImpl implements CampagneService {
|
public class CampagneServiceImpl implements CampagneService {
|
||||||
private final CampagneRepository campagneRepository;
|
private final CampagneRepository campagneRepository;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class RestaurationServiceImpl implements RestaurationService {
|
public class RestaurationServiceImpl implements RestaurationService {
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class StatistiquesServiceImpl implements StatistiquesService {
|
public class StatistiquesServiceImpl implements StatistiquesService {
|
||||||
private Authentication authentication;
|
private Authentication authentication;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final EnqueteRepository enqueteRepository;
|
private final EnqueteRepository enqueteRepository;
|
||||||
|
|
||||||
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository) {
|
public StatistiquesServiceImpl(UserService userService, EnqueteRepository enqueteRepository) {
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
this.enqueteRepository = enqueteRepository;
|
this.enqueteRepository = enqueteRepository;
|
||||||
|
|||||||
@@ -699,7 +699,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
batiment.setNub(batimentPaylaod.getNub());
|
batiment.setNub(batimentPaylaod.getNub());
|
||||||
batiment.setCode(batimentPaylaod.getCode());
|
batiment.setCode(batimentPaylaod.getCode());
|
||||||
batiment.setDateConstruction(batimentPaylaod.getDateConstruction());
|
batiment.setDateConstruction(batimentPaylaod.getDateConstruction());
|
||||||
@@ -1334,7 +1333,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SyncResponse> syncBatiment(List<BatimentPaylaod> batimentPaylaods) {
|
public List<SyncResponse> syncBatiment(List<BatimentPaylaod> batimentPaylaods) {
|
||||||
|
|
||||||
@@ -1412,7 +1410,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SyncResponse> syncUniteLogement(List<UniteLogementPaylaod> uniteLogementPaylaods) {
|
public List<SyncResponse> syncUniteLogement(List<UniteLogementPaylaod> uniteLogementPaylaods) {
|
||||||
|
|
||||||
@@ -1773,7 +1770,6 @@ public class SynchronisationServiceImpl implements SynchronisationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SyncResponse> syncEnqueteBatiment(List<EnqueteBatimentPayload> enqueteBatimentPayLoads) {
|
public List<SyncResponse> syncEnqueteBatiment(List<EnqueteBatimentPayload> enqueteBatimentPayLoads) {
|
||||||
List<SyncResponse> syncResponses = new ArrayList<>();
|
List<SyncResponse> syncResponses = new ArrayList<>();
|
||||||
|
|||||||
@@ -12,10 +12,15 @@ import java.util.Optional;
|
|||||||
public interface ArrondissementService {
|
public interface ArrondissementService {
|
||||||
|
|
||||||
Arrondissement createArrondissement(Arrondissement arrondissement) throws BadRequestException;
|
Arrondissement createArrondissement(Arrondissement arrondissement) throws BadRequestException;
|
||||||
|
|
||||||
Arrondissement updateArrondissement(Long id, Arrondissement arrondissement) throws NotFoundException;
|
Arrondissement updateArrondissement(Long id, Arrondissement arrondissement) throws NotFoundException;
|
||||||
|
|
||||||
void deleteArrondissement(Long id) throws NotFoundException;
|
void deleteArrondissement(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Arrondissement> getArrondissementList(Pageable pageable);
|
Page<Arrondissement> getArrondissementList(Pageable pageable);
|
||||||
|
|
||||||
List<Arrondissement> getArrondissementList();
|
List<Arrondissement> getArrondissementList();
|
||||||
|
|
||||||
Optional<Arrondissement> getArrondissementById(Long id);
|
Optional<Arrondissement> getArrondissementById(Long id);
|
||||||
|
|
||||||
List<Arrondissement> getArrondissementByComune(Long communeId);
|
List<Arrondissement> getArrondissementByComune(Long communeId);
|
||||||
|
|||||||
@@ -12,10 +12,16 @@ import java.util.Optional;
|
|||||||
public interface CommuneService {
|
public interface CommuneService {
|
||||||
|
|
||||||
Commune createCommune(Commune commune) throws BadRequestException;
|
Commune createCommune(Commune commune) throws BadRequestException;
|
||||||
|
|
||||||
Commune updateCommune(Long id, Commune commune) throws NotFoundException;
|
Commune updateCommune(Long id, Commune commune) throws NotFoundException;
|
||||||
|
|
||||||
void deleteCommune(Long id) throws NotFoundException;
|
void deleteCommune(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Commune> getCommuneList(Pageable pageable);
|
Page<Commune> getCommuneList(Pageable pageable);
|
||||||
|
|
||||||
List<Commune> getCommuneList();
|
List<Commune> getCommuneList();
|
||||||
|
|
||||||
List<Commune> getCommunesByDepartement(Long departementId);
|
List<Commune> getCommunesByDepartement(Long departementId);
|
||||||
|
|
||||||
Optional<Commune> getCommuneById(Long id);
|
Optional<Commune> getCommuneById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ import java.util.Optional;
|
|||||||
public interface DepartementService {
|
public interface DepartementService {
|
||||||
|
|
||||||
Departement createDepartement(Departement departement) throws BadRequestException;
|
Departement createDepartement(Departement departement) throws BadRequestException;
|
||||||
|
|
||||||
Departement updateDepartement(Long id, Departement departement) throws NotFoundException;
|
Departement updateDepartement(Long id, Departement departement) throws NotFoundException;
|
||||||
|
|
||||||
void deleteDepartement(Long id) throws NotFoundException;
|
void deleteDepartement(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Departement> getDepartementList(Pageable pageable);
|
Page<Departement> getDepartementList(Pageable pageable);
|
||||||
|
|
||||||
List<Departement> getDepartementList();
|
List<Departement> getDepartementList();
|
||||||
|
|
||||||
Optional<Departement> getDepartementById(Long id);
|
Optional<Departement> getDepartementById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ import java.util.Optional;
|
|||||||
public interface NationaliteService {
|
public interface NationaliteService {
|
||||||
|
|
||||||
Nationalite createNationalite(Nationalite nationalite) throws BadRequestException;
|
Nationalite createNationalite(Nationalite nationalite) throws BadRequestException;
|
||||||
|
|
||||||
Nationalite updateNationalite(Long id, Nationalite nationalite) throws NotFoundException;
|
Nationalite updateNationalite(Long id, Nationalite nationalite) throws NotFoundException;
|
||||||
|
|
||||||
void deleteNationalite(Long id) throws NotFoundException;
|
void deleteNationalite(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Nationalite> getNationaliteList(Pageable pageable);
|
Page<Nationalite> getNationaliteList(Pageable pageable);
|
||||||
|
|
||||||
List<Nationalite> getNationaliteList();
|
List<Nationalite> getNationaliteList();
|
||||||
|
|
||||||
Optional<Nationalite> getNationaliteById(Long id);
|
Optional<Nationalite> getNationaliteById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,16 @@ import java.util.Optional;
|
|||||||
public interface QuartierService {
|
public interface QuartierService {
|
||||||
|
|
||||||
Quartier createQuartier(Quartier quartier) throws BadRequestException;
|
Quartier createQuartier(Quartier quartier) throws BadRequestException;
|
||||||
|
|
||||||
Quartier updateQuartier(Long id, Quartier quartier) throws NotFoundException;
|
Quartier updateQuartier(Long id, Quartier quartier) throws NotFoundException;
|
||||||
|
|
||||||
void deleteQuartier(Long id) throws NotFoundException;
|
void deleteQuartier(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Quartier> getQuartierList(Pageable pageable);
|
Page<Quartier> getQuartierList(Pageable pageable);
|
||||||
|
|
||||||
List<Quartier> getQuartierList();
|
List<Quartier> getQuartierList();
|
||||||
|
|
||||||
Optional<Quartier> getQuartierById(Long id);
|
Optional<Quartier> getQuartierById(Long id);
|
||||||
|
|
||||||
List<Quartier> getQuartierByArrondissement(Long arrondissementId);
|
List<Quartier> getQuartierByArrondissement(Long arrondissementId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,13 @@ import java.util.Optional;
|
|||||||
public interface SecteurDecoupageService {
|
public interface SecteurDecoupageService {
|
||||||
|
|
||||||
SecteurDecoupage createSecteurDecoupage(SecteurDecoupage secteurDecoupage) throws BadRequestException;
|
SecteurDecoupage createSecteurDecoupage(SecteurDecoupage secteurDecoupage) throws BadRequestException;
|
||||||
|
|
||||||
SecteurDecoupage updateSecteurDecoupage(Long id, SecteurDecoupage secteurDecoupage) throws NotFoundException;
|
SecteurDecoupage updateSecteurDecoupage(Long id, SecteurDecoupage secteurDecoupage) throws NotFoundException;
|
||||||
|
|
||||||
void deleteSecteurDecoupage(Long id) throws NotFoundException;
|
void deleteSecteurDecoupage(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<SecteurDecoupage> getSecteurDecoupageList(Pageable pageable);
|
Page<SecteurDecoupage> getSecteurDecoupageList(Pageable pageable);
|
||||||
|
|
||||||
List<SecteurDecoupage> getSecteurDecoupageList();
|
List<SecteurDecoupage> getSecteurDecoupageList();
|
||||||
|
|
||||||
Optional<SecteurDecoupage> getSecteurDecoupageById(Long id);
|
Optional<SecteurDecoupage> getSecteurDecoupageById(Long id);
|
||||||
|
|||||||
@@ -13,10 +13,15 @@ import java.util.Optional;
|
|||||||
public interface SecteurService {
|
public interface SecteurService {
|
||||||
|
|
||||||
Secteur createSecteur(SecteurPayload secteur) throws BadRequestException;
|
Secteur createSecteur(SecteurPayload secteur) throws BadRequestException;
|
||||||
|
|
||||||
Secteur updateSecteur(Long id, SecteurPayload secteur) throws NotFoundException;
|
Secteur updateSecteur(Long id, SecteurPayload secteur) throws NotFoundException;
|
||||||
|
|
||||||
void deleteSecteur(Long id) throws NotFoundException;
|
void deleteSecteur(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Secteur> getSecteurList(Pageable pageable);
|
Page<Secteur> getSecteurList(Pageable pageable);
|
||||||
|
|
||||||
List<Secteur> getSecteurList();
|
List<Secteur> getSecteurList();
|
||||||
|
|
||||||
List<Secteur> getSecteurListUneStruture(Long structureId);
|
List<Secteur> getSecteurListUneStruture(Long structureId);
|
||||||
|
|
||||||
Optional<Secteur> getSecteurById(Long id);
|
Optional<Secteur> getSecteurById(Long id);
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ import java.util.Optional;
|
|||||||
public interface ActeurConcerneService {
|
public interface ActeurConcerneService {
|
||||||
|
|
||||||
ActeurConcerne createActeurConcerne(ActeurConcerne acteurConcerne) throws BadRequestException;
|
ActeurConcerne createActeurConcerne(ActeurConcerne acteurConcerne) throws BadRequestException;
|
||||||
|
|
||||||
ActeurConcerne updateActeurConcerne(Long id, ActeurConcerne acteurConcerne) throws NotFoundException;
|
ActeurConcerne updateActeurConcerne(Long id, ActeurConcerne acteurConcerne) throws NotFoundException;
|
||||||
|
|
||||||
void deleteActeurConcerne(Long id) throws NotFoundException;
|
void deleteActeurConcerne(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<ActeurConcerne> getActeurConcerneList(Pageable pageable);
|
Page<ActeurConcerne> getActeurConcerneList(Pageable pageable);
|
||||||
|
|
||||||
List<ActeurConcerne> getActeurConcerneList();
|
List<ActeurConcerne> getActeurConcerneList();
|
||||||
|
|
||||||
Optional<ActeurConcerne> getActeurConcerneById(Long id);
|
Optional<ActeurConcerne> getActeurConcerneById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,25 @@ import java.util.Optional;
|
|||||||
public interface CommentaireService {
|
public interface CommentaireService {
|
||||||
|
|
||||||
Commentaire createCommentaire(Commentaire commentaire) throws BadRequestException;
|
Commentaire createCommentaire(Commentaire commentaire) throws BadRequestException;
|
||||||
|
|
||||||
Commentaire updateCommentaire(Long id, Commentaire commentaire) throws NotFoundException;
|
Commentaire updateCommentaire(Long id, Commentaire commentaire) throws NotFoundException;
|
||||||
|
|
||||||
void deleteCommentaire(Long id) throws NotFoundException;
|
void deleteCommentaire(Long id) throws NotFoundException;
|
||||||
|
|
||||||
List<Commentaire> getCommentairesByEnqueteAndTerminal(Long idEnquete, Long terminalId);
|
List<Commentaire> getCommentairesByEnqueteAndTerminal(Long idEnquete, Long terminalId);
|
||||||
|
|
||||||
List<Commentaire> getCommentairesByEnqueteAndLu(Long idEnquete, boolean lu);
|
List<Commentaire> getCommentairesByEnqueteAndLu(Long idEnquete, boolean lu);
|
||||||
|
|
||||||
List<Commentaire> getCommentairesByOrigineAndStateReadAndTerminalId(Origine origine, boolean lu, Long terminalId);
|
List<Commentaire> getCommentairesByOrigineAndStateReadAndTerminalId(Origine origine, boolean lu, Long terminalId);
|
||||||
|
|
||||||
List<Commentaire> getCommentairesByOrigineAndStateSynchronizedAndTerminalId(Origine origine, boolean synchronise, Long terminalId);
|
List<Commentaire> getCommentairesByOrigineAndStateSynchronizedAndTerminalId(Origine origine, boolean synchronise, Long terminalId);
|
||||||
|
|
||||||
Optional<Commentaire> getCommentaireByNup(String nup);
|
Optional<Commentaire> getCommentaireByNup(String nup);
|
||||||
|
|
||||||
List<Commentaire> getCommentaireList();
|
List<Commentaire> getCommentaireList();
|
||||||
|
|
||||||
Optional<Commentaire> getCommentaireById(Long id);
|
Optional<Commentaire> getCommentaireById(Long id);
|
||||||
|
|
||||||
boolean setCommentaireRead(Long id);
|
boolean setCommentaireRead(Long id);
|
||||||
|
|
||||||
List<CommentaireResponse> saveAllCommentairesFromMobile(List<Commentaire> commentaires);
|
List<CommentaireResponse> saveAllCommentairesFromMobile(List<Commentaire> commentaires);
|
||||||
|
|||||||
@@ -20,23 +20,38 @@ import java.util.Optional;
|
|||||||
public interface EnqueteService {
|
public interface EnqueteService {
|
||||||
|
|
||||||
Enquete createEnquete(EnquetePayLoad enquetePayLoad) throws BadRequestException;
|
Enquete createEnquete(EnquetePayLoad enquetePayLoad) throws BadRequestException;
|
||||||
|
|
||||||
Enquete updateEnquete(EnquetePayLoad enquetePayLoad) throws NotFoundException;
|
Enquete updateEnquete(EnquetePayLoad enquetePayLoad) throws NotFoundException;
|
||||||
|
|
||||||
void deleteEnquete(Long id) throws NotFoundException;
|
void deleteEnquete(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Enquete> getEnqueteList(Pageable pageable);
|
Page<Enquete> getEnqueteList(Pageable pageable);
|
||||||
|
|
||||||
List<Enquete> getEnqueteList();
|
List<Enquete> getEnqueteList();
|
||||||
|
|
||||||
List<EnqueteResponse> getEnqueteCommuneArrondBloc();
|
List<EnqueteResponse> getEnqueteCommuneArrondBloc();
|
||||||
|
|
||||||
List<EnqueteFiltreResponse> getEnqueteCommuneArrondBlocFiltre(FiltreEnquetePayLoad filtreEnquetePayLoad);
|
List<EnqueteFiltreResponse> getEnqueteCommuneArrondBlocFiltre(FiltreEnquetePayLoad filtreEnquetePayLoad);
|
||||||
|
|
||||||
Optional<Enquete> getEnqueteById(Long id);
|
Optional<Enquete> getEnqueteById(Long id);
|
||||||
|
|
||||||
Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
Enquete validerEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||||
|
|
||||||
Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
Enquete rejeterEnquete(EnqueteTraitementPayLoad enqueteTraitementPayLoad);
|
||||||
|
|
||||||
List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
List<Enquete> validerEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||||
|
|
||||||
List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
List<Enquete> rejeterEnquete(List<EnqueteTraitementPayLoad> enqueteTraitementPayLoads);
|
||||||
|
|
||||||
Enquete finaliserEnquete(Long enqueteId);
|
Enquete finaliserEnquete(Long enqueteId);
|
||||||
|
|
||||||
Enquete reglerLitigeEnquete(Long enqueteId);
|
Enquete reglerLitigeEnquete(Long enqueteId);
|
||||||
|
|
||||||
public UserDecoupageEnqResponses getDecoupageAdminUserConnecterAndStat();
|
public UserDecoupageEnqResponses getDecoupageAdminUserConnecterAndStat();
|
||||||
|
|
||||||
public FicheEnqueteResponse getFicheEnquete(Long EnqueteId);
|
public FicheEnqueteResponse getFicheEnquete(Long EnqueteId);
|
||||||
|
|
||||||
public List<EnqueteNonSyncResponse> getEnqueteValideNonSynch(Long terminalId);
|
public List<EnqueteNonSyncResponse> getEnqueteValideNonSynch(Long terminalId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ import java.util.Optional;
|
|||||||
public interface MembreGroupeService {
|
public interface MembreGroupeService {
|
||||||
|
|
||||||
MembreGroupe createMembreGroupe(MembreGroupe membreGroupe) throws BadRequestException;
|
MembreGroupe createMembreGroupe(MembreGroupe membreGroupe) throws BadRequestException;
|
||||||
|
|
||||||
MembreGroupe updateMembreGroupe(Long id, MembreGroupe membreGroupe) throws NotFoundException;
|
MembreGroupe updateMembreGroupe(Long id, MembreGroupe membreGroupe) throws NotFoundException;
|
||||||
|
|
||||||
void deleteMembreGroupe(Long id) throws NotFoundException;
|
void deleteMembreGroupe(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<MembreGroupe> getMembreGroupeList(Pageable pageable);
|
Page<MembreGroupe> getMembreGroupeList(Pageable pageable);
|
||||||
|
|
||||||
List<MembreGroupe> getMembreGroupeList();
|
List<MembreGroupe> getMembreGroupeList();
|
||||||
|
|
||||||
Optional<MembreGroupe> getMembreGroupeById(Long id);
|
Optional<MembreGroupe> getMembreGroupeById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,14 @@ public interface ParcelleService {
|
|||||||
|
|
||||||
|
|
||||||
Parcelle createParcelle(ParcellePayLoad parcellePayLoad) throws BadRequestException;
|
Parcelle createParcelle(ParcellePayLoad parcellePayLoad) throws BadRequestException;
|
||||||
|
|
||||||
Parcelle updateParcelle(ParcellePayLoad parcellePayLoad) throws NotFoundException;
|
Parcelle updateParcelle(ParcellePayLoad parcellePayLoad) throws NotFoundException;
|
||||||
|
|
||||||
void deleteParcelle(Long id) throws NotFoundException;
|
void deleteParcelle(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Parcelle> getParcelleList(Pageable pageable);
|
Page<Parcelle> getParcelleList(Pageable pageable);
|
||||||
|
|
||||||
List<Parcelle> getParcelleList();
|
List<Parcelle> getParcelleList();
|
||||||
|
|
||||||
Optional<Parcelle> getParcelleById(Long id);
|
Optional<Parcelle> getParcelleById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,14 @@ import java.util.Optional;
|
|||||||
public interface PieceService {
|
public interface PieceService {
|
||||||
|
|
||||||
Piece createPiece(Piece piece) throws BadRequestException;
|
Piece createPiece(Piece piece) throws BadRequestException;
|
||||||
|
|
||||||
Piece updatePiece(Long id, Piece piece) throws NotFoundException;
|
Piece updatePiece(Long id, Piece piece) throws NotFoundException;
|
||||||
|
|
||||||
void deletePiece(Long id) throws NotFoundException;
|
void deletePiece(Long id) throws NotFoundException;
|
||||||
|
|
||||||
Page<Piece> getPieceList(Pageable pageable);
|
Page<Piece> getPieceList(Pageable pageable);
|
||||||
|
|
||||||
List<Piece> getPieceList();
|
List<Piece> getPieceList();
|
||||||
|
|
||||||
Optional<Piece> getPieceById(Long id);
|
Optional<Piece> getPieceById(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user