| .. | .. |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | import net.curisit.integrity.commons.Utils; |
|---|
| 29 | 29 | import net.curisit.securis.DefaultExceptionHandler; |
|---|
| 30 | | -import net.curisit.securis.SeCurisException; |
|---|
| 31 | 30 | import net.curisit.securis.db.Application; |
|---|
| 32 | 31 | import net.curisit.securis.db.ApplicationMetadata; |
|---|
| 33 | 32 | import net.curisit.securis.ioc.EnsureTransaction; |
|---|
| .. | .. |
|---|
| 35 | 34 | import net.curisit.securis.security.Securable; |
|---|
| 36 | 35 | import net.curisit.securis.services.exception.SeCurisServiceException; |
|---|
| 37 | 36 | import net.curisit.securis.services.exception.SeCurisServiceException.ErrorCodes; |
|---|
| 38 | | -import net.curisit.securis.utils.JsonUtils; |
|---|
| 39 | 37 | import net.curisit.securis.utils.TokenHelper; |
|---|
| 40 | 38 | |
|---|
| 41 | 39 | import org.apache.logging.log4j.LogManager; |
|---|
| .. | .. |
|---|
| 100 | 98 | return Response.status(Status.NOT_FOUND).build(); |
|---|
| 101 | 99 | } |
|---|
| 102 | 100 | |
|---|
| 103 | | - // EntityManager em = emProvider.get(); |
|---|
| 104 | 101 | em.clear(); |
|---|
| 105 | 102 | |
|---|
| 106 | 103 | Application app = null; |
|---|
| .. | .. |
|---|
| 115 | 112 | throw new SeCurisServiceException(ErrorCodes.NOT_FOUND, "Application not found with ID: " + appid); |
|---|
| 116 | 113 | } |
|---|
| 117 | 114 | |
|---|
| 118 | | - try { |
|---|
| 119 | | - LOG.info("JSON for APP:\n\n\n"); |
|---|
| 120 | | - LOG.info(JsonUtils.toJSON(app)); |
|---|
| 121 | | - } catch (SeCurisException e) { |
|---|
| 122 | | - LOG.info("ERROR {}", e); |
|---|
| 123 | | - |
|---|
| 124 | | - } catch (Exception e) { |
|---|
| 125 | | - LOG.info("ERROR??? {}", e); |
|---|
| 126 | | - } |
|---|
| 127 | 115 | return Response.ok(app).build(); |
|---|
| 128 | 116 | } |
|---|
| 129 | 117 | |
|---|
| .. | .. |
|---|
| 141 | 129 | // EntityManager em = emProvider.get(); |
|---|
| 142 | 130 | app.setCreationTimestamp(new Date()); |
|---|
| 143 | 131 | em.persist(app); |
|---|
| 144 | | - LOG.info("App ID: {}", app.getId()); |
|---|
| 132 | + |
|---|
| 145 | 133 | if (app.getApplicationMetadata() != null) { |
|---|
| 146 | 134 | for (ApplicationMetadata md : app.getApplicationMetadata()) { |
|---|
| 147 | 135 | md.setApplication(app); |
|---|
| 148 | 136 | md.setCreationTimestamp(new Date()); |
|---|
| 149 | 137 | em.persist(md); |
|---|
| 150 | | - LOG.info("Creating METADATA: '{}' -> {}", md.getKey(), md.getCreationTimestamp()); |
|---|
| 151 | 138 | } |
|---|
| 152 | 139 | } |
|---|
| 153 | | - LOG.info("Creating application with date: " + app.getCreationTimestamp()); |
|---|
| 140 | + LOG.info("Creating application ({}) with date: {}", app.getId(), app.getCreationTimestamp()); |
|---|
| 154 | 141 | |
|---|
| 155 | 142 | return Response.ok(app).build(); |
|---|
| 156 | 143 | } |
|---|