Skip to content

Commit

Permalink
parametres assistance
Browse files Browse the repository at this point in the history
  • Loading branch information
khergalant committed Jul 10, 2024
1 parent 2ad9844 commit 1a479e3
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 126 deletions.
3 changes: 2 additions & 1 deletion configuration/application.sample.properties
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ limesurvey.v3 = true
# ClamAV
clamAV.ip = 127.0.0.1
clamAV.port = 3310
clamAV.timeout = 1000# En millisecondes. Doc ClamAV : timeout zero means infinite timeout. Not a good idea, but will be accepted. Par défaut 500ms
# En millisecondes. Doc ClamAV : timeout zero means infinite timeout. Not a good idea, but will be accepted. Par défaut 500ms
clamAV.timeout = 1000

# Encodage des champs de saisie.
# - Encodage par défaut : UTF-8 (Ne pas renseigner ce paramètre si vous souhaitez rester en UTF-8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class BatchController {
@Resource
private transient DateTimeFormatter formatterDateTime;

@Value("${batch.fixedRate}")
@Value("${batch.fixedRate:5000}")
private transient String batchFixedRate;

/** @return liste des batchs */
Expand Down Expand Up @@ -265,7 +265,7 @@ public void cancelRunImmediatly(final Batch batch) {
}

/** Vérifie si un batch doit etre lancé depuis la dernière date de verification */
@Scheduled(fixedDelayString = "${batch.fixedRate}")
@Scheduled(fixedDelayString = "${batch.fixedRate:5000}")
public void checkBatchRun() {
if (!loadBalancingController.isLoadBalancingCandidatMode()) {
final List<BatchRun> liste = batchRunRepository.findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ public class ConfigController {
@Value("${pegase.etablissement:}")
private transient String etablissement;

@Value("${assistance.documentation.url.candidat:}")
private transient String assistDocUrlCand;

@Value("${assistance.documentation.url.candidat.en:}")
private transient String assistDocUrlCandEn;

@Value("${assistance.documentation.url:}")
private transient String assistDocUrl;

@Value("${assistance.helpdesk.url:}")
private transient String assistHelpdeskUrl;

@Value("${assistance.contact.mail:}")
private transient String assistContactMail;

@Value("${assistance.contact.url:}")
private transient String assistContactUrl;

/**
* Permet de précharger au démarrage les caches
*/
Expand Down Expand Up @@ -304,6 +322,12 @@ public ConfigEtab loadConfigEtab() {
final ConfigEtab config = new ConfigEtab();
config.setNom(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_NOM));
config.setCnil(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_CNIL));
config.setAssistDocUrl(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL));
config.setAssistDocUrlCand(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL_CAND));
config.setAssistDocUrlCandEn(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL_CAND_EN));
config.setAssistHelpdeskUrl(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_ASSIST_HELPDESK_URL));
config.setAssistContactMail(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_ASSIST_CONTACT_MAIL));
config.setAssistContactUrl(getConfigurationByCod(list, Configuration.COD_CONFIG_ETAB_ASSIST_CONTACT_URL));
return config;
}

Expand All @@ -318,55 +342,118 @@ public List<SimpleTablePresentation> getConfigEtabPresentation() {
final ConfigEtab config = loadConfigEtab();
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_NOM, applicationContext.getMessage("config.etab.table.nom", null, UI.getCurrent().getLocale()), config.getNom()));
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_CNIL, applicationContext.getMessage("config.etab.table.cnil", null, UI.getCurrent().getLocale()), config.getCnil()));
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL, applicationContext.getMessage("config.etab.table.assistDocUrl", null, UI.getCurrent().getLocale()), config.getAssistDocUrl()));
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL_CAND, applicationContext.getMessage("config.etab.table.assistDocUrlCand", null, UI.getCurrent().getLocale()),
config.getAssistDocUrlCand()));
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL_CAND_EN, applicationContext.getMessage("config.etab.table.assistDocUrlCandEn", null, UI.getCurrent().getLocale()),
config.getAssistDocUrlCandEn()));
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_ASSIST_HELPDESK_URL, applicationContext.getMessage("config.etab.table.assistHelpdeskUrl", null, UI.getCurrent().getLocale()),
config.getAssistHelpdeskUrl()));
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_ASSIST_CONTACT_MAIL, applicationContext.getMessage("config.etab.table.assistContactMail", null, UI.getCurrent().getLocale()),
config.getAssistContactMail()));
list.add(new SimpleTablePresentation(Configuration.COD_CONFIG_ETAB_ASSIST_CONTACT_URL, applicationContext.getMessage("config.etab.table.assistContactUrl", null, UI.getCurrent().getLocale()),
config.getAssistContactUrl()));
return list;
}

