增强服务配置文件启动功能,支持文件配置仍然可以修改
This commit is contained in:
@@ -482,17 +482,34 @@ public final class MetaKit {
|
||||
|
||||
// ---------------------- repository -------------------
|
||||
public static <T extends Doc> void save(T ... ts) {
|
||||
Set<Class<T>> clazzs = new HashSet<>();
|
||||
if (ts == null || ts.length == 0) return;
|
||||
|
||||
for (T t : ts) {
|
||||
if ("file".equals(dcate)) {
|
||||
if (t.getKey() == null) { //数据新增异常提示
|
||||
throw new UnsupportedOperationException("数据文件形式启动服务,不支持配置新增!");
|
||||
}
|
||||
|
||||
cacheSave(t.getClass());
|
||||
return;
|
||||
}
|
||||
|
||||
if (t.getKey() == null) {
|
||||
t.save();
|
||||
} else {
|
||||
|
||||
if (t instanceof MetaLink) {
|
||||
//避免删除属性无效
|
||||
if (((MetaLink) t).getLink() != null && ((MetaLink) t).getLink().size() > 0) {
|
||||
t.find(String.format("UPDATE '%s' WITH { link:null } IN MetaLink", t.getKey()), Map.class);
|
||||
}
|
||||
}
|
||||
|
||||
t.update();
|
||||
}
|
||||
|
||||
clazzs.add((Class<T>) t.getClass());
|
||||
}
|
||||
clazzs.forEach(x -> reload(x));
|
||||
|
||||
reload(ts[0].getClass());
|
||||
}
|
||||
|
||||
public static <T extends Doc> T findFirst(T t) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.tccn.base;
|
||||
|
||||
import com.lxyer.excel.poi.ExcelKit;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.redkale.convert.Convert;
|
||||
import org.redkale.net.http.*;
|
||||
|
||||
@@ -256,11 +256,6 @@ public class MetadataService extends BaseService { //arango
|
||||
|
||||
@RestMapping(name = "link_save", comment = "实体关系列表")
|
||||
public JBean linkSave(MetaLink link, @RestParam(name = "platToken") String token) {
|
||||
if (link.getKey() != null) {
|
||||
link.find(String.format("UPDATE '%s' WITH { link:null } IN MetaLink", link.getKey()), Map.class); //避免删除属性无效
|
||||
// fixme: 将逻辑迁移到 MetaKit中:
|
||||
}
|
||||
|
||||
MetaKit.save(link);
|
||||
return JBean.OK;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.tccn.service;
|
||||
|
||||
import com.lxyer.excel.poi.ExcelKit;
|
||||
import net.tccn.base.ExcelKit;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.dbq.Field;
|
||||
|
||||
@@ -67,6 +67,9 @@ public class BaseServlet extends HttpServlet {
|
||||
} catch (ArangoDBException e) {
|
||||
logger.log(Level.INFO, "arangodb init!", e);
|
||||
ArangoSource.init();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
e.printStackTrace();
|
||||
response.finish(JBean.by(-1, e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
@@ -122,7 +119,7 @@ public class RunTest<T> {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void buildeDetailTest() {
|
||||
Kv kv = MetaKit.buildeDetail(MetaKit.getMetaService("user_service", "3421432"));
|
||||
|
||||
@@ -196,7 +193,7 @@ public class RunTest<T> {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void T() {
|
||||
List<MetaTable> metaTables = MetaKit.getMetaTables();
|
||||
|
||||
@@ -234,7 +231,7 @@ public class RunTest<T> {
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void taskRunTest() {
|
||||
TaskEntity entity = TaskEntity.dao.findByKey("23074420");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user