@ -91,6 +91,19 @@ public class AdvancedOperationPortlet extends MVCPortlet {
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void reindexPratica ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
Privati . 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 ) ;
IntPraticaLocalServiceUtil . reIndexFasciolo ( intPraticaId , themeDisplay . getCompanyId ( ) ) ;
}
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
public void fixStatusPratica ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {
@ -112,32 +125,35 @@ public class AdvancedOperationPortlet extends MVCPortlet {
Privati . checkIfUserIsCompanyAdmin ( actionRequest ) ;
long intPraticaId = ParamUtil . getLong ( actionRequest , "intPraticaId" , - 1L ) ;
_log . info ( "intPraticaId: " + intPraticaId ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . fetchIntPratica ( intPraticaId ) ;
int destinationUO = AdvancedOperationUtil . getDestinationUO ( intPratica ) ;
_log . info ( "intPratica uo: " + intPratica . getUnitaOperativa ( ) ) ;
if ( AdvancedOperationUtil . evalUO ( intPratica ) ) {
_setUO ( intPratica , destinationUO ) ;
}
_log . info ( "intPratica uo: " + intPratica . getUnitaOperativa ( ) ) ;
actionResponse . setRenderParameter ( "intPraticaId" , String . valueOf ( intPraticaId ) ) ;
}
private void _setUO ( IntPratica intPratica , int uo ) throws SystemException , SearchException {
private void _setUO ( IntPratica intPratica , int uo ) throws SystemException , PortalException {
_log . info ( "uo: " + uo ) ;
intPratica . setUnitaOperativa ( uo ) ;
IntPraticaLocalServiceUtil . updateIntPratica ( intPratica ) ;
Indexer intPraticaIndexer = IndexerRegistryUtil . getIndexer ( IntPratica . class ) ;
intPraticaIndexer . reindex ( intPratica ) ;
Indexer controlloPraticaIndexer = IndexerRegistryUtil . getIndexer ( ControlloPratica . class ) ;
List < ControlloPratica > controlloPraticas = ControlloPraticaLocalServiceUtil . findByIntPratica ( intPratica . getIntPraticaId ( ) ) ;
if ( ! controlloPraticas . isEmpty ( ) ) {
for ( ControlloPratica controlloPratica : controlloPraticas ) {
if ( controlloPratica . getStatus ( ) = = WorkflowConstants . STATUS_PENDING ) {
controlloPraticaIndexer . reindex ( intPratica ) ;
}
}
}
IntPraticaLocalServiceUtil . reIndexFasciolo ( intPratica . getIntPraticaId ( ) , intPratica . getCompanyId ( ) ) ;
// Indexer intPraticaIndexer = IndexerRegistryUtil.getIndexer(IntPratica.class);
// intPraticaIndexer.reindex(intPratica);
// Indexer controlloPraticaIndexer = IndexerRegistryUtil.getIndexer(ControlloPratica.class);
// List<ControlloPratica> controlloPraticas = ControlloPraticaLocalServiceUtil.findByIntPratica(intPratica.getIntPraticaId());
// if(!controlloPraticas.isEmpty()){
// for(ControlloPratica controlloPratica : controlloPraticas){
// if(controlloPratica.getStatus() == WorkflowConstants.STATUS_PENDING){
// controlloPraticaIndexer.reindex(intPratica);
// }
// }
// }
}
public void ripristinaPraticaVidimata ( ActionRequest actionRequest , ActionResponse actionResponse ) throws Exception {