@ -11,6 +11,7 @@ import com.liferay.portal.kernel.util.Validator;
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.kernel.workflow.WorkflowTask ;
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil ;
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil ;
import com.liferay.portal.model.User ;
import com.liferay.portal.model.WorkflowInstanceLink ;
import com.liferay.portal.model.WorkflowInstanceLink ;
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil ;
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil ;
@ -23,6 +24,7 @@ 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.shared.util.Constants ;
import it.tref.liferay.portos.bo.shared.util.Constants ;
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants ;
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants ;
import it.tref.liferay.portos.bo.util.WorkflowUtil ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Date ;
import java.util.Date ;
@ -43,7 +45,7 @@ public class AdvancedOperationUtil {
return false ;
return false ;
}
}
}
}
public static boolean hasControlloPratica_ProceduraC ( IntPratica intPratica ) {
public static boolean hasControlloPratica_ProceduraC ( IntPratica intPratica ) {
if ( Constants . PROCEDURA_C . equalsIgnoreCase ( intPratica . getTipoProcedura ( ) ) ) {
if ( Constants . PROCEDURA_C . equalsIgnoreCase ( intPratica . getTipoProcedura ( ) ) ) {
try {
try {
@ -156,6 +158,41 @@ public class AdvancedOperationUtil {
}
}
return false ;
return false ;
}
}
public static long getCurrentAssignee ( IntPratica intPratica ) {
long currentAssignee = 0 ;
WorkflowTask lastTask = getLastTask ( intPratica ) ;
if ( Validator . isNotNull ( lastTask ) ) {
if ( it . tref . liferay . portos . bo . util . WorkflowConstants . WORKFLOW_TASKNAME_ESITO . equalsIgnoreCase ( lastTask . getName ( ) ) ) {
currentAssignee = lastTask . getAssigneeUserId ( ) ;
}
}
return currentAssignee ;
}
public static WorkflowTask getLastTask ( IntPratica intPratica ) {
if ( Validator . isNotNull ( intPratica ) ) {
try {
List < ControlloPratica > controlloPraticas = ControlloPraticaLocalServiceUtil . findByIntPratica ( intPratica . getIntPraticaId ( ) ) ;
if ( ! controlloPraticas . isEmpty ( ) & & Validator . isNotNull ( controlloPraticas . get ( 0 ) ) ) {
ControlloPratica controlloPratica = controlloPraticas . get ( 0 ) ;
return WorkflowUtil . getLastTask ( controlloPratica . getCompanyId ( ) ,
controlloPratica . getGroupId ( ) , null , controlloPratica ) ;
}
} catch ( SystemException | PortalException e ) {
_log . error ( e , e ) ;
}
}
return null ;
}
public static boolean evalCurrentAssignee ( IntPratica intPratica , User tecnico ) {
WorkflowTask lastTask = getLastTask ( intPratica ) ;
if ( Validator . isNotNull ( lastTask ) & & lastTask . getName ( ) . equalsIgnoreCase ( "Esito" ) ) {
return tecnico . getUserId ( ) ! = lastTask . getAssigneeUserId ( ) | | lastTask . getAssigneeUserId ( ) = = 0 ;
}
return false ;
}
public static List < DettPratica > fetchDettPraticaListWithInizioLavori ( IntPratica intPratica ) {
public static List < DettPratica > fetchDettPraticaListWithInizioLavori ( IntPratica intPratica ) {
if ( Validator . isNotNull ( intPratica ) ) {
if ( Validator . isNotNull ( intPratica ) ) {