提交 84d5043c 编写于 作者: Z zhourui

修改agent和invoke 默认注释

上级 7a4973bd
......@@ -38,7 +38,7 @@ class ActionEdit extends BaseAction {
}
emc.beginTransaction(Agent.class);
Wi.copier.copy(wi, agent);
this.addComment(agent);
//this.addComment(agent);
emc.check(agent, CheckPersistType.all);
emc.commit();
CacheManager.notify(Agent.class);
......
......@@ -17,14 +17,14 @@ class ActionUpdate extends BaseAction {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
Agent agent = emc.flag(flag, Agent.class );
Agent agent = emc.flag(flag, Agent.class);
if (null == agent) {
throw new ExceptionAgentNotExist(flag);
}
String text = new String(bytes, DefaultCharset.name);
emc.beginTransaction(Agent.class);
agent.setText(text);
this.addComment(agent);
// this.addComment(agent);
emc.commit();
wo.setId(agent.getId());
result.setData(wo);
......
......@@ -9,31 +9,31 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.program.center.core.entity.Agent;
abstract class BaseAction extends StandardJaxrsAction {
private static String COMMENT = "";
private static final Pattern COMMENT_REGEX = Pattern.compile("^\\/\\*(\\s|.)*?\\*\\/");
static {
COMMENT = "/*" + StringUtils.LF;
COMMENT += "* resources.getEntityManagerContainer() // 实体管理容器." + StringUtils.LF;
COMMENT += "* resources.getContext() //上下文根." + StringUtils.LF;
COMMENT += "* resources.getOrganization() //组织访问接口." + StringUtils.LF;
COMMENT += "* requestText //请求内容." + StringUtils.LF;
COMMENT += "* request //请求对象." + StringUtils.LF;
COMMENT += "*/" + StringUtils.LF;
}
protected void addComment(Agent agent) {
if (StringUtils.isEmpty(agent.getText())) {
agent.setText(COMMENT);
} else {
Matcher m = COMMENT_REGEX.matcher(agent.getText());
if (m.find()) {
agent.setText(COMMENT + m.replaceFirst(""));
} else {
agent.setText(COMMENT + agent.getText());
}
}
}
// private static String COMMENT = "";
//
// private static final Pattern COMMENT_REGEX = Pattern.compile("^\\/\\*(\\s|.)*?\\*\\/");
//
// static {
// COMMENT = "/*" + StringUtils.LF;
// COMMENT += "* resources.getEntityManagerContainer() // 实体管理容器." + StringUtils.LF;
// COMMENT += "* resources.getContext() //上下文根." + StringUtils.LF;
// COMMENT += "* resources.getOrganization() //组织访问接口." + StringUtils.LF;
// COMMENT += "* requestText //请求内容." + StringUtils.LF;
// COMMENT += "* request //请求对象." + StringUtils.LF;
// COMMENT += "*/" + StringUtils.LF;
// }
//
// protected void addComment(Agent agent) {
// if (StringUtils.isEmpty(agent.getText())) {
// agent.setText(COMMENT);
// } else {
// Matcher m = COMMENT_REGEX.matcher(agent.getText());
// if (m.find()) {
// agent.setText(COMMENT + m.replaceFirst(""));
// } else {
// agent.setText(COMMENT + agent.getText());
// }
// }
// }
}
......@@ -24,7 +24,7 @@ class ActionEdit extends BaseAction {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
Invoke invoke = emc.flag(flag, Invoke.class );
Invoke invoke = emc.flag(flag, Invoke.class);
if (StringUtils.isEmpty(wi.getName())) {
throw new ExceptionEmptyName();
}
......@@ -38,7 +38,7 @@ class ActionEdit extends BaseAction {
}
emc.beginTransaction(Invoke.class);
Wi.copier.copy(wi, invoke);
this.addComment(invoke);
// this.addComment(invoke);
emc.check(invoke, CheckPersistType.all);
emc.commit();
CacheManager.notify(Invoke.class);
......
......@@ -17,14 +17,14 @@ class ActionUpdate extends BaseAction {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
Invoke invoke = emc.flag(flag, Invoke.class );
Invoke invoke = emc.flag(flag, Invoke.class);
if (null == invoke) {
throw new ExceptionInvokeNotExist(flag);
}
String text = new String(bytes, DefaultCharset.name);
emc.beginTransaction(Invoke.class);
invoke.setText(text);
this.addComment(invoke);
// this.addComment(invoke);
emc.commit();
wo.setId(invoke.getId());
result.setData(wo);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册