Browse Source

Merge pull request #14212 in DESIGN/design from mss/2.0 to fbp-1.0

* commit '280e2ff39a39d3f88476d6839c3224bc40ecdb65':
  REPORT-114392-远程设计fbp能够正常使用 完善代码
  无jira任务,修复打包,去除内置参数接口
  REPORT-126537 部署集成-安装卸载-demo演示
  REPORT-126500 fbp设计器——取色器概率卡死
  REPORT-126873 FBP适配测试——国际化异常
  REPORT-126951 【仅FBP有问题】-设计器菜单栏-文件-选项-高级-log导出配置
fbp-1.0
superman 4 months ago
parent
commit
864a7b4fff
  1. 7
      designer-base/src/main/java/com/fr/design/ConfigHelper.java
  2. 3
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  3. 7
      designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java
  4. 14
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  5. 17
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  6. 6
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java
  7. 82
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  8. 2
      designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

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

@ -77,15 +77,16 @@ public class ConfigHelper {
private static Properties getProperties(String path, Properties defaultValue){
Properties properties = new Properties();
if (defaultValue != null) {
properties.putAll(defaultValue);
}
try {
File file = new File(path);
if (!file.exists()) {
createFile(file);
}
properties.load(new BufferedReader(new FileReader(path)));
// 底层的环境信息,比如国际化什么的,不应该跟环境有关,要覆盖过来
if (defaultValue != null) {
properties.putAll(defaultValue);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}

3
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -3,6 +3,7 @@
*/
package com.fr.design;
import com.fanruan.carina.Carina;
import com.fr.base.BaseXMLUtils;
import com.fr.base.OptimizeUtil;
import com.fr.base.Utils;
@ -51,6 +52,7 @@ import com.fr.general.xml.async.XmlException;
import com.fr.general.xml.async.XmlInitialFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.log.LogHandler;
import com.fr.platform.scaffold.provider.config.LanguageConfigProvider;
import com.fr.stable.CommonUtils;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
@ -1714,6 +1716,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
}
}
}
Carina.config(LanguageConfigProvider.class).setLocale(CommonUtils.localeToString(designerEnvManager.getLanguage()));
}

7
designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java

@ -7,7 +7,6 @@ import com.fr.general.web.ParameterConstants;
import com.fr.plugin.ExtraClassManager;
import com.fr.script.ScriptConstants;
import com.fr.stable.ArrayUtils;
import com.fr.stable.fun.BuiltInParametersProvider;
import com.fr.stable.script.CalculatorProvider;
import java.util.ArrayList;
@ -38,12 +37,6 @@ public abstract class VariableResolverAdapter implements VariableResolver {
CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME,
CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID
};
Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG);
for (BuiltInParametersProvider provider : set) {
ArrayUtils.addAll(variables, new String[]{
ScriptConstants.DETAIL_TAG + provider.getParametersName()
});
}
return variables;
}

