From 8b5a0e6b856f4b18785a98996dc383143b3f2f1f Mon Sep 17 00:00:00 2001
From: Leonardo Vannucci <leonardo.vannucci@grupposistematica.it>
Date: Mon, 17 Sep 2018 09:23:59 +0200
Subject: [PATCH] Implementazione URP

---
 dg1cloud-core/src/main/java/it/digione/dg1cloud/form/DownloadFileCaptchaForm.java             |    4 
 dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadFileCaptchaController.java |    3 
 dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/SOAPConnector.java                  |   10 +
 dg1cloud-core/src/main/java/it/digione/dg1cloud/config/dg1cloud.properties                    |   13 +
 dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/StartURPController.java            |   78 ++++++++
 dg1cloud-core/src/main/resources/templates/startURP.html                                      |   71 +++++++
 dg1cloud-core/src/main/resources/application.properties                                       |    9 
 dg1cloud-core/pom.xml                                                                         |   55 +++++
 dg1cloud-core/src/main/resources/templates/error.html                                         |   43 ++++
 dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadController.java            |    2 
 /dev/null                                                                                     |   22 --
 dg1cloud-core/src/main/java/it/digione/dg1cloud/form/StartURPForm.java                        |   54 ++++++
 dg1cloud-core/src/main/resources/templates/downloadFileCaptcha.html                           |    1 
 dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdProperties.java              |  114 ++++++++++++
 dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdConfig.java                  |   47 +++++
 15 files changed, 491 insertions(+), 35 deletions(-)

diff --git a/dg1cloud-core/pom.xml b/dg1cloud-core/pom.xml
index 7cdda94..5a2d522 100644
--- a/dg1cloud-core/pom.xml
+++ b/dg1cloud-core/pom.xml
@@ -33,7 +33,6 @@
 		<dependency>
 			<groupId>org.flywaydb</groupId>
 			<artifactId>flyway-core</artifactId>
-			<version>4.0.1</version>
 		</dependency>
 
 		<dependency>
@@ -71,6 +70,16 @@
 		</dependency>
 		
 		<dependency>
+			<groupId>org.springframework.ws</groupId>
+			<artifactId>spring-ws-core</artifactId>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.springframework.ws</groupId>
+			<artifactId>spring-ws-security</artifactId>
+		</dependency>
+		
+		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpclient</artifactId>
 		</dependency>
@@ -98,10 +107,10 @@
 		</dependency>
 		
 		<dependency>
-			<groupId>commons-codec</groupId>
-			<artifactId>commons-codec</artifactId>
+			<groupId>org.webjars</groupId>
+			<artifactId>webjars-locator</artifactId>
+			<version>0.34</version>
 		</dependency>
-		
 		<!-- bootstrap and jquery -->
 		<dependency>
 			<groupId>org.webjars</groupId>
@@ -118,11 +127,49 @@
 
 	<build>
 		<finalName>${project.artifactId}</finalName>
+		<resources>
+			<resource>
+				<directory>src/main/java</directory>
+				<includes>
+					<include>**/*.properties</include>
+					<include>**/*.sql</include>
+				</includes>
+			</resource>
+			<resource>
+				<directory>src/main/resource</directory>
+				<includes>
+					<include>application.properties</include>
+				</includes>
+			</resource>
+		</resources>
 		<plugins>
 			<plugin>
 				<groupId>org.springframework.boot</groupId>
 				<artifactId>spring-boot-maven-plugin</artifactId>
 			</plugin>
+			<!-- tag::wsdl[] -->
+			<plugin>
+				<groupId>org.jvnet.jaxb2.maven2</groupId>
+				<artifactId>maven-jaxb2-plugin</artifactId>
+				<version>0.14.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>generate</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<schemaLanguage>WSDL</schemaLanguage>
+					<generatePackage>it.isharedoc.schemas.instance</generatePackage>
+					<schemas>
+						<schema>
+							<url>https://democorepa3.grupposistematica.it/isharedoc/webservices/webserviceInstance3.wsdl</url>
+						</schema>
+					</schemas>
+				</configuration>
+			</plugin>
+			<!-- end::wsdl[] -->
 		</plugins>
 	</build>
 
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/config/dg1cloud.properties b/dg1cloud-core/src/main/java/it/digione/dg1cloud/config/dg1cloud.properties
index 79d523e..a6711ce 100644
--- a/dg1cloud-core/src/main/java/it/digione/dg1cloud/config/dg1cloud.properties
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/config/dg1cloud.properties
@@ -15,7 +15,16 @@
 
 external.server.address.base.url=http://vannux.grupposistematica.it:8080/dg1cloud
 
