|
|
@ -19,35 +19,59 @@ import com.liferay.portal.kernel.exception.SystemException; |
|
|
|
import com.liferay.portal.kernel.log.Log; |
|
|
|
import com.liferay.portal.kernel.log.Log; |
|
|
|
import com.liferay.portal.kernel.log.LogFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.log.LogFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.util.StringPool; |
|
|
|
import com.liferay.portal.kernel.util.StringPool; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.util.Validator; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.util.WebKeys; |
|
|
|
|
|
|
|
import com.liferay.portal.theme.ThemeDisplay; |
|
|
|
|
|
|
|
|
|
|
|
public class MappeUtil { |
|
|
|
public class MappeUtil { |
|
|
|
private final static Log _log = LogFactoryUtil.getLog(MappeUtil.class); |
|
|
|
private final static Log _log = LogFactoryUtil.getLog(MappeUtil.class); |
|
|
|
|
|
|
|
|
|
|
|
public static String getUrlFe(HttpServletRequest request, DettPratica dettPratica, Comune comune) |
|
|
|
public static String getUrlFe(HttpServletRequest request, DettPratica dettPratica, Comune comune, boolean readOnly) |
|
|
|
throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(comune.getCompanyId(), |
|
|
|
|
|
|
|
|
|
|
|
ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
|
|
|
long companyId = td.getCompanyId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, |
|
|
|
ConfigurazioneConstants.MAPPE_URL_IFRAME_FE); |
|
|
|
ConfigurazioneConstants.MAPPE_URL_IFRAME_FE); |
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune); |
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune, readOnly); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String getUrlBo(HttpServletRequest request, DettPratica dettPratica, Comune comune) |
|
|
|
public static String getUrlBo(HttpServletRequest request, DettPratica dettPratica, Comune comune, boolean readOnly) |
|
|
|
throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(comune.getCompanyId(), |
|
|
|
|
|
|
|
|
|
|
|
ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
|
|
|
long companyId = td.getCompanyId(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String baseUrl = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, |
|
|
|
ConfigurazioneConstants.MAPPE_URL_IFRAME_BO); |
|
|
|
ConfigurazioneConstants.MAPPE_URL_IFRAME_BO); |
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune); |
|
|
|
return getUrlComune(request, baseUrl, dettPratica, comune, readOnly); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static String getUrlComune(HttpServletRequest request, String baseUrl, DettPratica dettPratica, |
|
|
|
private static String getUrlComune(HttpServletRequest request, String baseUrl, DettPratica dettPratica, |
|
|
|
Comune comune) throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
Comune comune, boolean readOnly) throws UnsupportedEncodingException, PortalException, SystemException { |
|
|
|
long companyId = comune.getCompanyId(); |
|
|
|
|
|
|
|
|
|
|
|
ThemeDisplay td = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); |
|
|
|
|
|
|
|
long companyId = td.getCompanyId(); |
|
|
|
|
|
|
|
|
|
|
|
String sharedSecret = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, |
|
|
|
String sharedSecret = ConfigurazioneLocalServiceUtil.findByC_ChiaveString(companyId, |
|
|
|
ConfigurazioneConstants.MAPPE_SHARED_SECRET); |
|
|
|
ConfigurazioneConstants.MAPPE_SHARED_SECRET); |
|
|
|
long date = new Date().getTime() / 1000; |
|
|
|
long date = new Date().getTime() / 1000; |
|
|
|
String auth = DigestUtils.sha256Hex(date + sharedSecret + request.getServerName()); |
|
|
|
String auth = DigestUtils.sha256Hex(date + sharedSecret + request.getServerName()); |
|
|
|
|
|
|
|
|
|
|
|
String url = baseUrl.replace("{{COD_BELFIORE}}", urlEncode(comune.getCodiceBelfiore())).replace( |
|
|
|
String url = baseUrl; |
|
|
|
"{{ESTREMI_CAT}}", urlEncode(dettPratica.getEstremiCatastali())); |
|
|
|
|
|
|
|
|
|
|
|
if(Validator.isNotNull(comune)) |
|
|
|
|
|
|
|
url = url.replace("{{COD_BELFIORE}}", urlEncode(comune.getCodiceBelfiore())); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
url = url.replace("{{COD_BELFIORE}}", ""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Validator.isNotNull(dettPratica)) |
|
|
|
|
|
|
|
url = url.replace("{{ESTREMI_CAT}}", urlEncode(dettPratica.getEstremiCatastali())); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
url = url.replace("{{ESTREMI_CAT}}", ""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
url = url.replace("{{READONLY}}", (readOnly ? "true" : "false")); |
|
|
|
|
|
|
|
|
|
|
|
String query = StringPool.BLANK; |
|
|
|
String query = StringPool.BLANK; |
|
|
|
String[] parti = StringUtils.split(url, StringPool.QUESTION); |
|
|
|
String[] parti = StringUtils.split(url, StringPool.QUESTION); |
|
|
|