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

File SpaceSearchResourceImpl.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

0
8
1
1
62
35
2
0.25
8
1
2

Classes

Class Line # Actions
SpaceSearchResourceImpl 35 8 0% 2 1
0.888888988.9%
 

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.resources.spaces;
21   
22    import java.util.List;
23   
24    import javax.inject.Named;
25   
26    import org.xwiki.component.annotation.Component;
27    import org.xwiki.rest.XWikiRestException;
28    import org.xwiki.rest.internal.Utils;
29    import org.xwiki.rest.internal.resources.BaseSearchResult;
30    import org.xwiki.rest.model.jaxb.SearchResults;
31    import org.xwiki.rest.resources.spaces.SpaceSearchResource;
32   
33    @Component
34    @Named("org.xwiki.rest.internal.resources.spaces.SpaceSearchResourceImpl")
 
35    public class SpaceSearchResourceImpl extends BaseSearchResult implements SpaceSearchResource
36    {
 
37  11 toggle @Override
38    public SearchResults search(String wikiName, String spaceName, String keywords, List<String> searchScopeStrings,
39    Integer number, Integer start, String orderField, String order, Boolean withPrettyNames)
40    throws XWikiRestException
41    {
42  11 List<String> spaces = parseSpaceSegments(spaceName);
43   
44  11 try {
45  11 SearchResults searchResults = objectFactory.createSearchResults();
46  11 searchResults.setTemplate(String.format("%s?%s", Utils.createURI(uriInfo.getBaseUri(),
47    SpaceSearchResource.class, wikiName, spaces).toString(), SEARCH_TEMPLATE_INFO));
48   
49  11 List<SearchScope> searchScopes = parseSearchScopeStrings(searchScopeStrings);
50   
51  11 searchResults.getSearchResults().addAll(
52    search(searchScopes, keywords, wikiName, Utils.getLocalSpaceId(spaces),
53    Utils.getXWiki(componentManager).getRightService().hasProgrammingRights(
54    Utils.getXWikiContext(componentManager)), number, start, true, orderField, order,
55    withPrettyNames));
56   
57  11 return searchResults;
58    } catch (Exception e) {
59  0 throw new XWikiRestException(e);
60    }
61    }
62    }