#1971 文档更新完成

parent fbe6ce2b
Pipeline #5711 failed with stages
package logwire.core.bo.eventhandler;
import logwire.core.bo.handler.Handler;
public interface OperationEventHandler extends Handler {
default boolean isAfter() {
return true;
}
}
...@@ -3,7 +3,7 @@ package logwire.core.bo.factory; ...@@ -3,7 +3,7 @@ package logwire.core.bo.factory;
import logwire.core.bo.object.BizObject; import logwire.core.bo.object.BizObject;
public interface BizObjectFactoryEventHandler<X extends BizObject> { public interface BizObjectFactoryEventHandler<X extends BizObject> {
String getOperationName(); String getName();
void doBefore(Class<X> xClass, Object... args); void doBefore(Class<X> xClass, Object... args);
......
...@@ -4,7 +4,7 @@ import logwire.core.bo.object.BizObject; ...@@ -4,7 +4,7 @@ import logwire.core.bo.object.BizObject;
public interface BizObjectFactoryHandler<X extends BizObject> { public interface BizObjectFactoryHandler<X extends BizObject> {
String getOperationName(); String getName();
// 取消enable这个参数,配置文件和程序里都有配置会导致混淆 // 取消enable这个参数,配置文件和程序里都有配置会导致混淆
// 只会从配置文件中读取,只有在配置文件中配置的,才会进行加载 // 只会从配置文件中读取,只有在配置文件中配置的,才会进行加载
......
package logwire.core.bo.handler;
public interface Handler {
/**
* 操作名称
*
* @return
*/
String getOperation();
/**
* 是否启用
*
* @return
*/
boolean isEnabled();
/**
*
* //TODO getQuery???
* @return
*/
default String getQuery() {
return "";
}
/**
* 优先级, 值越小优先级越高
*
* @return
*/
default Integer getOrder() {
return 1000;
}
}
package logwire.core.bo.handler;
import logwire.core.bo.object.BizObject;
import java.util.List;
public interface ListOperationHandler<X extends BizObject> extends OperationHandler {
default String getQuery() {
return "";
}
default boolean accept(List<X> xList, Object... args) {
return true;
}
Object execute(List<X> xList, Object... args);
}
package logwire.core.bo.handler;
public interface OperationHandler extends Handler {
}
package logwire.core.bo.list; package logwire.core.bo.list;
import logwire.core.bo.annotation.Operation;
import logwire.core.bo.object.BizObject; import logwire.core.bo.object.BizObject;
import logwire.core.bo.operation.list.DefaultListOperationProvider;
import java.util.Map; import java.util.Map;
public interface BizList<X extends BizObject> extends Iterable<X> { public abstract class BizList<X extends BizObject> implements Iterable<X>,DefaultListOperationProvider<X> {
De @Operation(name = "findById")
abstract X findById(Long id);
X findOne(String field, Object value); @Operation(name = "findOne")
abstract X findOne(String field, Object value);
X findOne(Map fields); @Operation(name = "findOneByMap")
abstract X findOneByMap(Map fields);
/* 暂不支持lql /* 暂不支持lql
X find(String query); X find(String query);
*/ */
@Operation(name = "create")
abstract X create();
X create(); @Operation(name = "createByMap")
abstract X createByMap(Map fields);
X create(Map fields); @Operation(name = "find")
abstract BizList<X> find(String field, Object value);
BizList<X> find(String field, Object value); @Operation(name = "findByMap")
abstract BizList<X> findByMap(Map fields);
BizList<X> find(Map fields);
/* 暂不支持lql /* 暂不支持lql
BizList<X> find(String query); BizList<X> find(String query);
*/ */
@Operation(name = "findAll")
BizList<X> findAll(); abstract BizList<X> findAll();
} }
\ No newline at end of file
...@@ -7,8 +7,6 @@ import logwire.core.bo.object.BizObject; ...@@ -7,8 +7,6 @@ import logwire.core.bo.object.BizObject;
//所有BO Object 默认ListOperation定义 //所有BO Object 默认ListOperation定义
@ListOperationProvider(type = BizObject.class) @ListOperationProvider(type = BizObject.class)
public interface DefaultListOperationProvider<X extends BizObject> { public interface DefaultListOperationProvider<X extends BizObject> {
@Operation(name = "getProvider")
DefaultListOperationProvider<X> getProvider();
@Operation(name = "save") @Operation(name = "save")
void save(); void save();
@Operation(name = "delete") @Operation(name = "delete")
......
package logwire.core.bo.eventhandler; package logwire.core.bo.operation.list;
import logwire.core.bo.list.BizList;
import logwire.core.bo.object.BizObject; import logwire.core.bo.object.BizObject;
import java.util.List; public interface ListOperationEventHandler<X extends BizObject> {
String getName();
public interface ListOperationEventHandler<X extends BizObject> extends OperationEventHandler { default void doBefore(BizList<X> xList, Object...args){
default String getQuery() {
return "";
}
default void doBefore(List<X> xList, Object... args) {
//调用行为同名方法 //调用行为同名方法
} }
default void doAfter(BizList<X> xList, Object result, Object...args){
default void doAfter(List<X> xList, Object result, Object... args) {
//调用行为同名方法 //调用行为同名方法
} }
} }
package logwire.core.bo.operation.list;
import logwire.core.bo.list.BizList;
import logwire.core.bo.object.BizObject;
public interface ListOperationHandler<X extends BizObject> {
String getName();
/**
boolean isEnabled();
String getQuery() default "";
defalut int getOrder(){return 1000;}
**/
default boolean accept(BizList<X> xList, Object... args) {
return true;
}
Object execute(BizList<X> xList, Object... args);
}
package logwire.core.bo.operation.list;
import logwire.core.bo.list.BizList;
import logwire.core.bo.object.BizObject;
public interface SmartListOperationHandler<X extends BizObject> extends ListOperationHandler<X> {
default Object execute(BizList<X> xList, Object...args) {
//调用与Operation同名方法
//目的增加代码可读性
return null;
}
}
...@@ -3,8 +3,7 @@ package logwire.core.bo.operation.object; ...@@ -3,8 +3,7 @@ package logwire.core.bo.operation.object;
import logwire.core.bo.object.BizObject; import logwire.core.bo.object.BizObject;
public interface ObjectOperationEventHandler<X extends BizObject> { public interface ObjectOperationEventHandler<X extends BizObject> {
String getOperationName(); String getName();
default boolean isAfter() {return true;}
default void doBefore(X x, Object...args){ default void doBefore(X x, Object...args){
//调用行为同名方法 //调用行为同名方法
} }
......
...@@ -3,7 +3,7 @@ package logwire.core.bo.operation.object; ...@@ -3,7 +3,7 @@ package logwire.core.bo.operation.object;
import logwire.core.bo.object.BizObject; import logwire.core.bo.object.BizObject;
public interface ObjectOperationHandler<X extends BizObject> { public interface ObjectOperationHandler<X extends BizObject> {
String getOperationName(); String getName();
/*boolean isEnabled(); /*boolean isEnabled();
default int getOrder(){return 1000;}*/ default int getOrder(){return 1000;}*/
......
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