Skip to content

Package: FileSystemMediaFolder

FileSystemMediaFolder

nameinstructionbranchcomplexitylinemethod
FileSystemMediaFolder(Path, MediaFolder, Path)
M: 0 C: 26
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
as(Class)
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%
as(Class, As.NotFoundBehaviour)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
asMany(Class)
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%
asOptional(Class)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
findChildren()
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getBasePath()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getParent()
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%
getPath()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
maybeAs(Class)
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%
toString()
M: 0 C: 13
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: * blueMarine II: Semantic Media Centre
5: * http://tidalwave.it/projects/bluemarine2
6: *
7: * Copyright (C) 2015 - 2021 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/bluemarine2-src
23: * git clone https://github.com/tidalwave-it/bluemarine2-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.bluemarine2.model.impl;
28:
29: import javax.annotation.Nonnull;
30: import javax.annotation.Nullable;
31: import javax.annotation.concurrent.Immutable;
32: import java.util.Optional;
33: import java.nio.file.Path;
34: import it.tidalwave.util.spi.PriorityAsSupport;
35: import it.tidalwave.bluemarine2.model.MediaFolder;
36: import it.tidalwave.bluemarine2.model.spi.PathAwareEntity;
37: import it.tidalwave.bluemarine2.model.spi.PathAwareFinder;
38: import lombok.AllArgsConstructor;
39: import lombok.Getter;
40: import lombok.experimental.Delegate;
41:
42: /***********************************************************************************************************************
43: *
44: * The default implementation of {@link MediaFolder}. It basically does nothing, it just acts as an aggregator of roles.
45: *
46: * @stereotype Datum
47: *
48: * @author Fabrizio Giudici
49: *
50: **********************************************************************************************************************/
51: @Immutable @AllArgsConstructor
52: public class FileSystemMediaFolder implements MediaFolder
53: {
54: @Getter @Nonnull
55: private final Path path;
56:
57: @Nullable
58: private final MediaFolder parent;
59:
60: @Getter @Nonnull
61: private final Path basePath;
62:
63: @Delegate
64: private final PriorityAsSupport asSupport = new PriorityAsSupport(this);
65:
66: @Override @Nonnull
67: public Optional<PathAwareEntity> getParent()
68: {
69: return Optional.ofNullable(parent);
70: }
71:
72: @Override @Nonnull
73: public PathAwareFinder findChildren()
74: {
75: return new FileSystemMediaFolderFinder(this, basePath).sort(new MediaItemComparator());
76: }
77:
78: @Override @Nonnull
79: public String toString()
80: {
81: return String.format("FileSystemMediaFolder(%s)", basePath.relativize(path));
82: }
83: }