Commit fb67058e by chengzhuoshen

优化BD版本mda,runtime代码分离

parent 8ec84d83
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public class Event {
public static final int UNSELECTED_INDEX = -1;
private IAttribute target;
private EventType type;
private Object data;
public Event(IAttribute target, EventType type, Object data) {
this.target = target;
this.type = type;
this.data = data;
}
public IAttribute getTarget() {
return this.target;
}
public final EventType getType() {
return this.type;
}
public final Object getData() {
return this.data;
}
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public enum EventType {
DEFAULT, ON_KEY_PRESS, ON_PULL_DOWN, ON_PULL_UP, ON_CHANGE, ON_CLICK, ON_DBLCLICK, ON_ROW_INSERT, ON_ROW_REMOVE, ON_STREAM_UPLOAD, ON_STREAM_DOWNLOAD, ON_PANEL_SHOW, ON_PANEL_CLOSE, ON_TIMER;
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public class ExitEventException extends RuntimeException {
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public interface IAttribute<E> {
public static final String ID = "ID";
public static final String DESCRIPTION = "DESCRIPTION";
public static final String REQUIRED = "REQUIRED";
public static final String VISIBLE = "VISIBLE";
public static final String ENABLE = "ENABLE";
public static final String MODIFY = "MODIFY";
public static final String BYINPUT = "BYINPUT";
public static final String CODEVALUES = "CODEVALUES";
public static final String FORMAT = "FORMAT";
public static final String WIDTH = "WIDTH";
public static final String COLSPAN = "COLSPAN";
public static final String ROWSPAN = "ROWSPAN";
public static final String HEIGHT = "HEIGHT";
public static final String LENGTH = "LENGTH";
public static final String LINE = "LINE";
public static final String VIEWTYPE = "VIEWTYPE";
public static final String STYLE = "STYLE";
public static final String STYLECLASS = "STYLECLASS";
public static final String HINT = "HINT";
public static final String ARGS = "ARGS";
public static final String SAVEDISPLAY = "SAVEDISPLAY";
Object setAttribute(String paramString, Object paramObject);
Object getAttribute(String paramString);
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public interface IAttributeValue<E> extends IValue<E>, IAttribute {
void addCheckRule(IRule paramIRule);
void addEventRule(IEventRule paramIEventRule);
boolean invokeCheckRules(IContext paramIContext);
boolean invokeEventRules(IContext paramIContext, EventType paramEventType, Object paramObject, int... paramVarArgs);
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/15
*/
public interface ICallback {
Object invoke(Object... paramVarArgs);
}
......@@ -30,6 +30,7 @@ public interface IContext extends Serializable {
boolean postRule(IModule m,String target,boolean isInModuleList);
boolean postRule(IBaseObject baseObject);
boolean postCheck(String target);
void setParams(Map<String, Object> params);
Map<String, CodeEntity> getValuesSet();
void visitValues();
......
......@@ -34,6 +34,16 @@ public interface IDaoSession {
<T extends IModule> int dbReadSet(IModuleList<T> list, Object... args);
<T extends IModule> int dbReadSetByArguments(IModuleList<T> list, Argument<? extends Object>... args);
@SuppressWarnings("rawtypes")
<T extends IModule> int dbReadset(IModuleList<T> list,int limitSize, Argument... args);
<T extends IModule> int dbReadset(IModuleList<T> list, String whereSql);
<T extends IModule> int dbReadset(IModuleList<T> list, String whereSql,Object[] params);
<T extends IModule> int dbReadset(IModuleList<T>[] lists, int maxSize, String whereClause, Object[] datas);
void dbReadset(IModuleList[] lists, String whereClause, Object[] datas);
void dbReadset(IModuleList list, int maxSize, String sql);
void dbExecuteSQL(IStream stm);
......@@ -56,4 +66,9 @@ public interface IDaoSession {
void dbSelect(IModule module, String string, String sql, Object... val);
void DBOpen(IModule module);
void dbSelectCursor(IModule module,String whereSql,Object... params);
boolean isOpenTrans();
void dbConnect();
void dbDisconnect();
String dbName();
}
package com.brilliance.mda.runtime.mda;
import java.io.Serializable;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public interface IEventRule extends Serializable {
int getOrder();
EventType getType();
boolean invoke(IContext paramIContext, Event paramEvent);
}
......@@ -8,4 +8,5 @@ public interface ILocker {
boolean lock(Serializable key, long timeout);
LockInfo lock(String userName,Serializable key);
boolean unlock(Serializable key);
boolean unlock(String lockname, Serializable key);
}
......@@ -32,4 +32,6 @@ public interface IModule extends IBaseObject{
return null;
}
IBaseObject get(String paramString);
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public interface IModuleAttribute extends IModule {
// void clearIdAttribute();
}
package com.brilliance.mda.runtime.mda;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public interface IModuleRoot extends IModuleAttribute {
public static final Log log = LogFactory.getLog(IModuleRoot.class);
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/15
*/
public interface IParent extends IBaseObject {
public static final IParent[] EMPTY = new IParent[0];
void addChild();
void bindEvents(IContext paramIContext);
void init(IContext paramIContext);
void copyValues(IParent paramIParent);
Object getAttribute(IBaseObject paramIBaseObject, String paramString);
Object setAttribute(IBaseObject paramIBaseObject, String paramString, Object paramObject);
void updateSubUrls(int paramInt);
String getSubUrl(Object paramObject);
}
package com.brilliance.mda.runtime.mda;
public interface IResult<E> extends IValue<E> {
String getName();
}
\ No newline at end of file
package com.brilliance.mda.runtime.mda;
import java.io.Serializable;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public interface IRule extends Serializable {
int getOrder();
boolean invoke(IContext paramIContext, IAttributeValue paramIAttributeValue);
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/15
*/
public interface IState {
boolean getContinued();
void sleep();
void setStopCallback(IStopCallback paramIStopCallback);
public static interface IStopCallback {
void stop();
}
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public interface IValue<E> extends Comparable<IValue<E>> {
E setValue(E value);
E getValue();
Class getDataType();
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public enum MessageType {
INFORMATION, ERROR, QUESTION;
}
package com.brilliance.mda.runtime.mda;
/**
* @Description
* @Author s_guodong
* @Date 2022/11/11
*/
public enum ViewType {
VIEW_LABEL, VIEW_EDIT, VIEW_DATEBOX, VIEW_DECIMALBOX, VIEW_COMBO, VIEW_CHECK, VIEW_RADIO, VIEW_RADIOS, VIEW_HYPER, VIEW_BUTTON;
}
package com.brilliance.mda.runtime.mda.impl;
import com.brilliance.mda.runtime.mda.IResult;
import com.brilliance.mda.runtime.mda.OpType;
public class Argument<E> {
public class Argument<E> implements IResult {
public String fieldName;
public OpType opType;
public E value;
public Object attachField;
public Argument(){
public Argument() {
}
public Argument(String fieldName)
{
public Argument(String fieldName) {
this.fieldName = fieldName;
}
public Argument(String fieldName,OpType opType, E value)
{
public Argument(String fieldName, OpType opType, E value) {
this.fieldName = fieldName;
this.opType = opType;
this.value = value;
}
public Argument(String fieldName,OpType opType)
{
public Argument(String fieldName, OpType opType) {
this.fieldName = fieldName;
this.opType = opType;
this.value = null;
}
public Argument(String fieldName,E value)
{
this(fieldName,OpType.EQ,value);
}
public Argument(OpType opType,E value)
{
this(null,opType,value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument or(Argument arg1, Argument arg2)
{
return new Argument(OpType.OR, new Argument[] { arg1, arg2 });
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument and(Argument arg1, Argument arg2)
{
return new Argument(OpType.AND, new Argument[] { arg1, arg2 });
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument not(Argument argument)
{
return new Argument(OpType.NOT, argument);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument in(String column, Object[] values)
{
return new Argument(column, OpType.IN, values);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument between(String column, Object value1, Object value2)
{
return new Argument(column, OpType.BETWEEN, new Object[] { value1, value2 });
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument eq(String column, Object value)
{
return new Argument(column, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument gt(String column, Object value)
{
return new Argument(column, OpType.GT, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument ge(String column, Object value)
{
return new Argument(column, OpType.GE, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument lt(String column, Object value)
{
return new Argument(column, OpType.LT, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument le(String column, Object value)
{
return new Argument(column, OpType.LE, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument isNotNull(String column)
{
return new Argument(column, OpType.ISNOTNULL);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument isNull(String column)
{
return new Argument(column, OpType.ISNULL);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument like(String column, Object value)
{
return new Argument(column, OpType.LIKE, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Argument notLike(String column, Object value)
{
return new Argument(column, OpType.NOTLIKE, value);
}
@SuppressWarnings({ "rawtypes"})
public Argument and(Argument argument)
{
return this.opType == null ? argument : and(this, argument);
}
@SuppressWarnings({ "rawtypes" })
public Argument and(String fieldName, Object value)
{
return and(fieldName, OpType.EQ, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public Argument and(String fieldName, OpType opType)
{
return and(new Argument(fieldName, opType));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public Argument and(String fieldName, OpType opType, Object value)
{
return and(new Argument(fieldName, opType, value));
}
@SuppressWarnings({ "rawtypes"})
public Argument or(Argument argument)
{
return this.opType == null ? argument : or(this, argument);
}
@SuppressWarnings({ "rawtypes" })
public Argument or(String fieldName, Object value)
{
return or(fieldName, OpType.EQ, value);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public Argument or(String fieldName, OpType opType)
{
return or(new Argument(fieldName, opType));
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public Argument or(String fieldName, OpType opType, Object value)
{
return or(new Argument(fieldName, opType, value));
}
public E getValue()
{
public Argument(String fieldName, E value) {
this(fieldName, OpType.EQ, value);
}
public Argument(OpType opType, E value) {
this(null, opType, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument or(Argument arg1, Argument arg2) {
return new Argument(OpType.OR, new Argument[]{arg1, arg2});
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument and(Argument arg1, Argument arg2) {
return new Argument(OpType.AND, new Argument[]{arg1, arg2});
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument not(Argument argument) {
return new Argument(OpType.NOT, argument);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument in(String column, Object[] values) {
return new Argument(column, OpType.IN, values);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument between(String column, Object value1, Object value2) {
return new Argument(column, OpType.BETWEEN, new Object[]{value1, value2});
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument eq(String column, Object value) {
return new Argument(column, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument gt(String column, Object value) {
return new Argument(column, OpType.GT, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument ge(String column, Object value) {
return new Argument(column, OpType.GE, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument lt(String column, Object value) {
return new Argument(column, OpType.LT, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument le(String column, Object value) {
return new Argument(column, OpType.LE, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument isNotNull(String column) {
return new Argument(column, OpType.ISNOTNULL);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument isNull(String column) {
return new Argument(column, OpType.ISNULL);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument like(String column, Object value) {
return new Argument(column, OpType.LIKE, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static Argument notLike(String column, Object value) {
return new Argument(column, OpType.NOTLIKE, value);
}
@SuppressWarnings({"rawtypes"})
public Argument and(Argument argument) {
return this.opType == null ? argument : and(this, argument);
}
@SuppressWarnings({"rawtypes"})
public Argument and(String fieldName, Object value) {
return and(fieldName, OpType.EQ, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public Argument and(String fieldName, OpType opType) {
return and(new Argument(fieldName, opType));
}
@SuppressWarnings({"rawtypes", "unchecked"})
public Argument and(String fieldName, OpType opType, Object value) {
return and(new Argument(fieldName, opType, value));
}
@SuppressWarnings({"rawtypes"})
public Argument or(Argument argument) {
return this.opType == null ? argument : or(this, argument);
}
@SuppressWarnings({"rawtypes"})
public Argument or(String fieldName, Object value) {
return or(fieldName, OpType.EQ, value);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public Argument or(String fieldName, OpType opType) {
return or(new Argument(fieldName, opType));
}
@SuppressWarnings({"rawtypes", "unchecked"})
public Argument or(String fieldName, OpType opType, Object value) {
return or(new Argument(fieldName, opType, value));
}
@Override
public Object setValue(Object value) {
this.value = (E) value;
return value;
}
@Override
public E getValue() {
return value;
}
public String getFieldName()
{
@Override
public Class getDataType() {
return this.getClass();
}
public String getFieldName() {
return this.fieldName;
}
@Override
public String getName() {
return this.fieldName;
}
@Override
public int compareTo(Object o) {
return 0;
}
public static <T> Argument<T> box(T value){
return new Argument<T>("",value);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment