@ -37,11 +37,11 @@ import javax.portlet.ActionResponse;
public class AdvancedOperationPortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil . getLog ( AdvancedOperationPortlet . class ) ;
public void deleteControlloPratica ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
_checkIfUserIsCompanyAdmin ( actionRequest ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , 0L ) ;
if ( intPraticaId ! = 0L ) {
List < ControlloPratica > controlloPraticaList =
@ -52,24 +52,24 @@ public class AdvancedOperationPortlet extends MVCPortlet {
for ( ControlloPratica cp : controlloPraticaList ) {
if ( _log . isDebugEnabled ( ) ) {
_log . debug ( "AdvancedOperationPortlet --- Cycling... ControlloPraticaID " + cp . getCompanyId ( )
+ " Status " + cp . getStatus ( ) ) ;
+ " Status " + cp . getStatus ( ) ) ;
}
if ( ArrayUtil . contains ( AdvancedOperationUtil . STATUS_ARRAY , cp . getStatus ( ) ) ) {
_log . info ( "AdvancedOperationPortlet --- Deleting ControlloPratica " + cp . getControlloPraticaId ( ) +
" with Status " + cp . getStatus ( ) + " of IntPraticaId " + intPraticaId ) ;
" with Status " + cp . getStatus ( ) + " of IntPraticaId " + intPraticaId ) ;
ControlloPraticaLocalServiceUtil . deleteControlloPratica ( cp ) ;
}
}
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void reindexPratica ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
_checkIfUserIsCompanyAdmin ( actionRequest ) ;
ThemeDisplay themeDisplay = ( ThemeDisplay ) actionRequest . getAttribute ( WebKeys . THEME_DISPLAY ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , 0L ) ;
if ( intPraticaId ! = 0L ) {
_log . info ( "AdvancedOperationPortlet --- Reindexing fascicolo of IntPraticaId " + intPraticaId ) ;
@ -77,23 +77,45 @@ public class AdvancedOperationPortlet extends MVCPortlet {
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void cambiaDataInizioLavori ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
_checkIfUserIsCompanyAdmin ( actionRequest ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
Date dataInizioLavoriOpera = ParamUtil . getDate ( actionRequest , "dataInizioLavoriOperaInput" ,
DateFormatFactoryUtil . getSimpleDateFormat ( "yyyy-MM-dd" ) , null ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
_log . info ( "AdvancedOperationPortlet --- Changing DataInizioLavori on DettPraticas of IntPraticaId" + intPraticaId ) ;
_setDataInizioLavori ( intPratica , dataInizioLavoriOpera ) ;
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void resetDataInizioLavori ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
_checkIfUserIsCompanyAdmin ( actionRequest ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
if ( AdvancedOperationUtil . hasNoFineLavori ( intPratica ) ) {
_log . info ( "AdvancedOperationPortlet --- Resetting DataInizioLavori on DettPraticas of IntPraticaId" + intPraticaId ) ;
_setDataInizioLavori ( intPratica , null ) ;
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
private void _setDataInizioLavori ( IntPratica intPratica , Date dataInizioLavoriOpera )
throws SystemException {
List < DettPratica > dettPraticaListWithInizioLavori = AdvancedOperationUtil . fetchDettPraticaListWithInizioLavori ( intPratica ) ;
for ( DettPratica dettPratica : dettPraticaListWithInizioLavori ) {
dettPratica . setDataInizioLavoriOpera ( dataInizioLavoriOpera ) ;
dettPratica . setModifiedDate ( new Date ( ) ) ;
DettPraticaLocalServiceUtil . updateDettPratica ( dettPratica ) ;
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void fixNormLavoriInProprio ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
@ -172,7 +194,7 @@ public class AdvancedOperationPortlet extends MVCPortlet {
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void cambiaIstruttore ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
ThemeDisplay themeDisplay = ( ThemeDisplay ) actionRequest . getAttribute ( WebKeys . THEME_DISPLAY ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
@ -192,14 +214,14 @@ public class AdvancedOperationPortlet extends MVCPortlet {
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void fixUserID ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
_checkIfUserIsCompanyAdmin ( actionRequest ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
if ( ! AdvancedOperationUtil . evalInt_Dett_UserID ( intPratica ) ) {
DettPratica dettPratica = DettPraticaLocalServiceUtil . getLastEditableByIntPratica ( intPratica . getIntPraticaId ( ) ) ;
if ( Validator . isNotNull ( dettPratica ) ) {
@ -218,7 +240,7 @@ public class AdvancedOperationPortlet extends MVCPortlet {
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
if ( WorkflowConstants . STATUS_INCOMPLETE = = intPratica . getStatus ( ) ) {
_log . info ( "AdvancedOperationPortlet --- Recovering Pratica Vidimata (INCOMPLETE ==> APPROVED) "
+ "with IntPraticaId " + intPraticaId ) ;