|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package it.mwg.sicilia.sue.api.v1.command.impl; |
|
|
|
|
|
|
|
|
|
import it.mwg.sicilia.sue.api.v1.ApiUtil; |
|
|
|
|
import it.mwg.sicilia.sue.api.v1.Parameters; |
|
|
|
|
import it.mwg.sicilia.sue.api.v1.Response; |
|
|
|
|
import it.mwg.sicilia.sue.api.v1.Status; |
|
|
|
@ -13,11 +14,10 @@ import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
|
|
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
|
import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; |
|
|
|
|
|
|
|
|
|
import java.io.Serializable; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Map.Entry; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
@ -26,7 +26,6 @@ import com.liferay.portal.kernel.exception.PortalException;
|
|
|
|
|
import com.liferay.portal.kernel.exception.SystemException; |
|
|
|
|
import com.liferay.portal.kernel.servlet.ServletResponseUtil; |
|
|
|
|
import com.liferay.portal.kernel.util.MapUtil; |
|
|
|
|
.portal.kernel.util.MapUtil; |
|
|
|
|
|
|
|
|
|
public class SetFields extends Command { |
|
|
|
|
|
|
|
|
@ -57,34 +56,14 @@ public class SetFields extends Command {
|
|
|
|
|
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Object mapObj = parameters.get(Parameters.FIELDS); |
|
|
|
|
if (!(mapObj instanceof Map<?, ?>)) { |
|
|
|
|
additionalInfo.add("Formato del parametro " + Parameters.FIELDS + " errato"); |
|
|
|
|
Map<String, Serializable> fields = ApiUtil.getMapStringSerializable(parameters.get(Parameters.FIELDS)); |
|
|
|
|
if (null == fields) { |
|
|
|
|
additionalInfo.add("Parametro " + Parameters.FIELDS + " non corretto"); |
|
|
|
|
ServletResponseUtil.write(response, Response.get(Status.MALFORMED_REQUEST, additionalInfo)); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
Map<Object, Object> mapMap = (Map<Object, Object>) mapObj; |
|
|
|
|
if (mapMap.size() > 0) { |
|
|
|
|
Entry<Object, Object> i = mapMap.entrySet().iterator().next(); |
|
|
|
|
System.out.println("====== " + i.getValue().getClass().getName()); |
|
|
|
|
if (!(i.getKey() instanceof String) || !(i.getValue() instanceof Serializable)) { |
|
|
|
|
System.out.println("****** " + i.getValue().getClass().getName()); |
|
|
|
|
} |
|
|
|
|
if (i.getValue() instanceof String) { |
|
|
|
|
System.out.println("String"); |
|
|
|
|
} |
|
|
|
|
if (i.getValue() instanceof Date) { |
|
|
|
|
System.out.println("Date"); |
|
|
|
|
} |
|
|
|
|
if (i.getValue() instanceof Long) { |
|
|
|
|
System.out.println("Long"); |
|
|
|
|
} |
|
|
|
|
System.out.println(i.getValue() + "!!!"); |
|
|
|
|
} |
|
|
|
|
long applicationId = MapUtil.getLong(parameters, Parameters.APPLICATION_ID); |
|
|
|
|
IntPratica intPratica = null; |
|
|
|
|
Object obj = parameters.get(Parameters.FIELDS); |
|
|
|
|
try { |
|
|
|
|
intPratica = IntPraticaLocalServiceUtil.getIntPratica(applicationId); |
|
|
|
|
} catch (PortalException | SystemException e) { |
|
|
|
|