📄 delegate.template
字号:
// ablout #entityClass#. Create in #dateTime#.
public String save#entityClass#(#entityClass# #entityClassInstance#, IState state) {
logger.debug("save#entityClass# delegate.");
if (DelegateUtil.isNullParam(#entityClassInstance#, "#entityClassInstance#", state)) {
return null;
}
Request req = new Request();
req.setServiceName(ServiceConsts.Save#entityClass#Processor);
req.setValue("#entityClassInstance#", #entityClassInstance#);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setIState(state, resp);
return ((String) resp.getValue("result"));
} catch (Exception e) {
DelegateUtil.handleException(e, "save#entityClass#", state);
return null;
}
}
public boolean delete#entityClass#By#primaryKey#(String #primaryKeyInstance#, IState state) {
logger.debug("delete#entityClass#By#primaryKey# delegate.");
if (DelegateUtil.isNullParam(#primaryKeyInstance#, "#primaryKeyInstance#", state)) {
return false;
}
Request req = new Request();
req.setServiceName(ServiceConsts.Delete#entityClass#By#primaryKey#Processor);
req.setValue("#primaryKeyInstance#",#primaryKeyInstance#);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setIState(state, resp);
return ((Boolean) resp.getValue("resultBoolean")).booleanValue();
} catch (Exception e) {
DelegateUtil.handleException(e, "delete#entityClass#By#primaryKey#", state);
return false;
}
}
public boolean delete#entityClass#(#entityClass# #entityClassInstance#, IState state) {
logger.debug("delete#entityClass# delegate.");
if (DelegateUtil.isNullParam(#entityClassInstance#, "#entityClassInstance#", state)) {
return false;
}
Request req = new Request();
req.setServiceName(ServiceConsts.Delete#entityClass#Processor);
req.setValue("#entityClassInstance#", #entityClassInstance#);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setIState(state, resp);
return ((Boolean) resp.getValue("resultBoolean")).booleanValue();
} catch (Exception e) {
DelegateUtil.handleException(e, "delete#entityClass#", state);
return false;
}
}
public boolean update#entityClass#(#entityClass# #entityClassInstance#, IState state) {
logger.debug("update#entityClass# delegate.");
if (DelegateUtil.isNullParam(#entityClassInstance#, "#entityClassInstance#", state)) {
return false;
}
Request req = new Request();
req.setServiceName(ServiceConsts.Update#entityClass#Processor);
req.setValue("#entityClassInstance#", #entityClassInstance#);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setIState(state, resp);
return ((Boolean) resp.getValue("resultBoolean")).booleanValue();
} catch (Exception e) {
DelegateUtil.handleException(e, "update#entityClass#", state);
return false;
}
}
public PageSupport findAll#entityClass#(CriteriaQuery cq, IState state) {
logger.debug("findAll#entityClass# delegate.");
if (DelegateUtil.isNullParam(cq, "CriteriaQuery", state)) {
return null;
}
Request req = new Request();
req.setServiceName(ServiceConsts.FindAll#entityClass#Processor);
req.setValue("CriteriaQuery", cq);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setIState(state, resp);
return (PageSupport) (resp.getValue("PageSupport"));
} catch (Exception e) {
DelegateUtil.handleException(e, "findAll#entityClass#", state);
}
return new PageSupport();
}
public #entityClass# find#entityClass#By#primaryKey#(String #primaryKeyInstance#, IState state) {
logger.debug("find#entityClass#By#primaryKey# delegate.");
if (DelegateUtil.isNullParam(#primaryKeyInstance#, "#primaryKeyInstance#", state)) {
return null;
}
Request req = new Request();
req.setServiceName(ServiceConsts.Find#entityClass#By#primaryKey#Processor);
req.setValue("#primaryKeyInstance#", #primaryKeyInstance#);
try {
Response resp = getDelegate().execute(req);
DelegateUtil.setIState(state, resp);
#entityClass# #entityClassInstance# = (#entityClass#) resp.getValue("#entityClassInstance#");
DelegateUtil.setIState(state, resp);
return #entityClassInstance#;
} catch (Exception e) {
DelegateUtil.handleException(e, "find#entityClass#By#primaryKey#", state);
return null;
}
}
// ablout #entityClass#. Create in #dateTime#.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -