Skip to content

Package: GalleryDescription

GalleryDescription

nameinstructionbranchcomplexitylinemethod
GalleryDescription(String, String)
M: 0 C: 17
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
canEqual(Object)
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%
createFolder(MediaFolder, BiFunction)
M: 0 C: 22
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
equals(Object)
M: 55 C: 0
0%
M: 18 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getDisplayName()
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%
getUrl()
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%
hashCode()
M: 34 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
lambda$createFolder$0(BiFunction, MediaFolder)
M: 0 C: 7
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: 6
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.service.stoppingdown.impl;
28:
29: import javax.annotation.Nonnull;
30: import javax.annotation.concurrent.Immutable;
31: import java.util.Collection;
32: import java.util.function.BiFunction;
33: import java.nio.file.Path;
34: import java.nio.file.Paths;
35: import it.tidalwave.bluemarine2.model.MediaFolder;
36: import it.tidalwave.bluemarine2.model.VirtualMediaFolder;
37: import it.tidalwave.bluemarine2.model.VirtualMediaFolder.EntityCollectionFactory;
38: import it.tidalwave.bluemarine2.model.spi.PathAwareEntity;
39: import lombok.EqualsAndHashCode;
40: import lombok.Getter;
41: import lombok.RequiredArgsConstructor;
42: import lombok.ToString;
43:
44: /***********************************************************************************************************************
45: *
46: * @author Fabrizio Giudici
47: *
48: **********************************************************************************************************************/
49: @Immutable
50:•@RequiredArgsConstructor @Getter @EqualsAndHashCode @ToString
51: public class GalleryDescription
52: {
53: @Nonnull
54: private final String displayName;
55:
56: @Nonnull
57: private final String url;
58:
59: /*******************************************************************************************************************
60: *
61: * Creates a {@link MediaFolder} with the given parent and the children provided by a factory.
62: *
63: * @param parent the parent folder
64: * @param entitiesFactory a function which, given the parent and a URL, provides the entities
65: * @return the folder
66: *
67: ******************************************************************************************************************/
68: // FIXME: even though the finder is retrieved later, through the factory, the translation to DIDL does compute
69: // the finder because it calls the count() for the children count
70: @Nonnull
71: public PathAwareEntity createFolder (@Nonnull final MediaFolder parent,
72: @Nonnull final BiFunction<MediaFolder, String, Collection<PathAwareEntity>> entitiesFactory)
73: {
74: final Path path = Paths.get(url.replaceAll("^.*(themes|diary\\/[0-9]{4})\\/(.*)\\/images\\.xml", "$2"));
75: final EntityCollectionFactory ecf = p -> entitiesFactory.apply(p, url);
76: return new VirtualMediaFolder(parent, path, displayName, ecf);
77: }
78: }