X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.suite.core%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fcore%2FCustomMaintenanceService.java;h=4cd05cfc92e903818e02ac2e6ff3127c795f4858;hb=41e9998f7f1c87c747c57f60c6bec65fa20757a6;hp=b6e997af2d1508380f02f047afd9526511c7959d;hpb=678186f16393cdafbd5430adbad98359179c96bd;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.suite.core/src/org/argeo/suite/core/CustomMaintenanceService.java b/org.argeo.suite.core/src/org/argeo/suite/core/CustomMaintenanceService.java index b6e997a..4cd05cf 100644 --- a/org.argeo.suite.core/src/org/argeo/suite/core/CustomMaintenanceService.java +++ b/org.argeo.suite.core/src/org/argeo/suite/core/CustomMaintenanceService.java @@ -11,15 +11,14 @@ import javax.jcr.ItemExistsException; import javax.jcr.Node; import javax.jcr.RepositoryException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.argeo.api.cms.CmsLog; import org.argeo.entity.EntityType; import org.argeo.jcr.JcrUtils; import org.argeo.maintenance.AbstractMaintenanceService; /** Base for custom initialisations. */ public abstract class CustomMaintenanceService extends AbstractMaintenanceService { - private final static Log log = LogFactory.getLog(AbstractMaintenanceService.class); + private final static CmsLog log = CmsLog.getLog(AbstractMaintenanceService.class); protected List getTypologies() { return new ArrayList<>(); @@ -36,14 +35,15 @@ public abstract class CustomMaintenanceService extends AbstractMaintenanceServic for (String terms : typologies) { loadTerms(termsBase, terms); } + // TODO do not save here, so that upper layers can decide when to save termsBase.getSession().save(); } } protected void loadTerms(Node termsBase, String name) throws IOException, RepositoryException { try { - if (termsBase.hasNode(name)) - return; +// if (termsBase.hasNode(name)) +// return; String termsLoadPath = getTypologiesLoadBase() + '/' + name + ".xml"; URL termsUrl = getClass().getClassLoader().getResource(termsLoadPath); @@ -62,6 +62,7 @@ public abstract class CustomMaintenanceService extends AbstractMaintenanceServic } if (log.isDebugEnabled()) log.debug("Terms '" + name + "' loaded."); + // TODO do not save here, so that upper layers can decide when to save termsBase.getSession().save(); } catch (RepositoryException | IOException e) { log.error("Cannot load terms '" + name + "': " + e.getMessage());