14
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -562,13 +562,13 @@ public abstract class ToolBarMenuDock {
LocaleCenter.buildAction(() -> shortCuts.add(new TechSupportAction()), SupportLocaleImpl.TECH_SUPPORT_HELP);
//远程不使用更新升级,产品演示
if (WorkContext.getCurrent().isLocal()) {
shortCuts.add(new WebDemoAction());
if (!Locale.getDefault().equals(Locale.JAPAN) && !Locale.getDefault().equals(Locale.JAPANESE)) {
LocaleCenter.buildAction(() -> shortCuts.add(new SoftwareUpdateAction()), SupportLocaleImpl.UPDATE_HELP);
}
}
/// fbp本地和远程都暂时不使用更新升级,产品演示
//if (WorkContext.getCurrent().isLocal()) {
// shortCuts.add(new WebDemoAction());
// if (!Locale.getDefault().equals(Locale.JAPAN) && !Locale.getDefault().equals(Locale.JAPANESE)) {
// LocaleCenter.buildAction(() -> shortCuts.add(new SoftwareUpdateAction()), SupportLocaleImpl.UPDATE_HELP);
// }
//}
if (AlphaFineConfigManager.isALPHALicAvailable()) {
shortCuts.add(new AlphaFineAction());
}

17
designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java

@ -87,14 +87,15 @@ public class ColorPicker extends JDialog implements ActionListener {
}
public void updateLocation() {
mousePos = MouseInfo.getPointerInfo().getLocation();
updateCoordinate();
setLocation(setCoordinateX, setCoordinateY);
updateMousePos();
updateCoordinate();
colorPickerPanel.setMagnifierLocation(setCoordinateX,
setCoordinateY);
if (MouseInfo.getPointerInfo() != null) {
mousePos = MouseInfo.getPointerInfo().getLocation();
updateCoordinate();
setLocation(setCoordinateX, setCoordinateY);
updateMousePos();
updateCoordinate();
colorPickerPanel.setMagnifierLocation(setCoordinateX,
setCoordinateY);
}
}
private void updateCoordinate() {

6
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java vendored

@ -104,7 +104,7 @@ import org.jetbrains.annotations.NotNull;
*/
@FineComponent(name = "design_env_choose")
public class DesignEnvChooseComponent extends ResourceAffiliate {
private Listener<Workspace> beforeSwitch4Min = new Listener<Workspace>(Integer.MIN_VALUE) {
private Listener<Workspace> afterSwitch4Max = new Listener<Workspace>(Integer.MAX_VALUE) {
@Override
public void on(Event event, Workspace current) {
@ -147,8 +147,8 @@ public class DesignEnvChooseComponent extends ResourceAffiliate {
@Start
public void start() {
registerEnvListener();
startEnvChoose();
registerEnvListener();
afterAllStart();
}
@ -217,7 +217,7 @@ public class DesignEnvChooseComponent extends ResourceAffiliate {
private void registerEnvListener() {
/*切换环境前,重启所有相关模块,最后执行*/
listenEvent(WorkspaceEvent.BeforeSwitch, beforeSwitch4Min);
listenEvent(WorkspaceEvent.AfterSwitch, afterSwitch4Max);
/*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/
listenEvent(WorkspaceEvent.BeforeSwitch, beforeSwitch4Max);

82
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -31,6 +31,7 @@ import com.fr.cluster.ClusterBridge;
import com.fr.cluster.lock.ClusterLock;
import com.fr.config.BaseDBEnv;
import com.fr.config.ConfigEvent;
import com.fr.config.Configuration;
import com.fr.config.FinalPreferenceConfig;
import com.fr.config.dao.DaoContext;
import com.fr.config.dao.impl.BatchSubmitClassHelperDao;
@ -42,6 +43,8 @@ import com.fr.config.dao.impl.hibernate.HibernateXmlEnityDao;
import com.fr.config.dao.impl.remote.RemoteClassHelperDao;
import com.fr.config.dao.impl.remote.RemoteEntityDao;
import com.fr.config.dao.impl.remote.RemoteXmlEntityDao;
import com.fr.config.holder.ConfigChangeListener;
import com.fr.config.holder.ValidateConfigManger;
import com.fr.config.impl.ConfConfigProviderImpl;
import com.fr.config.impl.ConfigInsecurityElementProviderImpl;
import com.fr.decision.service.context.ServiceContext;
@ -54,6 +57,7 @@ import com.fr.design.backup.EnvBackupHelper;
import com.fr.env.detect.EnvDetectorCenter;
import com.fr.event.EventDispatcher;
import com.fr.general.FRLogger;
import com.fr.general.log.Log4jConfig;
import com.fr.general.log.Log4jUtils;
import com.fr.intelli.metrics.Compute;
import com.fr.intelli.metrics.DBMonitorInterceptor;
@ -86,6 +90,7 @@ import com.fr.stable.db.session.DBSession;
import com.fr.stable.project.ProjectConstants;
import com.fr.tenant.context.TenantContext;
import com.fr.tenant.context.provider.CurrentTenantKey;
import com.fr.third.apache.logging.log4j.core.config.Configurator;
import com.fr.third.net.bytebuddy.implementation.MethodDelegation;
import com.fr.third.net.bytebuddy.matcher.ElementMatchers;
import com.fr.third.org.hibernate.jdbc.AbstractWork;
@ -164,36 +169,38 @@ public class DesignEnvComponent {
}
private void startScheduler() {
TenantContext.doIsolatedWork(() -> {
ClusterLock lock = ClusterBridge.getLockFactory().get(SchedulerCoreComponent.class);
// 多节点同时启动quartz模块可能会产生脏数据,导致报错,使用集群锁控制一下
DBSession dbSession = null;
try {
lock.lock();
final DBContextProvider context = BaseDBEnv.getDBContext();
if (context == null) {
throw new IllegalArgumentException("ConfigDBActivator must start before SchedulerActivator");
}
dbSession = context.openSession();
dbSession.doWork(new AbstractWork() {
@Override
public void execute(Connection connection) throws SQLException {
//quartz需要的数据库方言
Properties properties = context.getDBProperties();
QuartzContext.getInstance().initScheduler(properties);
if (WorkContext.getCurrent().isLocal()) {
TenantContext.doIsolatedWork(() -> {
ClusterLock lock = ClusterBridge.getLockFactory().get(SchedulerCoreComponent.class);
// 多节点同时启动quartz模块可能会产生脏数据,导致报错,使用集群锁控制一下
DBSession dbSession = null;
try {
lock.lock();
final DBContextProvider context = BaseDBEnv.getDBContext();
if (context == null) {
throw new IllegalArgumentException("ConfigDBActivator must start before SchedulerActivator");
}
dbSession = context.openSession();
dbSession.doWork(new AbstractWork() {
@Override
public void execute(Connection connection) throws SQLException {
//quartz需要的数据库方言
Properties properties = context.getDBProperties();
QuartzContext.getInstance().initScheduler(properties);
}
});
EventDispatcher.fire(SchedulerEvent.START);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
if (dbSession != null) {
dbSession.closeSession();
}
});
EventDispatcher.fire(SchedulerEvent.START);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
if (dbSession != null) {
dbSession.closeSession();
lock.unlock();
}
lock.unlock();
}
}, "default");
}, "default");
}
}
@ -235,6 +242,25 @@ public class DesignEnvComponent {
String realPath = Carina.properties(LoggerProperties.class).getXml();
URI uri = Log4jUtils.buildUserConfigURI(realPath);
FRLogger.getLogger().config(uri);
// 日志配置更新的监听在FRLogger里面,fbp去掉了但是设计器本地还是需要这个监听的,初始化的时候监听一下
listenConfig();
}
private void listenConfig() {
ValidateConfigManger.getInstance().registerListener(new ConfigChangeListener() {
@Override
public boolean accept(Class<? extends Configuration> configClass) {
return configClass.equals(Log4jConfig.class);
}
@Override
public void change() {
// The root logger is the topmost logger with a name of "" (the empty string).
Configurator.setAllLevels("", Log4jConfig.getInstance().getRootLevel());
}
});
}
private void stopLogger() {

2
designer-realize/src/main/java/com/fanruan/boot/init/DesignWorkContextComponent.java

@ -50,6 +50,7 @@ import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.CompatibleConnectionOperator;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fanruan.workplace.network.RemoteNetworkRepository;
import com.fr.workspace.server.repository.config.ConfigRepository;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.resource.PublicResourceRepository;
import com.fr.workspace.server.repository.resource.WorkResourceRepository;
@ -98,6 +99,7 @@ public class DesignWorkContextComponent {
RepositoryManager.getInstance().pureRegisterRepo4Start(ShareRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(WorkResourceRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(PublicResourceRepository.getInstance());
RepositoryManager.getInstance().pureRegisterRepo4Start(ConfigRepository.getInstance());
RepositoryManager.getInstance().initLocalRepository();
CompatibleRegister.registerCompatibleEnv();
for (WorkRPCRegister<?> workRPCRegister : ServiceContext.group(WorkspaceKey.class).getAll()) {

Loading…
Cancel
Save