@@ -0,0 +1,1037 @@
+package org.oskari.control.userlayer;%0A%0Aimport org.oskari.map.userlayer.service.UserLayerDbService;%0A%0Aimport fi.nls.oskari.control.ActionConstants;%0Aimport fi.nls.oskari.control.ActionDeniedException;%0Aimport fi.nls.oskari.control.ActionException;%0Aimport fi.nls.oskari.control.ActionParameters;%0Aimport fi.nls.oskari.control.ActionParamsException;%0Aimport fi.nls.oskari.domain.map.userlayer.UserLayer;%0A%0Apublic class UserLayerHandlerHelper %7B%0A%0A    public static UserLayer getUserLayer(UserLayerDbService service, ActionParameters params) throws ActionException %7B%0A        params.requireLoggedInUser();%0A        long id = params.getRequiredParamLong(ActionConstants.KEY_ID);%0A        UserLayer userLayer = service.getUserLayerById(id);%0A        if (userLayer == null) %7B%0A            throw new ActionParamsException(%22UserLayer doesn't exist: %22 + id);%0A        %7D%0A        if (!userLayer.isOwnedBy(params.getUser().getUuid())) %7B%0A            throw new ActionDeniedException(%22UserLayer belongs to another user%22);%0A        %7D%0A        return userLayer;%0A    %7D%0A%0A%7D%0A

Add Helper class for common functionality