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}");
|
||||
}
|
||||
String pluginUIContent = plugin;
|
||||
System.out.println(pluginUIContent);
|
||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
||||
pluginUIContent));
|
||||
|
|
|
@ -14,17 +14,17 @@ import javax.persistence.Table;
|
|||
@Entity
|
||||
@Table(name = "behaviorInfo")
|
||||
public class BehaviorInfo extends ParamsContainer {
|
||||
private String behavoirType;
|
||||
private String behaviorType;
|
||||
private PluginUI pluginUI;
|
||||
private Set<Group> groups;
|
||||
|
||||
@Column(name = "behavoirType")
|
||||
public String getBehavoirType() {
|
||||
return behavoirType;
|
||||
@Column(name = "behaviorType")
|
||||
public String getBehaviorType() {
|
||||
return behaviorType;
|
||||
}
|
||||
|
||||
public void setBehavoirType(String behavoirType) {
|
||||
this.behavoirType = behavoirType;
|
||||
public void setBehaviorType(String behaviorType) {
|
||||
this.behaviorType = behaviorType;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="dateType")
|
||||
public class DateType extends ParamType {
|
||||
private int size;
|
||||
|
||||
@Column(name="size")
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="dateType")
|
||||
public class DateType extends ParamType {
|
||||
private int size;
|
||||
|
||||
@Column(name="size")
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fileType")
|
||||
public class FileType extends ParamType {
|
||||
private String text;
|
||||
|
||||
@Column(name = "text")
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fileType")
|
||||
public class FileType extends ParamType {
|
||||
private String text;
|
||||
|
||||
@Column(name = "text")
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,73 +1,73 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "param")
|
||||
public class ParamInfo {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String lable;
|
||||
private ParamType paramType;
|
||||
private ParamsContainer paramsContainer;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "name", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "lable")
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "typeId", nullable = false)
|
||||
public ParamType getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(ParamType paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "paramsContainerId", nullable = false)
|
||||
public ParamsContainer getParamsContainer() {
|
||||
return paramsContainer;
|
||||
}
|
||||
|
||||
public void setParamsContainer(ParamsContainer paramsContainer) {
|
||||
this.paramsContainer = paramsContainer;
|
||||
}
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "param")
|
||||
public class ParamInfo {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String lable;
|
||||
private ParamType paramType;
|
||||
private ParamsContainer paramsContainer;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "name", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "lable")
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "typeId", nullable = false)
|
||||
public ParamType getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(ParamType paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "paramsContainerId", nullable = false)
|
||||
public ParamsContainer getParamsContainer() {
|
||||
return paramsContainer;
|
||||
}
|
||||
|
||||
public void setParamsContainer(ParamsContainer paramsContainer) {
|
||||
this.paramsContainer = paramsContainer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,56 +1,64 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "paramsContainer")
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
public abstract class ParamsContainer {
|
||||
private int id;
|
||||
private String name;
|
||||
private Set<ParamInfo> params;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "containerName",nullable=false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "paramsContainer", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
|
||||
public Set<ParamInfo> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Set<ParamInfo> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "paramsContainer")
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
public abstract class ParamsContainer {
|
||||
private int id;
|
||||
private String name;
|
||||
private String nameCN;
|
||||
private Set<ParamInfo> params;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.TABLE)
|
||||
@Column(name = "id", nullable = false)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "containerName", nullable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String 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)
|
||||
public Set<ParamInfo> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Set<ParamInfo> params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ public class PluginUI {
|
|||
private PluginInfo pluginInfo;
|
||||
private Set<BehaviorInfo> behaviorInfos;
|
||||
private Date createDateTime;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
|
@ -62,4 +61,5 @@ public class PluginUI {
|
|||
this.createDateTime = createDateTime;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CollectionTable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "selectType")
|
||||
public class SelectType extends ParamType {
|
||||
private int size;
|
||||
private Set<String> options;
|
||||
|
||||
@Column(name = "size")
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@ElementCollection(fetch = FetchType.EAGER)
|
||||
@CollectionTable(name = "selectOptions", joinColumns = @JoinColumn(name = "select_id"))
|
||||
@Column(name = "selectOption", nullable = false)
|
||||
public Set<String> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(Set<String> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
}
|
||||
package org.bench4q.master.domain.entity.plugin;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CollectionTable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.Table;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "selectType")
|
||||
public class SelectType extends ParamType {
|
||||
private int size;
|
||||
private Set<String> options;
|
||||
|
||||
@Column(name = "size")
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@ElementCollection(fetch = FetchType.EAGER)
|
||||
@CollectionTable(name = "selectOptions", joinColumns = @JoinColumn(name = "select_id"))
|
||||
@Column(name = "selectOption", nullable = false)
|
||||
public Set<String> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(Set<String> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public class PluginDomainFactory {
|
|||
private PluginInfoModel createPluginInfoModel(PluginInfo pluginInfo) {
|
||||
PluginInfoModel pluginInfoModel = new PluginInfoModel();
|
||||
pluginInfoModel.setName(pluginInfo.getName());
|
||||
pluginInfoModel.setNameCN(pluginInfo.getNameCN());
|
||||
pluginInfoModel.setParamInfoModels(createParamInfoModels(pluginInfo
|
||||
.getParams()));
|
||||
pluginInfoModel
|
||||
|
@ -81,6 +82,7 @@ public class PluginDomainFactory {
|
|||
private BehaviorInfoModel createBehaviorInfoModel(BehaviorInfo behaviorInfo) {
|
||||
BehaviorInfoModel behaviorInfoModel = new BehaviorInfoModel();
|
||||
behaviorInfoModel.setName(behaviorInfo.getName());
|
||||
behaviorInfoModel.setNameCN(behaviorInfo.getNameCN());
|
||||
behaviorInfoModel.setParamInfoModels(createParamInfoModels(behaviorInfo
|
||||
.getParams()));
|
||||
behaviorInfoModel.setGroupModels(createGroupModels(behaviorInfo
|
||||
|
@ -141,6 +143,7 @@ public class PluginDomainFactory {
|
|||
}
|
||||
GroupModel groupModel = new GroupModel();
|
||||
groupModel.setName(group.getName());
|
||||
groupModel.setNameCN(group.getNameCN());
|
||||
groupModel.setParamInfoModels(createParamInfoModels(group.getParams()));
|
||||
return groupModel;
|
||||
|
||||
|
|
|
@ -73,8 +73,9 @@ public class PluginEntityFactory {
|
|||
private BehaviorInfo createBehaviorInfoWithOutId(Element element,
|
||||
PluginUI pluginUI) {
|
||||
BehaviorInfo behaviorInfo = new BehaviorInfo();
|
||||
behaviorInfo.setBehavoirType(element.getName());
|
||||
behaviorInfo.setBehaviorType(element.getName());
|
||||
behaviorInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||
behaviorInfo.setNameCN(XmlParseHelper.getAttribute(element, "nameCN"));
|
||||
behaviorInfo.setPluginUI(pluginUI);
|
||||
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
||||
element, "params");
|
||||
|
@ -91,6 +92,7 @@ public class PluginEntityFactory {
|
|||
|
||||
PluginInfo pluginInfo = new PluginInfo();
|
||||
pluginInfo.setName(XmlParseHelper.getAttribute(element, "name"));
|
||||
pluginInfo.setNameCN(XmlParseHelper.getAttribute(element, "nameCN"));
|
||||
Element paramsElement = XmlParseHelper.getOneChildElementByName(
|
||||
element, "params");
|
||||
pluginInfo.setGroups(createGroups(
|
||||
|
@ -124,6 +126,8 @@ public class PluginEntityFactory {
|
|||
Group paramsContainer = new Group();
|
||||
paramsContainer.setName(XmlParseHelper.getAttribute(groupElement,
|
||||
"name"));
|
||||
paramsContainer.setNameCN(XmlParseHelper.getAttribute(groupElement,
|
||||
"nameCN"));
|
||||
|
||||
List<Element> paramElements = XmlParseHelper.getChildElementsByName(
|
||||
groupElement, "param");
|
||||
|
@ -148,6 +152,7 @@ public class PluginEntityFactory {
|
|||
}
|
||||
return paramInfos;
|
||||
}
|
||||
|
||||
private ParamInfo createParamInfoWithOutId(Element paramElement,
|
||||
ParamsContainer paramsContainer) {
|
||||
if (!paramElement.getName().equals("param")) {
|
||||
|
|
|
@ -60,7 +60,7 @@ public class Test_PluginEntityFactory {
|
|||
int timerCount = 0;
|
||||
System.out.println(pluginUI.getBehaviorInfos().size());
|
||||
for (BehaviorInfo behaviorInfo : pluginUI.getBehaviorInfos()) {
|
||||
if (behaviorInfo.getBehavoirType().equals("timer"))
|
||||
if (behaviorInfo.getBehaviorType().equals("timer"))
|
||||
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