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=88470323af2bb86a1fccd3d29117c64a471508a5;hpb=9cfd54a608937b5373c6ac880a9874aa542bb2a1;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 8847032..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,12 +35,16 @@ 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; + String termsLoadPath = getTypologiesLoadBase() + '/' + name + ".xml"; URL termsUrl = getClass().getClassLoader().getResource(termsLoadPath); if (termsUrl == null) @@ -59,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());