@@ -12,7 +12,9 @@ public class DirectJob implements SignatureJob, WithExitUrls {
12
12
13
13
private String reference ;
14
14
private List <DirectSigner > signers ;
15
- private DirectDocument document ;
15
+ private List <DirectDocument > documents ;
16
+ private String title ;
17
+ private Optional <String > description = Optional .empty ();
16
18
private URI completionUrl ;
17
19
private URI rejectionUrl ;
18
20
private URI errorUrl ;
@@ -21,9 +23,10 @@ public class DirectJob implements SignatureJob, WithExitUrls {
21
23
private Optional <AuthenticationLevel > requiredAuthentication = Optional .empty ();
22
24
private Optional <IdentifierInSignedDocuments > identifierInSignedDocuments = Optional .empty ();
23
25
24
- private DirectJob (List <DirectSigner > signers , DirectDocument document , URI completionUrl , URI rejectionUrl , URI errorUrl ) {
26
+ private DirectJob (String title , List <DirectSigner > signers , List <DirectDocument > documents , URI completionUrl , URI rejectionUrl , URI errorUrl ) {
27
+ this .title = title ;
25
28
this .signers = unmodifiableList (new ArrayList <>(signers ));
26
- this .document = document ;
29
+ this .documents = unmodifiableList ( new ArrayList <>( documents )) ;
27
30
this .completionUrl = completionUrl ;
28
31
this .rejectionUrl = rejectionUrl ;
29
32
this .errorUrl = errorUrl ;
@@ -35,13 +38,8 @@ public String getReference() {
35
38
}
36
39
37
40
@ Override
38
- public DirectDocument getDocument () {
39
- return document ;
40
- }
41
-
42
- @ Override
43
- public List <? extends Document > getDocuments () {
44
- return unmodifiableList (Collections .singletonList (document ));
41
+ public List <DirectDocument > getDocuments () {
42
+ return documents ;
45
43
}
46
44
47
45
@ Override
@@ -93,13 +91,12 @@ public Optional<StatusRetrievalMethod> getStatusRetrievalMethod() {
93
91
* @param signers The {@link DirectSigner DirectSigners} of the document.
94
92
*
95
93
* @return a builder to further customize the job
96
- * @see DirectJob#builder(DirectDocument, WithExitUrls, List)
94
+ * @see DirectJob#builder(String, DirectDocument, WithExitUrls, List)
97
95
*/
98
- public static Builder builder (DirectDocument document , WithExitUrls hasExitUrls , DirectSigner ... signers ) {
99
- return builder (document , hasExitUrls , Arrays .asList (signers ));
96
+ public static Builder builder (String title , DirectDocument document , WithExitUrls hasExitUrls , DirectSigner ... signers ) {
97
+ return builder (title , Collections . singletonList ( document ) , hasExitUrls , Arrays .asList (signers ));
100
98
}
101
99
102
-
103
100
/**
104
101
* Create a new DirectJob.
105
102
*
@@ -110,26 +107,48 @@ public static Builder builder(DirectDocument document, WithExitUrls hasExitUrls,
110
107
* @param signers The {@link DirectSigner DirectSigners} of the document.
111
108
*
112
109
* @return a builder to further customize the job
113
- * @see DirectJob#builder(DirectDocument, WithExitUrls, DirectSigner...)
110
+ * @see DirectJob#builder(String, DirectDocument, WithExitUrls, DirectSigner...)
114
111
*/
115
- public static Builder builder (DirectDocument document , WithExitUrls hasExitUrls , List <DirectSigner > signers ) {
116
- return new Builder (signers , document , hasExitUrls .getCompletionUrl (), hasExitUrls .getRejectionUrl (), hasExitUrls .getErrorUrl ());
112
+ public static Builder builder (String title , DirectDocument document , WithExitUrls hasExitUrls , List <DirectSigner > signers ) {
113
+ return builder (title , Collections .singletonList (document ), hasExitUrls , signers );
114
+ }
115
+
116
+ public static Builder builder (String title , List <DirectDocument > documents , WithExitUrls hasExitUrls , DirectSigner ... signers ) {
117
+ return builder (title , documents , hasExitUrls , Arrays .asList (signers ));
118
+ }
119
+
120
+ public static Builder builder (String title , List <DirectDocument > documents , WithExitUrls hasExitUrls , List <DirectSigner > signers ) {
121
+ return new Builder (title , signers , documents , hasExitUrls .getCompletionUrl (), hasExitUrls .getRejectionUrl (), hasExitUrls .getErrorUrl ());
117
122
}
118
123
124
+ public String getTitle () {
125
+ return title ;
126
+ }
127
+
128
+ public Optional <String > getDescription () {
129
+ return description ;
130
+ }
131
+
132
+
119
133
public static class Builder implements JobCustomizations <Builder > {
120
134
121
135
private final DirectJob target ;
122
136
private boolean built = false ;
123
137
124
- private Builder (List <DirectSigner > signers , DirectDocument document , URI completionUrl , URI rejectionUrl , URI errorUrl ) {
125
- target = new DirectJob (signers , document , completionUrl , rejectionUrl , errorUrl );
138
+ private Builder (String title , List <DirectSigner > signers , List < DirectDocument > documents , URI completionUrl , URI rejectionUrl , URI errorUrl ) {
139
+ target = new DirectJob (title , signers , documents , completionUrl , rejectionUrl , errorUrl );
126
140
}
127
141
128
142
@ Override
129
143
public Builder withReference (UUID uuid ) {
130
144
return withReference (uuid .toString ());
131
145
}
132
146
147
+ public Builder withDescription (String description ) {
148
+ target .description = Optional .of (description );
149
+ return this ;
150
+ }
151
+
133
152
@ Override
134
153
public Builder withReference (String reference ) {
135
154
target .reference = reference ;
0 commit comments