levels) {
55 | this.levels = levels;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/transform/RESTGdalTranslateTransform.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package de.terrestris.shoguncore.importer.transform;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * terrestris GmbH & Co. KG
10 | *
11 | * @author ahenn
12 | * @date 01.04.2016
13 | *
14 | * Importer transform task representing gdal_translate, a tool which converts
15 | * raster data between different formats
16 | * @see GDAL (gdal_translate) documentation
17 | * Requires gdal_translate
to be inside the PATH used by the web container running GeoServer.
18 | */
19 | public class RESTGdalTranslateTransform extends RESTTransform {
20 |
21 | /**
22 | *
23 | */
24 | public static final String TYPE_NAME = "GdalTranslateTransform";
25 |
26 | private List options;
27 |
28 | /**
29 | * Default constructor; sets type
of
30 | * {@link RESTTransform} to "GdalTranslateTransform"
31 | */
32 | public RESTGdalTranslateTransform() {
33 | super(TYPE_NAME);
34 | }
35 |
36 | /**
37 | * @return the options
38 | */
39 | public List getOptions() {
40 | return options;
41 | }
42 |
43 | /**
44 | * @param options the options to set
45 | */
46 | public void setOptions(List options) {
47 | this.options = options;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/transform/RESTGdalWarpTransform.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.importer.transform;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * terrestris GmbH & Co. KG
7 | *
8 | * @author ahenn
9 | * @date 01.04.2016
10 | *
11 | * Importer transform task representing gdalwarp, an image reprojection and warping utility,
12 | * @see GDAL (gdalwarp) documentation
13 | * Requires gdalwarp
to be inside the PATH used by the web container running GeoServer.
14 | */
15 | public class RESTGdalWarpTransform extends RESTTransform {
16 |
17 | /**
18 | *
19 | */
20 | public static final String TYPE_NAME = "GdalWarpTransform";
21 |
22 | private List options;
23 |
24 | /**
25 | * Default constructor; sets type
of
26 | * {@link RESTTransform} to "GdalWarpTransform"
27 | */
28 | public RESTGdalWarpTransform() {
29 | super(TYPE_NAME);
30 | }
31 |
32 | /**
33 | * @return the options
34 | */
35 | public List getOptions() {
36 | return options;
37 | }
38 |
39 | /**
40 | * @param options the options to set
41 | */
42 | public void setOptions(List options) {
43 | this.options = options;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/transform/RESTTransform.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.importer.transform;
2 |
3 | import de.terrestris.shoguncore.importer.communication.AbstractRESTEntity;
4 |
5 | /**
6 | * @author Daniel Koch
7 | * @author terrestris GmbH & Co. KG
8 | */
9 | public class RESTTransform extends AbstractRESTEntity {
10 |
11 | /**
12 | *
13 | */
14 | private String type;
15 |
16 | /**
17 | * Default constructor
18 | */
19 | public RESTTransform() {
20 |
21 | }
22 |
23 | /**
24 | * @param type
25 | */
26 | public RESTTransform(String type) {
27 | this.type = type;
28 | }
29 |
30 | /**
31 | * @return the type
32 | */
33 | public String getType() {
34 | return type;
35 | }
36 |
37 | /**
38 | * @param type the type to set
39 | */
40 | public void setType(String type) {
41 | this.type = type;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/transform/RESTTransformChain.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.importer.transform;
2 |
3 | import de.terrestris.shoguncore.importer.communication.AbstractRESTEntity;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @author Daniel Koch
9 | * @author terrestris GmbH & Co. KG
10 | */
11 | public class RESTTransformChain extends AbstractRESTEntity {
12 |
13 | /**
14 | *
15 | */
16 | private String type;
17 |
18 | /**
19 | *
20 | */
21 | private List transforms;
22 |
23 | /**
24 | * Default constructor.
25 | */
26 | public RESTTransformChain() {
27 |
28 | }
29 |
30 | /**
31 | * @return the type
32 | */
33 | public String getType() {
34 | return type;
35 | }
36 |
37 | /**
38 | * @param type the type to set
39 | */
40 | public void setType(String type) {
41 | this.type = type;
42 | }
43 |
44 | /**
45 | * @return the transforms
46 | */
47 | public List getTransforms() {
48 | return transforms;
49 | }
50 |
51 | /**
52 | * @param transforms the transforms to set
53 | */
54 | public void setTransforms(List transforms) {
55 | this.transforms = transforms;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/model/security/Permission.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.model.security;
2 |
3 |
4 | /**
5 | * @author Nils Bühner
6 | */
7 | public enum Permission {
8 | ADMIN("ADMIN"),
9 | CREATE("CREATE"),
10 | DELETE("DELETE"),
11 | UPDATE("UPDATE"),
12 | READ("READ");
13 |
14 | private final String permission;
15 |
16 | /**
17 | * Enum constructor
18 | *
19 | * @param value
20 | */
21 | Permission(String permission) {
22 | this.permission = permission;
23 | }
24 |
25 | public static Permission fromString(String inputValue) {
26 | if (inputValue != null) {
27 | for (Permission permission : Permission.values()) {
28 | if (inputValue.equalsIgnoreCase(permission.permission)) {
29 | return permission;
30 | }
31 | }
32 | }
33 | return null;
34 | }
35 |
36 | /**
37 | *
38 | */
39 | @Override
40 | public String toString() {
41 | return permission;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/model/token/PasswordResetToken.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.model.token;
2 |
3 | import de.terrestris.shoguncore.model.User;
4 |
5 | import javax.persistence.Cacheable;
6 | import javax.persistence.Entity;
7 | import javax.persistence.Table;
8 |
9 | /**
10 | * A {@link Token} instance that has a one-to-one relation to a {@link User}
11 | * that wants to reset the password.
12 | *
13 | * @author Daniel Koch
14 | * @author Nils Bühner
15 | */
16 | @Entity
17 | @Table
18 | @Cacheable
19 | public class PasswordResetToken extends UserToken {
20 |
21 | /**
22 | *
23 | */
24 | private static final long serialVersionUID = 1L;
25 |
26 | /**
27 | * Default constructor
28 | */
29 | public PasswordResetToken() {
30 | }
31 |
32 | /**
33 | * Constructor that uses the default expiration time.
34 | */
35 | public PasswordResetToken(User user) {
36 | super(user);
37 | }
38 |
39 | /**
40 | * Constructor that uses the passed values
41 | */
42 | public PasswordResetToken(User user, int expirationInMinutes) {
43 | super(user, expirationInMinutes);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/model/token/RegistrationToken.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.model.token;
2 |
3 | import de.terrestris.shoguncore.model.User;
4 |
5 | import javax.persistence.Cacheable;
6 | import javax.persistence.Entity;
7 | import javax.persistence.Table;
8 |
9 | /**
10 | * A {@link Token} instance that has a one-to-one relation to a {@link User}
11 | * that wants to register.
12 | *
13 | * @author Daniel Koch
14 | * @author Nils Bühner
15 | */
16 | @Entity
17 | @Table
18 | @Cacheable
19 | public class RegistrationToken extends UserToken {
20 |
21 | /**
22 | *
23 | */
24 | private static final long serialVersionUID = 1L;
25 |
26 | /**
27 | * Default constructor
28 | */
29 | public RegistrationToken() {
30 | }
31 |
32 | /**
33 | * Constructor that uses the default expiration time.
34 | */
35 | public RegistrationToken(User user) {
36 | super(user);
37 | }
38 |
39 | /**
40 | * Constructor that uses the passed values
41 | */
42 | public RegistrationToken(User user, int expirationInMinutes) {
43 | super(user, expirationInMinutes);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/paging/PagingResult.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.paging;
2 |
3 | import de.terrestris.shoguncore.model.PersistentObject;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * The Result of a paging request. Contains a list with returned objects and the
9 | * totalCount of available database entries.
10 | *
11 | * @author Nils Bühner
12 | */
13 | public class PagingResult {
14 |
15 | private List resultList;
16 |
17 | private Number totalCount;
18 |
19 | /**
20 | * Constructor
21 | *
22 | * @param resultList
23 | * @param number
24 | */
25 | public PagingResult(List resultList, Number number) {
26 | this.setResultList(resultList);
27 | this.setTotalCount(number);
28 | }
29 |
30 | /**
31 | * @return the resultList
32 | */
33 | public List getResultList() {
34 | return resultList;
35 | }
36 |
37 | /**
38 | * @param resultList the resultList to set
39 | */
40 | public void setResultList(List resultList) {
41 | this.resultList = resultList;
42 | }
43 |
44 | /**
45 | * @return the totalCount
46 | */
47 | public Number getTotalCount() {
48 | return totalCount;
49 | }
50 |
51 | /**
52 | * @param totalCount the totalCount to set
53 | */
54 | public void setTotalCount(Number totalCount) {
55 | this.totalCount = totalCount;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/ButtonRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.ButtonDao;
4 | import de.terrestris.shoguncore.model.module.Button;
5 | import de.terrestris.shoguncore.service.ButtonService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Nils Bühner
13 | */
14 | @RestController
15 | @RequestMapping("/buttons")
16 | public class ButtonRestController, S extends ButtonService>
17 | extends AbstractRestController {
18 |
19 | /**
20 | * Default constructor, which calls the type-constructor
21 | */
22 | @SuppressWarnings("unchecked")
23 | public ButtonRestController() {
24 | this((Class) Button.class);
25 | }
26 |
27 | /**
28 | * Constructor that sets the concrete entity class for the controller.
29 | * Subclasses MUST call this constructor.
30 | */
31 | protected ButtonRestController(Class entityClass) {
32 | super(entityClass);
33 | }
34 |
35 | /**
36 | * We have to use {@link Qualifier} to define the correct service here.
37 | * Otherwise, spring can not decide which service has to be autowired here
38 | * as there are multiple candidates.
39 | */
40 | @Override
41 | @Autowired
42 | @Qualifier("buttonService")
43 | public void setService(S service) {
44 | this.service = service;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/ExtentRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.ExtentDao;
4 | import de.terrestris.shoguncore.model.layer.util.Extent;
5 | import de.terrestris.shoguncore.service.ExtentService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/extents")
17 | public class ExtentRestController, S extends ExtentService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public ExtentRestController() {
25 | this((Class) Extent.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected ExtentRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("extentService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/ImageFileRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.ImageFileDao;
4 | import de.terrestris.shoguncore.model.ImageFile;
5 | import de.terrestris.shoguncore.service.ImageFileService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/images")
17 | public class ImageFileRestController, S extends ImageFileService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public ImageFileRestController() {
25 | this((Class) ImageFile.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected ImageFileRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("imageFileService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/LayerRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.LayerDao;
4 | import de.terrestris.shoguncore.model.layer.Layer;
5 | import de.terrestris.shoguncore.service.LayerService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/layers")
17 | public class LayerRestController, S extends LayerService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public LayerRestController() {
25 | this((Class) Layer.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected LayerRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("layerService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/LayoutRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.LayoutDao;
4 | import de.terrestris.shoguncore.model.layout.Layout;
5 | import de.terrestris.shoguncore.service.LayoutService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/layouts")
17 | public class LayoutRestController, S extends LayoutService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public LayoutRestController() {
25 | this((Class) Layout.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected LayoutRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("layoutService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/MapConfigRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.MapConfigDao;
4 | import de.terrestris.shoguncore.model.map.MapConfig;
5 | import de.terrestris.shoguncore.service.MapConfigService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/mapconfigs")
17 | public class MapConfigRestController, S extends MapConfigService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public MapConfigRestController() {
25 | this((Class) MapConfig.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected MapConfigRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("mapConfigService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/MapControlRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.MapControlDao;
4 | import de.terrestris.shoguncore.model.map.MapControl;
5 | import de.terrestris.shoguncore.service.MapControlService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/mapcontrols")
17 | public class MapControlRestController, S extends MapControlService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public MapControlRestController() {
25 | this((Class) MapControl.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected MapControlRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("mapControlService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/ModuleRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.ModuleDao;
4 | import de.terrestris.shoguncore.model.module.Module;
5 | import de.terrestris.shoguncore.service.ModuleService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/modules")
17 | public class ModuleRestController, S extends ModuleService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public ModuleRestController() {
25 | this((Class) Module.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected ModuleRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("moduleService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/RoleRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.RoleDao;
4 | import de.terrestris.shoguncore.model.Role;
5 | import de.terrestris.shoguncore.service.RoleService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Andre Henn
13 | */
14 | @RestController
15 | @RequestMapping("/roles")
16 | public class RoleRestController, S extends RoleService>
17 | extends AbstractRestController {
18 |
19 | /**
20 | * Default constructor, which calls the type-constructor
21 | */
22 | @SuppressWarnings("unchecked")
23 | public RoleRestController() {
24 | this((Class) Role.class);
25 | }
26 |
27 | /**
28 | * Constructor that sets the concrete entity class for the controller.
29 | * Subclasses MUST call this constructor.
30 | */
31 | protected RoleRestController(Class entityClass) {
32 | super(entityClass);
33 | }
34 |
35 | /**
36 | * We have to use {@link Qualifier} to define the correct service here.
37 | * Otherwise, spring can not decide which service has to be autowired here
38 | * as there are multiple candidates.
39 | */
40 | @Override
41 | @Autowired
42 | @Qualifier("roleService")
43 | public void setService(S service) {
44 | this.service = service;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/TileGridRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.TileGridDao;
4 | import de.terrestris.shoguncore.model.layer.util.TileGrid;
5 | import de.terrestris.shoguncore.service.TileGridService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/tilegrids")
17 | public class TileGridRestController, S extends TileGridService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public TileGridRestController() {
25 | this((Class) TileGrid.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected TileGridRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("tileGridService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/TreeNodeRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.TreeNodeDao;
4 | import de.terrestris.shoguncore.model.tree.TreeNode;
5 | import de.terrestris.shoguncore.service.TreeNodeService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Kai Volland
13 | * @author Nils Bühner
14 | */
15 | @RestController
16 | @RequestMapping("/treenodes")
17 | public class TreeNodeRestController, S extends TreeNodeService>
18 | extends AbstractRestController {
19 |
20 | /**
21 | * Default constructor, which calls the type-constructor
22 | */
23 | @SuppressWarnings("unchecked")
24 | public TreeNodeRestController() {
25 | this((Class) TreeNode.class);
26 | }
27 |
28 | /**
29 | * Constructor that sets the concrete entity class for the controller.
30 | * Subclasses MUST call this constructor.
31 | */
32 | protected TreeNodeRestController(Class entityClass) {
33 | super(entityClass);
34 | }
35 |
36 | /**
37 | * We have to use {@link Qualifier} to define the correct service here.
38 | * Otherwise, spring can not decide which service has to be autowired here
39 | * as there are multiple candidates.
40 | */
41 | @Override
42 | @Autowired
43 | @Qualifier("treeNodeService")
44 | public void setService(S service) {
45 | this.service = service;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/rest/WpsPluginRestController.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.rest;
2 |
3 | import de.terrestris.shoguncore.dao.WpsPluginDao;
4 | import de.terrestris.shoguncore.model.wps.WpsPlugin;
5 | import de.terrestris.shoguncore.service.WpsPluginService;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | /**
12 | * @author Nils Bühner
13 | */
14 | @RestController
15 | @RequestMapping("/wpsplugins")
16 | public class WpsPluginRestController, S extends WpsPluginService>
17 | extends PluginRestController {
18 |
19 | /**
20 | * Default constructor, which calls the type-constructor
21 | */
22 | @SuppressWarnings("unchecked")
23 | public WpsPluginRestController() {
24 | this((Class) WpsPlugin.class);
25 | }
26 |
27 | /**
28 | * Constructor that sets the concrete entity class for the controller.
29 | * Subclasses MUST call this constructor.
30 | */
31 | protected WpsPluginRestController(Class entityClass) {
32 | super(entityClass);
33 | }
34 |
35 | /**
36 | * We have to use {@link Qualifier} to define the correct service here.
37 | * Otherwise, spring can not decide which service has to be autowired here
38 | * as there are multiple candidates.
39 | */
40 | @Override
41 | @Autowired
42 | @Qualifier("wpsPluginService")
43 | public void setService(S service) {
44 | this.service = service;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/AlwaysAllowReadPermissionEvaluator.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.security.access.entity;
2 |
3 | import de.terrestris.shoguncore.model.PersistentObject;
4 | import de.terrestris.shoguncore.model.User;
5 | import de.terrestris.shoguncore.model.security.Permission;
6 |
7 | /**
8 | * @author Nils Bühner
9 | */
10 | public class AlwaysAllowReadPermissionEvaluator extends
11 | PersistentObjectPermissionEvaluator {
12 |
13 | /**
14 | * Default constructor
15 | */
16 | @SuppressWarnings("unchecked")
17 | public AlwaysAllowReadPermissionEvaluator() {
18 | this((Class) PersistentObject.class);
19 | }
20 |
21 | /**
22 | * Constructor for subclasses
23 | *
24 | * @param entityClass
25 | */
26 | protected AlwaysAllowReadPermissionEvaluator(Class entityClass) {
27 | super(entityClass);
28 | }
29 |
30 | /**
31 | * Grants READ permission on the user object of the currently logged in
32 | * user. Uses default implementation otherwise.
33 | */
34 | @Override
35 | public boolean hasPermission(User user, E entity, Permission permission) {
36 |
37 | // always grant READ access ("unsecured" object)
38 | if (permission.equals(Permission.READ)) {
39 | logger.trace("Granting READ access on " + entity.getClass().getSimpleName() + " with ID " + entity.getId());
40 | return true;
41 | }
42 |
43 | // call parent implementation
44 | return super.hasPermission(user, entity, permission);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/PermissionCollectionPermissionEvaluator.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.security.access.entity;
2 |
3 | import de.terrestris.shoguncore.model.User;
4 | import de.terrestris.shoguncore.model.security.Permission;
5 | import de.terrestris.shoguncore.model.security.PermissionCollection;
6 |
7 | /**
8 | * @author Nils Bühner
9 | */
10 | public class PermissionCollectionPermissionEvaluator extends
11 | PersistentObjectPermissionEvaluator {
12 |
13 | /**
14 | * Default constructor
15 | */
16 | @SuppressWarnings("unchecked")
17 | public PermissionCollectionPermissionEvaluator() {
18 | this((Class) PermissionCollection.class);
19 | }
20 |
21 | /**
22 | * Constructor for subclasses
23 | *
24 | * @param entityClass
25 | */
26 | protected PermissionCollectionPermissionEvaluator(Class entityClass) {
27 | super(entityClass);
28 | }
29 |
30 | /**
31 | * Always grants every permission on permission collections.
32 | */
33 | @Override
34 | public boolean hasPermission(User user, E permissionCollection, Permission permission) {
35 |
36 | // it is necessary to grant every permission.
37 | // otherwise permission collections could not be created or updated.
38 | return true;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/UserGroupPermissionEvaluator.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.security.access.entity;
2 |
3 | import de.terrestris.shoguncore.model.User;
4 | import de.terrestris.shoguncore.model.UserGroup;
5 | import de.terrestris.shoguncore.model.security.Permission;
6 |
7 | /**
8 | * @author Nils Bühner
9 | */
10 | public class UserGroupPermissionEvaluator extends
11 | PersistentObjectPermissionEvaluator {
12 |
13 | /**
14 | * Default constructor
15 | */
16 | @SuppressWarnings("unchecked")
17 | public UserGroupPermissionEvaluator() {
18 | this((Class) UserGroup.class);
19 | }
20 |
21 | /**
22 | * Constructor for subclasses
23 | *
24 | * @param entityClass
25 | */
26 | protected UserGroupPermissionEvaluator(Class entityClass) {
27 | super(entityClass);
28 | }
29 |
30 | /**
31 | * Grants READ permission on groups where the user is a member.
32 | * Uses default implementation otherwise.
33 | */
34 | @Override
35 | public boolean hasPermission(User user, E userGroup, Permission permission) {
36 |
37 | // always grant READ access to groups in which the user itself is a member
38 | if (user != null && permission.equals(Permission.READ)
39 | && userGroup.getMembers().contains(user)) {
40 | logger.trace("Granting READ access on group where the user is member.");
41 | return true;
42 | }
43 |
44 | // call parent implementation
45 | return super.hasPermission(user, userGroup, permission);
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/UserPermissionEvaluator.java:
--------------------------------------------------------------------------------
1 | package de.terrestris.shoguncore.security.access.entity;
2 |
3 | import de.terrestris.shoguncore.model.User;
4 | import de.terrestris.shoguncore.model.security.Permission;
5 |
6 | /**
7 | * @author Nils Bühner
8 | */
9 | public class UserPermissionEvaluator extends
10 | PersistentObjectPermissionEvaluator {
11 |
12 | /**
13 | * Default constructor
14 | */
15 | @SuppressWarnings("unchecked")
16 | public UserPermissionEvaluator() {
17 | this((Class