提交 47bda3aa 编写于 作者: Z zhourui

remove program.

上级 4d560d0c
......@@ -6,7 +6,7 @@ import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType;
@Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "数据查询设计", packageName = "com.x.query.assemble.designer", containerEntities = {
"com.x.query.core.entity.program.Argument", "com.x.query.core.entity.Item", "com.x.query.core.entity.Query",
"com.x.query.core.entity.Item", "com.x.query.core.entity.Query",
"com.x.query.core.entity.View", "com.x.query.core.entity.Stat",
// "com.x.query.core.entity.Reveal",
"com.x.query.core.entity.neural.Entry", "com.x.query.core.entity.neural.InText",
......
......@@ -6,8 +6,8 @@ import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType;
@Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "数据查询", packageName = "com.x.query.assemble.surface", containerEntities = {
"com.x.query.core.entity.program.Argument", "com.x.query.core.entity.Item", "com.x.query.core.entity.Query",
"com.x.query.core.entity.View", "com.x.query.core.entity.Stat",
"com.x.query.core.entity.Item", "com.x.query.core.entity.Query",
"com.x.query.core.entity.View", "com.x.query.core.entity.Stat",
// "com.x.query.core.entity.Reveal",
// "com.x.query.core.entity.segment.Word", "com.x.query.core.entity.segment.Entry",
"com.x.query.core.entity.neural.Entry", "com.x.query.core.entity.neural.InText",
......
......@@ -6,8 +6,8 @@ import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType;
@Module(type = ModuleType.SERVICE, category = ModuleCategory.OFFICIAL, name = "数据查询服务", packageName = "com.x.query.service.processing", containerEntities = {
"com.x.query.core.entity.program.Argument", "com.x.query.core.entity.Item", "com.x.query.core.entity.Query",
"com.x.query.core.entity.View", "com.x.query.core.entity.Stat",
"com.x.query.core.entity.Item", "com.x.query.core.entity.Query",
"com.x.query.core.entity.View", "com.x.query.core.entity.Stat",
// "com.x.query.core.entity.Reveal",
// "com.x.query.core.entity.segment.Word", "com.x.query.core.entity.segment.Entry",
"com.x.query.core.entity.neural.Entry", "com.x.query.core.entity.neural.InText",
......
......@@ -50,13 +50,6 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
}
public static class Program {
public static class Argument {
public static final String table = "QRY_PGM_ARGUMENT";
}
}
public static class Neural {
public static class Model {
......
package com.x.query.core.entity.program;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.CitationNotExist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.query.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Deprecated(forRemoval = true)
@Schema(name = "Argument", description = "数据中心参数.")
@Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Program.Argument.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.Program.Argument.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Argument extends SliceJpaObject {
private static final long serialVersionUID = -2947673429928571227L;
private static final String TABLE = PersistenceProperties.Program.Argument.table;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
}
/* 更新运行方法 */
/* flag标志位 */
/* Entity 默认字段结束 */
public static final String name_FIELDNAME = "name";
@Flag
@FieldDescribe("名称.")
@Column(length = length_255B, name = ColumnNamePrefix + name_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + name_FIELDNAME)
@CheckPersist(allowEmpty = false, simplyString = true, citationNotExists = @CitationNotExist(type = Argument.class, fields = {
id_FIELDNAME, name_FIELDNAME }))
private String name;
public static final String stringValue_FIELDNAME = "stringValue";
@FieldDescribe("业务数据String值01.")
@Column(length = length_255B, name = ColumnNamePrefix + stringValue_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + stringValue_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String stringValue;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStringValue() {
return stringValue;
}
public void setStringValue(String stringValue) {
this.stringValue = stringValue;
}
}
\ No newline at end of file
package com.x.query.core.express.program;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.query.core.entity.program.Argument;
public class Arguments {
private static final String CRAWLUPDATEWORKCOMPLETED = "crawlUpdateWorkCompleted";
private static final String CRAWLUPDATEWORK = "crawlUpdateWork";
private static final String CRAWLUPDATECMS = "crawlUpdateCms";
public static String getCrawlUpdateWorkCompleted() throws Exception {
return get(CRAWLUPDATEWORKCOMPLETED, String.class);
}
public static void setCrawlUpdateWorkCompleted(String value) throws Exception {
set(CRAWLUPDATEWORKCOMPLETED, value, String.class);
}
public static String getCrawlUpdateWork() throws Exception {
return get(CRAWLUPDATEWORK, String.class);
}
public static void setCrawlUpdateWork(String value) throws Exception {
set(CRAWLUPDATEWORK, value, String.class);
}
public static String getCrawlUpdateCms() throws Exception {
return get(CRAWLUPDATECMS, String.class);
}
public static void setCrawlUpdateCms(String value) throws Exception {
set(CRAWLUPDATECMS, value, String.class);
}
private static <T> T get(String name, Class<T> cls) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Argument argument = emc.firstEqual(Argument.class, Argument.name_FIELDNAME, name);
if (null == argument) {
return null;
}
if (String.class.isAssignableFrom(cls)) {
return (T) argument.getStringValue();
} else {
}
}
return null;
}
private synchronized static <T> T set(String name, Object value, Class<T> cls) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
emc.beginTransaction(Argument.class);
Argument argument = emc.firstEqual(Argument.class, Argument.name_FIELDNAME, name);
if (null == argument) {
argument = new Argument();
argument.setName(name);
setValue(argument, value, cls);
emc.persist(argument, CheckPersistType.all);
} else {
setValue(argument, value, cls);
}
emc.commit();
}
return null;
}
private static <T> void setValue(Argument argument, Object value, Class<T> cls) throws Exception {
if (String.class.isAssignableFrom(cls)) {
argument.setStringValue(value.toString());
} else {
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册