changed template naming
This commit is contained in:
parent
0b9473465e
commit
a856f9580b
2
pom.xml
2
pom.xml
@ -51,7 +51,7 @@
|
||||
<dependency>
|
||||
<groupId>com.inteligr8.alfresco</groupId>
|
||||
<artifactId>aps-public-rest-api</artifactId>
|
||||
<version>2.0.16</version>
|
||||
<version>2.0.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.inteligr8.alfresco</groupId>
|
||||
|
@ -71,7 +71,7 @@ public class DownloadTemplateGoal extends ApsTemplateAddressibleGoal {
|
||||
for (Entry<String, ? extends BaseTemplateLight> 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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user