提交 c51ad354 编写于 作者: sq3536's avatar sq3536

整理方法

上级 8221d13f
......@@ -58,8 +58,9 @@ public class BootServiceImpl<T extends BaseData, F extends BaseFilter> extends D
private IBootSystemRuntime systemRuntime;
@Override
public IBootSystemRuntime getSystemRuntime() {
if(this.systemRuntime==null)
systemRuntime=BootSystemRuntime.getInstance();
if(this.systemRuntime==null) {
systemRuntime = BootSystemRuntime.getInstance();
}
return this.systemRuntime;
}
......@@ -129,13 +130,6 @@ public class BootServiceImpl<T extends BaseData, F extends BaseFilter> extends D
public Object executeAction(String strActionName, IPSDEAction iPSDEAction, Object[] args) throws Throwable {
if(getBaseService()!=null) {
if(args.length>0&&args[0]!=null) {
// if(args[0] instanceof BaseData)
// {
// Method beforeMethod = getBaseService().getServiceMethod("before"+StringAdvUtils.pascalcase(strActionName), args[0].getClass());
// if (beforeMethod != null)
// beforeMethod.invoke(this.getBaseService(), args[0]);
// }
Method method = getBaseService().getServiceMethod(StringAdvUtils.camelcase(strActionName), args[0].getClass());
if (method != null) {
Object rt = null;
......@@ -143,14 +137,6 @@ public class BootServiceImpl<T extends BaseData, F extends BaseFilter> extends D
method.invoke(this.getBaseService(), args[0]);
else
rt = method.invoke(this.getBaseService(), args[0]);
// if(args[0] instanceof BaseData)
// {
// Method afterMethod = getBaseService().getServiceMethod("after"+StringAdvUtils.pascalcase(strActionName), args[0].getClass());
// if (afterMethod != null)
// afterMethod.invoke(this.getBaseService(), args[0]);
// }
return rt;
}
}
......@@ -186,12 +172,6 @@ public class BootServiceImpl<T extends BaseData, F extends BaseFilter> extends D
if(getBaseService()!=null) {
if(args.length>0&&args[0]!=null) {
((F) args[0]).setDataSet(iPSDEDataSet);
// if(args[0] instanceof BaseFilter)
// {
// Method beforeMethod = getBaseService().getServiceMethod("beforeFetch"+StringAdvUtils.pascalcase(strDataSetName), args[0].getClass());
// if (beforeMethod != null)
// beforeMethod.invoke(this.getBaseService(), args[0]);
// }
Method method = getBaseService().getServiceMethod("fetch" + StringAdvUtils.pascalcase(strDataSetName), args[0].getClass());
if (method != null)
return method.invoke(this.getBaseService(), args[0]);
......
......@@ -43,24 +43,38 @@ public interface IBaseService<T extends BaseData, F extends BaseFilter> {
return this.getRuntimeService().getDataEntityRuntime().executeAction(strActionName, iPSDEAction, args, true);
}
default void callAction(String strActionName,Object arg) throws Throwable{
beforeAction(strActionName,arg);
forwardAction(strActionName,arg);
afterAction(strActionName,arg);
}
default Object fetchDataSet(String strDataSetName, IPSDEDataSet iPSDEDataSet, Object[] args) throws Throwable {
return this.getRuntimeService().getDataEntityRuntime().fetchDataSet(strDataSetName, iPSDEDataSet, args, true);
default void beforeAction(String strActionName,Object arg) throws Throwable{
Method beforeMethod = getServiceMethod("before"+ StringAdvUtils.pascalcase(strActionName), arg.getClass());
if (beforeMethod != null)
beforeMethod.invoke(this, arg);
}
default Object forwardAction(String strActionName,Object arg) throws Throwable{
return this.getRuntimeService().getDataEntityRuntime().executeAction(strActionName, null, new Object[]{arg}, true);
}
default Object executeActionReal(IDataEntityRuntimeContext iDataEntityRuntimeContext, String strActionName, IPSDEAction iPSDEAction, Object[] args, Object actionData) throws Throwable{
return iDataEntityRuntimeContext.executeActionReal(strActionName, iPSDEAction, args, actionData);
}
default Object fetchDataSetReal(IDataEntityRuntimeContext iDataEntityRuntimeContext, String strDataSetName, IPSDEDataSet iPSDEDataSet, Object[] args, Object actionData) throws Throwable{
return iDataEntityRuntimeContext.fetchDataSetReal(strDataSetName, iPSDEDataSet, args, actionData);
default Object onRealAction(String strActionName,Object arg) throws Throwable{
return this.getDataEntityRuntimeContext().executeActionReal(strActionName, null, new Object[]{arg}, null);
}
default void beforeAction(String strActionName,Object arg) throws Throwable{
Method beforeMethod = getServiceMethod("before"+ StringAdvUtils.pascalcase(strActionName), arg.getClass());
if (beforeMethod != null)
beforeMethod.invoke(this, arg);
default void afterAction(String strActionName,Object arg) throws Throwable{
Method afterMethod = getServiceMethod("after"+ StringAdvUtils.pascalcase(strActionName), arg.getClass());
if (afterMethod != null)
afterMethod.invoke(this, arg);
}
default Object fetchDataSet(String strDataSetName, IPSDEDataSet iPSDEDataSet, Object[] args) throws Throwable {
return this.getRuntimeService().getDataEntityRuntime().fetchDataSet(strDataSetName, iPSDEDataSet, args, true);
}
default void beforeFetch(String strActionName,Object arg) throws Throwable{
......@@ -69,45 +83,45 @@ public interface IBaseService<T extends BaseData, F extends BaseFilter> {
beforeMethod.invoke(this, arg);
}
default void afterAction(String strActionName,Object arg) throws Throwable{
Method afterMethod = getServiceMethod("after"+ StringAdvUtils.pascalcase(strActionName), arg.getClass());
if (afterMethod != null)
afterMethod.invoke(this, arg);
default Object forwardFetch(String dsName,F arg) throws Throwable{
return this.getRuntimeService().getDataEntityRuntime().fetchDataSet(dsName, arg.getDataSet(), new Object[]{arg}, true);
}
default Object fetchDataSetReal(IDataEntityRuntimeContext iDataEntityRuntimeContext, String strDataSetName, IPSDEDataSet iPSDEDataSet, Object[] args, Object actionData) throws Throwable{
return iDataEntityRuntimeContext.fetchDataSetReal(strDataSetName, iPSDEDataSet, args, actionData);
}
default Object onRealFetch(String dsName,F arg) throws Throwable{
return this.getDataEntityRuntimeContext().fetchDataSetReal("DEFAULT", arg.getDataSet(), new Object[]{arg}, null);
}
default boolean create(T dto) throws Throwable {
beforeAction("Create",dto);
this.getRuntimeService().getDataEntityRuntime().executeAction("Create", null, new Object[]{dto}, true);
afterAction("Create",dto);
callAction("Create",dto);
return true;
}
default boolean onCreate(T dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("Create", null, new Object[]{dto}, null);
onRealAction("Create",dto);
return true;
}
default boolean update(T dto) throws Throwable {
beforeAction("Update",dto);
this.getRuntimeService().getDataEntityRuntime().executeAction("Update", null, new Object[]{dto}, true);
afterAction("Update",dto);
callAction("Update",dto);
return true;
}
default boolean onUpdate(T dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("Update", null, new Object[]{dto}, null);
onRealAction("Update",dto);
return true;
}
default boolean save(T dto) throws Throwable {
beforeAction("Save",dto);
this.getRuntimeService().getDataEntityRuntime().executeAction("Save", null, new Object[]{dto}, true);
afterAction("Save",dto);
callAction("Save",dto);
return true;
}
default boolean onSave(T dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("Save", null, new Object[]{dto}, null);
onRealAction("Save",dto);
return true;
}
......@@ -122,58 +136,56 @@ public interface IBaseService<T extends BaseData, F extends BaseFilter> {
}
default boolean remove(List keys) throws Throwable {
beforeAction("Remove",keys);
this.getRuntimeService().getDataEntityRuntime().executeAction("Remove", null, new Object[]{keys}, true);
afterAction("Remove",keys);
callAction("Remove",keys);
return true;
}
default boolean onRemove(List keys) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("Remove", null, new Object[]{keys}, null);
onRealAction("Remove",keys);
return true;
}
default <K extends Serializable> T get(K key) throws Throwable {
T dto = (T)this.getRuntimeService().getDataEntityRuntime().executeAction("Get", null, new Object[]{key}, true);
T dto = (T)forwardAction("Get",key);
if(dto!=null)
afterAction("Get",dto);
return dto;
}
default <K extends Serializable> T onGet(K key) throws Throwable {
return (T)this.getDataEntityRuntimeContext().executeActionReal("Get", null, new Object[]{key}, null);
return (T)onRealAction("Get",key);
}
default T getDraft(T dto) throws Throwable {
beforeAction("GetDraft",dto);
T rtdto = (T)this.getRuntimeService().getDataEntityRuntime().executeAction("GetDraft", null, new Object[]{dto}, true);
T rtdto = (T)forwardAction("GetDraft",dto);
if(dto!=null)
afterAction("GetDraft",rtdto);
return rtdto;
}
default T onGetDraft(T dto) throws Throwable {
return (T)this.getDataEntityRuntimeContext().executeActionReal("GetDraft", null, new Object[]{dto}, null);
return (T)onRealAction("GetDraft",dto);
}
default Integer checkKey(T dto) throws Throwable {
beforeAction("CheckKey",dto);
return (Integer) this.getRuntimeService().getDataEntityRuntime().executeAction("CheckKey", null, new Object[]{dto}, true);
return (Integer) forwardAction("CheckKey",dto);
}
default Integer onCheckKey(T dto) throws Throwable {
return (Integer) this.getDataEntityRuntimeContext().executeActionReal("CheckKey", null, new Object[]{dto}, null);
return (Integer) onRealAction("CheckKey",dto);
}
default Page<T> fetchDefault(F dto) throws Throwable {
beforeFetch("Default",dto);
return (Page) this.getRuntimeService().getDataEntityRuntime().fetchDataSet("DEFAULT", dto.getDataSet(), new Object[]{dto}, true);
return (Page) forwardFetch("DEFAULT",dto);
}
default Page<T> onFetchDefault(F dto) throws Throwable {
return (Page) this.getDataEntityRuntimeContext().fetchDataSetReal("DEFAULT", dto.getDataSet(), new Object[]{dto}, null);
return (Page) onRealFetch("DEFAULT",dto);
}
default List<T> selectDefault(F dto) throws Throwable {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册