Skip to content

Commit

Permalink
replaced combo box into checkbox on Robot modal
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Jul 28, 2024
1 parent d14b147 commit e15376b
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public QueuedExecutionResult addCampaignToExecutionQueue(String campaignId, Queu
LOG.debug("MANUALEXEC {}", manualExecution);
if (CollectionUtils.isEmpty(robots)) {
if (manualExecution.equalsIgnoreCase("Y") || manualExecution.equalsIgnoreCase("A")) {
robotsMap.put("", robotFactory.create(0, "", "", "", "", "Y", "", "", "", "", "", "", true, "", ""));
robotsMap.put("", robotFactory.create(0, "", "", "", "", true, "", "", "", "", "", "", true, "", ""));
} else {
throw new InvalidRequestException("No robots found for this campaign");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public AnswerList<Robot> readByCriteria(int start, int amount, String column, St
public Answer create(Robot robot) {
MessageEvent msg = null;
StringBuilder query = new StringBuilder();
query.append("INSERT INTO robot (`robot`, `platform`,`browser`, `version`,`active` , `description`, `useragent`, `screensize`, `ProfileFolder`, `ExtraParam`, `IsAcceptInsecureCerts`, `robotdecli`, `lbexemethod`, `type`) ");
query.append("INSERT INTO robot (`robot`, `platform`,`browser`, `version`,`isactive` , `description`, `useragent`, `screensize`, `ProfileFolder`, `ExtraParam`, `IsAcceptInsecureCerts`, `robotdecli`, `lbexemethod`, `type`) ");

query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

Expand All @@ -398,7 +398,7 @@ public Answer create(Robot robot) {
preStat.setString(i++, robot.getPlatform());
preStat.setString(i++, robot.getBrowser());
preStat.setString(i++, robot.getVersion());
preStat.setString(i++, robot.getActive());
preStat.setBoolean(i++, robot.isActive());
preStat.setString(i++, robot.getDescription());
preStat.setString(i++, robot.getUserAgent());
preStat.setString(i++, robot.getScreenSize());
Expand Down Expand Up @@ -488,7 +488,7 @@ public Answer update(Robot robot) {
MessageEvent msg = null;
StringBuilder query = new StringBuilder();
query.append("UPDATE robot SET robot= ? ,");
query.append("platform = ?, browser = ? , version = ?, active=?, description = ?, useragent = ?, screensize = ?, ProfileFolder = ?, ExtraParam = ?, IsAcceptInsecureCerts = ?, robotdecli = ?, lbexemethod = ?, type = ?, dateModif = NOW() ");
query.append("platform = ?, browser = ? , version = ?, isactive=?, description = ?, useragent = ?, screensize = ?, ProfileFolder = ?, ExtraParam = ?, IsAcceptInsecureCerts = ?, robotdecli = ?, lbexemethod = ?, type = ?, dateModif = NOW() ");
query.append("WHERE robotID = ?");

// Debug message on SQL.
Expand All @@ -504,7 +504,7 @@ public Answer update(Robot robot) {
preStat.setString(cpt++, robot.getPlatform());
preStat.setString(cpt++, robot.getBrowser());
preStat.setString(cpt++, robot.getVersion());
preStat.setString(cpt++, robot.getActive());
preStat.setBoolean(cpt++, robot.isActive());
preStat.setString(cpt++, robot.getDescription());
preStat.setString(cpt++, robot.getUserAgent());
preStat.setString(cpt++, robot.getScreenSize());
Expand Down Expand Up @@ -549,7 +549,7 @@ public Robot loadFromResultSet(ResultSet rs) throws SQLException {
String platform = ParameterParserUtil.parseStringParam(rs.getString("platform"), "");
String browser = ParameterParserUtil.parseStringParam(rs.getString("browser"), "");
String version = ParameterParserUtil.parseStringParam(rs.getString("version"), "");
String active = ParameterParserUtil.parseStringParam(rs.getString("active"), "");
boolean isActive = ParameterParserUtil.parseBooleanParam(rs.getString("isActive"), true);
String lbexemethod = ParameterParserUtil.parseStringParam(rs.getString("lbexemethod"), "");
String description = ParameterParserUtil.parseStringParam(rs.getString("description"), "");
String userAgent = ParameterParserUtil.parseStringParam(rs.getString("useragent"), "");
Expand All @@ -562,7 +562,7 @@ public Robot loadFromResultSet(ResultSet rs) throws SQLException {

//TODO remove when working in test with mockito and autowired
factoryRobot = new FactoryRobot();
return factoryRobot.create(robotID, robot, platform, browser, version, active, lbexemethod, description, userAgent, screenSize, profileFolder, extraParam, isAcceptInsecureCerts, robotDecli, type);
return factoryRobot.create(robotID, robot, platform, browser, version, isActive, lbexemethod, description, userAgent, screenSize, profileFolder, extraParam, isAcceptInsecureCerts, robotDecli, type);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public AnswerList<RobotExecutor> readByVariousByCriteria(List<String> robot, Str
if (!StringUtil.isEmpty(searchTerm)) {
searchSQL.append(" and (rbe.`robot` like ?");
searchSQL.append(" or rbe.`executor` like ?");
searchSQL.append(" or rbe.`active` like ?");
searchSQL.append(" or rbe.`rank` like ?");
searchSQL.append(" or rbe.`host` like ?");
searchSQL.append(" or rbe.`port` like ?");
Expand Down Expand Up @@ -211,7 +210,6 @@ public AnswerList<RobotExecutor> readByVariousByCriteria(List<String> robot, Str
preStat.setString(i++, "%" + searchTerm + "%");
preStat.setString(i++, "%" + searchTerm + "%");
preStat.setString(i++, "%" + searchTerm + "%");
preStat.setString(i++, "%" + searchTerm + "%");
}
for (String individualColumnSearchValue : individalColumnSearchValues) {
preStat.setString(i++, individualColumnSearchValue);
Expand Down Expand Up @@ -270,7 +268,7 @@ public AnswerList<RobotExecutor> readByVariousByCriteria(List<String> robot, Str
public Answer create(RobotExecutor object) {
MessageEvent msg = null;
StringBuilder query = new StringBuilder();
query.append("INSERT INTO robotexecutor (`robot`, `executor`, `active`, `rank`, `host`, `port`, `host_user`, `host_password`, `deviceudid`, `devicename`, `deviceport`, `devicelockunlock`, `executorextensionhost`, `executorextensionport`, `executorproxyhost`, `executorproxyport`, `executorproxytype`, `description`, `usrcreated`) ");
query.append("INSERT INTO robotexecutor (`robot`, `executor`, `isactive`, `rank`, `host`, `port`, `host_user`, `host_password`, `deviceudid`, `devicename`, `deviceport`, `isdevicelockunlock`, `executorextensionhost`, `executorextensionport`, `executorproxyhost`, `executorproxyport`, `executorproxytype`, `description`, `usrcreated`) ");
query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

// Debug message on SQL.
Expand All @@ -284,7 +282,7 @@ public Answer create(RobotExecutor object) {
int i = 1;
preStat.setString(i++, object.getRobot());
preStat.setString(i++, object.getExecutor());
preStat.setString(i++, object.getActive());
preStat.setBoolean(i++, object.isActive());
preStat.setInt(i++, object.getRank());
preStat.setString(i++, object.getHost());
preStat.setString(i++, object.getPort());
Expand All @@ -297,7 +295,7 @@ public Answer create(RobotExecutor object) {
} else {
preStat.setNull(i++, Types.INTEGER);
}
preStat.setString(i++, object.getDeviceLockUnlock());
preStat.setBoolean(i++, object.isDeviceLockUnlock());
preStat.setString(i++, object.getExecutorExtensionHost());
if (object.getExecutorExtensionPort() != null) {
preStat.setInt(i++, object.getExecutorExtensionPort());
Expand Down Expand Up @@ -368,7 +366,7 @@ public Answer delete(RobotExecutor object) {
@Override
public Answer update(String robot, String executor, RobotExecutor object) {
MessageEvent msg = null;
final String query = "UPDATE robotexecutor SET `robot` = ?, `executor` = ?, description = ?, active = ?, `rank` = ?, `host` = ?, `port` = ?, `host_user` = ?, `host_password` = ?, `deviceudid` = ?, `devicename` = ?, `deviceport` = ?, `devicelockunlock` = ?, `executorextensionhost` = ?, `executorextensionport` = ?, `executorproxyhost` = ?, `executorproxyport` = ?, `executorproxytype` = ?, "
final String query = "UPDATE robotexecutor SET `robot` = ?, `executor` = ?, description = ?, isactive = ?, `rank` = ?, `host` = ?, `port` = ?, `host_user` = ?, `host_password` = ?, `deviceudid` = ?, `devicename` = ?, `deviceport` = ?, `isdevicelockunlock` = ?, `executorextensionhost` = ?, `executorextensionport` = ?, `executorproxyhost` = ?, `executorproxyport` = ?, `executorproxytype` = ?, "
+ "dateModif = NOW(), usrModif= ? WHERE `robot` = ? and `executor` = ?";

// Debug message on SQL.
Expand All @@ -384,7 +382,7 @@ public Answer update(String robot, String executor, RobotExecutor object) {
preStat.setString(i++, object.getRobot());
preStat.setString(i++, object.getExecutor());
preStat.setString(i++, object.getDescription());
preStat.setString(i++, object.getActive());
preStat.setBoolean(i++, object.isActive());
preStat.setInt(i++, object.getRank());
preStat.setString(i++, object.getHost());
preStat.setString(i++, object.getPort());
Expand All @@ -397,7 +395,7 @@ public Answer update(String robot, String executor, RobotExecutor object) {
} else {
preStat.setNull(i++, Types.INTEGER);
}
preStat.setString(i++, object.getDeviceLockUnlock());
preStat.setBoolean(i++, object.isDeviceLockUnlock());
preStat.setString(i++, object.getExecutorExtensionHost());
if (object.getExecutorExtensionPort() != null) {
preStat.setInt(i++, object.getExecutorExtensionPort());
Expand Down Expand Up @@ -462,7 +460,7 @@ public RobotExecutor loadFromResultSet(ResultSet rs) throws SQLException {
int id = ParameterParserUtil.parseIntegerParam(rs.getString("rbe.id"), 0);
String robot = ParameterParserUtil.parseStringParam(rs.getString("rbe.robot"), "");
String executor = ParameterParserUtil.parseStringParam(rs.getString("rbe.executor"), "");
String active = ParameterParserUtil.parseStringParam(rs.getString("rbe.active"), "");
boolean isActive = rs.getBoolean("rbe.isActive");
int rank = ParameterParserUtil.parseIntegerParam(rs.getString("rbe.rank"), 0);
String host = ParameterParserUtil.parseStringParam(rs.getString("rbe.host"), "");
String port = ParameterParserUtil.parseStringParam(rs.getString("rbe.port"), "");
Expand All @@ -472,7 +470,7 @@ public RobotExecutor loadFromResultSet(ResultSet rs) throws SQLException {
String deviceudid = ParameterParserUtil.parseStringParam(rs.getString("rbe.deviceudid"), "");
String devicename = ParameterParserUtil.parseStringParam(rs.getString("rbe.devicename"), "");
Integer deviceport = rs.getInt("rbe.deviceport");
String devicelockunlock = rs.getString("rbe.devicelockunlock");
boolean isDevicelockunlock = rs.getBoolean("rbe.isdevicelockunlock");
String executorExtensionHost = rs.getString("rbe.executorextensionhost");
Integer executorExtensionPort = rs.getInt("rbe.executorextensionport");
String executorProxyHost = rs.getString("rbe.executorproxyhost");
Expand All @@ -490,7 +488,7 @@ public RobotExecutor loadFromResultSet(ResultSet rs) throws SQLException {

//TODO remove when working in test with mockito and autowired
factoryRobotExecutor = new FactoryRobotExecutor();
return factoryRobotExecutor.create(id, robot, executor, active, rank, host, port, host_user, host_password, nodeProxyPort, deviceudid, devicename, deviceport, devicelockunlock, executorExtensionHost, executorExtensionPort, executorProxyHost, executorProxyPort, executorProxyType, description, usrCreated, dateCreated, usrModif, dateModif);
return factoryRobotExecutor.create(id, robot, executor, isActive, rank, host, port, host_user, host_password, nodeProxyPort, deviceudid, devicename, deviceport, isDevicelockunlock, executorExtensionHost, executorExtensionPort, executorProxyHost, executorProxyPort, executorProxyType, description, usrCreated, dateCreated, usrModif, dateModif);
}

@Override
Expand All @@ -516,7 +514,6 @@ public AnswerList<String> readDistinctValuesByCriteria(String robot, String sear
if (!StringUtil.isEmpty(searchTerm)) {
searchSQL.append(" and (src.`robot` like ?");
searchSQL.append(" or src.`executor` like ?");
searchSQL.append(" or src.`active` like ?");
searchSQL.append(" or src.`rank` like ?");
searchSQL.append(" or src.`host` like ?");
searchSQL.append(" or src.`usrCreated` like ?");
Expand Down Expand Up @@ -559,7 +556,6 @@ public AnswerList<String> readDistinctValuesByCriteria(String robot, String sear
preStat.setString(i++, "%" + searchTerm + "%");
preStat.setString(i++, "%" + searchTerm + "%");
preStat.setString(i++, "%" + searchTerm + "%");
preStat.setString(i++, "%" + searchTerm + "%");
}
for (String individualColumnSearchValue : individalColumnSearchValues) {
preStat.setString(i++, individualColumnSearchValue);
Expand Down
12 changes: 6 additions & 6 deletions source/src/main/java/org/cerberus/core/crud/entity/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Robot {
private String platform;
private String browser;
private String version;
private String active;
private boolean isActive;
private String userAgent;
private String screenSize;
private String profileFolder;
Expand Down Expand Up @@ -186,12 +186,12 @@ public void setRobot(String robot) {
this.robot = robot;
}

public String getActive() {
return active;
public boolean isActive() {
return isActive;
}

public void setActive(String active) {
this.active = active;
public void setIsActive(boolean active) {
this.isActive = active;
}

public String getDescription() {
Expand Down Expand Up @@ -252,7 +252,7 @@ public void setType(String type) {
public JSONObject toJson(boolean withChilds, boolean secured) {
JSONObject result = new JSONObject();
try {
result.put("active", this.getActive());
result.put("isActive", this.isActive());
result.put("description", this.getDescription());
result.put("userAgent", this.getUserAgent());
result.put("robotID", this.getRobotID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RobotExecutor {
private Integer ID;
private String robot;
private String executor;
private String active;
private boolean isActive;
private Integer rank;
private String host;
private String port;
Expand All @@ -47,7 +47,7 @@ public class RobotExecutor {
private String deviceUdid;
private String deviceName;
private Integer devicePort;
private String deviceLockUnlock;
private boolean isDeviceLockUnlock;
private String description;
private long dateLastExeSubmitted;
private String executorProxyType;
Expand Down Expand Up @@ -107,12 +107,12 @@ public void setDateLastExeSubmitted(long dateLastExeSubmitted) {
this.dateLastExeSubmitted = dateLastExeSubmitted;
}

public String getActive() {
return active;
public boolean isActive() {
return isActive;
}

public void setActive(String active) {
this.active = active;
public void setIsActive(boolean isActive) {
this.isActive = isActive;
}

public Integer getRank() {
Expand Down Expand Up @@ -255,19 +255,16 @@ public void setExecutorProxyType(String executorProxyType) {
this.executorProxyType = executorProxyType;
}

/**
* From here are data outside database model.
*/
public void setDateModif(Timestamp DateModif) {
this.DateModif = DateModif;
}

public String getDeviceLockUnlock() {
return deviceLockUnlock;
public boolean isDeviceLockUnlock() {
return isDeviceLockUnlock;
}

public void setDeviceLockUnlock(String deviceLockUnlock) {
this.deviceLockUnlock = deviceLockUnlock;
public void setIsDeviceLockUnlock(boolean isDeviceLockUnlock) {
this.isDeviceLockUnlock = isDeviceLockUnlock;
}

public String getHostWithCredential() {
Expand Down Expand Up @@ -310,7 +307,8 @@ public int hashCode() {
hash = 67 * hash + (this.hostPassword != null ? this.hostPassword.hashCode() : 0);
hash = 67 * hash + (this.deviceUdid != null ? this.deviceUdid.hashCode() : 0);
hash = 67 * hash + (this.deviceName != null ? this.deviceName.hashCode() : 0);
hash = 67 * hash + (this.active != null ? this.active.hashCode() : 0);
hash = 67 * hash + (this.isActive ? 1 : 0);
hash = 67 * hash + (this.isDeviceLockUnlock ? 1 : 0);
hash = 67 * hash + (this.description != null ? this.description.hashCode() : 0);
return hash;
}
Expand Down Expand Up @@ -355,13 +353,13 @@ public boolean equals(Object obj) {
if ((this.devicePort == null) ? (other.devicePort != null) : !this.devicePort.equals(other.devicePort)) {
return false;
}
if ((this.active == null) ? (other.active != null) : !this.active.equals(other.active)) {
if (this.isActive != other.isActive) {
return false;
}
if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
return false;
}
if ((this.deviceLockUnlock == null) ? (other.deviceLockUnlock != null) : !this.deviceLockUnlock.equals(other.deviceLockUnlock)) {
if (this.isDeviceLockUnlock != other.isDeviceLockUnlock) {
return false;
}
if ((this.executorProxyType == null) ? (other.executorProxyType != null) : !this.executorProxyType.equals(other.executorProxyType)) {
Expand Down Expand Up @@ -395,12 +393,12 @@ public JSONObject toJson(boolean secured) {
result.put("ID", this.getID());
result.put("UsrCreated", this.getUsrCreated());
result.put("UsrModif", this.getUsrModif());
result.put("active", this.getActive());
result.put("isActive", this.isActive());
result.put("description", this.getDescription());
result.put("deviceName", this.getDeviceName());
result.put("deviceUdid", this.getDeviceUuid());
result.put("devicePort", this.getDevicePort());
result.put("deviceLockUnlock", "Y".equals(this.getDeviceLockUnlock()));
result.put("isDeviceLockUnlock", this.isDeviceLockUnlock());
result.put("executorExtensionHost", this.getExecutorExtensionHost());
result.put("executorExtensionPort", this.getExecutorExtensionPort());
result.put("executorProxyHost", this.getExecutorProxyHost());
Expand Down
Loading

0 comments on commit e15376b

Please sign in to comment.