@Test(expected = NullPointerException.class) @Sql(scripts = { "/sql/clearAction.sql" }) public void testCreateActionsIfThereisNoActions() { ActionRequest actionRequest = new ActionRequest(); List<Action> actions = actionRepository.createAction(actionRequest); assertThat(actions).isEqualTo(null); }
public List<Action> createAction(final ActionRequest actionRequest) { LOGGER.info("Create Action Repository::" + actionRequest); final String actionInsert = ActionQueryBuilder.insertActionQuery(); List<Action> actions = actionRequest.getActions(); List<Map<String, Object>> batchValues = new ArrayList<>(actions.size()); for (Action action : actions) { batchValues.add(new MapSqlParameterSource("name", action.getName()).addValue("url", action.getUrl()) .addValue("servicecode", action.getServiceCode()).addValue("queryparams", action.getQueryParams()) .addValue("parentmodule", action.getParentModule()).addValue("ordernumber", action.getOrderNumber()) .addValue("displayname", action.getDisplayName()).addValue("enabled", action.isEnabled()) .addValue("createdby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())).getValues()); } namedParameterJdbcTemplate.batchUpdate(actionInsert, batchValues.toArray(new Map[actions.size()])); return actions; }
ActionRepository { public List<Action> createAction(final ActionRequest actionRequest) { LOGGER.info("Create Action Repository::" + actionRequest); final String actionInsert = ActionQueryBuilder.insertActionQuery(); List<Action> actions = actionRequest.getActions(); List<Map<String, Object>> batchValues = new ArrayList<>(actions.size()); for (Action action : actions) { batchValues.add(new MapSqlParameterSource("name", action.getName()).addValue("url", action.getUrl()) .addValue("servicecode", action.getServiceCode()).addValue("queryparams", action.getQueryParams()) .addValue("parentmodule", action.getParentModule()).addValue("ordernumber", action.getOrderNumber()) .addValue("displayname", action.getDisplayName()).addValue("enabled", action.isEnabled()) .addValue("createdby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())).getValues()); } namedParameterJdbcTemplate.batchUpdate(actionInsert, batchValues.toArray(new Map[actions.size()])); return actions; } }
ActionRepository { public List<Action> createAction(final ActionRequest actionRequest) { LOGGER.info("Create Action Repository::" + actionRequest); final String actionInsert = ActionQueryBuilder.insertActionQuery(); List<Action> actions = actionRequest.getActions(); List<Map<String, Object>> batchValues = new ArrayList<>(actions.size()); for (Action action : actions) { batchValues.add(new MapSqlParameterSource("name", action.getName()).addValue("url", action.getUrl()) .addValue("servicecode", action.getServiceCode()).addValue("queryparams", action.getQueryParams()) .addValue("parentmodule", action.getParentModule()).addValue("ordernumber", action.getOrderNumber()) .addValue("displayname", action.getDisplayName()).addValue("enabled", action.isEnabled()) .addValue("createdby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())).getValues()); } namedParameterJdbcTemplate.batchUpdate(actionInsert, batchValues.toArray(new Map[actions.size()])); return actions; }  }
ActionRepository { public List<Action> createAction(final ActionRequest actionRequest) { LOGGER.info("Create Action Repository::" + actionRequest); final String actionInsert = ActionQueryBuilder.insertActionQuery(); List<Action> actions = actionRequest.getActions(); List<Map<String, Object>> batchValues = new ArrayList<>(actions.size()); for (Action action : actions) { batchValues.add(new MapSqlParameterSource("name", action.getName()).addValue("url", action.getUrl()) .addValue("servicecode", action.getServiceCode()).addValue("queryparams", action.getQueryParams()) .addValue("parentmodule", action.getParentModule()).addValue("ordernumber", action.getOrderNumber()) .addValue("displayname", action.getDisplayName()).addValue("enabled", action.isEnabled()) .addValue("createdby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())).getValues()); } namedParameterJdbcTemplate.batchUpdate(actionInsert, batchValues.toArray(new Map[actions.size()])); return actions; }  List<Action> createAction(final ActionRequest actionRequest); List<Action> updateAction(final ActionRequest actionRequest); boolean checkActionNameExit(String actionName); boolean checkCombinationOfUrlAndqueryparamsExist(String url, String queryParams); ActionService getAllActionsBasedOnRoles(ActionRequest actionRequest); List<Action> getAllActions(ActionRequest actionRequest); List<Action> getAllMDMSActions(ActionRequest actionRequest); static RequestInfo getRInfo(); }
ActionRepository { public List<Action> createAction(final ActionRequest actionRequest) { LOGGER.info("Create Action Repository::" + actionRequest); final String actionInsert = ActionQueryBuilder.insertActionQuery(); List<Action> actions = actionRequest.getActions(); List<Map<String, Object>> batchValues = new ArrayList<>(actions.size()); for (Action action : actions) { batchValues.add(new MapSqlParameterSource("name", action.getName()).addValue("url", action.getUrl()) .addValue("servicecode", action.getServiceCode()).addValue("queryparams", action.getQueryParams()) .addValue("parentmodule", action.getParentModule()).addValue("ordernumber", action.getOrderNumber()) .addValue("displayname", action.getDisplayName()).addValue("enabled", action.isEnabled()) .addValue("createdby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("lastmodifiedby", Long.valueOf(actionRequest.getRequestInfo().getUserInfo().getId())) .addValue("createddate", new Date(new java.util.Date().getTime())) .addValue("lastmodifieddate", new Date(new java.util.Date().getTime())).getValues()); } namedParameterJdbcTemplate.batchUpdate(actionInsert, batchValues.toArray(new Map[actions.size()])); return actions; }  List<Action> createAction(final ActionRequest actionRequest); List<Action> updateAction(final ActionRequest actionRequest); boolean checkActionNameExit(String actionName); boolean checkCombinationOfUrlAndqueryparamsExist(String url, String queryParams); ActionService getAllActionsBasedOnRoles(ActionRequest actionRequest); List<Action> getAllActions(ActionRequest actionRequest); List<Action> getAllMDMSActions(ActionRequest actionRequest); static RequestInfo getRInfo(); static final Logger LOGGER; }