diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/report/controller/ControllerViewReport.java b/arc-web/src/main/java/fr/insee/arc/web/gui/report/controller/ControllerViewReport.java new file mode 100644 index 00000000..accbeae8 --- /dev/null +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/report/controller/ControllerViewReport.java @@ -0,0 +1,22 @@ +package fr.insee.arc.web.gui.report.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; + +import fr.insee.arc.web.gui.report.service.ServiceViewReport; + +@Controller +public class ControllerViewReport extends ServiceViewReport { + + /** + * Action trigger by selecting a calendar in the GUI. Update the GUI + * + * @return success + */ + @RequestMapping("/secure/selectReport") + public String selectReportAction(Model model) { + return selectReport(model); + } + +} diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/report/dao/GererReportDao.java b/arc-web/src/main/java/fr/insee/arc/web/gui/report/dao/GererReportDao.java new file mode 100644 index 00000000..f75db172 --- /dev/null +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/report/dao/GererReportDao.java @@ -0,0 +1,68 @@ +package fr.insee.arc.web.gui.report.dao; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.stereotype.Component; + +import fr.insee.arc.core.dataobjects.ArcPreparedStatementBuilder; +import fr.insee.arc.core.dataobjects.ColumnEnum; +import fr.insee.arc.core.dataobjects.DataObjectService; +import fr.insee.arc.core.dataobjects.ViewEnum; +import fr.insee.arc.core.model.TraitementPhase; +import fr.insee.arc.utils.dao.SQL; +import fr.insee.arc.utils.database.Delimiters; +import fr.insee.arc.web.gui.all.util.VObject; +import fr.insee.arc.web.gui.all.util.VObjectHelperDao; +import fr.insee.arc.web.gui.all.util.VObjectService; + +@Component +public class GererReportDao extends VObjectHelperDao { + + private static final Logger LOGGER = LogManager.getLogger(GererReportDao.class); + + /** + * dao call to build norm vobject + * + * @param viewNorme + */ + public void initializeViewReport(VObject viewReport) { + + ViewEnum dataModelReport = ViewEnum.MAPPING_ARC_REPORT_OK; + + Map defaultInputFields = new HashMap<>(); + + ArcPreparedStatementBuilder query = new ArcPreparedStatementBuilder(); + + query.build(SQL.SELECT, query.sqlListeOfColumnsFromModel(dataModelReport)); + query.build(SQL.FROM, dataObjectService.getView(dataModelReport), SQL.AS, ViewEnum.ALIAS_A); + query.build(SQL.WHERE, SQL.NOT, SQL.EXISTS, "("); + query.build(SQL.SELECT, SQL.FROM, dataObjectService.getView(ViewEnum.PILOTAGE_FICHIER), SQL.AS, ViewEnum.ALIAS_B); + query.build(SQL.WHERE, ColumnEnum.PHASE_TRAITEMENT, "=", query.quoteText(TraitementPhase.RECEPTION.toString())); + query.build(SQL.AND, ViewEnum.ALIAS_B, ".", ColumnEnum.O_CONTAINER, "=", ViewEnum.ALIAS_A, ".", ColumnEnum.ENTREPOT, "||", query.quoteText(Delimiters.SQL_TOKEN_DELIMITER), "||", ViewEnum.ALIAS_A, ".", ColumnEnum.ARCHIVE_FILENAME); + query.build(")"); + query.build(SQL.ORDER_BY, ColumnEnum.ARCHIVE_TIMESTAMP, SQL.DESC); + + // Initialize the vobject + vObjectService.initialize(viewReport, query, dataObjectService.getView(dataModelReport), defaultInputFields); + } + + public VObjectService getvObjectService() { + return vObjectService; + } + + public void setvObjectService(VObjectService vObjectService) { + this.vObjectService = vObjectService; + } + + public DataObjectService getDataObjectService() { + return dataObjectService; + } + + public void setDataObjectService(DataObjectService dataObjectService) { + this.dataObjectService = dataObjectService; + } + +} diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ModelReport.java b/arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ModelReport.java new file mode 100644 index 00000000..f190365b --- /dev/null +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ModelReport.java @@ -0,0 +1,28 @@ +package fr.insee.arc.web.gui.report.model; + +import org.springframework.stereotype.Component; + +import fr.insee.arc.web.gui.all.model.ArcModel; +import fr.insee.arc.web.gui.all.util.VObject; + +@Component +public class ModelReport implements ArcModel { + + // The report view + private VObject viewReport; + + + public ModelReport() { + this.viewReport = new ViewReport(); + } + + + public VObject getViewReport() { + return viewReport; + } + + + public void setViewReport(VObject viewReport) { + this.viewReport = viewReport; + } +} \ No newline at end of file diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ViewReport.java b/arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ViewReport.java new file mode 100644 index 00000000..fd2071e1 --- /dev/null +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ViewReport.java @@ -0,0 +1,33 @@ +package fr.insee.arc.web.gui.report.model; + +import java.util.HashMap; + +import fr.insee.arc.core.dataobjects.ArcPreparedStatementBuilder; +import fr.insee.arc.web.gui.all.util.ConstantVObject; +import fr.insee.arc.web.gui.all.util.VObject; +import fr.insee.arc.web.gui.all.util.ConstantVObject.ColumnRendering; + +public class ViewReport extends VObject { + public ViewReport() { + super(); + + this.setTitle("view.report"); + + this.setDefaultPaginationSize(15); + + this.setSessionName("viewReport"); + + this.setConstantVObject(new ConstantVObject( + + new HashMap() { + /** + * + */ + private static final long serialVersionUID = 4705381559117478720L; + + { + put("id", new ColumnRendering(false, "label.id", "0%", "text", null, false)); + } + })); + } +} \ No newline at end of file diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/report/package-info.java b/arc-web/src/main/java/fr/insee/arc/web/gui/report/package-info.java new file mode 100644 index 00000000..904823cb --- /dev/null +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/report/package-info.java @@ -0,0 +1,4 @@ +/** + * This package contains the controllers, service and data objects for the "debugging query sender" gui screen + */ +package fr.insee.arc.web.gui.report; \ No newline at end of file diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/report/service/InteractorReport.java b/arc-web/src/main/java/fr/insee/arc/web/gui/report/service/InteractorReport.java new file mode 100644 index 00000000..edc959e4 --- /dev/null +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/report/service/InteractorReport.java @@ -0,0 +1,54 @@ +package fr.insee.arc.web.gui.report.service; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.context.annotation.ScopedProxyMode; +import org.springframework.stereotype.Service; +import org.springframework.web.context.WebApplicationContext; + +import fr.insee.arc.utils.utils.LoggerHelper; +import fr.insee.arc.web.gui.all.service.ArcWebGenericService; +import fr.insee.arc.web.gui.all.util.VObject; +import fr.insee.arc.web.gui.report.dao.GererReportDao; +import fr.insee.arc.web.gui.report.model.ModelReport; + +@Service +@Scope(scopeName = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS) +public class InteractorReport extends ArcWebGenericService { + + protected static final String RESULT_SUCCESS = "jsp/gererReport.jsp"; + + private static final Logger LOGGER = LogManager.getLogger(InteractorReport.class); + + @Autowired + protected ModelReport views; + + // The action Name + public static final String ACTION_NAME="reportManagement"; + + @Override + public void putAllVObjects(ModelReport model) { + + views.setViewReport(vObjectService.preInitialize(model.getViewReport())); + + putVObject(views.getViewReport(), t -> initializeViewReport(t)); + } + + @Override + public String getActionName() { + return ACTION_NAME; + } + + + /** + * Initialize the {@value InteractorReport#viewNorme}. Call dao to create the view + */ + public void initializeViewReport(VObject viewReport) { + LoggerHelper.debug(LOGGER, "/* initializeNorme */"); + dao.initializeViewReport(viewReport); + } + + +} diff --git a/arc-web/src/main/java/fr/insee/arc/web/gui/report/service/ServiceViewReport.java b/arc-web/src/main/java/fr/insee/arc/web/gui/report/service/ServiceViewReport.java new file mode 100644 index 00000000..165a156b --- /dev/null +++ b/arc-web/src/main/java/fr/insee/arc/web/gui/report/service/ServiceViewReport.java @@ -0,0 +1,25 @@ +package fr.insee.arc.web.gui.report.service; + +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Service; +import org.springframework.ui.Model; + +@Service +public class ServiceViewReport extends InteractorReport { + + /** + * Action trigger by selecting a calendar in the GUI. Update the GUI + * + * @return success + */ + public String selectReport(Model model) { + return basicAction(model, RESULT_SUCCESS); + } + + public String sortReport(Model model) { + return sortVobject(model, RESULT_SUCCESS, this.views.getViewReport()); + } + +} diff --git a/arc-web/src/main/webapp/WEB-INF/jsp/gererReport.jsp b/arc-web/src/main/webapp/WEB-INF/jsp/gererReport.jsp new file mode 100644 index 00000000..04684c27 --- /dev/null +++ b/arc-web/src/main/webapp/WEB-INF/jsp/gererReport.jsp @@ -0,0 +1,56 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%> +<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %> +<%@taglib prefix="c" uri="jakarta.tags.core"%> + + + + +<spring:message code="header.reportManagement"/> + + + + + + + +
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + diff --git a/arc-web/src/main/webapp/WEB-INF/jsp/tiles/header.jsp b/arc-web/src/main/webapp/WEB-INF/jsp/tiles/header.jsp index 91c54df0..c51a9022 100644 --- a/arc-web/src/main/webapp/WEB-INF/jsp/tiles/header.jsp +++ b/arc-web/src/main/webapp/WEB-INF/jsp/tiles/header.jsp @@ -60,6 +60,7 @@ +
  • Maintenance