Skip to contentPackage: DataManager
DataManager
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.model;
28:
29: import jakarta.annotation.Nonnull;
30: import java.util.Optional;
31: import it.tidalwave.util.spi.ExtendedFinderSupport;
32: import lombok.Getter;
33: import lombok.RequiredArgsConstructor;
34:
35: /***********************************************************************************************************************
36: *
37: * The business controller for the application.
38: *
39: * @stereotype Business Controller
40: * @author Fabrizio Giudici
41: *
42: **********************************************************************************************************************/
43: public interface DataManager
44: {
45: /*******************************************************************************************************************
46: * A {@link it.tidalwave.util.Finder} for querying {@link ManagedFile}s.
47: ******************************************************************************************************************/
48: public static interface ManagedFileFinder extends ExtendedFinderSupport<ManagedFile, ManagedFileFinder>
49: {
50: /***************************************************************************************************************
51: * Sorting keys.
52: **************************************************************************************************************/
53: @RequiredArgsConstructor @Getter
54: public enum SortingKeys
55: {
56: PATH("path");
57:
58: @Nonnull
59: private final String name;
60: }
61:
62: /***************************************************************************************************************
63: * Specifies that returned {@link ManagedFile}s must contain the given fingerprint.
64: * @param fingerprint the fingerprint
65: * @return the same finder in fluent style
66: **************************************************************************************************************/
67: @Nonnull
68: public ManagedFileFinder withFingerprint (@Nonnull final Optional<String> fingerprint);
69:
70: /***************************************************************************************************************
71: * Specifies that returned {@link ManagedFile}s must contain the given fingerprint.
72: * @param fingerprint the fingerprint
73: * @return the same finder in fluent style
74: **************************************************************************************************************/
75: @Nonnull
76: public default ManagedFileFinder withFingerprint (@Nonnull final String fingerprint)
77: {
78: return withFingerprint(Optional.of(fingerprint));
79: }
80: }
81:
82: /*******************************************************************************************************************
83: * A {@link it.tidalwave.util.Finder} for querying {@link Backup}s.
84: ******************************************************************************************************************/
85: public static interface BackupFinder extends ExtendedFinderSupport<Backup, BackupFinder>
86: {
87: /***************************************************************************************************************
88: * Sorting keys.
89: **************************************************************************************************************/
90: @RequiredArgsConstructor @Getter
91: public enum SortingKeys
92: {
93: LABEL("label");
94:
95: @Nonnull
96: private final String name;
97: }
98:
99: /***************************************************************************************************************
100: * Specifies that returned {@link Backup}s with the given label.
101: * @param label the label
102: * @return the same finder in fluent style
103: **************************************************************************************************************/
104: @Nonnull
105: public BackupFinder withLabel (@Nonnull final Optional<String> label);
106:
107: /***************************************************************************************************************
108: * Specifies that returned {@link Backup}s with the given volume id.
109: * @param volumeId the volume id
110: * @return the same finder in fluent style
111: **************************************************************************************************************/
112: @Nonnull
113: public BackupFinder withVolumeId (@Nonnull final Optional<String> volumeId);
114:
115: /***************************************************************************************************************
116: * Specifies that returned {@link Backup}s contains the file with the given volume id.
117: * @param fileId the file id
118: * @return the same finder in fluent style
119: **************************************************************************************************************/
120: @Nonnull
121: public BackupFinder withFileId (@Nonnull final Optional<String> fileId);
122: }
123:
124: /*******************************************************************************************************************
125: *
126: * Queries the managed files.
127: *
128: * @return a {@link it.tidalwave.util.Finder} for {@link it.tidalwave.datamanager.model.ManagedFile}s
129: *
130: ******************************************************************************************************************/
131: @Nonnull
132: public ManagedFileFinder findManagedFiles();
133:
134: /*******************************************************************************************************************
135: *
136: * Queries the backups.
137: *
138: * @return a {@link it.tidalwave.util.Finder} for {@link it.tidalwave.datamanager.model.Backup}s
139: *
140: ******************************************************************************************************************/
141: @Nonnull
142: public BackupFinder findBackups();
143: }