Skip to content

Package: RepositoryMusicPerformer

RepositoryMusicPerformer

nameinstructionbranchcomplexitylinemethod
RepositoryMusicPerformer(Repository, BindingSet)
M: 0 C: 25
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
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: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
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%
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%
getId()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMusicArtist()
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%
getRole()
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%
toString()
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%

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.catalog;
28:
29: import javax.annotation.Nonnull;
30: import java.util.Collection;
31: import java.util.Optional;
32: import org.eclipse.rdf4j.query.BindingSet;
33: import org.eclipse.rdf4j.repository.Repository;
34: import it.tidalwave.util.Id;
35: import it.tidalwave.bluemarine2.model.audio.MusicArtist;
36: import it.tidalwave.bluemarine2.model.audio.MusicPerformer;
37: import it.tidalwave.bluemarine2.model.spi.Entity;
38: import it.tidalwave.bluemarine2.model.vocabulary.*;
39: import lombok.EqualsAndHashCode;
40: import lombok.Getter;
41: import lombok.ToString;
42:
43: /***********************************************************************************************************************
44: *
45: * @author Fabrizio Giudici
46: *
47: **********************************************************************************************************************/
48:•@Getter @EqualsAndHashCode @ToString
49: public class RepositoryMusicPerformer implements MusicPerformer
50: {
51: @Nonnull
52: private final MusicArtist musicArtist;
53:
54: @Nonnull
55: private final Optional<Entity> role;
56:
57: // @Delegate
58: // private final PriorityAsSupport asSupport = new PriorityAsSupport(this);
59:
60: public RepositoryMusicPerformer (@Nonnull final Repository repository, @Nonnull final BindingSet bindingSet)
61: {
62: this.musicArtist = new RepositoryMusicArtist(repository, bindingSet);
63: final Optional<String> r = Optional.of(bindingSet.getBinding("role").getValue().stringValue()
64: .replaceAll(BMMO.NS + "performer_", ""));
65: this.role = r.map(RepositoryMusicPerformerRole::new);
66: }
67:
68: @Override @Nonnull
69: public Id getId()
70: {
71: return musicArtist.getId();
72: }
73:
74: // FIXME: should delegate first to its own AsDelegate and only as a fallaback to MusicArtist
75: @Override @Nonnull
76: public <T> T as(@Nonnull Class<T> type)
77: {
78: return musicArtist.as(type);
79: }
80:
81: @Override @Nonnull
82: public <T> T as(@Nonnull Class<T> type, @Nonnull NotFoundBehaviour<T> notFoundBehaviour)
83: {
84: return musicArtist.as(type, notFoundBehaviour);
85: }
86:
87: @Override @Nonnull
88: public <T> Collection<T> asMany(@Nonnull Class<T> type)
89: {
90: return musicArtist.asMany(type);
91: }
92: }