/**
* Enregistre la config Pégase
* Enregistre la config de l'etablissement
* @param configPegaseUrl
*/
public void saveConfigEtab(final ConfigEtab config) {
/* Enregistrement du nom */
if (StringUtils.isBlank(config.getNom())) {
final Configuration configNom = configurationRepository.findOne(Configuration.COD_CONFIG_ETAB_NOM);
if (configNom != null) {
configurationRepository.delete(configNom);
}
} else {
configurationRepository.saveAndFlush(new Configuration(Configuration.COD_CONFIG_ETAB_NOM, config.getNom()));
}
saveConfigEtabItem(config.getNom(), Configuration.COD_CONFIG_ETAB_NOM);

/* Enregistrement mention CNIL */
if (StringUtils.isBlank(config.getCnil())) {
final Configuration configCnil = configurationRepository.findOne(Configuration.COD_CONFIG_ETAB_CNIL);
if (configCnil != null) {
configurationRepository.delete(configCnil);
}
} else {
configurationRepository.saveAndFlush(new Configuration(Configuration.COD_CONFIG_ETAB_CNIL, config.getCnil()));
}
saveConfigEtabItem(config.getCnil(), Configuration.COD_CONFIG_ETAB_CNIL);

/* Enregistrement Url assistance */
saveConfigEtabItem(config.getAssistDocUrl(), Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL);

/* Enregistrement Url assistance candidat */
saveConfigEtabItem(config.getAssistDocUrlCand(), Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL_CAND);

/* Enregistrement Url assistance candidat anglais */
saveConfigEtabItem(config.getAssistDocUrlCandEn(), Configuration.COD_CONFIG_ETAB_ASSIST_DOC_URL_CAND_EN);

/* Enregistrement Url helpdesk */
saveConfigEtabItem(config.getAssistHelpdeskUrl(), Configuration.COD_CONFIG_ETAB_ASSIST_HELPDESK_URL);

/* Enregistrement Contact Mail */
saveConfigEtabItem(config.getAssistContactMail(), Configuration.COD_CONFIG_ETAB_ASSIST_CONTACT_MAIL);

/* Enregistrement Contact Url */
saveConfigEtabItem(config.getAssistContactUrl(), Configuration.COD_CONFIG_ETAB_ASSIST_CONTACT_URL);

Notification.show(applicationContext.getMessage("config.save", null, UI.getCurrent().getLocale()), Type.TRAY_NOTIFICATION);
cacheController.invalidConfCache();
}

/**
* Enregistre un item de conf etab
* @param value
* @param code
*/
private void saveConfigEtabItem(final String value, final String code) {
if (StringUtils.isBlank(value)) {
final Configuration configValue = configurationRepository.findOne(code);
if (configValue != null) {
configurationRepository.delete(configValue);
}
} else {
configurationRepository.saveAndFlush(new Configuration(code, value));
}
}

/**
* @return la configuration Pegase
*/
@Cacheable(value = CacheConfig.CACHE_CONF_ETAB, cacheManager = CacheConfig.CACHE_MANAGER_NAME)
public ConfigEtab getConfigEtab(final Locale locale) {
final ConfigEtab config = loadConfigEtab();
/* Nom etablissement */
if (StringUtils.isBlank(config.getNom())) {
try {
config.setNom(applicationContext.getMessage("universite.title", null, locale));
} catch (final Exception e) {
}
}
/* Mention cnil page d'accueil */
if (StringUtils.isBlank(config.getCnil())) {
try {
config.setCnil(applicationContext.getMessage("cnil.mention", null, locale));
} catch (final Exception e) {
}
}
/* Page d'assistance */
if (StringUtils.isBlank(config.getAssistDocUrl())) {
config.setAssistDocUrl(assistDocUrl);
}
/* Page d'assistance candidat */
if (StringUtils.isBlank(config.getAssistDocUrlCand())) {
config.setAssistDocUrlCand(assistDocUrlCand);
}

/* Page d'assistance candidat anglais */
if (StringUtils.isBlank(config.getAssistDocUrlCandEn())) {
config.setAssistDocUrlCandEn(assistDocUrlCandEn);
}

/* Page helpdesk */
if (StringUtils.isBlank(config.getAssistHelpdeskUrl())) {
config.setAssistHelpdeskUrl(assistHelpdeskUrl);
}

/* Page contact mail */
if (StringUtils.isBlank(config.getAssistContactMail())) {
config.setAssistContactMail(assistContactMail);
}

/* Page contact url */
if (StringUtils.isBlank(config.getAssistContactUrl())) {
config.setAssistContactUrl(assistContactUrl);
}

return config;
}

Expand Down
Loading

0 comments on commit 1a479e3

Please sign in to comment.