Skip to content

Package: DataManagerPresentationControl$ManagedFileOptions$Builder

DataManagerPresentationControl$ManagedFileOptions$Builder

nameinstructionbranchcomplexitylinemethod
fingerprint(String)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
max(int)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
missingFiles()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
regex(String)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
renderFingerprints()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * *********************************************************************************************************************
3: *
4: * SolidBlue 3: Data safety
5: * http://tidalwave.it/projects/solidblue3
6: *
7: * Copyright (C) 2023 - 2023 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *********************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
12: * the License. You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
17: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations under the License.
19: *
20: * *********************************************************************************************************************
21: *
22: * git clone https://bitbucket.org/tidalwave/solidblue3j-src
23: * git clone https://github.com/tidalwave-it/solidblue3j-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.datamanager.application.nogui;
28:
29: import jakarta.annotation.Nonnull;
30: import java.util.Optional;
31: import lombok.Builder;
32: import lombok.Builder.Default;
33: import lombok.EqualsAndHashCode;
34: import lombok.ToString;
35: import lombok.experimental.Tolerate;
36:
37: /***********************************************************************************************************************
38: *
39: * The controller for {@link DataManagerPresentation}.
40: *
41: * @stereotype Presentation Control
42: * @author Fabrizio Giudici
43: *
44: **********************************************************************************************************************/
45: public interface DataManagerPresentationControl
46: {
47: @Builder(builderClassName = "Builder") @ToString @EqualsAndHashCode
48: public static class ManagedFileOptions
49: {
50: public static class Builder
51: {
52: @Nonnull @Tolerate
53: public Builder renderFingerprints()
54: {
55: return renderFingerprints(true);
56: }
57:
58: @Nonnull @Tolerate
59: public Builder max (final int max)
60: {
61: return max(Optional.of(max));
62: }
63:
64: @Nonnull @Tolerate
65: public Builder regex (@Nonnull final String regex)
66: {
67: return regex(Optional.of(regex));
68: }
69:
70: @Nonnull @Tolerate
71: public Builder fingerprint (@Nonnull final String fingerprint)
72: {
73: return fingerprint(Optional.of(fingerprint));
74: }
75:
76: @Nonnull @Tolerate
77: public Builder missingFiles()
78: {
79: return missingFiles(true);
80: }
81: }
82:
83: /** Render fingerprints too. */
84: public final boolean renderFingerprints;
85:
86: /** The maximum number of items to render. */
87: @Nonnull @Default
88: public final Optional<Integer> max = Optional.empty();
89:
90: /** A regex filter. */
91: @Nonnull @Default
92: public final Optional<String> regex = Optional.empty();
93:
94: /** Filter files having this fingerprint. */
95: @Nonnull @Default
96: public final Optional<String> fingerprint = Optional.empty();
97:
98: /** Filter output only to files no more present in the filesystem. */
99: public final boolean missingFiles;
100:
101: // Syntactic sugar
102: @Nonnull
103: public static ManagedFileOptions.Builder with()
104: {
105: return builder();
106: }
107:
108: @Nonnull
109: public static ManagedFileOptions.Builder withDefaultOptions()
110: {
111: return builder();
112: }
113: }
114:
115: @Builder(builderClassName = "Builder") @ToString @EqualsAndHashCode
116: public static class BackupOptions
117: {
118: public static class Builder
119: {
120: @Nonnull @Tolerate
121: public Builder label (@Nonnull final String label)
122: {
123: return label(Optional.of(label));
124: }
125:
126: @Nonnull @Tolerate
127: public Builder volumeId (@Nonnull final String volumeId)
128: {
129: return volumeId(Optional.of(volumeId));
130: }
131:
132: @Nonnull @Tolerate
133: public Builder fileId (@Nonnull final String fileId)
134: {
135: return fileId(Optional.of(fileId));
136: }
137:
138: @Nonnull @Tolerate
139: public Builder renderFiles()
140: {
141: return renderFiles(true);
142: }
143: }
144:
145: /** The label. */
146: @Nonnull @Default
147: public final Optional<String> label = Optional.empty();
148:
149: @Nonnull @Default
150: public final Optional<String> volumeId = Optional.empty();
151:
152: @Nonnull @Default
153: public final Optional<String> fileId = Optional.empty();
154:
155: /** Render files too. */
156: public final boolean renderFiles;
157:
158: // Syntactic sugar
159: @Nonnull
160: public static BackupOptions.Builder with()
161: {
162: return builder();
163: }
164:
165: @Nonnull
166: public static BackupOptions.Builder withDefaultOptions()
167: {
168: return builder();
169: }
170: }
171:
172: /*******************************************************************************************************************
173: *
174: * Render managed files.
175: *
176: ******************************************************************************************************************/
177: public default void renderManagedFiles()
178: {
179: renderManagedFiles(ManagedFileOptions.withDefaultOptions());
180: }
181:
182: /*******************************************************************************************************************
183: *
184: * Render managed files with the specified options.
185: *
186: * @param options the options
187: *
188: ******************************************************************************************************************/
189: public default void renderManagedFiles (@Nonnull final ManagedFileOptions.Builder options)
190: {
191: renderManagedFiles(options.build());
192: }
193:
194: /*******************************************************************************************************************
195: *
196: * Render managed files with the specified options.
197: *
198: * @param options the options
199: *
200: ******************************************************************************************************************/
201: public void renderManagedFiles (@Nonnull ManagedFileOptions options);
202:
203: /*******************************************************************************************************************
204: *
205: * Render managed backups with the specified options.
206: *
207: ******************************************************************************************************************/
208: public default void renderBackups()
209: {
210: renderBackups(BackupOptions.withDefaultOptions());
211: }
212:
213: /*******************************************************************************************************************
214: *
215: * Render managed backups with the specified options.
216: *
217: * @param options the options
218: *
219: ******************************************************************************************************************/
220: public default void renderBackups (@Nonnull final BackupOptions.Builder options)
221: {
222: renderBackups(options.build());
223: }
224:
225: /*******************************************************************************************************************
226: *
227: * Render managed backups with the specified options.
228: *
229: * @param options the options
230: *
231: ******************************************************************************************************************/
232: public void renderBackups (@Nonnull BackupOptions options);
233: }