-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFormClient.java
More file actions
165 lines (147 loc) · 7.82 KB
/
Copy pathFormClient.java
File metadata and controls
165 lines (147 loc) · 7.82 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
package com.artezio.forms;
import com.artezio.forms.resources.ResourceLoader;
import com.artezio.forms.storages.FileStorage;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.List;
public interface FormClient {
/**
* Build a json string with a form definition and data according to the form fields. The form definition is got using
* formKey value. Current variables are variables that already are in a system.
*
* @param formKey The id of the form
* @param currentVariables The variables in a system
* @return Json string with the form definition and data for the form
*/
String getFormWithData(String formKey, ObjectNode currentVariables);
/**
* Build a json string with a form definition and data according to the form fields. The form definition is got using
* formKey value. Current variables are variables that already are in a system. {@link FileStorage} is used to store files
* separately in an external storage.
*
* @param formKey The id of the form
* @param currentVariables The variables in a system
* @param fileStorage Implementation of {@link FileStorage}
* @return Json string with the form definition and data for the form
*/
String getFormWithData(String formKey, ObjectNode currentVariables, FileStorage fileStorage);
/**
* Build a json string with a form definition and data according to the form fields. The form definition is got using
* formKey value. Current variables are variables that already are in a system. {@link ResourceLoader} is used to make
* resource (e.g. forms, scripts etc.) loading approach more dynamic.
*
* @param formKey The id of the form
* @param currentVariables The variables in a system
* @param resourceLoader Implementation of {@link ResourceLoader}
* @return Json string with the form definition and data for the form
*/
String getFormWithData(String formKey, ObjectNode currentVariables, ResourceLoader resourceLoader);
/**
* Build a json string with a form definition and data according to the form fields. The form definition is got using
* formKey value. Current variables are variables that already are in a system. {@link FileStorage} is used to store files
* separately in an external storage. {@link ResourceLoader} is used to make resource (e.g. forms, scripts etc.)
* loading approach more dynamic.
*
* @param formKey The id of the form
* @param currentVariables The variables in a system
* @param resourceLoader Implementation of {@link ResourceLoader}
* @param fileStorage Implementation of {@link FileStorage}
* @return Json string with the form definition and data for the form
*/
String getFormWithData(String formKey, ObjectNode currentVariables, ResourceLoader resourceLoader, FileStorage fileStorage);
/**
* Validate submitted variables against a form loaded by formKey. Current variables are passed to provide information
* about current state of a system.
*
* @param formKey The id of the form
* @param submittedVariables The variables submitted from the form
* @param currentVariables The variables in a system
* @return Json string with the validated variables
*/
String dryValidationAndCleanup(String formKey, ObjectNode submittedVariables, ObjectNode currentVariables);
/**
* Validate submitted variables against a form loaded by formKey. Current variables are passed to provide information
* about a current state of a system. {@link FileStorage} is used to store files separately in an external storage.
*
* @param formKey The id of the form
* @param submittedVariables The variables submitted from the form
* @param currentVariables The variables in a system
* @param fileStorage Implementation of {@link FileStorage}
* @return Json string with the validated variables
*/
String dryValidationAndCleanup(String formKey, ObjectNode submittedVariables, ObjectNode currentVariables, FileStorage fileStorage);
/**
* Validate submitted variables against a form loaded by formKey. Current variables are passed to provide information
* about a current state of a system. {@link ResourceLoader} is used to make resource (e.g. forms, scripts etc.)
* loading approach more dynamic.
*
* @param formKey The id of the form
* @param submittedVariables The variables submitted from the form
* @param currentVariables The variables in a system
* @param resourceLoader Implementation of {@link ResourceLoader}
* @return Json string with the validated variables
*/
String dryValidationAndCleanup(String formKey, ObjectNode submittedVariables, ObjectNode currentVariables, ResourceLoader resourceLoader);
/**
* Validate submitted variables against a form loaded by formKey. Current variables are passed to provide information
* about a current state of a system. {@link FileStorage} is used to store files separately in an external storage.
* {@link ResourceLoader} is used to make resource (e.g. forms, scripts etc.) loading approach more dynamic.
*
* @param formKey The id of the form
* @param submittedVariables The variables submitted from the form
* @param currentVariables The variables in a system
* @param resourceLoader Implementation of {@link ResourceLoader}
* @param fileStorage Implementation of {@link FileStorage}
* @return Json string with the validated variables
*/
String dryValidationAndCleanup(String formKey, ObjectNode submittedVariables, ObjectNode currentVariables, ResourceLoader resourceLoader, FileStorage fileStorage);
/**
* Define whether submitted data should go through the whole submission lifecycle.
*
* @param formKey The id of the form
* @param submissionState A submission state due to which the decision is made
* @return Boolean indicating whether submitted data should be processed or not
*/
boolean shouldProcessSubmission(String formKey, String submissionState);
/**
* Define whether submitted data should go through the whole submission lifecycle. {@link ResourceLoader} is used to
* make resource (e.g. forms, scripts etc.) loading approach more dynamic.
*
* @param formKey The id of the form
* @param submissionState A submission state due to which the decision is made
* @param resourceLoader Implementation of {@link ResourceLoader}
* @return Boolean indicating whether submitted data should be processed or not
*/
boolean shouldProcessSubmission(String formKey, String submissionState, ResourceLoader resourceLoader);
/**
* Get root field names of a form
*
* @param formKey The id of the form
* @return List of root fields of the form
*/
List<String> getRootFormFieldNames(String formKey);
/**
* Get root field names of a form. {@link ResourceLoader} is used to make resource (e.g. forms, scripts etc.)
* loading approach more dynamic.
*
* @param formKey The id of the form
* @param resourceLoader Implementation of {@link ResourceLoader}
* @return List of root fields of the form
*/
List<String> getRootFormFieldNames(String formKey, ResourceLoader resourceLoader);
/**
* Get all form field names
*
* @param formKey The id of the form
* @return List of all form field names
*/
List<String> getFormFieldPaths(String formKey);
/**
* Get all form field names. {@link ResourceLoader} is used to make resource (e.g. forms, scripts etc.)
* loading approach more dynamic.
*
* @param formKey The id of the form
* @param resourceLoader Implementation of {@link ResourceLoader}
* @return List of all form field names
*/
List<String> getFormFieldPaths(String formKey, ResourceLoader resourceLoader);
}