-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: report functionnality (not complete)
- Loading branch information
Showing
9 changed files
with
291 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
arc-web/src/main/java/fr/insee/arc/web/gui/report/controller/ControllerViewReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
arc-web/src/main/java/fr/insee/arc/web/gui/report/dao/GererReportDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, String> 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; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ModelReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
arc-web/src/main/java/fr/insee/arc/web/gui/report/model/ViewReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<String, ColumnRendering>() { | ||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = 4705381559117478720L; | ||
|
||
{ | ||
put("id", new ColumnRendering(false, "label.id", "0%", "text", null, false)); | ||
} | ||
})); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
arc-web/src/main/java/fr/insee/arc/web/gui/report/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
54 changes: 54 additions & 0 deletions
54
arc-web/src/main/java/fr/insee/arc/web/gui/report/service/InteractorReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ModelReport, GererReportDao> { | ||
|
||
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); | ||
} | ||
|
||
|
||
} |
25 changes: 25 additions & 0 deletions
25
arc-web/src/main/java/fr/insee/arc/web/gui/report/service/ServiceViewReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"%> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html lang="${pageContext.response.locale}"> | ||
<head> | ||
<link rel="icon" href="data:,"/> | ||
<title><spring:message code="header.reportManagement"/></title> | ||
<c:import url="tiles/defaulthead.jsp"> | ||
<c:param name="pageJs" value="/js/gererNorme.js" /> | ||
</c:import> | ||
</head> | ||
|
||
<body class="bg-body"> | ||
|
||
<form | ||
spellcheck="false" | ||
id="selectReport" | ||
action="selectReport.action" | ||
method="post" | ||
accept-charset="UTF-8" | ||
> | ||
|
||
<c:import url="tiles/header.jsp"> | ||
<c:param name="currentPage" value="reportManagement" /> | ||
</c:import> | ||
|
||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<!-- norm list --> | ||
<c:set var="view" value="${viewReport}" scope="request"/> | ||
<c:import url="tiles/templateVObject.jsp"> | ||
<c:param name="btnSelect" value ="true" /> | ||
<c:param name="btnSee" value ="true" /> | ||
<c:param name="btnSort" value ="true" /> | ||
<c:param name="btnAdd" value ="false" /> | ||
<c:param name="btnUpdate" value ="false" /> | ||
<c:param name="btnDelete" value ="false" /> | ||
<c:param name="ligneAdd" value ="false" /> | ||
<c:param name="ligneFilter" value ="true" /> | ||
<c:param name="checkbox" value ="true" /> | ||
<c:param name="checkboxVisible" value ="true" /> | ||
<c:param name="extraScopeAdd" value ="" /> | ||
<c:param name="extraScopeDelete" value ="" /> | ||
<c:param name="extraScopeUpdate" value ="" /> | ||
<c:param name="extraScopeSee" value ="" /> | ||
</c:import> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters