1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.model.internal.reference

File RelativeStringEntityReferenceResolver.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
2
3
1
76
24
3
1.5
0.67
3
1

Classes

Class Line # Actions
RelativeStringEntityReferenceResolver 47 2 0% 3 0
1.0100%
 

Contributing tests

This file is covered by 189 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.model.internal.reference;
21   
22    import javax.inject.Named;
23    import javax.inject.Singleton;
24   
25    import org.xwiki.component.annotation.Component;
26    import org.xwiki.model.EntityType;
27    import org.xwiki.model.reference.EntityReference;
28   
29    /**
30    * Resolve {@link org.xwiki.model.reference.EntityReference} objects from its string representations. This
31    * implementation doesn't generate absolute references; instead it stores the representation into an
32    * {@link EntityReference} object (ie if the representation is a Document reference and it has only a page name
33    * specified, then a single EntityReference of type DOCUMENT will be returned, with no Space and Wiki references). This
34    * is useful in cases when we need to store a reference relative to another reference (for example for storing Parent
35    * references in a Document, since we want these references to stay relative if the user has specified a relative
36    * reference, and absolute if the user has specified an absolute reference).
37    * <p>
38    * In other words, this implementation just transforms a String representation into a {@link EntityReference}
39    * representation without resolving any missing parts (space, wiki, etc).
40    *
41    * @version $Id: 2721c7825618e8f9a58d41fbfe666be70ac738a2 $
42    * @since 2.2.3
43    */
44    @Component
45    @Named("relative")
46    @Singleton
 
47    public class RelativeStringEntityReferenceResolver extends AbstractStringEntityReferenceResolver
48    {
49    /**
50    * Empty constructor, to be used by the Component Manager, which will also inject the Symbol Scheme.
51    */
 
52  300 toggle public RelativeStringEntityReferenceResolver()
53    {
54    // Empty constructor, to be used by the Component Manager, which will also inject the Symbol Scheme
55    }
56   
57    /**
58    * Constructor to be used when using this class as a POJO and not as a component.
59    *
60    * @param symbolScheme the scheme to use for serializing the passed references (i.e. defines the separators to use
61    * between the Entity types, and the characters to escape and how to escape them)
62    */
 
63  50 toggle public RelativeStringEntityReferenceResolver(SymbolScheme symbolScheme)
64    {
65  50 super(symbolScheme);
66    }
67   
68   
 
69  2232120 toggle @Override
70    protected EntityReference getDefaultReference(EntityType type, Object... parameters)
71    {
72    // Return null to signify to the generic algorithm that we don't want to generate references with default
73    // values.
74  2232307 return null;
75    }
76    }