@Test(expected = ActionDeniedException.class) public void testHandlePostGuest() throws Exception { ActionParameters params = createActionParams(createDummyLocale()); handler.handlePost(params); fail("Should have thrown denied exception"); }
public void handlePost(ActionParameters params) throws ActionException { params.requireAdminUser(); MaplayerGroup maplayerGroup = populateFromRequest(params.getPayLoadJSON()); if (maplayerGroup.getId() == -1) { maplayerGroup.setId(params.getRequiredParamInt(PARAM_ID)); } maplayerGroup.setOrderNumber(getEnsuredOrderNumber(maplayerGroup)); oskariMapLayerGroupService.update(maplayerGroup); AuditLog.user(params.getClientIp(), params.getUser()).withParam("id", maplayerGroup.getId()) .withParam("name", maplayerGroup.getName(PropertyUtil.getDefaultLanguage())) .updated(AuditLog.ResourceType.MAPLAYER_GROUP); ResponseHelper.writeResponse(params, maplayerGroup.getAsJSON()); }
MapLayerGroupsHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { params.requireAdminUser(); MaplayerGroup maplayerGroup = populateFromRequest(params.getPayLoadJSON()); if (maplayerGroup.getId() == -1) { maplayerGroup.setId(params.getRequiredParamInt(PARAM_ID)); } maplayerGroup.setOrderNumber(getEnsuredOrderNumber(maplayerGroup)); oskariMapLayerGroupService.update(maplayerGroup); AuditLog.user(params.getClientIp(), params.getUser()).withParam("id", maplayerGroup.getId()) .withParam("name", maplayerGroup.getName(PropertyUtil.getDefaultLanguage())) .updated(AuditLog.ResourceType.MAPLAYER_GROUP); ResponseHelper.writeResponse(params, maplayerGroup.getAsJSON()); } }
MapLayerGroupsHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { params.requireAdminUser(); MaplayerGroup maplayerGroup = populateFromRequest(params.getPayLoadJSON()); if (maplayerGroup.getId() == -1) { maplayerGroup.setId(params.getRequiredParamInt(PARAM_ID)); } maplayerGroup.setOrderNumber(getEnsuredOrderNumber(maplayerGroup)); oskariMapLayerGroupService.update(maplayerGroup); AuditLog.user(params.getClientIp(), params.getUser()).withParam("id", maplayerGroup.getId()) .withParam("name", maplayerGroup.getName(PropertyUtil.getDefaultLanguage())) .updated(AuditLog.ResourceType.MAPLAYER_GROUP); ResponseHelper.writeResponse(params, maplayerGroup.getAsJSON()); }  }
MapLayerGroupsHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { params.requireAdminUser(); MaplayerGroup maplayerGroup = populateFromRequest(params.getPayLoadJSON()); if (maplayerGroup.getId() == -1) { maplayerGroup.setId(params.getRequiredParamInt(PARAM_ID)); } maplayerGroup.setOrderNumber(getEnsuredOrderNumber(maplayerGroup)); oskariMapLayerGroupService.update(maplayerGroup); AuditLog.user(params.getClientIp(), params.getUser()).withParam("id", maplayerGroup.getId()) .withParam("name", maplayerGroup.getName(PropertyUtil.getDefaultLanguage())) .updated(AuditLog.ResourceType.MAPLAYER_GROUP); ResponseHelper.writeResponse(params, maplayerGroup.getAsJSON()); }  void setOskariMapLayerGroupService(final OskariMapLayerGroupService service); void setLinkService(OskariLayerGroupLinkService linkService); void init(); void handleGet(ActionParameters params); void handlePut(ActionParameters params); void handlePost(ActionParameters params); void handleDelete(ActionParameters params); }
MapLayerGroupsHandler extends RestActionHandler { public void handlePost(ActionParameters params) throws ActionException { params.requireAdminUser(); MaplayerGroup maplayerGroup = populateFromRequest(params.getPayLoadJSON()); if (maplayerGroup.getId() == -1) { maplayerGroup.setId(params.getRequiredParamInt(PARAM_ID)); } maplayerGroup.setOrderNumber(getEnsuredOrderNumber(maplayerGroup)); oskariMapLayerGroupService.update(maplayerGroup); AuditLog.user(params.getClientIp(), params.getUser()).withParam("id", maplayerGroup.getId()) .withParam("name", maplayerGroup.getName(PropertyUtil.getDefaultLanguage())) .updated(AuditLog.ResourceType.MAPLAYER_GROUP); ResponseHelper.writeResponse(params, maplayerGroup.getAsJSON()); }  void setOskariMapLayerGroupService(final OskariMapLayerGroupService service); void setLinkService(OskariLayerGroupLinkService linkService); void init(); void handleGet(ActionParameters params); void handlePut(ActionParameters params); void handlePost(ActionParameters params); void handleDelete(ActionParameters params);  }