Roberto Sánchez
2014-09-19 071a008cf28e733ca3aaafa57e675fd54a5ea33b
securis/src/main/java/net/curisit/securis/services/ApplicationResource.java
....@@ -27,8 +27,8 @@
2727 import net.curisit.securis.db.Application;
2828 import net.curisit.securis.utils.TokenHelper;
2929
30
-import org.apache.logging.log4j.Logger;
3130 import org.apache.logging.log4j.LogManager;
31
+import org.apache.logging.log4j.Logger;
3232
3333 import com.google.inject.persist.Transactional;
3434
....@@ -49,7 +49,8 @@
4949
5050 private static final Logger LOG = LogManager.getLogger(ApplicationResource.class);
5151
52
- public ApplicationResource() {}
52
+ public ApplicationResource() {
53
+ }
5354
5455 /**
5556 *
....@@ -57,7 +58,9 @@
5758 */
5859 @GET
5960 @Path("/")
60
- @Produces({ MediaType.APPLICATION_JSON })
61
+ @Produces({
62
+ MediaType.APPLICATION_JSON
63
+ })
6164 public Response index() {
6265 LOG.info("Getting applications list ");
6366
....@@ -74,7 +77,9 @@
7477 */
7578 @GET
7679 @Path("/{appid}")
77
- @Produces({ MediaType.APPLICATION_JSON })
80
+ @Produces({
81
+ MediaType.APPLICATION_JSON
82
+ })
7883 public Response get(@PathParam("appid") String appid, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
7984 LOG.info("Getting application data for id: {}: ", appid);
8085 if (appid == null || "".equals(appid)) {
....@@ -96,7 +101,9 @@
96101 @POST
97102 @Path("/")
98103 @Consumes(MediaType.APPLICATION_JSON)
99
- @Produces({ MediaType.APPLICATION_JSON })
104
+ @Produces({
105
+ MediaType.APPLICATION_JSON
106
+ })
100107 @Transactional
101108 public Response create(Application app, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
102109 LOG.info("Creating new application");
....@@ -112,7 +119,9 @@
112119 @Path("/{appid}")
113120 @Transactional
114121 @Consumes(MediaType.APPLICATION_JSON)
115
- @Produces({ MediaType.APPLICATION_JSON })
122
+ @Produces({
123
+ MediaType.APPLICATION_JSON
124
+ })
116125 public Response modify(Application app, @PathParam("appid") String appid, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
117126 LOG.info("Modifying application with id: {}", appid);
118127 EntityManager em = emProvider.get();
....@@ -132,7 +141,9 @@
132141 @DELETE
133142 @Path("/{appid}")
134143 @Transactional
135
- @Produces({ MediaType.APPLICATION_JSON })
144
+ @Produces({
145
+ MediaType.APPLICATION_JSON
146
+ })
136147 public Response delete(@PathParam("appid") String appid, @Context HttpServletRequest request) {
137148 LOG.info("Deleting app with id: {}", appid);
138149 EntityManager em = emProvider.get();
....@@ -143,7 +154,7 @@
143154 .build();
144155 }
145156
146
- if (app.getLicenseTypes() != null && app.getLicenseTypes().size() > 0) {
157
+ if (app.getLicenseTypes() != null && !app.getLicenseTypes().isEmpty()) {
147158 return Response
148159 .status(Status.FORBIDDEN)
149160 .header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER,