From a856f9580b9f4b1db7d153ecfdac037453c41dab Mon Sep 17 00:00:00 2001 From: Brian Long Date: Thu, 16 Nov 2023 13:39:58 -0500 Subject: [PATCH] changed template naming --- pom.xml | 2 +- .../aps/modeling/goal/DownloadTemplateGoal.java | 8 ++++---- .../aps/modeling/goal/UploadTemplateGoal.java | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 2131626..85e4222 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ com.inteligr8.alfresco aps-public-rest-api - 2.0.16 + 2.0.17 com.inteligr8.alfresco diff --git a/src/main/java/com/inteligr8/maven/aps/modeling/goal/DownloadTemplateGoal.java b/src/main/java/com/inteligr8/maven/aps/modeling/goal/DownloadTemplateGoal.java index 54bd705..a7407f3 100644 --- a/src/main/java/com/inteligr8/maven/aps/modeling/goal/DownloadTemplateGoal.java +++ b/src/main/java/com/inteligr8/maven/aps/modeling/goal/DownloadTemplateGoal.java @@ -71,7 +71,7 @@ public class DownloadTemplateGoal extends ApsTemplateAddressibleGoal { for (Entry template : templates.get(ttype).entrySet()) { switch (ttype) { case Document: - File dfilebin = new File(this.templateDirectory, template.getValue().getId() + ".doc-template.docx"); + File dfilebin = new File(this.templateDirectory, template.getValue().getName()); Response response = this.getApsApi().getTemplatesApi().getDocumentTemplate( template.getValue().getId(), @@ -93,7 +93,7 @@ public class DownloadTemplateGoal extends ApsTemplateAddressibleGoal { } ObjectNode djson = ModelUtil.getInstance().readPojo(template.getValue()); - File dfile = new File(this.templateDirectory, template.getValue().getId() + ".doc-template.json"); + File dfile = new File(this.templateDirectory, template.getValue().getName() + ".dt.json"); ModelUtil.getInstance().writeJson(djson, dfile, this.diffFriendly); if (this.normalize) new ApsTemplateJsonNormalizer(this.diffFriendly).normalizeFile(dfile, null); @@ -102,7 +102,7 @@ public class DownloadTemplateGoal extends ApsTemplateAddressibleGoal { case CustomEmail: EmailTemplate etemplate = this.getApsApi().getTemplatesApi().getCustomEmailTemplate(template.getValue().getId(), tenantId); ObjectNode ejson = ModelUtil.getInstance().readPojo(etemplate); - File efile = new File(this.templateDirectory, template.getValue().getId() + ".custom-email-template.json"); + File efile = new File(this.templateDirectory, template.getValue().getName() + ".cet.json"); ModelUtil.getInstance().writeJson(ejson, efile, this.diffFriendly); if (this.normalize) new ApsTemplateJsonNormalizer(this.diffFriendly).normalizeFile(efile, null); @@ -111,7 +111,7 @@ public class DownloadTemplateGoal extends ApsTemplateAddressibleGoal { case SystemEmail: EmailTemplate stemplate = this.getApsApi().getTemplatesApi().getSystemEmailTemplate(template.getValue().getName(), tenantId); ObjectNode sjson = ModelUtil.getInstance().readPojo(stemplate); - File sfile = new File(this.templateDirectory, template.getValue().getName() + ".system-email-template.json"); + File sfile = new File(this.templateDirectory, template.getValue().getName() + ".set.json"); ModelUtil.getInstance().writeJson(sjson, sfile, this.diffFriendly); if (this.normalize) new ApsTemplateJsonNormalizer(this.diffFriendly).normalizeFile(sfile, null); diff --git a/src/main/java/com/inteligr8/maven/aps/modeling/goal/UploadTemplateGoal.java b/src/main/java/com/inteligr8/maven/aps/modeling/goal/UploadTemplateGoal.java index 1e5511f..c77516f 100644 --- a/src/main/java/com/inteligr8/maven/aps/modeling/goal/UploadTemplateGoal.java +++ b/src/main/java/com/inteligr8/maven/aps/modeling/goal/UploadTemplateGoal.java @@ -73,7 +73,7 @@ public class UploadTemplateGoal extends ApsAddressibleGoal { } try { - if (file.getName().endsWith(".doc-template.json")) { + if (file.getName().endsWith(".dt.json")) { DocumentTemplateLight template = ModelUtil.getInstance().writePojo(ModelUtil.getInstance().readJsonAsMap(file), DocumentTemplateLight.class); if (!this.alwaysOverwrite && template.getId() != null && template.getCreated() != null) { DocumentTemplateLight serverSideTemplate = this.getApsApi().getTemplatesApi().getDocumentTemplate(template.getId()); @@ -83,14 +83,14 @@ public class UploadTemplateGoal extends ApsAddressibleGoal { } } - File docxfile = new File(file.getParent(), file.getName().substring(0, file.getName().length() - ".json".length()) + ".docx"); - if (!docxfile.exists()) - throw new FileNotFoundException("The file, '" + docxfile.getName() + "' was expected and not found"); + File dfile = new File(file.getParent(), file.getName().substring(0, file.getName().length() - ".dt.json".length())); + if (!dfile.exists()) + throw new FileNotFoundException("The file, '" + dfile.getName() + "' was expected and not found"); - FileInputStream fistream = new FileInputStream(docxfile); + FileInputStream fistream = new FileInputStream(dfile); BufferedInputStream bistream = new BufferedInputStream(fistream, this.bufferSize); try { - FileMultipartJersey multipart = FileMultipartJersey.from(docxfile.getName(), bistream); + FileMultipartJersey multipart = FileMultipartJersey.from(dfile.getName(), bistream); if (template.getId() == null) { if (this.dryRun) { this.getLog().info("[DRYRUN]: Creating document template: " + template.getName()); @@ -110,7 +110,7 @@ public class UploadTemplateGoal extends ApsAddressibleGoal { bistream.close(); fistream.close(); } - } else if (file.getName().endsWith(".custom-email-template.json")) { + } else if (file.getName().endsWith(".cet.json")) { EmailTemplate template = ModelUtil.getInstance().writePojo(ModelUtil.getInstance().readJsonAsMap(file), EmailTemplate.class); if (!this.alwaysOverwrite && template.getId() != null && template.getCreated() != null) { EmailTemplate serverSideTemplate = this.getApsApi().getTemplatesApi().getCustomEmailTemplate(template.getId(), tenantId); @@ -135,7 +135,7 @@ public class UploadTemplateGoal extends ApsAddressibleGoal { this.getApsApi().getTemplatesJerseyApi().updateCustomEmailTemplate(template.getId(), template); } } - } else if (file.getName().endsWith(".system-email-template.json")) { + } else if (file.getName().endsWith(".set.json")) { EmailTemplate template = ModelUtil.getInstance().writePojo(ModelUtil.getInstance().readJsonAsMap(file), EmailTemplate.class); if (!this.alwaysOverwrite) { EmailTemplate serverSideTemplate = this.getApsApi().getTemplatesApi().getSystemEmailTemplate(template.getName(), tenantId);