Skip to content

Commit

Permalink
Added two new sections for declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Jun 10, 2023
1 parent 8529c6d commit d4f34d7
Show file tree
Hide file tree
Showing 29 changed files with 672 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public enum JCONONPropertyIds {
CALL_ELENCO_ASPECTS("jconon_call:elenco_aspects"),
CALL_ELENCO_ASPECTS_SEZIONE_CNR("jconon_call:elenco_aspects_sezione_cnr"),
CALL_ELENCO_ASPECTS_ULTERIORI_DATI("jconon_call:elenco_aspects_ulteriori_dati"),
CALL_ELENCO_ASPECTS_SEZIONE_4("jconon_call:elenco_aspects_sezione_4"),
CALL_ELENCO_ASPECTS_SEZIONE_5("jconon_call:elenco_aspects_sezione_5"),
CALL_ELENCO_SEZIONI_DOMANDA("jconon_call:elenco_sezioni_domanda"),
CALL_ELENCO_ASSOCIATIONS("jconon_call:elenco_association"),
CALL_ELENCO_FIELD_NOT_REQUIRED("jconon_call:elenco_field_not_required"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,16 @@ public JsonElement serialize(GregorianCalendar src, Type typeOfSrc,
application,
JCONONPropertyIds.CALL_ELENCO_ASPECTS_ULTERIORI_DATI,
applicationModel, Dichiarazioni.ulterioriDati));
applicationModel.getProperties().put(Dichiarazioni.sezione4.name(), getDichiarazioni(
bulkInfoService.find(application.getType().getId()),
application,
JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_4,
applicationModel, Dichiarazioni.sezione4));
applicationModel.getProperties().put(Dichiarazioni.sezione5.name(), getDichiarazioni(
bulkInfoService.find(application.getType().getId()),
application,
JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_5,
applicationModel, Dichiarazioni.sezione5));
String labelSottoscritto = i18nService.getLabel(
"application.text.sottoscritto.lower." + application.getPropertyValue(JCONONPropertyIds.APPLICATION_SESSO.value()), locale);

Expand All @@ -614,7 +624,11 @@ public JsonElement serialize(GregorianCalendar src, Type typeOfSrc,
applicationModel.getProperties().put("label_jconon_application_dichiarazione_dati_personali",
i18nService.getLabel("text.jconon_application_dichiarazione_dati_personali", locale, labelSottoscritto));
for (Object key : call.getProperty(JCONONPropertyIds.CALL_ELENCO_SEZIONI_DOMANDA.value()).getValues()) {
applicationModel.getProperties().put(String.valueOf(key), props.get(key));
String sectionLabel = (String)props.get(key);
final int i = sectionLabel.indexOf("<sub>");
if (i != -1)
sectionLabel = sectionLabel.substring(0, i);
applicationModel.getProperties().put(String.valueOf(key), sectionLabel);
}
if (immediate) {
applicationModel.getProperties().put(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value(), StatoDomanda.CONFERMATA.getValue());
Expand Down Expand Up @@ -2245,6 +2259,20 @@ public String extractionApplication(Session session, List<String> ids, String ty
JCONONPropertyIds.CALL_ELENCO_ASPECTS_ULTERIORI_DATI
)
);
headPropertyDefinition.addAll(
createHeadApplicationAll(
session,
callObject,
JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_4
)
);
headPropertyDefinition.addAll(
createHeadApplicationAll(
session,
callObject,
JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_5
)
);
Stream<String> concat = headCSVApplicationIstruttoria.stream();
if (Optional.ofNullable(siperService).isPresent()) {
concat = Stream.concat(
Expand Down Expand Up @@ -2360,6 +2388,20 @@ public String extractionApplication(Session session, List<String> ids, String ty
JCONONPropertyIds.CALL_ELENCO_ASPECTS_ULTERIORI_DATI
)
);
headPropertyDefinition.addAll(
createHeadApplicationAll(
session,
callObject,
JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_4
)
);
headPropertyDefinition.addAll(
createHeadApplicationAll(
session,
callObject,
JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_5
)
);
Stream<String> concat = headCSVApplicationIstruttoria.stream();
if (Optional.ofNullable(siperService).isPresent()) {
concat = Stream.concat(
Expand Down Expand Up @@ -3442,7 +3484,7 @@ public JasperCompileManager jasperCompileManager() {
}

protected enum Dichiarazioni {
dichiarazioni, datiCNR, ulterioriDati
dichiarazioni, datiCNR, ulterioriDati,sezione4,sezione5
}

class CacheAwareJasperReportsContext implements JasperReportsContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,8 @@ protected Folder createInitialFolder(CMISUser loginUser, Map<String, Object> mod
secondaryTypes.addAll(call.getProperty(JCONONPropertyIds.CALL_ELENCO_ASPECTS.value()).getValues());
secondaryTypes.addAll(call.getProperty(JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_CNR.value()).getValues());
secondaryTypes.addAll(call.getProperty(JCONONPropertyIds.CALL_ELENCO_ASPECTS_ULTERIORI_DATI.value()).getValues());
secondaryTypes.addAll(call.getProperty(JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_4.value()).getValues());
secondaryTypes.addAll(call.getProperty(JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_5.value()).getValues());
properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);

manageApplicationPermission(folder, loginUser.getId());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package it.cnr.si.cool.jconon.service.application;

import it.cnr.cool.web.scripts.exception.ClientMessageException;
import org.apache.chemistry.opencmis.client.api.Folder;
import org.springframework.stereotype.Service;

import java.util.Optional;
import java.util.stream.IntStream;

@Service
public class PosizionamentoRicercatoreService implements ApplicationValidateSend{
@Override
public void validate(Folder call, Folder application) {
if (application.getSecondaryTypes()
.stream()
.filter(secondaryType -> secondaryType.getId().equalsIgnoreCase("P:jconon_application:aspect_posizionamento_ricercatore"))
.findAny().isPresent()) {
final Integer sum = IntStream.range(1, 4)
.map(i -> applicationValue(application, "jconon_application:posizionamento_ricercatore_" + i))
.reduce(0, (a, b) -> a + b);
if (sum != 100) {
throw new ClientMessageException("Il totale delle percentuali attribuite [" + sum + "%] deve essere necessariamente il 100%!");
}
}
}

private Integer applicationValue(Folder application, String property) {
return Optional.ofNullable(application.<String>getPropertyValue(property))
.map(s -> s.substring(0, s.length() -1))
.map(s -> Integer.valueOf(s))
.orElse(0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package it.cnr.si.cool.jconon.service.application;

import it.cnr.cool.web.scripts.exception.ClientMessageException;
import org.apache.chemistry.opencmis.client.api.Folder;
import org.springframework.stereotype.Service;

import java.util.Optional;
import java.util.stream.IntStream;

@Service
public class PosizionamentoTecnologoService implements ApplicationValidateSend{
@Override
public void validate(Folder call, Folder application) {
if (application.getSecondaryTypes()
.stream()
.filter(secondaryType -> secondaryType.getId().equalsIgnoreCase("P:jconon_application:aspect_posizionamento_tecnologo"))
.findAny().isPresent()) {
final Integer sum = IntStream.range(1, 11)
.map(i -> applicationValue(application, "jconon_application:posizionamento_tecnologo_" + i))
.reduce(0, (a, b) -> a + b);
if (sum != 100) {
throw new ClientMessageException("Il totale delle percentuali attribuite [" + sum + "%] deve essere necessariamente il 100%!");
}
}
}

private Integer applicationValue(Folder application, String property) {
return Optional.ofNullable(application.<String>getPropertyValue(property))
.map(s -> s.substring(0, s.length() -1))
.map(s -> Integer.valueOf(s))
.orElse(0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,22 @@ public Folder publish(Session cmisSession, BindingSession currentBindingSession,
.map(List::isEmpty).orElse(Boolean.TRUE)) {
throw new ClientMessageException("message.error.call.incomplete.section.affix_tabUlterioriDati");
}
if (publish && call.<List<String>>getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONI_DOMANDA.value())
.stream()
.filter(s -> s.equalsIgnoreCase("affix_tabSezione4"))
.findAny().isPresent() &&
Optional.ofNullable(call.<List<String>>getPropertyValue(JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_4.value()))
.map(List::isEmpty).orElse(Boolean.TRUE)) {
throw new ClientMessageException("message.error.call.incomplete.section.affix_tabSezione4");
}
if (publish && call.<List<String>>getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONI_DOMANDA.value())
.stream()
.filter(s -> s.equalsIgnoreCase("affix_tabSezione5"))
.findAny().isPresent() &&
Optional.ofNullable(call.<List<String>>getPropertyValue(JCONONPropertyIds.CALL_ELENCO_ASPECTS_SEZIONE_5.value()))
.map(List::isEmpty).orElse(Boolean.TRUE)) {
throw new ClientMessageException("message.error.call.incomplete.section.affix_tabSezione5");
}
if (publish && call.<List<String>>getPropertyValue(JCONONPropertyIds.CALL_ELENCO_SEZIONI_DOMANDA.value())
.stream()
.filter(s -> s.equalsIgnoreCase("affix_tabDatiCNR"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ application:
documents:
notrequired: D:jconon_allegato_generico:attachment_mono,D:jconon_programma_di_mandato:attachment
send:
validate-bean: contributoAttivitaService
validate-bean: contributoAttivitaService,posizionamentoRicercatoreService,posizionamentoTecnoogoService
contributo-attivita:
max-length: 20000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
<form name="affix_tabTitoli"/>
<form name="affix_tabDatiCNR"/>
<form name="affix_tabUlterioriDati"/>
<form name="affix_tabSezione4"/>
<form name="affix_tabSezione5"/>
<form name="affix_tabDichiarazioni"/>
<form name="affix_tabReperibilita">
<formFieldProperty name="copyFromTabResidenza"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ affix_tabProdottiScelti=C) Prodotti scelti
affix_tabSchedaAnonima=Scheda Anonima Sintetica
affix_tabDatiCNR=Dati CNR
affix_tabUlterioriDati=Dati Preselezione
affix_tabSezione4=Dati Sezione 4
affix_tabSezione5=Dati Sezione 5

label.print.dic.sost=Stampa Modulo Dichiarazioni Sostitutive da firmare e allegare
label.print.trattamento.dati.personali=Stampa Modulo Trattamento Dati Personali da firmare e allegare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@
<field name="affix_tabSchedaAnonima" class="java.lang.String"/>
<field name="affix_tabDatiCNR" class="java.lang.String"/>
<field name="affix_tabUlterioriDati" class="java.lang.String"/>
<field name="affix_tabSezione4" class="java.lang.String"/>
<field name="affix_tabSezione5" class="java.lang.String"/>
<title>
<band height="80">
<image scaleImage="FillFrame">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<parameter name="prodottiScelti" class="java.lang.String" isForPrompting="false"/>
<parameter name="datiCNR" class="java.lang.String" isForPrompting="false"/>
<parameter name="ulterioriDati" class="java.lang.String" isForPrompting="false"/>
<parameter name="sezione4" class="java.lang.String" isForPrompting="false"/>
<parameter name="sezione5" class="java.lang.String" isForPrompting="false"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
</parameter>
Expand Down Expand Up @@ -267,6 +269,8 @@
<field name="affix_tabSchedaAnonima" class="java.lang.String"/>
<field name="affix_tabDatiCNR" class="java.lang.String"/>
<field name="affix_tabUlterioriDati" class="java.lang.String"/>
<field name="affix_tabSezione4" class="java.lang.String"/>
<field name="affix_tabSezione5" class="java.lang.String"/>
<background>
<band height="786">
<printWhenExpression><![CDATA[$F{jconon_application:stato_domanda}.equals("P")]]></printWhenExpression>
Expand Down Expand Up @@ -638,6 +642,42 @@ new SimpleDateFormat("dd/MM/yyyy").format(new SimpleDateFormat("yyyy-MM-dd'T'HH:
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "DomandaConcorso_dichiarazioni.jrxml"]]></subreportExpression>
</subreport>
</band>
<band height="43">
<printWhenExpression><![CDATA[$F{jconon_call:elenco_sezioni_domanda}.contains("affix_tabSezione4")]]></printWhenExpression>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="FONT_Bold" mode="Opaque" x="0" y="0" width="515" height="20" forecolor="#000000" backcolor="#CCCCCC" uuid="017d49dc-db37-4094-ac37-17bb3cdb5670"/>
<textElement verticalAlignment="Middle" markup="html">
<font isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{affix_tabSezione4}.toUpperCase()]]></textFieldExpression>
</textField>
<subreport>
<reportElement stretchType="RelativeToTallestObject" x="0" y="22" width="515" height="20" uuid="f63c2d11-a7f4-4005-84bf-95f20d756976"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("sezione4")]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "DomandaConcorso_dichiarazioni.jrxml"]]></subreportExpression>
</subreport>
</band>
<band height="43">
<printWhenExpression><![CDATA[$F{jconon_call:elenco_sezioni_domanda}.contains("affix_tabSezione5")]]></printWhenExpression>
<textField textAdjust="StretchHeight" isBlankWhenNull="true">
<reportElement style="FONT_Bold" mode="Opaque" x="0" y="0" width="515" height="20" forecolor="#000000" backcolor="#CCCCCC" uuid="017d49dc-db37-4094-ac37-17bb3cdb5670"/>
<textElement verticalAlignment="Middle" markup="html">
<font isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{affix_tabSezione5}.toUpperCase()]]></textFieldExpression>
</textField>
<subreport>
<reportElement stretchType="RelativeToTallestObject" x="0" y="22" width="515" height="20" uuid="f63c2d11-a7f4-4005-84bf-95f20d756976"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("sezione5")]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "DomandaConcorso_dichiarazioni.jrxml"]]></subreportExpression>
</subreport>
</band>
<band height="30">
<printWhenExpression><![CDATA[$F{jconon_call:elenco_sezioni_domanda}.contains("affix_tabCurriculum")]]></printWhenExpression>
<subreport>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,20 @@
<mandatory>false</mandatory>
<multiple>true</multiple>
</property>
<property name="jconon_call:elenco_aspects_sezione_4">
<title>Elenco Aspect da inserire in Sezione 4</title>
<description>Inserire l'elenco degli aspect per la Sezione 4</description>
<type>d:text</type>
<mandatory>false</mandatory>
<multiple>true</multiple>
</property>
<property name="jconon_call:elenco_aspects_sezione_5">
<title>Elenco Aspect da inserire in Sezione 5</title>
<description>Inserire l'elenco degli aspect per la Sezione 4</description>
<type>d:text</type>
<mandatory>false</mandatory>
<multiple>true</multiple>
</property>
<property name="jconon_call:num_giorni_mail_sollecito">
<title>Indica il numero di giorni precedenti alla scadenza per inviare la mail di sollecito</title>
<description>Indica il numero di giorni precedenti alla scadenza per inviare la mail di sollecito
Expand Down
Loading

0 comments on commit d4f34d7

Please sign in to comment.