EchoSignConfiguration.java
4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.aemds.guide.addon.signing.echosign;
import com.adobe.aemds.guide.addon.signing.echosign.EchoSignUtils;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class EchoSignConfiguration {
protected static final Logger log = LoggerFactory.getLogger(EchoSignConfiguration.class);
private String agreementName;
private String agreementLocale;
private int agreementTimeout;
private boolean sendAttachments;
private String attachmentJsonString;
private String senderEmail;
private String recipientEmail;
private String successRedirectURL;
private String failureRedirectURL;
private String configPath;
public static EchoSignConfiguration getConfig(Map<String, String> configMap) {
EchoSignConfiguration config = new EchoSignConfiguration();
for (Map.Entry<String, String> entry : configMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key.equals("Agreement Name")) {
config.setAgreementName(value);
continue;
}
if (key.equals("Locale")) {
config.setAgreementLocale(EchoSignUtils.getLocaleCode(value));
continue;
}
if (key.equals("Signing timeout")) {
try {
config.setAgreementTimeout(Integer.parseInt(value));
continue;
}
catch (NumberFormatException exception) {
log.error("Excpetion while parsing the config Map entry:" + key + ":" + value);
log.error("Number Format Exception", (Throwable)exception);
return null;
}
}
if (key.equals("Send Attachments")) {
if ("true".equals(value)) {
config.setAttachmentsFlag(true);
continue;
}
config.setAttachmentsFlag(false);
continue;
}
if (key.equals("attachmentJson")) {
config.setAttachmentJsonString(value);
continue;
}
if (key.equals("Sender")) {
config.setSenderEmail(value);
continue;
}
if (key.equals("Recipient")) {
config.setRecipientEmail(value);
continue;
}
if (key.equals("Widget Completion URL")) {
config.setSuccesssURL(value);
continue;
}
if (key.equals("Widget Failure URL")) {
config.setFailureURL(value);
continue;
}
if (!key.equals("CONFIG_PATH")) continue;
config.setConfigPath(value);
}
return config;
}
public void setSuccesssURL(String successURL) {
this.successRedirectURL = successURL;
}
public String getSuccessURL() {
return this.successRedirectURL;
}
public void setFailureURL(String failureURL) {
this.failureRedirectURL = failureURL;
}
public String getFailureURL() {
return this.failureRedirectURL;
}
public void setSenderEmail(String sender) {
this.senderEmail = sender;
}
public String getSenderEmail() {
return this.senderEmail;
}
public void setRecipientEmail(String recipient) {
this.recipientEmail = recipient;
}
public String getRecipientEmail() {
return this.recipientEmail;
}
public void setAttachmentsFlag(boolean bool) {
this.sendAttachments = bool;
}
public boolean shouldSendAttachments() {
return this.sendAttachments;
}
public void setAttachmentJsonString(String jsonString) {
this.attachmentJsonString = jsonString;
}
public String getAttachmentJsonString() {
return this.attachmentJsonString;
}
public void setAgreementTimeout(int timeout) {
this.agreementTimeout = timeout;
}
public int getAgreementTimeout() {
return this.agreementTimeout;
}
public void setAgreementLocale(String locale) {
this.agreementLocale = locale;
}
public String getAgreementLocale() {
return this.agreementLocale;
}
public void setAgreementName(String name) {
this.agreementName = name;
}
public String getAgreementName() {
return this.agreementName;
}
public String getConfigPath() {
return this.configPath;
}
public void setConfigPath(String configPath) {
this.configPath = configPath;
}
}