From d9a770f847fa6d88d350f870080fec6904f2e8d5 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 24 Dec 2020 10:23:14 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-44644=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E6=94=BE=20fix=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/impl/AbstractTemplateResource.java | 37 +--------------- .../file/impl/DefaultTemplateResource.java | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+), 36 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java index acf785dd46..cb76792a13 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateResource.java @@ -14,41 +14,6 @@ import java.io.OutputStream; * @version 10.0 * Created by hades on 2020/12/23 */ -public class AbstractTemplateResource implements TemplateResource { - - @Override - public InputStream readTemplate(String path) throws Exception { - return new ByteArrayInputStream(WorkContext.getCurrent().get(TplOperator.class).readAndLockFile(path)); - } - - @Override - public OutputStream saveTemplate(FILE file) throws Exception { - return file.asOutputStream(); - } - - @Override - public boolean closeTemplate(String path) { - return WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); - } - - @Override - public boolean delete(FILE file) { - return WorkContext.getCurrent().get(TplOperator.class).delete(file.getPath()); - } - - @Override - public boolean rename(String from, String to) { - return WorkContext.getCurrent().get(TplOperator.class).rename(from, to); - } - - @Override - public boolean exist(String path) { - return WorkContext.getWorkResource().exist(path); - } - - @Override - public boolean mkdir(String path) { - return WorkContext.getWorkResource().createDirectory(path); - } +public abstract class AbstractTemplateResource implements TemplateResource { } diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java index 125f1a9f31..8c54cc8cc3 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateResource.java @@ -1,5 +1,12 @@ package com.fr.design.file.impl; +import com.fr.file.FILE; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.OutputStream; + /** * @author hades * @version 10.0 @@ -7,4 +14,39 @@ package com.fr.design.file.impl; */ public class DefaultTemplateResource extends AbstractTemplateResource { + @Override + public InputStream readTemplate(String path) throws Exception { + return new ByteArrayInputStream(WorkContext.getCurrent().get(TplOperator.class).readAndLockFile(path)); + } + + @Override + public OutputStream saveTemplate(FILE file) throws Exception { + return file.asOutputStream(); + } + + @Override + public boolean closeTemplate(String path) { + return WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(path); + } + + @Override + public boolean delete(FILE file) { + return WorkContext.getCurrent().get(TplOperator.class).delete(file.getPath()); + } + + @Override + public boolean rename(String from, String to) { + return WorkContext.getCurrent().get(TplOperator.class).rename(from, to); + } + + @Override + public boolean exist(String path) { + return WorkContext.getWorkResource().exist(path); + } + + @Override + public boolean mkdir(String path) { + return WorkContext.getWorkResource().createDirectory(path); + } + }