Browse Source

REPORT-65050 远程模板锁定优化-fvs模板被超管在某设备上强制解锁后,编辑者点击保存时不会触发另存为弹窗,而是保存成功

bugfix/11.0
hades 3 years ago
parent
commit
20160eae69
  1. 7
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 9
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

7
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -967,6 +967,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return false; return false;
} }
try { try {
checkBeforeSave();
export(); export();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -985,7 +986,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return isNewCreateTpl; return isNewCreateTpl;
} }
protected boolean export() throws Exception { protected void checkBeforeSave() throws Exception {
// 保存前校验下未解锁 // 保存前校验下未解锁
if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) { if (WorkContext.getCurrent().get(LockInfoOperator.class).isTplUnLocked(getEditingFILE().getPath())) {
throw new UnLockedException(); throw new UnLockedException();
@ -994,6 +995,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (getEditingFILE().exists() && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath())) { if (getEditingFILE().exists() && !WorkContext.getCurrent().get(LockInfoOperator.class).isConsistentLock(getEditingFILE().getPath())) {
throw new InconsistentLockException(); throw new InconsistentLockException();
} }
}
protected boolean export() throws Exception {
return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE())); return this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(getEditingFILE()));
} }
@ -1634,6 +1638,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (editingFILE == null || editingFILE instanceof MemFILE) { if (editingFILE == null || editingFILE instanceof MemFILE) {
return false; return false;
} }
checkBeforeSave();
export(); export();
this.editingFILE = editingFILE; this.editingFILE = editingFILE;
return true; return true;

9
designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

@ -6,6 +6,7 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.TemplateUtils; import com.fr.design.utils.TemplateUtils;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
@ -31,11 +32,19 @@ public class SaveFailureHandler implements ThrowableHandler {
@Override @Override
public boolean process(Throwable e) { public boolean process(Throwable e) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (Handler handler : Handler.values()) { for (Handler handler : Handler.values()) {
try {
if (handler.process(e)) { if (handler.process(e)) {
break; break;
} }
} catch (Exception ignored) {
}
}
} }
});
return true; return true;
} }

Loading…
Cancel
Save