mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 00:48:49 +00:00
22 lines
678 B
Java
22 lines
678 B
Java
package com.imprimelibros.erp.pdf;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@Service
|
|
public class TemplateRegistry {
|
|
private final PdfModuleConfig config;
|
|
|
|
public TemplateRegistry(PdfModuleConfig config) {
|
|
this.config = config;
|
|
}
|
|
|
|
public String resolve(DocumentType type, String templateId) {
|
|
String key = type.name() + ":" + templateId;
|
|
String keyAlt = type.name() + "_" + templateId; // compatibilidad con properties
|
|
if (config.getTemplates() == null) return null;
|
|
String value = config.getTemplates().get(key);
|
|
if (value == null) value = config.getTemplates().get(keyAlt);
|
|
return value;
|
|
}
|
|
}
|