| .. | .. |
|---|
| 27 | 27 | import net.curisit.securis.db.Application; |
|---|
| 28 | 28 | import net.curisit.securis.utils.TokenHelper; |
|---|
| 29 | 29 | |
|---|
| 30 | | -import org.apache.logging.log4j.Logger; |
|---|
| 31 | 30 | import org.apache.logging.log4j.LogManager; |
|---|
| 31 | +import org.apache.logging.log4j.Logger; |
|---|
| 32 | 32 | |
|---|
| 33 | 33 | import com.google.inject.persist.Transactional; |
|---|
| 34 | 34 | |
|---|
| .. | .. |
|---|
| 49 | 49 | |
|---|
| 50 | 50 | private static final Logger LOG = LogManager.getLogger(ApplicationResource.class); |
|---|
| 51 | 51 | |
|---|
| 52 | | - public ApplicationResource() {} |
|---|
| 52 | + public ApplicationResource() { |
|---|
| 53 | + } |
|---|
| 53 | 54 | |
|---|
| 54 | 55 | /** |
|---|
| 55 | 56 | * |
|---|
| .. | .. |
|---|
| 57 | 58 | */ |
|---|
| 58 | 59 | @GET |
|---|
| 59 | 60 | @Path("/") |
|---|
| 60 | | - @Produces({ MediaType.APPLICATION_JSON }) |
|---|
| 61 | + @Produces({ |
|---|
| 62 | + MediaType.APPLICATION_JSON |
|---|
| 63 | + }) |
|---|
| 61 | 64 | public Response index() { |
|---|
| 62 | 65 | LOG.info("Getting applications list "); |
|---|
| 63 | 66 | |
|---|
| .. | .. |
|---|
| 74 | 77 | */ |
|---|
| 75 | 78 | @GET |
|---|
| 76 | 79 | @Path("/{appid}") |
|---|
| 77 | | - @Produces({ MediaType.APPLICATION_JSON }) |
|---|
| 80 | + @Produces({ |
|---|
| 81 | + MediaType.APPLICATION_JSON |
|---|
| 82 | + }) |
|---|
| 78 | 83 | public Response get(@PathParam("appid") String appid, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) { |
|---|
| 79 | 84 | LOG.info("Getting application data for id: {}: ", appid); |
|---|
| 80 | 85 | if (appid == null || "".equals(appid)) { |
|---|
| .. | .. |
|---|
| 96 | 101 | @POST |
|---|
| 97 | 102 | @Path("/") |
|---|
| 98 | 103 | @Consumes(MediaType.APPLICATION_JSON) |
|---|
| 99 | | - @Produces({ MediaType.APPLICATION_JSON }) |
|---|
| 104 | + @Produces({ |
|---|
| 105 | + MediaType.APPLICATION_JSON |
|---|
| 106 | + }) |
|---|
| 100 | 107 | @Transactional |
|---|
| 101 | 108 | public Response create(Application app, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) { |
|---|
| 102 | 109 | LOG.info("Creating new application"); |
|---|
| .. | .. |
|---|
| 112 | 119 | @Path("/{appid}") |
|---|
| 113 | 120 | @Transactional |
|---|
| 114 | 121 | @Consumes(MediaType.APPLICATION_JSON) |
|---|
| 115 | | - @Produces({ MediaType.APPLICATION_JSON }) |
|---|
| 122 | + @Produces({ |
|---|
| 123 | + MediaType.APPLICATION_JSON |
|---|
| 124 | + }) |
|---|
| 116 | 125 | public Response modify(Application app, @PathParam("appid") String appid, @HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) { |
|---|
| 117 | 126 | LOG.info("Modifying application with id: {}", appid); |
|---|
| 118 | 127 | EntityManager em = emProvider.get(); |
|---|
| .. | .. |
|---|
| 132 | 141 | @DELETE |
|---|
| 133 | 142 | @Path("/{appid}") |
|---|
| 134 | 143 | @Transactional |
|---|
| 135 | | - @Produces({ MediaType.APPLICATION_JSON }) |
|---|
| 144 | + @Produces({ |
|---|
| 145 | + MediaType.APPLICATION_JSON |
|---|
| 146 | + }) |
|---|
| 136 | 147 | public Response delete(@PathParam("appid") String appid, @Context HttpServletRequest request) { |
|---|
| 137 | 148 | LOG.info("Deleting app with id: {}", appid); |
|---|
| 138 | 149 | EntityManager em = emProvider.get(); |
|---|
| .. | .. |
|---|
| 143 | 154 | .build(); |
|---|
| 144 | 155 | } |
|---|
| 145 | 156 | |
|---|
| 146 | | - if (app.getLicenseTypes() != null && app.getLicenseTypes().size() > 0) { |
|---|
| 157 | + if (app.getLicenseTypes() != null && !app.getLicenseTypes().isEmpty()) { |
|---|
| 147 | 158 | return Response |
|---|
| 148 | 159 | .status(Status.FORBIDDEN) |
|---|
| 149 | 160 | .header(DefaultExceptionHandler.ERROR_MESSAGE_HEADER, |
|---|