|
|
@ -12,6 +12,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
package it.tref.liferay.portos.bo.service.impl; |
|
|
|
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.Collaudo; |
|
|
|
import it.tref.liferay.portos.bo.model.DettPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.DettPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.FineLavori; |
|
|
|
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. |
|
|
|
* The implementation of the pagamento remote service. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* All custom service methods should be put in this class. Whenever methods are added, rerun |
|
|
|
* All custom service methods should be put in this class. Whenever methods are |
|
|
|
* ServiceBuilder to copy their definitions into the |
|
|
|
* added, rerun ServiceBuilder to copy their definitions into the |
|
|
|
* {@link it.tref.liferay.portos.bo.service.PagamentoService} interface. |
|
|
|
* {@link it.tref.liferay.portos.bo.service.PagamentoService} interface. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p> |
|
|
|
* <p> |
|
|
|
* This is a remote service. Methods of this service are expected to have security checks based on |
|
|
|
* This is a remote service. Methods of this service are expected to have |
|
|
|
* the propagated JAAS credentials because this service can be accessed remotely. |
|
|
|
* security checks based on the propagated JAAS credentials because this service |
|
|
|
|
|
|
|
* can be accessed remotely. |
|
|
|
* </p> |
|
|
|
* </p> |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Davide Barbagallo, 3F Consulting |
|
|
|
* @author Davide Barbagallo, 3F Consulting |
|
|
@ -45,25 +48,28 @@ import com.liferay.portal.service.ServiceContext; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class PagamentoServiceImpl extends PagamentoServiceBaseImpl { |
|
|
|
public class PagamentoServiceImpl extends PagamentoServiceBaseImpl { |
|
|
|
/* |
|
|
|
/* |
|
|
|
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use {@link |
|
|
|
* NOTE FOR DEVELOPERS: Never reference this interface directly. Always use |
|
|
|
* it.tref.liferay.portos.bo.service.PagamentoServiceUtil} to access the pagamento remote service. |
|
|
|
* {@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, |
|
|
|
public void sostituisciPagamento(long pagamentoId, String codiceFiscaleCommittente, String mezzo, |
|
|
|
ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
String url, ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
|
|
Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(pagamentoId); |
|
|
|
Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(pagamentoId); |
|
|
|
long userId = findTitolare(pagamentoId); |
|
|
|
long userId = findTitolare(pagamentoId); |
|
|
|
|
|
|
|
|
|
|
|
if (getUserId() == userId || DelegheUtil.hasDelegaPagamento(userId, pagamento.getClassPk())) { |
|
|
|
if (getUserId() == userId || DelegheUtil.hasDelegaPagamento(userId, pagamento.getClassPk())) { |
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, serviceContext); |
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, |
|
|
|
|
|
|
|
serviceContext); |
|
|
|
} else { |
|
|
|
} 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, |
|
|
|
public void rigeneraPagamento(long pagamentoId, String codiceFiscaleCommittente, String mezzo, |
|
|
|
ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
String url, ServiceContext serviceContext) throws PortalException, SystemException { |
|
|
|
|
|
|
|
|
|
|
|
if (PendingPagamentiPermission.contains(getPermissionChecker(), serviceContext.getScopeGroupId(), |
|
|
|
if (PendingPagamentiPermission.contains(getPermissionChecker(), serviceContext.getScopeGroupId(), |
|
|
|
ActionKeys.PAGAMENTI_PENDING)) { |
|
|
|
ActionKeys.PAGAMENTI_PENDING)) { |
|
|
@ -76,13 +82,15 @@ public class PagamentoServiceImpl extends PagamentoServiceBaseImpl { |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if (isAllowed) {
|
|
|
|
// if (isAllowed) {
|
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, serviceContext); |
|
|
|
pagamentoLocalService.sostituisciPagamento(pagamentoId, codiceFiscaleCommittente, mezzo, url, |
|
|
|
|
|
|
|
serviceContext); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new SystemException("pagamento rigenerabile solo da personale autorizzato"); |
|
|
|
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(), |
|
|
|
if (PendingPagamentiPermission.contains(getPermissionChecker(), serviceContext.getScopeGroupId(), |
|
|
|
ActionKeys.PAGAMENTI_PENDING)) { |
|
|
|
ActionKeys.PAGAMENTI_PENDING)) { |
|
|
@ -93,13 +101,14 @@ public class PagamentoServiceImpl extends PagamentoServiceBaseImpl { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void updatePagamentoManuale(long pagamentoId, byte[] content, String sourceFileName, |
|
|
|
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); |
|
|
|
Pagamento pagamento = PagamentoLocalServiceUtil.getPagamento(pagamentoId); |
|
|
|
long userId = findTitolare(pagamentoId); |
|
|
|
long userId = findTitolare(pagamentoId); |
|
|
|
|
|
|
|
|
|
|
|
if (getUserId() == userId || DelegheUtil.hasDelegaPagamento(userId, pagamento.getClassPk())) { |
|
|
|
if (getUserId() == userId || DelegheUtil.hasDelegaPagamento(userId, pagamento.getClassPk())) { |
|
|
|
pagamentoLocalService.updatePagamentoManuale(pagamentoId, content, sourceFileName, serviceContext); |
|
|
|
pagamentoLocalService |
|
|
|
|
|
|
|
.updatePagamentoManuale(pagamentoId, content, sourceFileName, serviceContext); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new SystemException("pagamento manuale aggiornabile solo da titolare digitale del " |
|
|
|
throw new SystemException("pagamento manuale aggiornabile solo da titolare digitale del " |
|
|
|
+ pagamento.getClassName()); |
|
|
|
+ pagamento.getClassName()); |
|
|
@ -121,8 +130,8 @@ public class PagamentoServiceImpl extends PagamentoServiceBaseImpl { |
|
|
|
Collaudo collaudo = collaudoLocalService.getCollaudo(pagamento.getClassPk()); |
|
|
|
Collaudo collaudo = collaudoLocalService.getCollaudo(pagamento.getClassPk()); |
|
|
|
userId = collaudo.getUserId(); |
|
|
|
userId = collaudo.getUserId(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new RuntimeException("unable to replace pagamento for entity type " + pagamento.getClassName() |
|
|
|
throw new RuntimeException("unable to replace pagamento for entity type " |
|
|
|
+ " with id " + pagamento.getClassPk()); |
|
|
|
+ pagamento.getClassName() + " with id " + pagamento.getClassPk()); |
|
|
|
} |
|
|
|
} |
|
|
|
return userId; |
|
|
|
return userId; |
|
|
|
} |
|
|
|
} |
|
|
|