EchoSignConstants.java
7.63 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.i18n.I18n
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.aemds.guide.addon.signing.echosign;
import com.day.cq.i18n.I18n;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class EchoSignConstants {
protected static final Logger log = LoggerFactory.getLogger(EchoSignConstants.class);
public static final String CLOUD_CONFIG_BASE_PATH = "/etc/cloudservices/echosign/";
public static final String CLOUD_CONFIG_PATH = "CONFIG_PATH";
public static final String API_URL = "API_URL";
public static final String API_KEY = "API_KEY";
public static final String AGREEMENT_NAME = "Agreement Name";
public static final String AGREEMENT_LOCALE = "Locale";
public static final String AGREEMENT_TIMEOUT = "Signing timeout";
public static final String SEND_ATTACHMENTS = "Send Attachments";
public static final String ATTACHMENT_JSON = "attachmentJson";
public static final String ATTACHMENT_NAME = "name";
public static final String ATTACHMENT_PATH = "path";
public static final String ATTACHMENT_MIME_TYPE = "mimeType";
public static final String SENDER_EMAIL = "Sender";
public static final String RECIPIENT_EMAIL = "Recipient";
public static final String SUCCESS_REDIRECT_URL = "Widget Completion URL";
public static final String FAILURE_REDIRECT_URL = "Widget Failure URL";
public static final String RESULT_STATUS = "serviceResultStatus";
public static final String RESULT_URL = "resultURL";
public static final String RESULT_JAVASCRIPT = "resultJavascript";
public static final String DOCUMENT_KEY = "documentKey";
public static final String FAILURE_REASON = "serviceFailureReason";
public static final String SIGN_URL = "signUrl";
public static final String AUTHENTICATION = "authentication";
public static final String WORKFLOW = "workflow";
public static final String CONFIG_PATH = "cq:cloudserviceconfigs";
public static final String CONFIG_PATH_KEY = "configPath";
public static final String EMAIL = "email";
public static final String COUNTRY_CODE = "countryCode";
public static final String NUMBER = "number";
public static final String PHONE = "phone";
public static final String AGREEMENT_ID = "agreementId";
public static final String NEXT_SIGNERS = "nextSigners";
public static final String ESIGN_STATUS = "esignStatus";
public static final String ECHOSIGN_PDF_PROCESS_SCRIPTS_ERROR = "Adobe Sign was unable to process your document(s). This can occur if uploaded documents contain scripts, macros or Visual Basic code";
public static final String ECHOSIGN_PDF_PROCESS_RM_ERROR = "Adobe Sign was unable to convert your PDF because it has limited access settings applied.";
public static enum ERROR_CODE {
OK(0),
REMOTE_EXCEPTION(1),
PROTECTED_DOCUMENT(2),
PDF_PROCESSING(3),
PDF_GENERATION(4),
NO_SIGNING_SERVICE(5),
UNKNOWN(6),
ADOBE_SIGN_EXCEPTION(7),
SIGN_SERVICE_EXCEPTION(8),
EMAIL_NOT_DEFINED(9);
private int code;
private ERROR_CODE(int code) {
this.code = code;
}
public int getCode() {
return this.code;
}
public String getLocalizedMessage(I18n i18n) {
if (i18n == null) {
EchoSignConstants.log.error("Failed to localize the error message due to invalid bundle resource.");
return null;
}
if (OK.getCode() == this.getCode()) {
return i18n.get("Success");
}
if (REMOTE_EXCEPTION.getCode() == this.getCode()) {
return i18n.get("Adobe Sign server not reachable.");
}
if (PROTECTED_DOCUMENT.getCode() == this.getCode()) {
return i18n.get("Adobe Sign workflow doesn't work with Rights Protected documents.");
}
if (PDF_PROCESSING.getCode() == this.getCode()) {
return i18n.get("Adobe Sign workflow doesn't work with documents containing scripts or macros.");
}
if (PDF_GENERATION.getCode() == this.getCode()) {
return i18n.get("Failed to generate PDF from form data.");
}
if (NO_SIGNING_SERVICE.getCode() == this.getCode()) {
return i18n.get("Failed to obtain the cloud service configuration for Adobe Sign");
}
if (UNKNOWN.getCode() == this.getCode()) {
return i18n.get("Unknown error: ");
}
if (ADOBE_SIGN_EXCEPTION.getCode() == this.getCode()) {
return i18n.get("Exception in processing agreement by Adobe Sign");
}
if (SIGN_SERVICE_EXCEPTION.getCode() == this.getCode()) {
return i18n.get("Exception in processing document for signing");
}
if (EMAIL_NOT_DEFINED.getCode() == this.getCode()) {
return i18n.get("User email undefined. Unable to generate signable PDF.");
}
return null;
}
}
public static enum MIME_TYPES {
INVALID("INVALID"),
pdf("application/pdf"),
doc("application/msword"),
docx("application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
wpd("application/vnd.wordperfect"),
rtf("application/rtf"),
xls("application/vnd.ms-excel"),
xlsx("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
ppt("application/vnd.ms-powerpoint"),
pptx("application/vnd.openxmlformats-officedocument.presentationml.presentation"),
txt("text/plain"),
html("text/html"),
htm("text/html"),
tiff("image/tiff"),
tif("image/tiff"),
bmp("image/bmp"),
gif("image/gif"),
jpg("image/jpeg"),
jpeg("image/jpeg"),
png("image/png");
private String mimeTypeString;
private MIME_TYPES(String mimeType) {
this.mimeTypeString = mimeType;
}
public String getMimeType() {
return this.mimeTypeString;
}
}
public static enum LOCALES {
en_US("en_US", "English: US"),
en_GB("en_GB", "English: UK"),
de_DE("de_DE", "German"),
ru_RU("ru_RU", "Russian"),
fr_FR("fr_FR", "French"),
es_ES("es_ES", "Spanish"),
sv_SE("sv_SE", "Swedish"),
nl_NL("nl_NL", "Dutch"),
fi_FI("fi_FI", "Finnish"),
no_NO("no_NO", "Norwegian"),
nn_NO("nn_NO", "Norwegian: Nynorsk"),
nb_NO("nb_NO", "Norwegian: Bokmal"),
pt_PT("pt_PT", "Portuguese: Portugal"),
pt_BR("pt_BR", "Portuguese: Brazil"),
it_IT("it_IT", "Italian"),
da_DK("da_DK", "Danish"),
ja_JP("ja_JP", "Japanese"),
is_IS("is_IS", "Icelandic"),
zh_CN("zh_CN", "Chinese Simplified"),
zh_TW("zh_TW", "Chinese Traditional"),
ko_KR("ko_KR", "Korean"),
iw_IL("iw_IL", "Hebrew"),
pl_PL("pl_PL", "Polish"),
in_ID("in_ID", "Indonesian"),
ms_MY("ms_MY", "Malay: Malaysia"),
th_TH("th_TH", "Thai"),
vi_VN("vi_VN", "Vietnamese"),
cs_CZ("cs_CZ", "Czech"),
tr_TR("tr_TR", "Turkish");
private String localeCode;
private String localeName;
private LOCALES(String code, String name) {
this.localeCode = code;
this.localeName = name;
}
public String getCode() {
return this.localeCode;
}
public String getName() {
return this.localeName;
}
}
}