1919import javax .servlet .http .HttpServletResponse ;
2020import java .text .MessageFormat ;
2121
22-
2322/**
2423 * Used to delete the envelope and restore it back.
2524 */
2625@ Controller
2726@ RequestMapping ("/eg045" )
2827public class EG045ControllerDeleteRestoreEnvelope extends AbstractEsignatureController {
29- public static final String RECYCLE_BIN_FOLDER_ID = "recyclebin" ;
30-
3128 public static final String SENT_ITEMS_FOLDER_NAME = "Sent items" ;
3229
3330 public static final String EXAMPLE_NUMBER = "/eg045" ;
@@ -36,7 +33,7 @@ public class EG045ControllerDeleteRestoreEnvelope extends AbstractEsignatureCont
3633
3734 public static final String RESTORE_ENVELOPE_PAGE = "pages/esignature/examples/eg045RestoreEnvelope" ;
3835
39- public EG045ControllerDeleteRestoreEnvelope (DSConfiguration config , Session session , User user ){
36+ public EG045ControllerDeleteRestoreEnvelope (DSConfiguration config , Session session , User user ) {
4037 super (config , "eg045" , session , user );
4138 }
4239
@@ -48,26 +45,22 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception
4845
4946 @ Override
5047 protected Object doWork (WorkArguments args , ModelMap model ,
51- HttpServletResponse response ) throws Exception {
48+ HttpServletResponse response ) throws Exception {
5249 String envelopeId = args .getEnvelopeId ();
5350 session .setEnvelopeId (envelopeId );
5451
5552 ApiClient apiClient = createApiClient (session .getBasePath (), user .getAccessToken ());
5653
57- DeleteRestoreEnvelopeService .moveEnvelopeToFolder (
54+ DeleteRestoreEnvelopeService .deleteEnvelope (
5855 apiClient ,
5956 session .getAccountId (),
60- envelopeId ,
61- RECYCLE_BIN_FOLDER_ID ,
62- null );
57+ envelopeId );
6358
6459 DoneExample .createDefault (getTextForCodeExampleByApiType ().ExampleName )
6560 .withMessage (
66- MessageFormat .format (
67- getTextForCodeExampleByApiType ().AdditionalPage .get (0 ).ResultsPageText ,
68- envelopeId
69- )
70- )
61+ MessageFormat .format (
62+ getTextForCodeExampleByApiType ().AdditionalPage .get (0 ).ResultsPageText ,
63+ envelopeId ))
7164 .withRedirect (EXAMPLE_NUMBER + RESTORE_ENVELOPE )
7265 .addToModel (model , config );
7366
@@ -81,8 +74,7 @@ public String getRestoreEnvelope(WorkArguments args, ModelMap model) throws Exce
8174 String envelopeId = session .getEnvelopeId ();
8275 String restoreEnvelopeText = MessageFormat .format (
8376 config .getCodeExamplesText ().SupportingTexts .HelpingTexts .EnvelopeWillBeRestored ,
84- envelopeId
85- );
77+ envelopeId );
8678
8779 model .addAttribute ("restoreText" , restoreEnvelopeText );
8880 model .addAttribute ("envelopeId" , envelopeId );
@@ -101,14 +93,12 @@ public String postRestoreEnvelope(WorkArguments args, ModelMap model) throws Exc
10193 FoldersResponse availableFolders = DeleteRestoreEnvelopeService .getFolders (apiClient , accountId );
10294 Folder folder = DeleteRestoreEnvelopeService .getFolderIdByName (availableFolders .getFolders (), folderName );
10395
104- if (folder == null ) {
96+ if (folder == null ) {
10597 DoneExample .createDefault (getTextForCodeExampleByApiType ().ExampleName )
10698 .withMessage (
107- MessageFormat .format (
108- getTextForCodeExampleByApiType ().AdditionalPage .get (1 ).ResultsPageText ,
109- folderName
110- )
111- )
99+ MessageFormat .format (
100+ getTextForCodeExampleByApiType ().AdditionalPage .get (1 ).ResultsPageText ,
101+ folderName ))
112102 .withRedirect (EXAMPLE_NUMBER + RESTORE_ENVELOPE )
113103 .addToModel (model , config );
114104
@@ -128,9 +118,7 @@ public String postRestoreEnvelope(WorkArguments args, ModelMap model) throws Exc
128118 getTextForCodeExampleByApiType ().ResultsPageText ,
129119 envelopeId ,
130120 folder .getType (),
131- folderName
132- )
133- )
121+ folderName ))
134122 .addToModel (model , config );
135123
136124 return DONE_EXAMPLE_PAGE ;
0 commit comments