|
|
|
@ -12,6 +12,8 @@
|
|
|
|
|
|
|
|
|
|
package it.tref.liferay.portos.bo.service.impl; |
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.model.Collaudo; |
|
|
|
|
import it.tref.liferay.portos.bo.model.DettPratica; |
|
|
|
|
import it.tref.liferay.portos.bo.model.FineLavori; |
|
|
|
@ -30,13 +32,14 @@ import com.liferay.portal.service.ServiceContext;
|
|
|
|
|
* The implementation of the pagamento 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.PagamentoService} 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 |
|
|
|
@ -45,25 +48,28 @@ import com.liferay.portal.service.ServiceContext;
|
|
|
|
|
*/ |
|
|
|
|
public class PagamentoServiceImpl extends PagamentoServiceBaseImpl { |
|
|
|
|
/* |
|
|
|
|
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link |
|
|
|
|
* it.tref.liferay.portos.bo.service.PagamentoServiceUtil} to access the pagamento remote service. |
|
|
|
|
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use |
|
|
|
|
* {@link it.tref.liferay.portos.bo.service.PagamentoServiceUtil} to access |
|
|
|
|
* the pagamento remote service. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
public void sostituisciPagamento(long pagamentoId, String codiceFiscaleCommittente, String mezzo, String url, |
|
|
|
|
ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
public void sostituisciPagamento(long pagamentoId, String codiceFiscaleCommittente, String mezzo, |
|
|
|
|
String url, ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(pagamentoId); |
|
|
|
|
long userId = findTitolare(pagamentoId); |
|
|
|
|
|
|
|
|
|
if (getUserId() == userId || DelegheUtil.hasDelegaPagamento(userId, pagamento.getClassPk())) { |
|
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, serviceContext); |
|
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, |
|
|
|
|
serviceContext); |
|
|
|
|
} else { |
|
|
|
|
throw new SystemException("pagamento aggiornabile solo da titolare digitale del " + pagamento.getClassName()); |
|
|
|
|
throw new SystemException("pagamento aggiornabile solo da titolare digitale del " |
|
|
|
|
+ pagamento.getClassName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void rigeneraPagamento(long pagamentoId, String codiceFiscaleCommittente, String mezzo, String url, |
|
|
|
|
ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
public void rigeneraPagamento(long pagamentoId, String codiceFiscaleCommittente, String mezzo, |
|
|
|
|
String url, ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
if (PendingPagamentiPermission.contains(getPermissionChecker(), serviceContext.getScopeGroupId(), |
|
|
|
|
ActionKeys.PAGAMENTI_PENDING)) { |
|
|
|
@ -76,13 +82,15 @@ public class PagamentoServiceImpl extends PagamentoServiceBaseImpl {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (isAllowed) {
|
|
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, serviceContext); |
|
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, |
|
|
|
|
serviceContext); |
|
|
|
|
} else { |
|
|
|
|
throw new SystemException("pagamento rigenerabile solo da personale autorizzato"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void annullaPagamento(long pagamentoId, ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
public void annullaPagamento(long pagamentoId, ServiceContext serviceContext) throws PortalException, |
|
|
|
|
SystemException { |
|
|
|
|
|
|
|
|
|
if (PendingPagamentiPermission.contains(getPermissionChecker(), serviceContext.getScopeGroupId(), |
|
|
|
|
ActionKeys.PAGAMENTI_PENDING)) { |
|
|
|
@ -93,13 +101,14 @@ public class PagamentoServiceImpl extends PagamentoServiceBaseImpl {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void updatePagamentoManuale(long pagamentoId, byte[] content, String sourceFileName, |
|
|
|
|
ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
ServiceContext serviceContext) throws IOException, PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(pagamentoId); |
|
|
|
|
long userId = findTitolare(pagamentoId); |
|
|
|
|
|
|
|
|
|
if (getUserId() == userId || DelegheUtil.hasDelegaPagamento(userId, pagamento.getClassPk())) { |
|
|
|
|
pagamentoLocalService.updatePagamentoManuale(pagamentoId, content, sourceFileName, serviceContext); |
|
|
|
|
pagamentoLocalService |
|
|
|
|
.updatePagamentoManuale(pagamentoId, content, sourceFileName, serviceContext); |
|
|
|
|
} else { |
|
|
|
|
throw new SystemException("pagamento manuale aggiornabile solo da titolare digitale del " |
|
|
|
|
+ pagamento.getClassName()); |
|
|
|
@ -121,8 +130,8 @@ public class PagamentoServiceImpl extends PagamentoServiceBaseImpl {
|
|
|
|
|
Collaudo collaudo = collaudoLocalService.getCollaudo(pagamento.getClassPk()); |
|
|
|
|
userId = collaudo.getUserId(); |
|
|
|
|
} else { |
|
|
|
|
throw new RuntimeException("unable to replace pagamento for entity type " + pagamento.getClassName() |
|
|
|
|
+ " with id " + pagamento.getClassPk()); |
|
|
|
|
throw new RuntimeException("unable to replace pagamento for entity type " |
|
|
|
|
+ pagamento.getClassName() + " with id " + pagamento.getClassPk()); |
|
|
|
|
} |
|
|
|
|
return userId; |
|
|
|
|
} |
|
|
|
|