Search in sources :

Example 6 with IBuildRevisionParametersService

use of org.cerberus.crud.service.IBuildRevisionParametersService in project cerberus-source by cerberustesting.

the class ReadBuildRevisionParameters method findBuildRevisionParametersByKey.

private AnswerItem findBuildRevisionParametersByKey(Integer id, ApplicationContext appContext, boolean userHasPermissions) throws JSONException, CerberusException {
    AnswerItem item = new AnswerItem();
    JSONObject object = new JSONObject();
    IBuildRevisionParametersService libService = appContext.getBean(IBuildRevisionParametersService.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
        BuildRevisionParameters brp = (BuildRevisionParameters) answer.getItem();
        JSONObject response = convertBuildRevisionParametersToJSONObject(brp);
        object.put("contentTable", response);
    }
    object.put("hasPermissions", userHasPermissions);
    item.setItem(object);
    item.setResultMessage(answer.getResultMessage());
    return item;
}
Also used : JSONObject(org.json.JSONObject) BuildRevisionParameters(org.cerberus.crud.entity.BuildRevisionParameters) IBuildRevisionParametersService(org.cerberus.crud.service.IBuildRevisionParametersService) AnswerItem(org.cerberus.util.answer.AnswerItem)

Aggregations

BuildRevisionParameters (org.cerberus.crud.entity.BuildRevisionParameters)6 IBuildRevisionParametersService (org.cerberus.crud.service.IBuildRevisionParametersService)6 AnswerItem (org.cerberus.util.answer.AnswerItem)5 JSONObject (org.json.JSONObject)5 ILogEventService (org.cerberus.crud.service.ILogEventService)4 MessageEvent (org.cerberus.engine.entity.MessageEvent)4 ApplicationContext (org.springframework.context.ApplicationContext)4 IOException (java.io.IOException)3 ServletException (javax.servlet.ServletException)3 Answer (org.cerberus.util.answer.Answer)3 PolicyFactory (org.owasp.html.PolicyFactory)3 IFactoryBuildRevisionParameters (org.cerberus.crud.factory.IFactoryBuildRevisionParameters)2 CerberusException (org.cerberus.exception.CerberusException)2 JSONException (org.json.JSONException)2 PrintWriter (java.io.PrintWriter)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 IApplicationService (org.cerberus.crud.service.IApplicationService)1 IProjectService (org.cerberus.crud.service.IProjectService)1 IUserService (org.cerberus.crud.service.IUserService)1