How to use getDescription method of org.cerberus.crud.entity.DeployType class

Best Cerberus-source code snippet using org.cerberus.crud.entity.DeployType.getDescription

Source:CreateDeployType.java Github

copy

Full Screen

...66 throws ServletException, IOException, CerberusException, JSONException {67 JSONObject jsonResponse = new JSONObject();68 Answer ans = new Answer();69 MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);70 msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));71 ans.setResultMessage(msg);72 PolicyFactory policy = Sanitizers.FORMATTING.and(Sanitizers.LINKS);73 response.setContentType("application/json");74 // Calling Servlet Transversal Util.75 ServletUtil.servletStart(request);76 77 /**78 * Parsing and securing all required parameters.79 */80 String deploytype = policy.sanitize(request.getParameter("deploytype"));81 String description = policy.sanitize(request.getParameter("description"));82 /**83 * Checking all constrains before calling the services.84 */85 if (StringUtil.isNullOrEmpty(deploytype)) {86 msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_EXPECTED);87 msg.setDescription(msg.getDescription().replace("%ITEM%", "Deploy Type")88 .replace("%OPERATION%", "Create")89 .replace("%REASON%", "Deploy Type name is missing!"));90 ans.setResultMessage(msg);91 } else {92 /**93 * All data seems cleans so we can call the services.94 */95 ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());96 IDeployTypeService deployTypeService = appContext.getBean(IDeployTypeService.class);97 IFactoryDeployType factoryDeployType = appContext.getBean(IFactoryDeployType.class);98 DeployType deployTypeData = factoryDeployType.create(deploytype, description);99 ans = deployTypeService.create(deployTypeData);100 if (ans.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {101 /**102 * Object created. Adding Log entry.103 */104 ILogEventService logEventService = appContext.getBean(LogEventService.class);105 logEventService.createForPrivateCalls("/CreateDeployType", "CREATE", "Create DeployType : ['" + deploytype + "']", request);106 }107 }108 /**109 * Formating and returning the json result.110 */111 jsonResponse.put("messageType", ans.getResultMessage().getMessage().getCodeString());112 jsonResponse.put("message", ans.getResultMessage().getDescription());113 response.getWriter().print(jsonResponse);114 response.getWriter().flush();115 }116 // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">117 /**118 * Handles the HTTP <code>GET</code> method.119 *120 * @param request servlet request121 * @param response servlet response122 * @throws ServletException if a servlet-specific error occurs123 * @throws IOException if an I/O error occurs124 */125 @Override126 protected void doGet(HttpServletRequest request, HttpServletResponse response)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Cerberus-source automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful