use of org.cerberus.crud.service.IRobotService in project cerberus-source by cerberustesting.
the class ReadRobot method findRobotByKeyTech.
private AnswerItem findRobotByKeyTech(Integer id, ApplicationContext appContext, boolean userHasPermissions) throws JSONException, CerberusException {
AnswerItem item = new AnswerItem();
JSONObject object = new JSONObject();
IRobotService libService = appContext.getBean(IRobotService.class);
// finds the project
AnswerItem answer = libService.readByKeyTech(id);
if (answer.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
// if the service returns an OK message then we can get the item and convert it to JSONformat
Robot lib = (Robot) answer.getItem();
if (lib != null) {
// hide the password to the view
lib.setHostPassword(null);
}
JSONObject response = convertRobotToJSONObject(lib);
object.put("contentTable", response);
}
object.put("hasPermissions", userHasPermissions);
item.setItem(object);
item.setResultMessage(answer.getResultMessage());
return item;
}
Aggregations