1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rest.internal.url.resources

File AbstractJobRestURLGenerator.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

2
7
1
1
58
24
3
0.43
7
1
3

Classes

Class Line # Actions
AbstractJobRestURLGenerator 39 7 0% 3 10
0.00%
 

Contributing tests

No tests hitting this source file were found.

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.rest.internal.url.resources;
21   
22    import java.io.UnsupportedEncodingException;
23    import java.net.URLEncoder;
24    import java.util.List;
25   
26    import javax.inject.Singleton;
27   
28    import org.xwiki.rest.internal.url.AbstractParametrizedRestURLGenerator;
29   
30    /**
31    * Jobs related Abstract class for ParametrizedRestURLGenerator.
32    *
33    * @param <T> the type of the resource for which the URL are created for. Must inherit from
34    * {@link org.xwiki.model.reference.EntityReference}.
35    * @version $Id: 2720616f9d1a5413a2621ad2fce6352fc3693ef1 $
36    * @since 8.0
37    */
38    @Singleton
 
39    public abstract class AbstractJobRestURLGenerator<T> extends AbstractParametrizedRestURLGenerator<T>
40    {
 
41  0 toggle protected String getIdStringElement(List<String> id)
42    {
43  0 StringBuilder builder = new StringBuilder();
44   
45  0 for (String idElement : id) {
46  0 if (builder.length() > 0) {
47  0 builder.append('/');
48    }
49  0 try {
50  0 builder.append(URLEncoder.encode(idElement, "UTF8"));
51    } catch (UnsupportedEncodingException e) {
52    // Should never happen
53    }
54    }
55   
56  0 return builder.toString();
57    }
58    }