Skip to content

Commit cda271f

Browse files
committed
Add Override annotation to moved services functions
1 parent 5b07c8b commit cda271f

16 files changed

+98
-2
lines changed

src/main/java/com/kodedu/service/cache/impl/BinaryCacheServiceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public BinaryCacheServiceImpl(ThreadService threadService, Current current) {
4545
this.current = current;
4646
}
4747

48+
@Override
4849
public String putBinary(String key, byte[] bytes) {
4950

5051
if (Platform.isFxApplicationThread()) {
@@ -142,10 +143,12 @@ private long getTotalSize() {
142143
return totalSize.get();
143144
}
144145

146+
@Override
145147
public CacheData getCacheData(String key) {
146148
return cache.get(key);
147149
}
148150

151+
@Override
149152
public void putBinary(String key, BufferedImage trimmed) {
150153
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();) {
151154
ImageIO.write(trimmed, "png", outputStream);
@@ -156,6 +159,7 @@ public void putBinary(String key, BufferedImage trimmed) {
156159
}
157160
}
158161

162+
@Override
159163
public boolean hasCache(String key) {
160164
return cache.containsKey(key);
161165
}

src/main/java/com/kodedu/service/extension/chart/impl/ChartBuilderServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public ChartBuilderServiceImpl(ThreadService threadService, Current current, App
2828
this.controller = controller;
2929
}
3030

31+
@Override
3132
public boolean chartBuild(String chartContent, String imagesDir, String imageTarget, Map<String, String> optMap) {
3233

3334
if (!imageTarget.endsWith(".png")) {

src/main/java/com/kodedu/service/impl/DirectoryServiceImpl.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public DirectoryServiceImpl(final ApplicationController controller, final FileBr
7676

7777
}
7878

79+
@Override
7980
public DirectoryChooser newDirectoryChooser(String title) {
8081
DirectoryChooser directoryChooser = new DirectoryChooser();
8182
directoryChooser.setTitle(title);
@@ -85,6 +86,7 @@ public DirectoryChooser newDirectoryChooser(String title) {
8586
return directoryChooser;
8687
}
8788

89+
@Override
8890
public FileChooser newFileChooser(String title) {
8991
final FileChooser fileChooser = new FileChooser();
9092
fileChooser.setTitle(title);
@@ -114,6 +116,7 @@ private static File getChooserInitialDirectory(File referenceFile) {
114116
return FileSystems.getDefault().getRootDirectories().iterator().next().toFile();
115117
}
116118

119+
@Override
117120
public Path workingDirectory() {
118121
return workingDirectory.orElseGet(this::workingDirectorySupplier);
119122
}
@@ -145,34 +148,42 @@ private Path workingDirectorySupplier() {
145148
return Objects.nonNull(file) ? file.toPath() : null;
146149
}
147150

151+
@Override
148152
public Path currentPath() {
149153
return current.currentPath().orElseGet(pathSaveSupplier);
150154
}
151155

156+
@Override
152157
public Supplier<Path> getPathSaveSupplier() {
153158
return pathSaveSupplier;
154159
}
155160

161+
@Override
156162
public void setPathSaveSupplier(Supplier<Path> pathSaveSupplier) {
157163
this.pathSaveSupplier = pathSaveSupplier;
158164
}
159165

166+
@Override
160167
public void setWorkingDirectory(Optional<Path> workingDirectory) {
161168
this.workingDirectory = workingDirectory;
162169
}
163170

171+
@Override
164172
public Optional<Path> getWorkingDirectory() {
165173
return workingDirectory;
166174
}
167175

176+
@Override
168177
public Optional<File> getInitialDirectory() {
169178
return initialDirectory;
170179
}
171180

181+
@Override
172182
public void setInitialDirectory(Optional<File> initialDirectory) {
173183
this.initialDirectory = initialDirectory;
174184
}
175185

186+
@Override
176187
public void askWorkingDir() {
177188
DirectoryChooser directoryChooser = this.newDirectoryChooser("Select Working Directory");
178189
File selectedDir = directoryChooser.showDialog(null);
@@ -181,6 +192,7 @@ public void askWorkingDir() {
181192
}
182193
}
183194

195+
@Override
184196
public void changeWorkigDir(Path path) {
185197
if (Objects.isNull(path))
186198
return;
@@ -196,18 +208,22 @@ public void changeWorkigDir(Path path) {
196208

197209
}
198210

211+
@Override
199212
public void goUp() {
200213
workingDirectory.map(Path::getParent).ifPresent(this::changeWorkigDir);
201214
}
202215

216+
@Override
203217
public void refreshWorkingDir() {
204218
workingDirectory.ifPresent(this::changeWorkigDir);
205219
}
206220

221+
@Override
207222
public String interPath() {
208223
return interPath(currentParentOrWorkdir());
209224
}
210225

226+
@Override
211227
public String interPath(Path path) {
212228

213229
try {
@@ -218,6 +234,7 @@ public String interPath(Path path) {
218234
}
219235
}
220236

237+
@Override
221238
public Path getSaveOutputPath(FileChooser.ExtensionFilter extensionFilter, boolean askPath) {
222239

223240
if (!Platform.isFxApplicationThread()) {
@@ -263,6 +280,7 @@ public Path getSaveOutputPath(FileChooser.ExtensionFilter extensionFilter, boole
263280
return file.toPath();
264281
}
265282

283+
@Override
266284
public Path findPathInCurrentOrWorkDir(String uri) {
267285

268286
Optional<Path> lookUpFile = pathMapper.lookUpFile(uri);
@@ -300,6 +318,7 @@ public Path findPathInCurrentOrWorkDir(String uri) {
300318

301319
}
302320

321+
@Override
303322
public Path findPathInPublic(String finalUri) {
304323
List<String> uris = asList(finalUri, finalUri.replaceFirst("/", "")).stream().collect(Collectors.toList());
305324
Path result = null;
@@ -314,6 +333,7 @@ public Path findPathInPublic(String finalUri) {
314333
return result;
315334
}
316335

336+
@Override
317337
public Path findPathInWorkdirOrLookup(Path uri) {
318338

319339
Optional<Path> lookUpFile = pathMapper.lookUpFile(uri);
@@ -363,6 +383,7 @@ public Path findPathInWorkdirOrLookup(Path uri) {
363383

364384
}
365385

386+
@Override
366387
public Path currentParentOrWorkdir() {
367388
return current.currentPath().map(Path::getParent).orElse(this.workingDirectory());
368389
}

src/main/java/com/kodedu/service/impl/FileWatchServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public void init() {
5858
threadService.runTaskLater(this::watchPathChanges);
5959
}
6060

61+
@Override
6162
public void reCreateWatchService() {
6263
if (Objects.nonNull(watcher)) {
6364
try {
@@ -77,6 +78,7 @@ public void reCreateWatchService() {
7778

7879
}
7980

81+
@Override
8082
public void unRegisterAllPath() {
8183
for (Map.Entry<WatchKey, Path> entry : watchKeys.entrySet()) {
8284
WatchKey watchKey = entry.getKey();
@@ -162,6 +164,7 @@ private void watchPathChanges() {
162164

163165
}
164166

167+
@Override
165168
public void registerPathWatcher(final Path path) {
166169

167170
threadService.runTaskLater(() -> {
@@ -191,6 +194,7 @@ public void registerPathWatcher(final Path path) {
191194
});
192195
}
193196

197+
@Override
194198
public boolean isRegisteredPath(Path finalPath, Map<WatchKey, Path> watchKeys) {
195199
boolean exist = false;
196200
for (Map.Entry<WatchKey, Path> entry : watchKeys.entrySet()) {
@@ -208,6 +212,7 @@ public boolean isRegisteredPath(Path finalPath, Map<WatchKey, Path> watchKeys) {
208212
return exist;
209213
}
210214

215+
@Override
211216
public void unRegisterPath(Path path) {
212217
try {
213218
for (Map.Entry<WatchKey, Path> entry : watchKeys.entrySet()) {

src/main/java/com/kodedu/service/impl/ParserServiceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public ParserServiceImpl(final ApplicationController asciiDocController, final C
5151
this.directoryService = directoryService;
5252
}
5353

54+
@Override
5455
public Optional<String> toIncludeBlock(List<File> dropFiles) {
5556

5657
List<Path> files = dropFiles.stream().map(File::toPath).filter(p -> !Files.isDirectory(p)).collect(Collectors.toList());
@@ -67,6 +68,7 @@ public Optional<String> toIncludeBlock(List<File> dropFiles) {
6768
return Optional.empty();
6869
}
6970

71+
@Override
7072
public Optional<String> toImageBlock(Image image) {
7173

7274
Path currentPath = directoryService.currentParentOrWorkdir();
@@ -95,6 +97,7 @@ public Optional<String> toImageBlock(Image image) {
9597

9698
}
9799

100+
@Override
98101
public Optional<String> toImageBlock(List<File> dropFiles) {
99102

100103
Path workDir = directoryService.workingDirectory();
@@ -114,6 +117,7 @@ public Optional<String> toImageBlock(List<File> dropFiles) {
114117

115118
}
116119

120+
@Override
117121
public Optional<String> toWebImageBlock(String html) {
118122

119123
Matcher matcher = Constants.IMAGE_URL_MATCH.matcher(html);

src/main/java/com/kodedu/service/impl/PathFinderServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public PathFinderServiceImpl(Current current, DirectoryService directoryService)
2828
this.directoryService = directoryService;
2929
}
3030

31+
@Override
3132
public Path findPath(String uri, Integer parent) {
3233

3334
if (Objects.isNull(parent))

src/main/java/com/kodedu/service/impl/PathOrderServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
@Component
1414
public class PathOrderServiceImpl implements PathOrderService {
1515

16+
@Override
1617
public int comparePaths(Path first, Path second) {
1718

1819
if (OSHelper.isMac() || OSHelper.isWindows())

src/main/java/com/kodedu/service/impl/PathResolverServiceImpl.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,34 +40,42 @@ public class PathResolverServiceImpl implements PathResolverService {
4040
private final PathMatcher bookMatcher = FileSystems.getDefault().getPathMatcher("glob:{**book.asc,**book.txt,**book.asciidoc,**book.adoc,**book.ad}");
4141
private final PathMatcher wordMatcher = FileSystems.getDefault().getPathMatcher("glob:**.{doc,dot,docx,docm,dotx,dotm,docb,odt,fodt}");
4242

43+
@Override
4344
public boolean isPDF(Path path) {
4445
return pdfMatcher.matches(path);
4546
}
4647

48+
@Override
4749
public boolean isImage(Path path) {
4850
return imageMatcher.matches(path);
4951
}
5052

53+
@Override
5154
public boolean isHidden(Path path) {
5255
return IOHelper.isHidden(path);
5356
}
5457

58+
@Override
5559
public boolean isMarkdown(Path path) {
5660
return markdownMatcher.matches(path);
5761
}
5862

63+
@Override
5964
public boolean isXML(Path path) {
6065
return docBookMatcher.matches(path);
6166
}
6267

68+
@Override
6369
public boolean isHTML(Path path) {
6470
return htmlMatcher.matches(path);
6571
}
6672

73+
@Override
6774
public boolean isAsciidoc(Path path) {
6875
return ascMatcher.matches(path);
6976
}
7077

78+
@Override
7179
public boolean isViewable(Path path) {
7280
return true || Files.isDirectory(path)
7381
|| isAsciidoc(path)
@@ -80,55 +88,67 @@ public boolean isViewable(Path path) {
8088
|| isMarkdown(path);
8189
}
8290

91+
@Override
8392
public boolean isOffice(Path path) {
8493
return isWord(path) || isExcel(path) || isPPT(path);
8594
}
8695

87-
96+
@Override
8897
public boolean isBook(Path path) {
8998
return bookMatcher.matches(path);
9099
}
91100

101+
@Override
92102
public boolean isMobi(Path path) {
93103
return mobiMatcher.matches(path);
94104
}
95105

106+
@Override
96107
public boolean isPPT(Path path) {
97108
return pptMatcher.matches(path);
98109
}
99110

111+
@Override
100112
public boolean isExcel(Path path) {
101113
return excelMatcher.matches(path);
102114
}
103115

116+
@Override
104117
public boolean isArchive(Path path) {
105118
return archieveMatcher.matches(path);
106119
}
107120

121+
@Override
108122
public boolean isVideo(Path path) {
109123
return videoMatcher.matches(path);
110124
}
111125

126+
@Override
112127
public boolean isCSS(Path path) {
113128
return cssMatcher.matches(path);
114129
}
115130

131+
@Override
116132
public boolean isBash(Path path) {
117133
return terminalMatcher.matches(path);
118134
}
119135

136+
@Override
120137
public boolean isCode(Path path) {
121138
return codeMatcher.matches(path);
122139
}
123140

141+
@Override
124142
public boolean isAny(Path path) {
125143
return anyMatcher.matches(path) || uniqueMatcher.matches(path);
126144
}
127145

146+
@Override
128147
public boolean isEpub(Path path) {
129148
return epubMatcher.matches(path);
130149
}
131150

151+
@Override
132152
public boolean isWord(Path path) {
133153
return wordMatcher.matches(path);
134154
}

src/main/java/com/kodedu/service/impl/SampleBookServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public class SampleBookServiceImpl implements SampleBookService {
1919

2020
private final Logger logger = LoggerFactory.getLogger(SampleBookService.class);
2121

22+
@Override
2223
public void produceSampleBook(Path configPath, Path outputPath) {
2324
File booksample = configPath.resolve("booksample").toFile();
2425
File destDir = outputPath.toFile();

0 commit comments

Comments
 (0)