-google.recaptcha.enabled=false
+google.recaptcha.enabled=true
 google.recaptcha.url=https://www.google.com/recaptcha/api/siteverify
 google.recaptcha.key=6LfCHmkUAAAAAFa1KmVtPFecItBriBHx1qmKHcVS
-google.recaptcha.secret=6LfCHmkUAAAAAKXdXWO36daHnItKQwkEvXOpX6YY
\ No newline at end of file
+google.recaptcha.secret=6LfCHmkUAAAAAKXdXWO36daHnItKQwkEvXOpX6YY
+
+isharedoc.ws.endpoint.instance=https://democorepa3.grupposistematica.it/isharedoc/webservices/webserviceInstance3.wsdl
+isharedoc.ws.username=admin
+isharedoc.ws.password=sistematica100
+isharedoc.ws.urp.puid=0109
+isharedoc.ws.urp.mbox=URP
+isharedoc.ws.urp.storyboad=URP
+isharedoc.ws.urp.metaviewname=URP
+isharedoc.ws.urp.direction=IN
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadController.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadController.java
index 5ee6cc7..b8b1a16 100644
--- a/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadController.java
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadController.java
@@ -10,8 +10,8 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.ModelAndView;
 
+import it.digione.dg1cloud.form.DownloadFileCaptchaForm;
 import it.digione.dg1cloud.recaptcha.CaptchaSettings;
-import it.digione.dg1cloud.recaptcha.DownloadFileCaptchaForm;
 
 @Controller
 public class DownloadController {
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/recaptcha/DownloadFileCaptchaController.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadFileCaptchaController.java
similarity index 93%
rename from dg1cloud-core/src/main/java/it/digione/dg1cloud/recaptcha/DownloadFileCaptchaController.java
rename to dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadFileCaptchaController.java
index 1a6c79f..8d7c7b0 100644
--- a/dg1cloud-core/src/main/java/it/digione/dg1cloud/recaptcha/DownloadFileCaptchaController.java
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/DownloadFileCaptchaController.java
@@ -1,4 +1,4 @@
-package it.digione.dg1cloud.recaptcha;
+package it.digione.dg1cloud.controller;
 
 import java.io.FileNotFoundException;
 
@@ -12,6 +12,7 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.servlet.ModelAndView;
 
+import it.digione.dg1cloud.form.DownloadFileCaptchaForm;
 import it.digione.dg1cloud.service.Utils;
 
 @Controller
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/StartURPController.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/StartURPController.java
new file mode 100644
index 0000000..24fbddd
--- /dev/null
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/controller/StartURPController.java
@@ -0,0 +1,78 @@
+package it.digione.dg1cloud.controller;
+
+import javax.validation.Valid;
+import javax.xml.bind.JAXBElement;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+import it.digione.dg1cloud.form.StartURPForm;
+import it.digione.dg1cloud.ws.client.SOAPConnector;
+import it.digione.dg1cloud.ws.client.isd.IsdProperties;
+import it.digione.dg1cloud.ws.client.isd.IsdConfig;
+import it.isharedoc.schemas.instance.InstanceMessageCreateRequest;
+import it.isharedoc.schemas.instance.ObjectFactory;
+
+@ControllerAdvice
+@Controller
+public class StartURPController {
+	
+	@Autowired IsdProperties isdProperties;
+	@Autowired IsdConfig isdConfig;
+	
+	@ModelAttribute("startURPForm")
+	public StartURPForm startURPForm() {
+		return new StartURPForm();
+	}
+
+	@RequestMapping("/startURP")
+	public String startURP() {
+		return "startURP";
+	}
+	@PostMapping("/sendStartRequest")
+	public Object sendStartRequest(@ModelAttribute("startURPForm") @Valid StartURPForm form,
+									BindingResult result) {
+		
+		ModelAndView modelAndView;
+		if (result.hasErrors()){
+			modelAndView = new ModelAndView("startURP");
+			modelAndView.addObject(result);
+			modelAndView.addObject("startURPForm", form);
+			modelAndView.addObject("message", "Impossibbile inviare la richiesta");
+			modelAndView.addObject("alertClass", "alert-danger");
+			return modelAndView;
+		} else {
+			modelAndView = new ModelAndView("startURP");
+			
+			InstanceMessageCreateRequest imcr = createInstanceMessageCreateRequest(form);
+			SOAPConnector soapConnector = isdConfig.soapConnector(isdConfig.marshaller(), isdConfig.wsSecurityInterceptor());
+			System.out.println(soapConnector.callWebService(soapConnector.getDefaultUri(), imcr));
+			
+			modelAndView.addObject("message", "Richiesta inviata con successo");
+			modelAndView.addObject("alertClass", "alert-success");
+			return modelAndView;
+		}
+		
+	}
+	
+	private InstanceMessageCreateRequest createInstanceMessageCreateRequest( StartURPForm startURPForm ) {
+		
+		ObjectFactory factory = new ObjectFactory();
+		
+		InstanceMessageCreateRequest request = new InstanceMessageCreateRequest();
+		
+		request.setPartitionPuid(isdProperties.getUrp().getPuid());
+		request.setMessageBoxCode(isdProperties.getUrp().getMbox());
+		request.setStoryboardCode(isdProperties.getUrp().getStoryboad());
+		
+		request.setMetaViewName(factory.createInstanceMessageCreateRequestMetaViewName(isdProperties.getUrp().getMetaviewname()));
+		
+		return null;
+	}
+}
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/recaptcha/DownloadFileCaptchaForm.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/form/DownloadFileCaptchaForm.java
similarity index 90%
rename from dg1cloud-core/src/main/java/it/digione/dg1cloud/recaptcha/DownloadFileCaptchaForm.java
rename to dg1cloud-core/src/main/java/it/digione/dg1cloud/form/DownloadFileCaptchaForm.java
index d743d43..b8511a9 100644
--- a/dg1cloud-core/src/main/java/it/digione/dg1cloud/recaptcha/DownloadFileCaptchaForm.java
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/form/DownloadFileCaptchaForm.java
@@ -1,8 +1,10 @@
-package it.digione.dg1cloud.recaptcha;
+package it.digione.dg1cloud.form;
 
 import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 
+import it.digione.dg1cloud.recaptcha.ValidReCaptcha;
+
 public class DownloadFileCaptchaForm {
 
 	@NotNull
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/form/StartURPForm.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/form/StartURPForm.java
new file mode 100644
index 0000000..905a6ed
--- /dev/null
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/form/StartURPForm.java
@@ -0,0 +1,54 @@
+package it.digione.dg1cloud.form;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+import org.springframework.web.multipart.MultipartFile;
+
+import it.digione.dg1cloud.recaptcha.ValidReCaptcha;
+
+public class StartURPForm {
+
+	@NotEmpty
+	private String mittente;
+	@NotEmpty
+	private String oggetto;
+	@NotEmpty
+	private String corpo;
+	@NotEmpty
+	@ValidReCaptcha
+	private String reCaptchaResponse;
+	@NotNull
+	private MultipartFile allegato;
+	
+	public String getMittente() {
+		return mittente;
+	}
+	public void setMittente(String mittente) {
+		this.mittente = mittente;
+	}
+	public String getOggetto() {
+		return oggetto;
+	}
+	public void setOggetto(String oggetto) {
+		this.oggetto = oggetto;
+	}
+	public String getCorpo() {
+		return corpo;
+	}
+	public void setCorpo(String corpo) {
+		this.corpo = corpo;
+	}
+	public String getReCaptchaResponse() {
+		return reCaptchaResponse;
+	}
+	public void setReCaptchaResponse(String reCaptchaResponse) {
+		this.reCaptchaResponse = reCaptchaResponse;
+	}
+	public MultipartFile getAllegato() {
+		return allegato;
+	}
+	public void setAllegato(MultipartFile allegato) {
+		this.allegato = allegato;
+	}
+}
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/SOAPConnector.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/SOAPConnector.java
new file mode 100644
index 0000000..4afef1a
--- /dev/null
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/SOAPConnector.java
@@ -0,0 +1,10 @@
+package it.digione.dg1cloud.ws.client;
+
+import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
+
+public class SOAPConnector extends WebServiceGatewaySupport {
+
+	public Object callWebService(String url, Object request){
+		return getWebServiceTemplate().marshalSendAndReceive(url, request);
+	}
+}
\ No newline at end of file
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdConfig.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdConfig.java
new file mode 100644
index 0000000..66a7202
--- /dev/null
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdConfig.java
@@ -0,0 +1,47 @@
+package it.digione.dg1cloud.ws.client.isd;
+
+import org.apache.wss4j.dom.WSConstants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.oxm.jaxb.Jaxb2Marshaller;
+import org.springframework.ws.client.support.interceptor.ClientInterceptor;
+import org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor;
+
+import it.digione.dg1cloud.ws.client.SOAPConnector;
+
+@Configuration
+public class IsdConfig {
+	
+	@Autowired IsdProperties isdProperties;
+	
+	@Bean
+	public Jaxb2Marshaller marshaller() {
+		Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
+		marshaller.setContextPath("it.isharedoc.schemas.instance");
+		return marshaller;
+	}
+	
+	@Bean
+	public Wss4jSecurityInterceptor wsSecurityInterceptor() {
+		Wss4jSecurityInterceptor wss4jSecurityInterceptor = new Wss4jSecurityInterceptor();
+		wss4jSecurityInterceptor.setSecurementActions(WSConstants.USERNAME_TOKEN_LN);
+		wss4jSecurityInterceptor.setSecurementUsername(isdProperties.getUsername());
+		wss4jSecurityInterceptor.setSecurementPassword(isdProperties.getPassword());
+		wss4jSecurityInterceptor.setSecurementPasswordType(WSConstants.PW_TEXT);
+		wss4jSecurityInterceptor.setSecurementUsernameTokenNonce(true);
+		return wss4jSecurityInterceptor;
+	}
+ 
+	@Bean
+	public SOAPConnector soapConnector(Jaxb2Marshaller marshaller, Wss4jSecurityInterceptor wsSecurityInterceptor) {
+		SOAPConnector client = new SOAPConnector();
+		client.setDefaultUri(isdProperties.getEndpoint().getInstance());
+		client.setMarshaller(marshaller);
+		client.setUnmarshaller(marshaller);
+		ClientInterceptor[] interceptors = new ClientInterceptor[1];
+		interceptors[0] = wsSecurityInterceptor;
+		client.setInterceptors(interceptors);
+		return client;
+	}
+}
diff --git a/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdProperties.java b/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdProperties.java
new file mode 100644
index 0000000..689105e
--- /dev/null
+++ b/dg1cloud-core/src/main/java/it/digione/dg1cloud/ws/client/isd/IsdProperties.java
@@ -0,0 +1,114 @@
+package it.digione.dg1cloud.ws.client.isd;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties("isharedoc.ws")
+public class IsdProperties {
+
+	private Endpoint endpoint;
+	private Urp urp;
+	private String username;
+	private String password;
+	
+	public Endpoint getEndpoint() {
+		return endpoint;
+	}
+	public void setEndpoint(Endpoint endpoint) {
+		this.endpoint = endpoint;
+	}
+	public Urp getUrp() {
+		return urp;
+	}
+	public void setUrp(Urp urp) {
+		this.urp = urp;
+	}
+	public String getUsername() {
+		return username;
+	}
+	public void setUsername(String username) {
+		this.username = username;
+	}
+	public String getPassword() {
+		return password;
+	}
+	public void setPassword(String password) {
+		this.password = password;
+	}
+	@Override
+	public String toString() {
+		return "IsdProperties{" + 
+				"username='" + username + "'," +
+				"endpoint=" + endpoint + "," +
+				"urp=" + urp +
+				"}";
+	}
+	
+	public static class Endpoint {
+		
+		private String instance;
+		public String getInstance() {
+			return instance;
+		}
+		public void setInstance(String instance) {
+			this.instance = instance;
+		}
+		
+		@Override
+		public String toString() {
+			return "Endpoint{" + 
+					"instance='" + instance + "'" +
+					"}";
+		}
+	}
+	
+	public static class Urp {
+		
+		private String puid;
+		private String mbox;
+		private String storyboad;
+		private String metaviewname;
+		private String direction;
+		public String getPuid() {
+			return puid;
+		}
+		public void setPuid(String puid) {
+			this.puid = puid;
+		}
+		public String getMbox() {
+			return mbox;
+		}
+		public void setMbox(String mbox) {
+			this.mbox = mbox;
+		}
+		public String getStoryboad() {
+			return storyboad;
+		}
+		public void setStoryboad(String storyboad) {
+			this.storyboad = storyboad;
+		}
+		public String getMetaviewname() {
+			return metaviewname;
+		}
+		public void setMetaviewname(String metaviewname) {
+			this.metaviewname = metaviewname;
+		}
+		public String getDirection() {
+			return direction;
+		}
+		public void setDirection(String direction) {
+			this.direction = direction;
+		}
+		@Override
+		public String toString() {
+			return "Urp{" + 
+					"puid='" + puid + "'," +
+					"mbox='" + mbox + "'," +
+					"storyboad='" + storyboad + "'," +
+					"metaviewname='" + metaviewname + "'," +
+					"direction='" + direction + "'" +
+					"}";
+		}
+	}
+}
diff --git a/dg1cloud-core/src/main/resources/application.properties b/dg1cloud-core/src/main/resources/application.properties
index a19f80c..a8be783 100644
--- a/dg1cloud-core/src/main/resources/application.properties
+++ b/dg1cloud-core/src/main/resources/application.properties
@@ -1,6 +1,6 @@
 spring.datasource.url=jdbc:postgresql://localhost:5432/dg1cloud
-#spring.datasource.username=postgres
-#spring.datasource.password=passero
+spring.datasource.username=postgres
+spring.datasource.password=passero
 spring.datasource.driver-class-name=org.postgresql.Driver
 spring.datasource.tomcat.initial-size=10
 spring.datasource.tomcat.max-wait=30000 
@@ -17,5 +17,8 @@
 spring.jmx.default-domain=dg1cloud
 
 #server.address=vannux.grupposistematica.it
+server.error.include-stacktrace=always
 
-logging.level.it.digione.dg1cloud=DEBUG
\ No newline at end of file
+logging.level.it.digione.dg1cloud=DEBUG
+
+logging.level.org.springframework.ws=TRACE
\ No newline at end of file
diff --git a/dg1cloud-core/src/main/resources/templates/downloadFileCaptcha.html b/dg1cloud-core/src/main/resources/templates/downloadFileCaptcha.html
index 8aa9595..2d7f0fb 100644
--- a/dg1cloud-core/src/main/resources/templates/downloadFileCaptcha.html
+++ b/dg1cloud-core/src/main/resources/templates/downloadFileCaptcha.html
@@ -6,7 +6,6 @@
 		<meta name="viewport" content="width=device-width, initial-scale=1"/>
 		
 		<link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.min.css}"/>
-		<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}"/>
 		
 		<title>Link download file</title>
 		<script src='https://www.google.com/recaptcha/api.js'></script>
