Merge branch 'master' of https://github.com/lostcharlie/Bench4Q
This commit is contained in:
commit
41190529b1
|
@ -147,6 +147,7 @@ public class PluginController extends BaseController {
|
||||||
"addPlugin/{pluginName}/{methodName}");
|
"addPlugin/{pluginName}/{methodName}");
|
||||||
}
|
}
|
||||||
String pluginUIContent = plugin;
|
String pluginUIContent = plugin;
|
||||||
|
System.out.println(pluginUIContent);
|
||||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||||
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
||||||
pluginUIContent));
|
pluginUIContent));
|
||||||
|
|
|
@ -14,17 +14,17 @@ import javax.persistence.Table;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "behaviorInfo")
|
@Table(name = "behaviorInfo")
|
||||||
public class BehaviorInfo extends ParamsContainer {
|
public class BehaviorInfo extends ParamsContainer {
|
||||||
private String behavoirType;
|
private String behaviorType;
|
||||||
private PluginUI pluginUI;
|
private PluginUI pluginUI;
|
||||||
private Set<Group> groups;
|
private Set<Group> groups;
|
||||||
|
|
||||||
@Column(name = "behavoirType")
|
@Column(name = "behaviorType")
|
||||||
public String getBehavoirType() {
|
public String getBehaviorType() {
|
||||||
return behavoirType;
|
return behaviorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBehavoirType(String behavoirType) {
|
public void setBehaviorType(String behaviorType) {
|
||||||
this.behavoirType = behavoirType;
|
this.behaviorType = behaviorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
|
|
@ -14,13 +14,13 @@ import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "paramsContainer")
|
@Table(name = "paramsContainer")
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
public abstract class ParamsContainer {
|
public abstract class ParamsContainer {
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
|
private String nameCN;
|
||||||
private Set<ParamInfo> params;
|
private Set<ParamInfo> params;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@ -34,7 +34,7 @@ public abstract class ParamsContainer {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(name = "containerName",nullable=false)
|
@Column(name = "containerName", nullable = false)
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,15 @@ public abstract class ParamsContainer {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Column(name = "nameCN", nullable = false)
|
||||||
|
public String getNameCN() {
|
||||||
|
return nameCN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameCN(String nameCN) {
|
||||||
|
this.nameCN = nameCN;
|
||||||
|
}
|
||||||
|
|
||||||
@OneToMany(mappedBy = "paramsContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "paramsContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||||
public Set<ParamInfo> getParams() {
|
public Set<ParamInfo> getParams() {
|
||||||
return params;
|
return params;
|
||||||
|
@ -52,5 +61,4 @@ public abstract class ParamsContainer {
|
||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ public class PluginUI {
|
||||||
private PluginInfo pluginInfo;
|
private PluginInfo pluginInfo;
|
||||||
private Set<BehaviorInfo> behaviorInfos;
|
private Set<BehaviorInfo> behaviorInfos;
|
||||||
private Date createDateTime;
|
private Date createDateTime;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "id", nullable = false)
|
@Column(name = "id", nullable = false)
|
||||||
|
@ -62,4 +61,5 @@ public class PluginUI {
|
||||||
this.createDateTime = createDateTime;
|
this.createDateTime = createDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class PluginDomainFactory {
|
||||||
private PluginInfoModel createPluginInfoModel(PluginInfo pluginInfo) {
|
private PluginInfoModel createPluginInfoModel(PluginInfo pluginInfo) {
|
||||||
PluginInfoModel pluginInfoModel = new PluginInfoModel();
|
PluginInfoModel pluginInfoModel = new PluginInfoModel();
|
||||||
pluginInfoModel.setName(pluginInfo.getName());
|
pluginInfoModel.setName(pluginInfo.getName());
|
||||||
|
pluginInfoModel.setNameCN(pluginInfo.getNameCN());
|
||||||
pluginInfoModel.setParamInfoModels(createParamInfoModels(pluginInfo
|
pluginInfoModel.setParamInfoModels(createParamInfoModels(pluginInfo
|
||||||
.getParams()));
|
.getParams()));
|
||||||
pluginInfoModel
|
pluginInfoModel
|
||||||
|
@ -81,6 +82,7 @@ public class PluginDomainFactory {
|
||||||
private BehaviorInfoModel createBehaviorInfoModel(BehaviorInfo behaviorInfo) {
|
private BehaviorInfoModel createBehaviorInfoModel(BehaviorInfo behaviorInfo) {
|
||||||
BehaviorInfoModel behaviorInfoModel = new BehaviorInfoModel();
|
BehaviorInfoModel behaviorInfoModel = new BehaviorInfoModel();
|
||||||
behaviorInfoModel.setName(behaviorInfo.getName());
|
behaviorInfoModel.setName(behaviorInfo.getName());
|
||||||
|
behaviorInfoModel.setNameCN(behaviorInfo.getNameCN());
|
||||||
behaviorInfoModel.setParamInfoModels(createParamInfoModels(behaviorInfo
|
behaviorInfoModel.setParamInfoModels(createParamInfoModels(behaviorInfo
|
||||||
.getParams()));
|
.getParams()));
|
||||||
behaviorInfoModel.setGroupModels(createGroupModels(behaviorInfo
|
behaviorInfoModel.setGroupModels(createGroupModels(behaviorInfo
|
||||||
|
@ -141,6 +143,7 @@ public class PluginDomainFactory {
|
||||||
}
|
}
|
||||||
GroupModel groupModel = new GroupModel();
|
GroupModel groupModel = new GroupModel();
|
||||||
groupModel.setName(group.getName());
|
groupModel.setName(group.getName());
|
||||||
|
groupModel.setNameCN(group.getNameCN());
|
||||||
groupModel.setParamInfoModels(createParamInfoModels(group.getParams()));
|
groupModel.setParamInfoModels(createParamInfoModels(group.getParams()));
|
||||||
return groupModel;
|
return groupModel;
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,9 @@ public class PluginEntityFactory {
|
||||||
private BehaviorInfo createBehaviorInfoWithOutId(Element element,
|
private BehaviorInfo createBehaviorInfoWithOutId(Element element,
|
||||||
PluginUI pluginUI) {
|
PluginUI pluginUI) {
|
||||||
BehaviorInfo behaviorInfo = new BehaviorInfo();
|
BehaviorInfo behaviorInfo = new BehaviorInfo();
|
||||||
behaviorInfo.setBehavoirType(element.getName());
|
behaviorInfo.setBehaviorType(element.getName());
|
||||||
behaviorInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
behaviorInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||||
|
behaviorInfo.setNameCN(XmlParseHelper.getAttribute(element, "nameCN"));
|
||||||
behaviorInfo.setPluginUI(pluginUI);
|
behaviorInfo.setPluginUI(pluginUI);
|
||||||
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
||||||
element, "params");
|
element, "params");
|
||||||
|
@ -91,6 +92,7 @@ public class PluginEntityFactory {
|
||||||
|
|
||||||
PluginInfo pluginInfo = new PluginInfo();
|
PluginInfo pluginInfo = new PluginInfo();
|
||||||
pluginInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
pluginInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||||
|
pluginInfo.setNameCN(XmlParseHelper.getAttribute(element, "nameCN"));
|
||||||
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
||||||
element, "params");
|
element, "params");
|
||||||
pluginInfo.setGroups(createGroups(
|
pluginInfo.setGroups(createGroups(
|
||||||
|
@ -124,6 +126,8 @@ public class PluginEntityFactory {
|
||||||
Group paramsContainer = new Group();
|
Group paramsContainer = new Group();
|
||||||
paramsContainer.setName(XmlParseHelper.getAttribute(groupElement,
|
paramsContainer.setName(XmlParseHelper.getAttribute(groupElement,
|
||||||
"name"));
|
"name"));
|
||||||
|
paramsContainer.setNameCN(XmlParseHelper.getAttribute(groupElement,
|
||||||
|
"nameCN"));
|
||||||
|
|
||||||
List<Element> paramElements = XmlParseHelper.getChildElementsByName(
|
List<Element> paramElements = XmlParseHelper.getChildElementsByName(
|
||||||
groupElement, "param");
|
groupElement, "param");
|
||||||
|
@ -148,6 +152,7 @@ public class PluginEntityFactory {
|
||||||
}
|
}
|
||||||
return paramInfos;
|
return paramInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParamInfo createParamInfoWithOutId(Element paramElement,
|
private ParamInfo createParamInfoWithOutId(Element paramElement,
|
||||||
ParamsContainer paramsContainer) {
|
ParamsContainer paramsContainer) {
|
||||||
if (!paramElement.getName().equals("param")) {
|
if (!paramElement.getName().equals("param")) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class Test_PluginEntityFactory {
|
||||||
int timerCount = 0;
|
int timerCount = 0;
|
||||||
System.out.println(pluginUI.getBehaviorInfos().size());
|
System.out.println(pluginUI.getBehaviorInfos().size());
|
||||||
for (BehaviorInfo behaviorInfo : pluginUI.getBehaviorInfos()) {
|
for (BehaviorInfo behaviorInfo : pluginUI.getBehaviorInfos()) {
|
||||||
if (behaviorInfo.getBehavoirType().equals("timer"))
|
if (behaviorInfo.getBehaviorType().equals("timer"))
|
||||||
timerCount++;
|
timerCount++;
|
||||||
}
|
}
|
||||||
assertEquals(1, timerCount);
|
assertEquals(1, timerCount);
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue