@ -37,13 +37,14 @@ import com.liferay.portal.service.ServiceContext;
* The implementation of the int pratica remote service .
*
* < p >
* All custom service methods should be put in this class . Whenever methods are added , rerun
* ServiceBuilder to copy their definitions into the
* All custom service methods should be put in this class . Whenever methods are
* added , rerun ServiceBuilder to copy their definitions into the
* { @link it . tref . liferay . portos . bo . service . IntPraticaService } interface .
*
* < p >
* This is a remote service . Methods of this service are expected to have security checks based on
* the propagated JAAS credentials because this service can be accessed remotely .
* This is a remote service . Methods of this service are expected to have
* security checks based on the propagated JAAS credentials because this service
* can be accessed remotely .
* < / p >
*
* @author Davide Barbagallo , 3F Consulting
@ -51,179 +52,192 @@ import com.liferay.portal.service.ServiceContext;
* @see it . tref . liferay . portos . bo . service . IntPraticaServiceUtil
* /
public class IntPraticaServiceImpl extends IntPraticaServiceBaseImpl {
/ *
* NOTE FOR DEVELOPERS : Never reference this interface directly . Always use { @link
* it . tref . liferay . portos . bo . service . IntPraticaServiceUtil } to access the int pratica remote
* service .
* /
/ *
* NOTE FOR DEVELOPERS : Never reference this interface directly . Always use
* { @link it . tref . liferay . portos . bo . service . IntPraticaServiceUtil } to access
* the int pratica remote service .
* /
public IntPratica getIntPratica ( long intPraticaId ) throws PortalException , SystemException {
public IntPratica getIntPratica ( long intPraticaId ) throws PortalException , SystemException {
// TODO: Permessi
return intPraticaLocalService . getIntPratica ( intPraticaId ) ;
}
// TODO: Permessi
return intPraticaLocalService . getIntPratica ( intPraticaId ) ;
}
public void deleteIntPratica ( long intPraticaId , long userId ) throws PortalException , SystemException {
public void deleteIntPratica ( long intPraticaId , long userId ) throws PortalException , SystemException {
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
if ( ValidazionePraticaUtil . canDeletePratica ( intPraticaId , userId ) ) {
intPraticaLocalService . deleteIntPratica ( intPratica ) ;
} else {
throw new SystemException ( "impossibile cancellare la int pratica" ) ;
}
}
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
if ( ValidazionePraticaUtil . canDeletePratica ( intPraticaId , userId ) ) {
intPraticaLocalService . deleteIntPratica ( intPratica ) ;
} else {
throw new SystemException ( "impossibile cancellare la int pratica" ) ;
}
}
// public void pagaInvia(long intPraticaId, int pagAdeguamentoSismico, int pagAltro, int
// pagMiglioramentoSismico,
// int pagNuovaCostruzione, boolean pagNuoveCostruzioni, boolean pagRiparazioneInterventoLocale,
// boolean pagVarianti, String importoSpeseIstruttoria, String codiceFiscaleCommittente, String
// currentUrl,
// ServiceContext serviceContext) throws PortalException, SystemException {
//
//
// intPraticaLocalService.pagaInvia(intPraticaId, pagAdeguamentoSismico, pagAltro,
// pagMiglioramentoSismico,
// pagNuovaCostruzione, pagNuoveCostruzioni, pagRiparazioneInterventoLocale, pagVarianti,
// importoSpeseIstruttoria,
// codiceFiscaleCommittente, currentUrl, serviceContext);
//
// }
// public void pagaInvia(long intPraticaId, int pagAdeguamentoSismico, int
// pagAltro, int
// pagMiglioramentoSismico,
// int pagNuovaCostruzione, boolean pagNuoveCostruzioni, boolean
// pagRiparazioneInterventoLocale,
// boolean pagVarianti, String importoSpeseIstruttoria, String
// codiceFiscaleCommittente, String
// currentUrl,
// ServiceContext serviceContext) throws PortalException, SystemException {
//
//
// intPraticaLocalService.pagaInvia(intPraticaId, pagAdeguamentoSismico,
// pagAltro,
// pagMiglioramentoSismico,
// pagNuovaCostruzione, pagNuoveCostruzioni, pagRiparazioneInterventoLocale,
// pagVarianti,
// importoSpeseIstruttoria,
// codiceFiscaleCommittente, currentUrl, serviceContext);
//
// }
public void sospendiPratica ( long intPraticaId , boolean sospesa ) throws PortalException , SystemException {
public void sospendiPratica ( long intPraticaId , boolean sospesa ) throws PortalException , SystemException {
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
Territorio territorio = TerritorioLocalServiceUtil . getTerritorio ( intPratica . getTerritorioId ( ) ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
Territorio territorio = TerritorioLocalServiceUtil . getTerritorio ( intPratica . getTerritorioId ( ) ) ;
IntPraticaPermission . check ( getPermissionChecker ( ) , territorio . getGroupId ( ) ,
ActionKeys . SOSPENDI_FASCICOLO ) ;
intPraticaLocalService . sospendiPratica ( intPraticaId , sospesa ) ;
IntPraticaPermission . check ( getPermissionChecker ( ) , territorio . getGroupId ( ) , ActionKeys . SOSPENDI_FASCICOLO ) ;
intPraticaLocalService . sospendiPratica ( intPraticaId , sospesa ) ;
}
}
public void cambiaTitolare ( long intPraticaId , long soggettoId , ServiceContext serviceContext )
throws PortalException , SystemException {
public void cambiaTitolare ( long intPraticaId , long soggettoId , ServiceContext serviceContext ) throws PortalException ,
SystemException {
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
Territorio territorio = TerritorioLocalServiceUtil . getTerritorio ( intPratica . getTerritorioId ( ) ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
Territorio territorio = TerritorioLocalServiceUtil . getTerritorio ( intPratica . getTerritorioId ( ) ) ;
IntPraticaPermission . check ( getPermissionChecker ( ) , territorio . getGroupId ( ) ,
ActionKeys . CAMBIO_TITOLARE ) ;
intPraticaLocalService . cambiaTitolare ( intPraticaId , soggettoId , serviceContext ) ;
}
IntPraticaPermission . check ( getPermissionChecker ( ) , territorio . getGroupId ( ) , ActionKeys . CAMBIO_TITOLARE ) ;
intPraticaLocalService . cambiaTitolare ( intPraticaId , soggettoId , serviceContext ) ;
}
public void updateStatoPratica ( long intPraticaId , String statoPratica ) throws PortalException ,
SystemException {
public void updateStatoPratica ( long intPraticaId , String statoPratica ) throws PortalException , SystemException {
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
Territorio territorio = TerritorioLocalServiceUtil . getTerritorio ( intPratica . getTerritorioId ( ) ) ;
IntPratica intPratica = IntPraticaLocalServiceUtil . getIntPratica ( intPraticaId ) ;
Territorio territorio = TerritorioLocalServiceUtil . getTerritorio ( intPratica . getTerritorioId ( ) ) ;
IntPraticaPermission . check ( getPermissionChecker ( ) , territorio . getGroupId ( ) , ActionKeys . CAMBIO_STATO ) ;
intPraticaLocalService . updateStatoPratica ( intPraticaId , statoPratica ) ;
}
IntPraticaPermission . check ( getPermissionChecker ( ) , territorio . getGroupId ( ) , ActionKeys . CAMBIO_STATO ) ;
intPraticaLocalService . updateStatoPratica ( intPraticaId , 0l , statoPratica ) ;
}
public List < IntPratica > search ( List < Long > groupIds , int start , int end ) throws SystemException {
public List < IntPratica > search ( List < Long > groupIds , int start , int end ) throws SystemException {
// TODO Modificare tramite Indexer
// TODO Aggiungere controllo permessi
// TODO Modificare tramite Indexer
// TODO Aggiungere controllo permessi
return intPraticaLocalService . search ( groupIds , start , end ) ;
return intPraticaLocalService . search ( groupIds , start , end ) ;
}
}
public int countSearch ( List < Long > groupIds ) throws SystemException {
public int countSearch ( List < Long > groupIds ) throws SystemException {
// TODO Modificare tramite Indexer
// TODO Aggiungere controllo permessi
// TODO Modificare tramite Indexer
// TODO Aggiungere controllo permessi
return intPraticaLocalService . countSearch ( groupIds ) ;
return intPraticaLocalService . countSearch ( groupIds ) ;
}
}
public List < IntPratica > findByCompanyIdSoggettoProgetti ( long companyId , long soggettoId )
throws SystemException , PortalException {
public List < IntPratica > findByCompanyIdSoggettoProgetti ( long companyId , long soggettoId ) throws SystemException ,
PortalException {
return intPraticaLocalService . findByCompanyIdSoggettoProgetti ( companyId , soggettoId ) ;
}
return intPraticaLocalService . find ByCompanyIdSoggettoProgetti ( companyId , soggettoId ) ;
}
public int count ByCompanyIdSoggettoProgetti ( long companyId , long soggettoId ) throws SystemException ,
PortalException {
public int countByCompanyIdSoggettoProgetti ( long companyId , long soggettoId ) throws SystemException , PortalException {
return intPraticaLocalService . countByCompanyIdSoggettoProgetti ( companyId , soggettoId ) ;
}
return intPraticaLocalService . countByCompanyIdSoggettoProgetti ( companyId , soggettoId ) ;
}
public List < IntPratica > findByCompanyIdSoggettoArchivio ( long companyId , long soggettoId )
throws SystemException , PortalException {
public List < IntPratica > findByCompanyIdSoggettoArchivio ( long companyId , long soggettoId ) throws SystemException ,
PortalException {
return intPraticaLocalService . findByCompanyIdSoggettoArchivio ( companyId , soggettoId ) ;
}
return intPraticaLocalService . find ByCompanyIdSoggettoArchivio ( companyId , soggettoId ) ;
}
public int count ByCompanyIdSoggettoArchivio ( long companyId , long soggettoId ) throws SystemException ,
PortalException {
public int countByCompanyIdSoggettoArchivio ( long companyId , long soggettoId ) throws SystemException , PortalException {
return intPraticaLocalService . countByCompanyIdSoggettoArchivio ( companyId , soggettoId ) ;
}
return intPraticaLocalService . countByCompanyIdSoggettoArchivio ( companyId , soggettoId ) ;
}
public List < IntPratica > findByCompanyIdSoggettoAltriProgetti ( long companyId , long soggettoId , int start ,
int end ) throws SystemException , PortalException {
public List < IntPratica > findByCompanyIdSoggettoAltriProgetti ( long companyId , long soggettoId , int start , int end )
throws SystemException , PortalException {
return intPraticaLocalService . findByCompanyIdSoggettoAltriProgetti ( companyId , soggettoId , start , end ) ;
}
return intPraticaLocalService . findByCompanyIdSoggettoAltriProgetti ( companyId , soggettoId , start , end ) ;
}
public int countByCompanyIdSoggettoAltriProgetti ( long companyId , long soggettoId ) throws SystemException ,
PortalException {
public int countByCompanyIdSoggettoAltriProgetti ( long companyId , long soggettoId ) throws SystemException ,
PortalException {
return intPraticaLocalService . countByCompanyIdSoggettoAltriProgetti ( companyId , soggettoId ) ;
}
return intPraticaLocalService . countByCompanyIdSoggettoAltriProgetti ( companyId , soggettoId ) ;
}
public List < IntPratica > findByCanAddFineLavori ( long companyId , String codiceFiscale , int start , int end )
throws SystemException , PortalException {
public List < IntPratica > findByCanAddFineLavori ( long companyId , String codiceFiscale , int start , int end )
throws SystemException , PortalException {
return intPraticaLocalService . findByCanAddFineLavori ( companyId , codiceFiscale , start , end ) ;
}
return intPraticaLocalService . findByCanAddFineLavori ( companyId , codiceFiscale , start , end ) ;
}
public int countByCanAddFineLavori ( long companyId , String codiceFiscale ) throws SystemException ,
PortalException {
public int countByCanAddFineLavori ( long companyId , String codiceFiscale ) throws SystemException , PortalException {
return intPraticaLocalService . countByCanAddFineLavori ( companyId , codiceFiscale ) ;
}
return intPraticaLocalService . countByCanAddFineLavori ( companyId , codiceFiscale ) ;
}
public List < IntPratica > findByCanAddCollaudo ( long companyId , String codiceFiscale , int start , int end )
throws SystemException , PortalException {
public List < IntPratica > findByCanAddCollaudo ( long companyId , String codiceFiscale , int start , int end )
throws SystemException , PortalException {
return intPraticaLocalService . findByCanAddCollaudo ( companyId , codiceFiscale , start , end ) ;
}
return intPraticaLocalService . findByCanAddCollaudo ( companyId , codiceFiscale , start , end ) ;
}
public int countByCanAddCollaudo ( long companyId , String codiceFiscale ) throws SystemException ,
PortalException {
public int countByCanAddCollaudo ( long companyId , String codiceFiscale ) throws SystemException , PortalException {
return intPraticaLocalService . countByCanAddCollaudo ( companyId , codiceFiscale ) ;
}
return intPraticaLocalService . countByCanAddCollaudo ( companyId , codiceFiscale ) ;
}
public FileEntry allegaFileAnnullamento ( long intPraticaId , byte [ ] content , String sourceFileName ,
String jsonFirmatari , ServiceContext serviceContext ) throws SystemException , PortalException ,
IOException {
public FileEntry allegaFileAnnullamento ( long intPraticaId , byte [ ] content , String sourceFileName ,
String jsonFirmatari , ServiceContext serviceContext ) throws SystemException , PortalException , IOException {
return intPraticaLocalService . allegaFileAnnullamento ( intPraticaId , content , sourceFileName ,
jsonFirmatari , serviceContext ) ;
}
return intPraticaLocalService . allegaFileAnnullamento ( intPraticaId , content , sourceFileName , jsonFirmatari , serviceContext ) ;
}
public void completeAnnullamento ( long intPraticaId , long userId ) throws PortalException , SystemException {
public void completeAnnullamento ( long intPraticaId , long userId ) throws PortalException , SystemException {
if ( ! AzioniPraticheUtil . isAllowedAction ( intPraticaId , AzioniPraticheUtil . ACTION_ANNULLA )
| | ! ValidazionePraticaUtil . praticaCanAbort ( intPraticaId , userId ) ) {
throw new SystemException ( "error.annullamento.add.file.not.allowed" ) ;
}
intPraticaLocalService . completeAnnullamento ( intPraticaId ) ;
}
if ( ! AzioniPraticheUtil . isAllowedAction ( intPraticaId , AzioniPraticheUtil . ACTION_ANNULLA )
| | ! ValidazionePraticaUtil . praticaCanAbort ( intPraticaId , userId ) ) {
throw new SystemException ( "error.annullamento.add.file.not.allowed" ) ;
}
intPraticaLocalService . completeAnnullamento ( intPraticaId ) ;
}
public void cambiaIstruttore ( long intPraticaId , long controlloPraticaId , long istruttoreId )
throws PortalException , SystemException {
public void cambiaIstruttore ( long intPraticaId , long controlloPraticaId , long istruttoreId ) throws PortalException ,
SystemException {
intPraticaLocalService . cambiaIstruttore ( intPraticaId , controlloPraticaId , istruttoreId ) ;
}
intPraticaLocalService . cambiaIstruttore ( intPraticaId , controlloPraticaId , istruttoreId ) ;
}
public String geosisma ( long intPraticaId ) throws PortalException , SystemException {
public String geosisma ( long intPraticaId ) throws PortalException , SystemException {
JSONObject json = JSONFactoryUtil . createJSONObject ( ) ;
JSONObject json = JSONFactoryUtil . createJSONObject ( ) ;
IntPratica intPratica = intPraticaLocalService . fetchIntPratica ( intPraticaId ) ;
if ( Validator . isNotNull ( intPratica ) ) {
json . put ( "intPraticaId" , intPratica . getIntPraticaId ( ) ) ;
}
IntPratica intPratica = intPraticaLocalService . fetchIntPratica ( intPraticaId ) ;
if ( Validator . isNotNull ( intPratica ) ) {
json . put ( "intPraticaId" , intPratica . getIntPraticaId ( ) ) ;
}
return json . toString ( ) ;
}
return json . toString ( ) ;
}
}