diff --git a/dg1cloud-core/src/main/resources/templates/error.html b/dg1cloud-core/src/main/resources/templates/error.html
new file mode 100644
index 0000000..9757972
--- /dev/null
+++ b/dg1cloud-core/src/main/resources/templates/error.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
+<head>
+	<style>
+		table td{
+		vertical-align:top;
+		border:solid 1px #888;
+		padding:10px;
+		}
+	</style>
+</head>
+<body>
+<h1>Si &egrave; verificato un errore</h1>
+<table>
+	<tr>
+		<td>Data</td>
+		<td th:text="${timestamp}"/>
+	</tr>
+	<tr>
+		<td>percorso</td>
+		<td th:text="${path}"/>
+	</tr>
+	<tr>
+		<td>Errore</td>
+		<td th:text="${error}"/>
+	</tr>
+	<tr>
+		<td>Stato</td>
+		<td th:text="${status}"/>
+	</tr>
+	<tr>
+		<td>Messaggio</td>
+		<td th:text="${message}"/>
+	</tr>
+	<tr>
+		<td>Trace</td>
+		<td>
+			<pre th:text="${trace}"></pre>
+		</td>
+	</tr>
+</table>
+</body>
+</html>
\ No newline at end of file
diff --git a/dg1cloud-core/src/main/resources/templates/startURP.html b/dg1cloud-core/src/main/resources/templates/startURP.html
new file mode 100644
index 0000000..efd21ef
--- /dev/null
+++ b/dg1cloud-core/src/main/resources/templates/startURP.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+	<head>
+		<meta charset="utf-8"/>
+		<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+		<meta name="viewport" content="width=device-width, initial-scale=1"/>
+		
+		<link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.min.css}"/>
+		
+		<title>Avvia istanza URP</title>
+		<script src='https://www.google.com/recaptcha/api.js'></script>
+	</head>
+	<body>
+		<div class="container">
+			<div class="row">
+				<div class="col-md-4 col-md-offset-4">
+					<div class="panel panel-default">
+						<div class="panel-body">
+							<div class="text-center">
+								<h3><i class="glyphicon glyphicon-inbox" style="font-size:2em;"></i></h3>
+								<h2 class="text-center" style="word-wrap: break-word;" th:text="'Avvia istanza URP'"></h2>
+								<div class="panel-body">
+									<form data-toggle="validator" action="#"
+										th:action="@{/sendStartRequest}" th:object="${startURPForm}"
+										method="post" role="form"
+										enctype="multipart/form-data" >
+										<div th:if="${message}" th:text="${message}" th:class="${'alert ' + alertClass}"></div>
+										<div class="form-group">
+											<label for="mittente" class="control-label">Mittente*</label>
+											<input type="email" class="form-control" th:field="*{mittente}" required placeholder="Email mittente" />
+											<p th:if="${#fields.hasErrors('mittente')}">Email mittente mancante</p>
+										</div>
+										<div class="form-group">
+											<label for="oggetto" class="control-label">Oggetto*</label>
+											<input type="text" class="form-control" th:field="*{oggetto}" required />
+											<p th:if="${#fields.hasErrors('oggetto')}">Compilare l'oggetto della richiesta</p>
+										</div>
+										<div class="form-group">
+											<label for="oggetto" class="control-label">Richiesta*</label>
+											<textarea rows="5" class="form-control" th:field="*{corpo}" required ></textarea>
+											<p th:if="${#fields.hasErrors('corpo')}">Scrivere il corpo della richiesta</p>
+										</div>
+										<div class="form-group">
+											<label for="allegato" class="control-label">Allegato richiesta*</label>
+											<input type="file" class="form-control" th:field="*{allegato}" required ></input>
+											<p th:if="${#fields.hasErrors('allegato')}">Inserire un allegato</p>
+											<p class="error-message"
+												th:each="error: ${#fields.errors('allegato')}"
+												th:text="${error}"></p>
+										</div>
+										<div class="form-group">
+											<div class="g-recaptcha" th:attr="data-sitekey=${@captchaSettings.getKey()}"></div>
+											<p class="error-message"
+												th:each="error: ${#fields.errors('reCaptchaResponse')}"
+												th:text="'Errore validazione reCaptcha'"></p>
+										</div>
+										<div class="form-group">
+											<button name="Invia richiesta" type="submit" th:text="'Invia richiesta'"></button>
+										</div>
+									</form>
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+		<script type="text/javascript" th:src="@{/webjars/jquery/3.2.1/jquery.min.js/}"></script>
+		<script type="text/javascript" th:src="@{/webjars/bootstrap/3.3.7/js/bootstrap.min.js}"></script>
+	</body>
+</html>
\ No newline at end of file
diff --git a/dg1cloud-core/src/test/java/it/digione/cloud/Dg1cloudCoreApplicationTests.java b/dg1cloud-core/src/test/java/it/digione/cloud/Dg1cloudCoreApplicationTests.java
deleted file mode 100644
index c7adb36..0000000
--- a/dg1cloud-core/src/test/java/it/digione/cloud/Dg1cloudCoreApplicationTests.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package it.digione.cloud;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import it.digione.dg1cloud.app.Dg1cloudCoreApplication;
-import it.digione.dg1cloud.service.CleanerService;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = Dg1cloudCoreApplication.class)
-public class Dg1cloudCoreApplicationTests {
-
-	@Autowired CleanerService cleanerService;
-	@Test
-	public void contextLoads() {
-		cleanerService.cleanEmptyStorageFolder();
-	}
-
-}

--
Gitblit v1.6.2