Skip to content

Commit

Permalink
Validating information for digital signature
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Nov 7, 2023
1 parent fd41c7f commit 49ebc77
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public Forward doBackFirmaOTP(ActionContext context) {
HookForward caller = (HookForward)context.getCaller();
FirmaOTPBulk firmaOTPBulk = (FirmaOTPBulk) caller.getParameter("firmaOTP");
try {
firmaOTPBulk.validate();
fillModel(context);
bulk = (OggettoBulk)bp.getBulkInfo().getBulkClass().newInstance();
bp.setModel(context, bulk);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public Forward doBackInvia(ActionContext context) {
CRUDDistintaCassiere1210BP bp = (CRUDDistintaCassiere1210BP)context.getBusinessProcess();
HookForward caller = (HookForward)context.getCaller();
FirmaOTPBulk firmaOTPBulk = (FirmaOTPBulk) caller.getParameter("firmaOTP");
firmaOTPBulk.validate();
bp.invia(context, firmaOTPBulk);
return context.findDefaultForward();
} catch (Exception e ){
Expand Down Expand Up @@ -115,6 +116,7 @@ public Forward doBackSign(ActionContext context) {
CRUDDistintaCassiere1210BP bp = (CRUDDistintaCassiere1210BP)context.getBusinessProcess();
HookForward caller = (HookForward)context.getCaller();
FirmaOTPBulk firmaOTPBulk = (FirmaOTPBulk) caller.getParameter("firmaOTP");
firmaOTPBulk.validate();
bp.signDocuments(context, firmaOTPBulk);
return super.doSalva(context);
} catch (Exception e ){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public Forward doBackSign(ActionContext context) {
FirmaOTPBulk firmaOTPBulk = (FirmaOTPBulk) caller.getParameter("firmaOTP");
try {
fillModel(context);
firmaOTPBulk.validate();
bp.invia(context, firmaOTPBulk);
} catch (Exception e) {
return handleException(context, e);
Expand Down Expand Up @@ -308,6 +309,7 @@ public Forward doBackInviaSiopeplus(ActionContext context) {
FirmaOTPBulk firmaOTPBulk = (FirmaOTPBulk) caller.getParameter("firmaOTP");
try {
fillModel(context);
firmaOTPBulk.validate();
bp.inviaSiopeplus(context, firmaOTPBulk);
} catch (Exception e) {
return handleException(context, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public Forward doBackSign(ActionContext context) {
FirmaOTPBulk firmaOTPBulk = (FirmaOTPBulk) caller.getParameter("firmaOTP");
try {
fillModel(context);
firmaOTPBulk.validate();
String statoTrasmissione = statoTrasmissioneBulk.getStato_trasmissione();
bulk = (OggettoBulk)bp.getBulkInfo().getBulkClass().newInstance();
statoTrasmissioneBulk = ((StatoTrasmissione)bulk);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
package it.cnr.contab.firma.bulk;

import it.cnr.jada.bulk.OggettoBulk;
import it.cnr.jada.bulk.ValidationException;

import javax.swing.text.html.Option;
import java.util.Optional;

public class FirmaOTPBulk extends OggettoBulk {
private static final long serialVersionUID = 1L;
Expand All @@ -43,7 +47,15 @@ public String getOtp() {
public void setOtp(String otp) {
this.otp = otp;
}


@Override
public void validate() throws ValidationException {
super.validate();
Optional.ofNullable(userName).orElseThrow(() -> new ValidationException("Valorizzare 'Username'!"));
Optional.ofNullable(password).orElseThrow(() -> new ValidationException("Valorizzare 'password'!"));
Optional.ofNullable(otp).orElseThrow(() -> new ValidationException("Valorizzare 'OTP'!"));
}

public static String errorMessage(String messageException) {
if (messageException.contains("0001"))
return "Errore generico nel processo di firma";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public Forward doBackFirmaOTP(ActionContext context) {
HookForward caller = (HookForward)context.getCaller();
FirmaOTPBulk firmaOTPBulk = (FirmaOTPBulk) caller.getParameter("firmaOTP");
try {
firmaOTPBulk.validate();
bp.firmaOTP(context, firmaOTPBulk);
} catch(Exception e) {
return handleException(context,e);
Expand Down

0 comments on commit 49ebc77

Please sign in to comment.