From f821f7faa537de2c97b9c684013470e507a41f3e Mon Sep 17 00:00:00 2001 From: Dominik Przybyl Date: Mon, 30 Oct 2023 12:34:13 +0100 Subject: [PATCH 1/3] fixed large history log issue --- .../apm/core/history/HistoryEntryImpl.java | 49 ++++++++++++++----- .../apm/core/history/HistoryEntryWriter.java | 28 ++++++++++- .../apm/core/history/HistoryImpl.java | 13 ++--- .../services/version/ScriptVersionModel.java | 14 ++++-- .../services/version/VersionServiceImpl.java | 6 +-- 5 files changed, 80 insertions(+), 30 deletions(-) diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryImpl.java b/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryImpl.java index b4de975b..f6ae51e2 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryImpl.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryImpl.java @@ -22,34 +22,54 @@ import com.cognifide.apm.core.logger.ProgressEntry; import com.cognifide.apm.core.progress.ProgressHelper; import com.cognifide.apm.core.utils.CalendarUtils; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.Calendar; import java.util.Date; import java.util.List; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; +import org.apache.commons.io.IOUtils; import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.Default; import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.Model; +import org.apache.sling.models.annotations.injectorspecific.Self; @Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) public class HistoryEntryImpl implements HistoryEntry { public static final String AUTHOR = "author"; + public static final String EXECUTION_TIME = "executionTime"; + public static final String EXECUTION_DURATION = "executionDuration"; + public static final String EXECUTOR = "executor"; + public static final String SCRIPT_PATH = "scriptPath"; + public static final String SCRIPT_NAME = "scriptName"; + public static final String IS_RUN_SUCCESSFUL = "isRunSuccessful"; + public static final String MODE = "mode"; + public static final String CHECKSUM = "checksum"; + public static final String PROGRESS_LOG = "summaryJSON"; + public static final String UPLOAD_TIME = "uploadTime"; + public static final String SCRIPT_CONTENT_PATH = "scriptContentPath"; + public static final String INSTANCE_NAME = "instanceName"; + @Self + private Resource resource; + @Inject @Named(AUTHOR) private String author; @@ -91,8 +111,6 @@ public class HistoryEntryImpl implements HistoryEntry { @Named(UPLOAD_TIME) private Date uploadTime; - @Inject - @Named(PROGRESS_LOG) private String executionSummaryJson; @Inject @@ -103,25 +121,22 @@ public class HistoryEntryImpl implements HistoryEntry { @Named(INSTANCE_NAME) private String instanceName; - private final String path; + private String path; private Calendar executionTimeCalendar; private List executionSummary; - public HistoryEntryImpl(Resource resource) { - this.path = resource.getPath(); - } - public List getExecutionSummary() { - if (this.executionSummary == null) { - this.executionSummary = ProgressHelper.fromJson(getExecutionSummaryJson()); + if (executionSummary == null) { + executionSummary = ProgressHelper.fromJson(getExecutionSummaryJson()); } - return this.executionSummary; + return executionSummary; } @PostConstruct private void afterCreated() { + path = resource.getPath(); executionTimeCalendar = CalendarUtils.asCalendar(executionTime); } @@ -166,6 +181,18 @@ public Date getUploadTime() { } public String getExecutionSummaryJson() { + if (executionSummaryJson == null) { + Object progressLog = resource.getValueMap().get(PROGRESS_LOG); + if (progressLog instanceof InputStream) { + try { + executionSummaryJson = IOUtils.toString((InputStream) progressLog, StandardCharsets.UTF_8); + } catch (IOException e) { + executionSummaryJson = "[]"; + } + } else { + executionSummaryJson = (String) progressLog; + } + } return executionSummaryJson; } @@ -184,4 +211,4 @@ public String getPath() { public Calendar getExecutionTimeCalendar() { return executionTimeCalendar; } -} \ No newline at end of file +} diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryWriter.java b/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryWriter.java index 36f1aa06..34f7047a 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryWriter.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryEntryWriter.java @@ -20,21 +20,34 @@ package com.cognifide.apm.core.history; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.Calendar; +import org.apache.commons.io.IOUtils; import org.apache.sling.api.resource.ModifiableValueMap; import org.apache.sling.api.resource.Resource; public final class HistoryEntryWriter { private final String author; + private final Calendar executionTime; + private final String executor; + private final long executionDuration; + private final String fileName; + private final String filePath; + private final Boolean isRunSuccessful; + private final String mode; + private final String progressLog; + private final String instanceName; private HistoryEntryWriter(String author, Calendar executionTime, String executor, long executionDuration, String fileName, String filePath, Boolean isRunSuccessful, String mode, String progressLog, String instanceName) { @@ -54,13 +67,15 @@ public static HistoryEntryWriterBuilder builder() { return new HistoryEntryWriterBuilder(); } - public void writeTo(Resource historyLogResource) { + public void writeTo(Resource historyLogResource) throws IOException { ModifiableValueMap valueMap = historyLogResource.adaptTo(ModifiableValueMap.class); valueMap.put(HistoryEntryImpl.SCRIPT_NAME, fileName); valueMap.put(HistoryEntryImpl.SCRIPT_PATH, filePath); valueMap.put(HistoryEntryImpl.AUTHOR, author); valueMap.put(HistoryEntryImpl.MODE, mode); - valueMap.put(HistoryEntryImpl.PROGRESS_LOG, progressLog); + try (InputStream progressLogInput = IOUtils.toInputStream(progressLog, StandardCharsets.UTF_8)) { + valueMap.put(HistoryEntryImpl.PROGRESS_LOG, progressLogInput); + } valueMap.put(HistoryEntryImpl.IS_RUN_SUCCESSFUL, isRunSuccessful); valueMap.put(HistoryEntryImpl.EXECUTION_TIME, executionTime); valueMap.put(HistoryEntryImpl.EXECUTION_DURATION, executionDuration); @@ -71,14 +86,23 @@ public void writeTo(Resource historyLogResource) { public static class HistoryEntryWriterBuilder { private String author; + private Calendar executionTime; + private String executor; + private long executionDuration; + private String fileName; + private String filePath; + private Boolean isRunSuccessful; + private String mode; + private String progressLog; + private String instanceName; private HistoryEntryWriterBuilder() { diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryImpl.java b/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryImpl.java index 586e0438..c29ea96b 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryImpl.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/history/HistoryImpl.java @@ -29,6 +29,7 @@ import com.cognifide.apm.core.services.version.VersionService; import com.cognifide.apm.core.utils.sling.SlingHelper; import com.day.cq.commons.jcr.JcrConstants; +import java.io.IOException; import java.lang.management.ManagementFactory; import java.util.Calendar; import java.util.LinkedList; @@ -40,7 +41,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.jackrabbit.commons.JcrUtils; import org.apache.sling.api.resource.AbstractResourceVisitor; -import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ValueMap; @@ -164,18 +164,16 @@ private HistoryEntry createHistoryEntry(ResourceResolver resolver, Script script session.save(); resolver.commit(); return resolver.getResource(historyEntryNode.getPath()).adaptTo(HistoryEntryImpl.class); - } catch (PersistenceException | RepositoryException e) { + } catch (IOException | RepositoryException e) { LOG.error("Issues with saving to repository while logging script execution", e); return null; } } - private Resource writeProperties(ResourceResolver resolver, Node historyEntry, HistoryEntryWriter - historyEntryWriter) - throws RepositoryException { + private void writeProperties(ResourceResolver resolver, Node historyEntry, HistoryEntryWriter historyEntryWriter) + throws RepositoryException, IOException { Resource entryResource = resolver.getResource(historyEntry.getPath()); historyEntryWriter.writeTo(entryResource); - return entryResource; } private Node createHistoryEntryNode(Node scriptHistoryNode, Script script, ExecutionMode mode) @@ -204,5 +202,4 @@ private String getModeName(ExecutionMode mode) { private String getScriptHistoryPath(Script script) { return HISTORY_FOLDER + "/" + script.getPath().replace("/", "_").substring(1); } - -} \ No newline at end of file +} diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java b/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java index 26b80071..a490126a 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java @@ -26,14 +26,18 @@ @Model(adaptables = Resource.class) public class ScriptVersionModel implements ScriptVersion { - private final String scriptPath; - - private final String lastChecksum; + @Inject + private String scriptPath; @Inject - public ScriptVersionModel(String scriptPath, String lastChecksum) { + private String lastChecksum; + + public ScriptVersionModel() { + // intentionally empty + } + + public ScriptVersionModel(String scriptPath) { this.scriptPath = scriptPath; - this.lastChecksum = lastChecksum; } @Override diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/VersionServiceImpl.java b/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/VersionServiceImpl.java index 920182c6..4b1bf3dc 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/VersionServiceImpl.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/VersionServiceImpl.java @@ -67,7 +67,7 @@ public ScriptVersion getScriptVersion(ResourceResolver resolver, Script script) String scriptVersionPath = getScriptVersionPath(script); return Optional.ofNullable(resolver.getResource(scriptVersionPath)) .map(resource -> resource.adaptTo(ScriptVersionModel.class)) - .orElse(new ScriptVersionModel(script.getPath(), null)); + .orElse(new ScriptVersionModel(script.getPath())); } @Override @@ -135,14 +135,12 @@ private Node createVersionNode(Node parent, Script script, Session session) thro return JcrUtils.getOrCreateByPath(path, "sling:OrderedFolder", "sling:OrderedFolder", session, true); } - private Node copyScriptContent(Node parent, Script script, Session session) throws RepositoryException { + private void copyScriptContent(Node parent, Script script, Session session) throws RepositoryException { if (!parent.hasNode(SCRIPT_NODE_NAME)) { Node source = session.getNode(script.getPath()); Node file = JcrUtil.copy(source, parent, SCRIPT_NODE_NAME); file.addMixin(ScriptNode.APM_SCRIPT); - return file; } - return parent.getNode(SCRIPT_NODE_NAME); } private String normalizedPath(Script script) { From f784d359c28236b3704e1e087c4c9d7b12859f5a Mon Sep 17 00:00:00 2001 From: Dominik Przybyl Date: Mon, 30 Oct 2023 14:55:22 +0100 Subject: [PATCH 2/3] reformat --- .../apm/clientlibs/externals/ace/.content.xml | 3 +- .../clientlibs/views/dashboard/.content.xml | 3 +- .../apm/clientlibs/views/history/.content.xml | 3 +- .../clientlibs/views/moveItem/.content.xml | 4 +- .../apm/clientlibs/views/scripts/.content.xml | 3 +- .../apm/fragments/scriptLauncher/.content.xml | 121 ++++++------ .../apps/apm/views/dashboard/.content.xml | 2 +- .../apps/apm/views/editor/.content.xml | 6 +- .../apps/apm/views/history/.content.xml | 13 +- .../jcr_root/apps/apm/views/move/.content.xml | 178 +++++++++--------- .../apps/apm/views/references/.content.xml | 7 +- .../apps/apm/views/scripts/.content.xml | 2 +- .../apps/apm/views/summary/.content.xml | 2 +- .../apps/apm/views/viewer/.content.xml | 6 +- .../main/content/META-INF/vault/config.xml | 132 ++++++------- .../main/content/META-INF/vault/filter.xml | 2 +- .../main/content/META-INF/vault/filter.xml | 2 +- .../main/content/META-INF/vault/filter.xml | 2 +- .../main/content/META-INF/vault/filter.xml | 4 +- .../src/main/content/jcr_root/_rep_policy.xml | 8 +- .../main/content/META-INF/vault/filter.xml | 2 +- gradle/META-INF/vault/definition/.content.xml | 11 +- 22 files changed, 266 insertions(+), 250 deletions(-) diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/externals/ace/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/externals/ace/.content.xml index 864ef200..6ad4d51d 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/externals/ace/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/externals/ace/.content.xml @@ -19,7 +19,8 @@ ~ =========================LICENSE_END================================== --> - diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/dashboard/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/dashboard/.content.xml index 77632433..af2333ff 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/dashboard/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/dashboard/.content.xml @@ -19,7 +19,8 @@ ~ =========================LICENSE_END================================== --> - diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/history/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/history/.content.xml index c2cf9e3a..86eaa2b0 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/history/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/history/.content.xml @@ -1,5 +1,6 @@ - diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/moveItem/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/moveItem/.content.xml index 28436967..35a32c72 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/moveItem/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/moveItem/.content.xml @@ -1,4 +1,4 @@ + jcr:primaryType="cq:ClientLibraryFolder" + categories="[apm-move-item]"/> diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/scripts/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/scripts/.content.xml index 4c44c653..9e34b997 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/scripts/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/clientlibs/views/scripts/.content.xml @@ -1,5 +1,6 @@ - diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/fragments/scriptLauncher/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/fragments/scriptLauncher/.content.xml index 2b145c57..c04de2e8 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/fragments/scriptLauncher/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/fragments/scriptLauncher/.content.xml @@ -1,63 +1,62 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/dashboard/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/dashboard/.content.xml index 05a0baad..b91038c6 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/dashboard/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/dashboard/.content.xml @@ -75,4 +75,4 @@ - \ No newline at end of file + diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/editor/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/editor/.content.xml index 9578354b..17c535c8 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/editor/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/editor/.content.xml @@ -1,7 +1,7 @@ - + - \ No newline at end of file + diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/move/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/move/.content.xml index 2af915df..f9c42bfe 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/move/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/move/.content.xml @@ -1,92 +1,94 @@ - - + + + - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ validation="{Boolean}false"> + + + + + + + + + + + +
diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/references/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/references/.content.xml index 4ec4e7b6..9911b1b7 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/references/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/references/.content.xml @@ -1,7 +1,6 @@ - - \ No newline at end of file +
diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/scripts/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/scripts/.content.xml index fda2271c..382c37b7 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/scripts/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/scripts/.content.xml @@ -271,4 +271,4 @@ -
\ No newline at end of file +
diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/summary/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/summary/.content.xml index 2d3e967c..a06f4918 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/summary/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/summary/.content.xml @@ -41,4 +41,4 @@ - \ No newline at end of file + diff --git a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/viewer/.content.xml b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/viewer/.content.xml index c1059a88..4790c079 100644 --- a/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/viewer/.content.xml +++ b/app/aem/ui.apps.base/src/main/content/jcr_root/apps/apm/views/viewer/.content.xml @@ -1,7 +1,7 @@ - + + - - - + - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - + + - - - - - - - - - + + + + + + + + + + + + + - + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/app/aem/ui.apps.cloud/src/main/content/META-INF/vault/filter.xml b/app/aem/ui.apps.cloud/src/main/content/META-INF/vault/filter.xml index 0bc624b6..74c95445 100644 --- a/app/aem/ui.apps.cloud/src/main/content/META-INF/vault/filter.xml +++ b/app/aem/ui.apps.cloud/src/main/content/META-INF/vault/filter.xml @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/app/aem/ui.apps/src/main/content/META-INF/vault/filter.xml b/app/aem/ui.apps/src/main/content/META-INF/vault/filter.xml index 0bc624b6..74c95445 100644 --- a/app/aem/ui.apps/src/main/content/META-INF/vault/filter.xml +++ b/app/aem/ui.apps/src/main/content/META-INF/vault/filter.xml @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/app/aem/ui.content/src/main/content/META-INF/vault/filter.xml b/app/aem/ui.content/src/main/content/META-INF/vault/filter.xml index 6441a599..354c74d9 100644 --- a/app/aem/ui.content/src/main/content/META-INF/vault/filter.xml +++ b/app/aem/ui.content/src/main/content/META-INF/vault/filter.xml @@ -1,4 +1,4 @@ - + diff --git a/app/aem/ui.system.user/src/main/content/META-INF/vault/filter.xml b/app/aem/ui.system.user/src/main/content/META-INF/vault/filter.xml index cbe94d5f..03ab9bec 100644 --- a/app/aem/ui.system.user/src/main/content/META-INF/vault/filter.xml +++ b/app/aem/ui.system.user/src/main/content/META-INF/vault/filter.xml @@ -1,5 +1,5 @@ - - + + diff --git a/app/aem/ui.system.user/src/main/content/jcr_root/_rep_policy.xml b/app/aem/ui.system.user/src/main/content/jcr_root/_rep_policy.xml index 7e10adc2..6be5ce94 100644 --- a/app/aem/ui.system.user/src/main/content/jcr_root/_rep_policy.xml +++ b/app/aem/ui.system.user/src/main/content/jcr_root/_rep_policy.xml @@ -1,7 +1,7 @@ - + diff --git a/examples/src/main/content/META-INF/vault/filter.xml b/examples/src/main/content/META-INF/vault/filter.xml index 860e74ed..1fc69e3d 100644 --- a/examples/src/main/content/META-INF/vault/filter.xml +++ b/examples/src/main/content/META-INF/vault/filter.xml @@ -1,4 +1,4 @@ - \ No newline at end of file + diff --git a/gradle/META-INF/vault/definition/.content.xml b/gradle/META-INF/vault/definition/.content.xml index 5aa45019..d1a71bc8 100644 --- a/gradle/META-INF/vault/definition/.content.xml +++ b/gradle/META-INF/vault/definition/.content.xml @@ -1,7 +1,8 @@ - + From d2822178a04846636bb5c9803d160ceacd663bf9 Mon Sep 17 00:00:00 2001 From: Dominik Przybyl Date: Mon, 30 Oct 2023 20:59:18 +0100 Subject: [PATCH 3/3] fixed large history log issue --- .../java/com/cognifide/apm/core/scripts/ScriptModel.java | 7 ++----- .../apm/core/services/version/ScriptVersionModel.java | 3 ++- .../cognifide/apm/core/ui/models/DashboardTileModel.java | 3 ++- .../com/cognifide/apm/core/ui/models/ScriptsRowModel.java | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptModel.java b/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptModel.java index 745d831c..85999475 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptModel.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptModel.java @@ -61,7 +61,7 @@ public class ScriptModel implements MutableScript { private static final Logger LOGGER = LoggerFactory.getLogger(ScriptModel.class); - private final String path; + private String path; @Self private Resource resource; @@ -120,12 +120,9 @@ public class ScriptModel implements MutableScript { private String data; - public ScriptModel(Resource resource) { - this.path = resource.getPath(); - } - @PostConstruct private void afterCreated() { + path = resource.getPath(); if (verified == null) { try { scriptManager.process(this, ExecutionMode.VALIDATION, resource.getResourceResolver()); diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java b/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java index a490126a..b9af76e9 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/services/version/ScriptVersionModel.java @@ -21,9 +21,10 @@ import javax.inject.Inject; import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.Model; -@Model(adaptables = Resource.class) +@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) public class ScriptVersionModel implements ScriptVersion { @Inject diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/DashboardTileModel.java b/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/DashboardTileModel.java index adfc0af3..e1d8a19f 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/DashboardTileModel.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/DashboardTileModel.java @@ -21,9 +21,10 @@ import javax.inject.Inject; import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.Model; -@Model(adaptables = Resource.class) +@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) public final class DashboardTileModel { @Inject diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java b/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java index 7ad59e0a..8497e878 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/ui/models/ScriptsRowModel.java @@ -42,10 +42,11 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.sling.api.resource.Resource; +import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.Model; import org.apache.sling.models.annotations.injectorspecific.Self; -@Model(adaptables = Resource.class) +@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) public final class ScriptsRowModel { private static final Set FOLDER_TYPES = ImmutableSet