3
3
// SPDX-License-Identifier: Apache-2.0
4
4
package org .lfenergy .compas .scl .data .rest .v1 ;
5
5
6
+ import org .jboss .logging .Logger ;
6
7
import org .lfenergy .compas .core .commons .ElementConverter ;
7
8
import org .lfenergy .compas .scl .data .model .SclType ;
8
9
import org .lfenergy .compas .scl .data .model .Version ;
9
10
import org .lfenergy .compas .scl .data .rest .v1 .model .*;
10
11
import org .lfenergy .compas .scl .data .service .CompasSclDataService ;
11
12
13
+ import javax .annotation .security .RolesAllowed ;
12
14
import javax .inject .Inject ;
13
15
import javax .validation .Valid ;
14
16
import javax .ws .rs .*;
19
21
20
22
@ Path ("/scl/v1/{" + TYPE_PATH_PARAM + "}" )
21
23
public class CompasSclDataResource {
24
+ private static final Logger LOG = Logger .getLogger (CompasSclDataResource .class );
25
+
22
26
private CompasSclDataService compasSclDataService ;
23
27
24
28
private ElementConverter converter = new ElementConverter ();
@@ -29,6 +33,7 @@ public CompasSclDataResource(CompasSclDataService compasSclDataService) {
29
33
}
30
34
31
35
@ POST
36
+ @ RolesAllowed ("Create" )
32
37
@ Consumes (MediaType .APPLICATION_XML )
33
38
@ Produces (MediaType .APPLICATION_XML )
34
39
public CreateResponse create (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
@@ -40,6 +45,7 @@ public CreateResponse create(@PathParam(TYPE_PATH_PARAM) SclType type,
40
45
41
46
@ GET
42
47
@ Path ("/list" )
48
+ @ RolesAllowed ("Read" )
43
49
@ Produces (MediaType .APPLICATION_XML )
44
50
public ListResponse list (@ PathParam (TYPE_PATH_PARAM ) SclType type ) {
45
51
var response = new ListResponse ();
@@ -49,6 +55,7 @@ public ListResponse list(@PathParam(TYPE_PATH_PARAM) SclType type) {
49
55
50
56
@ GET
51
57
@ Path ("/{" + ID_PATH_PARAM + "}/versions" )
58
+ @ RolesAllowed ("Read" )
52
59
@ Produces (MediaType .APPLICATION_XML )
53
60
public VersionsResponse listVersionsByUUID (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
54
61
@ PathParam (ID_PATH_PARAM ) UUID id ) {
@@ -59,6 +66,7 @@ public VersionsResponse listVersionsByUUID(@PathParam(TYPE_PATH_PARAM) SclType t
59
66
60
67
@ GET
61
68
@ Path ("/{" + ID_PATH_PARAM + "}" )
69
+ @ RolesAllowed ("Read" )
62
70
@ Produces (MediaType .APPLICATION_XML )
63
71
public GetResponse findByUUID (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
64
72
@ PathParam (ID_PATH_PARAM ) UUID id ) {
@@ -69,6 +77,7 @@ public GetResponse findByUUID(@PathParam(TYPE_PATH_PARAM) SclType type,
69
77
70
78
@ GET
71
79
@ Path ("/{" + ID_PATH_PARAM + "}/{" + VERSION_PATH_PARAM + "}" )
80
+ @ RolesAllowed ("Read" )
72
81
@ Produces (MediaType .APPLICATION_XML )
73
82
public GetResponse findByUUIDAndVersion (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
74
83
@ PathParam (ID_PATH_PARAM ) UUID id ,
@@ -80,6 +89,7 @@ public GetResponse findByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclType type
80
89
81
90
@ GET
82
91
@ Path ("/{" + ID_PATH_PARAM + "}/scl" )
92
+ @ RolesAllowed ("Read" )
83
93
@ Produces (MediaType .APPLICATION_XML )
84
94
public String findRawSCLByUUID (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
85
95
@ PathParam (ID_PATH_PARAM ) UUID id ) {
@@ -89,6 +99,7 @@ public String findRawSCLByUUID(@PathParam(TYPE_PATH_PARAM) SclType type,
89
99
90
100
@ GET
91
101
@ Path ("/{" + ID_PATH_PARAM + "}/{" + VERSION_PATH_PARAM + "}/scl" )
102
+ @ RolesAllowed ("Read" )
92
103
@ Produces (MediaType .APPLICATION_XML )
93
104
public String findRawSCLByUUIDAndVersion (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
94
105
@ PathParam (ID_PATH_PARAM ) UUID id ,
@@ -99,6 +110,7 @@ public String findRawSCLByUUIDAndVersion(@PathParam(TYPE_PATH_PARAM) SclType typ
99
110
100
111
@ PUT
101
112
@ Path ("/{" + ID_PATH_PARAM + "}" )
113
+ @ RolesAllowed ("Update" )
102
114
@ Consumes (MediaType .APPLICATION_XML )
103
115
@ Produces (MediaType .APPLICATION_XML )
104
116
public void update (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
@@ -109,6 +121,7 @@ public void update(@PathParam(TYPE_PATH_PARAM) SclType type,
109
121
110
122
@ DELETE
111
123
@ Path ("/{" + ID_PATH_PARAM + "}" )
124
+ @ RolesAllowed ("Delete" )
112
125
@ Produces (MediaType .APPLICATION_XML )
113
126
public void deleteAll (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
114
127
@ PathParam (ID_PATH_PARAM ) UUID id ) {
@@ -117,6 +130,7 @@ public void deleteAll(@PathParam(TYPE_PATH_PARAM) SclType type,
117
130
118
131
@ DELETE
119
132
@ Path ("/{" + ID_PATH_PARAM + "}/{" + VERSION_PATH_PARAM + "}" )
133
+ @ RolesAllowed ("Delete" )
120
134
@ Produces (MediaType .APPLICATION_XML )
121
135
public void deleteVersion (@ PathParam (TYPE_PATH_PARAM ) SclType type ,
122
136
@ PathParam (ID_PATH_PARAM ) UUID id ,
0 commit comments