Sfoglia il codice sorgente

Merge branch 'p-2marzo' of 149.202.172.180:/home/ubuntu/sicilia/sismica into p-2marzo

master
Salvatore La Manna 4 anni fa
parent
commit
ba796d5871
  1. 3
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/.settings/org.eclipse.wst.common.component
  2. 148
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ManualHtml.java
  3. 31
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/css/api/v1/api.css
  4. 10300
      liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/css/bootstrap.css

3
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/.settings/org.eclipse.wst.common.component

@ -6,6 +6,9 @@
<dependent-module archiveName="portos-bo-portlet-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/portos-bo-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="portos-bo-portlet-service.jar" deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/portos-bo-portlet/docroot/WEB-INF/lib/portos-bo-portlet-service.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="sicilia-sue-connector-portlet"/>
<property name="java-output-path" value="/sicilia-sue-connector-portlet/docroot/WEB-INF/classes"/>
</wb-module>

148
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/WEB-INF/src/it/mwg/sicilia/sue/api/v1/command/impl/ManualHtml.java

@ -35,65 +35,127 @@ public class ManualHtml extends Manual {
public void run(HttpServletRequest request, HttpServletResponse response) throws Exception {
String cssFile = "/css/api/v1/api.css";
String bootstrapFile = "/css/bootstrap.css";
StringBuilder result = new StringBuilder();
result.append("<!doctype html>").append("<meta charset=\"utf-8\">")
.append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">")
.append("<head><title>Manual</title>").append("<link rel=\"stylesheet\" href=\"")
.append(request.getContextPath()).append(cssFile).append("?v=")
.append(new File(request.getServletContext().getRealPath(cssFile)).lastModified()).append("\">")
.append("</head><body>");
for (Command command : CommandList.getList()) {
result.append("<div class=\"command\">Comando: <b>/").append(command.getVerb()).append("</b>");
if (command.isSecure()) {
result.append(" [T]");
}
result.append("<div class=\"description\">").append(command.getDescription()).append(".</div>");
result.append("<div class=\"methods\">Metodi: ")
.append(StringUtils.join(command.getMethods(), StringPool.COMMA_AND_SPACE)).append("</div>");
result.append("<div class=\"parameters\">Parametri:");
List<Parameter> parameters = command.getInputParameters();
if (parameters.isEmpty()) {
result.append(" Nessuno</div>");
} else {
for (Parameter parameter : parameters) {
result.append("<div class=\"parameter\">").append(parameter.getName());
if (parameter.isRequired()) {
result.append(StringPool.STAR);
}
result.append(" (").append(parameter.getType().toString()).append(") - ")
.append(parameter.getDescription()).append("</div>");
}
.append("<link rel=\"stylesheet\" href=\"").append(request.getContextPath())
.append(bootstrapFile).append("\">")
.append("</head><body class=''>");
result.append("<div class='container'>");
result.append("<div class='row'>");
result.append("<div class='col-12 pt-4'>");
result.append("<h1>Sicilia SUE API v1</h1>");
result.append("</div>");
}
parameters = command.getOutputParameters();
if (!parameters.isEmpty()) {
result.append("<div class=\"returns\">Restituisce:");
for (Parameter parameter : parameters) {
result.append("<div class=\"parameter\">").append(parameter.getName()).append(" (")
.append(parameter.getType().toString()).append(") - ").append(parameter.getDescription());
if (parameter.getType().equals(TYPES.ARRAY)) {
for (Parameter subParameter : parameter.getSubParameters()) {
result.append("<div class=\"parameter\">").append(subParameter.getName()).append(" (")
.append(subParameter.getType().toString()).append(") - ")
.append(subParameter.getDescription()).append("</div>");
result.append("</div>");
for (Command command : CommandList.getList()) {
result.append("<div class='row'>");
result.append("<div class='col-12 mb-5'>");
result.append("<h2 class='mb-3 mt-2'>/").append(command.getVerb());
if (command.isSecure())
result.append(" <small>[T]</small>");
result.append("</h2>");
result.append("<p class='description text-secondary mb-3'>").append(command.getDescription()).append(".</p>");
result.append("<div class='w-100 mb-2'>");
for(String cmd : command.getMethods() ){
result.append("<span class='badge badge-success mr-2 py-1 px-2' data-type='" + cmd.toLowerCase() + "'>"+cmd+"</span>");
}
}
result.append("</div>");
result.append("<div class='d-flex w-100 mb-3'><kbd class='container-fluid py-2'>");
result.append(getCurlExample(command, getBaseUrl(request)));
result.append("</kbd></div>");
List<Parameter> parameters = command.getInputParameters();
result.append("<div class='w-100 mb-3 mt-4'>");
result.append("<h4 class='w-100'>Parametri</h4>");
if (parameters.isEmpty()) {
result.append("<p>Nessuno</p>");
} else {
result.append("<table class='table table-sm table-bordered'>");
result.append("<thead class='thead-light font-weight-bold'>");
result.append("<tr>");
result.append("<th>Campo</th>");
result.append("<th>Obbligatorio</th>");
result.append("<th>Tipo</th>");
result.append("<th>Descrizione</th>");
result.append("</tr>");
result.append("</thead>");
result.append("<tbody>");
result.append(printTableParameters(parameters, 1));
result.append("</tbody>");
result.append("</table>");
}
result.append("</div>");
parameters = command.getOutputParameters();
result.append("<div class='w-100 mb-3 mt-4'>");
result.append("<h4 clsas='w-100'>Risposta</h4>");
if (parameters.isEmpty()) {
result.append("<p>Nessuno</p>");
} else {
result.append("<table class='table table-sm table-bordered'>");
result.append("<thead class='thead-light font-weight-bold'>");
result.append("<tr>");
result.append("<th>Campo</th>");
result.append("<th>Obbligatorio</th>");
result.append("<th>Tipo</th>");
result.append("<th>Descrizione</th>");
result.append("</tr>");
result.append("</thead>");
result.append("<tbody>");
result.append(printTableParameters(parameters, 1));
result.append("</tbody>");
result.append("</table>");
}
result.append("</div>");
result.append("</div>");
}
result.append("</div>");
}
result.append("<div class=\"example\">Esempio:<pre>").append(getCurlExample(command, getBaseUrl(request)))
.append("</pre></div>");
result.append("</div>"); // class="command"
}
result.append("<div class=\"notes\">Note:<br>[T] = Richiede token di autenticazione: header di richiesta \"")
.append(Parameters.X_AUTH_TOKEN).append("\" oppure parametro \"").append(Parameters.TOKEN)
.append("\"<br>* = Parametro obbligatorio</div>");
result.append("<div class='row'>");
result.append("<div class='col-12 pt-4'>");
result.append("<p>");
result.append("<b>Note</b><br>[T] = Richiede token di autenticazione: header di richiesta \"");
result.append(Parameters.X_AUTH_TOKEN).append("\" oppure parametro \"").append(Parameters.TOKEN);
result.append("\"</p>");
result.append("</div>");
result.append("</div>");
result.append("</div>");
result.append("</body></html>");
setTextHtml(response);
ServletResponseUtil.write(response, result.toString());
}
private String printTableParameters(List<Parameter> parameters, int level){
StringBuilder result = new StringBuilder();
for (Parameter parameter : parameters) {
result.append("<tr>");
result.append("<td style='padding-left:" + (0.75 * level) + "rem'>" + parameter.getName() + "</td>");
result.append("<td>");
if (parameter.isRequired())
result.append("Sì");
else
result.append("No");
result.append("</td>");
result.append("<td>" + parameter.getType().toString() + "</td>");
result.append("<td>" + parameter.getDescription() + "</td>");
result.append("</tr>");
if (parameter.getType().equals(TYPES.ARRAY)) {
printTableParameters(parameter.getSubParameters(), level++);
}
}
return result.toString();
}
@Override
public List<Parameter> getOutputParameters() {
return OUTPUT_PARAMETERS;

31
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/css/api/v1/api.css

@ -1,7 +1,7 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain) */
html, body, div, span, applet, object, iframe,
/*html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
@ -21,7 +21,6 @@ time, mark, audio, video {
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
@ -43,28 +42,10 @@ q:before, q:after {
table {
border-collapse: collapse;
border-spacing: 0;
}
}*/
/* End reset.css */
body {
margin: 10px;
font-family: sans-serif;
}
div {
margin-bottom: 5px;
}
b {
font-weight: bold;
}
pre {
background-color: #ccc;
width: fit-content;
padding: 10px;
border: 1px solid #999;
}
.command {
border-bottom: 1px solid #999;
padding: 10px 0;
}
.parameter {
margin-left: 40px;
.badge.badge-success[data-type="post"] {
background-color: #007bff;
}

10300
liferay-plugins-sdk-6.2/portlets/sicilia-sue-connector-portlet/docroot/css/bootstrap.css vendored

File diff soppresso perché troppo grande Load Diff
Caricamento…
Annulla
Salva