@ -11,6 +11,7 @@ import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.Validator ;
import com.liferay.portal.kernel.util.Validator ;
import com.liferay.portal.kernel.util.WebKeys ;
import com.liferay.portal.kernel.util.WebKeys ;
import com.liferay.portal.kernel.workflow.WorkflowConstants ;
import com.liferay.portal.kernel.workflow.WorkflowConstants ;
import com.liferay.portal.kernel.workflow.WorkflowTask ;
import com.liferay.portal.theme.ThemeDisplay ;
import com.liferay.portal.theme.ThemeDisplay ;
import com.liferay.portal.util.PortalUtil ;
import com.liferay.portal.util.PortalUtil ;
import com.liferay.util.bridges.mvc.MVCPortlet ;
import com.liferay.util.bridges.mvc.MVCPortlet ;
@ -24,8 +25,8 @@ import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil ;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil ;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil ;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil ;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil ;
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil ;
import it.tref.liferay.portos.bo.util.WorkflowUtil ;
import java.util.Arrays ;
import java.util.Date ;
import java.util.Date ;
import java.util.List ;
import java.util.List ;
@ -171,6 +172,27 @@ public class AdvancedOperationPortlet extends MVCPortlet {
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
}
public void cambiaIstruttore ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
ThemeDisplay themeDisplay = ( ThemeDisplay ) actionRequest . getAttribute ( WebKeys . THEME_DISPLAY ) ;
_log . info ( "== cambiaIstruttore == dentro" ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
long istruttoreId = ParamUtil . getLong ( actionRequest , "istruttoreId" , - 1L ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
WorkflowTask lastTask = AdvancedOperationUtil . getLastTask ( intPratica ) ;
if ( lastTask ! = null & & lastTask . getName ( ) . equalsIgnoreCase ( "Esito" ) ) {
_log . info ( "== cambiaIstruttore == lastTask è esito" ) ;
List < ControlloPratica > controlloPraticas = ControlloPraticaLocalServiceUtil . findByIntPratica ( intPratica . getIntPraticaId ( ) ) ;
if ( ! controlloPraticas . isEmpty ( ) & & Validator . isNotNull ( controlloPraticas . get ( 0 ) ) ) {
_log . info ( "== cambiaIstruttore == controlloPratica trovato" ) ;
_log . info ( "== cambiaIstruttore == istruttoreId: " + istruttoreId ) ;
ControlloPratica controlloPratica = controlloPraticas . get ( 0 ) ;
WorkflowUtil . assegnaUltimoTask ( intPratica . getCompanyId ( ) , intPratica . getGroupId ( ) ,
istruttoreId , themeDisplay . getUserId ( ) , controlloPratica ) ;
}
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void ripristinaPraticaConforme ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
public void ripristinaPraticaConforme ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
_checkIfUserIsCompanyAdmin ( actionRequest ) ;
_checkIfUserIsCompanyAdmin ( actionRequest ) ;