1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rest.internal.resources.pages; |
21 |
|
|
22 |
|
import javax.inject.Named; |
23 |
|
import javax.ws.rs.core.Response; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
import org.xwiki.rest.XWikiRestException; |
27 |
|
import org.xwiki.rest.model.jaxb.Page; |
28 |
|
import org.xwiki.rest.resources.pages.PageTranslationResource; |
29 |
|
|
30 |
|
import com.xpn.xwiki.XWikiException; |
31 |
|
import com.xpn.xwiki.api.Document; |
32 |
|
|
33 |
|
|
34 |
|
@version |
35 |
|
|
36 |
|
@Component |
37 |
|
@Named("org.xwiki.rest.internal.resources.pages.PageTranslationResourceImpl") |
|
|
| 81.2% |
Uncovered Elements: 3 (16) |
Complexity: 6 |
Complexity Density: 0.46 |
|
38 |
|
public class PageTranslationResourceImpl extends ModifiablePageResource implements PageTranslationResource |
39 |
|
{ |
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
|
40 |
8 |
@Override... |
41 |
|
public Page getPageTranslation(String wikiName, String spaceName, String pageName, String language, |
42 |
|
Boolean withPrettyNames) throws XWikiRestException |
43 |
|
{ |
44 |
8 |
try { |
45 |
8 |
DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, language, null, true, false); |
46 |
|
|
47 |
5 |
Document doc = documentInfo.getDocument(); |
48 |
|
|
49 |
5 |
return this.factory.toRestPage(this.uriInfo.getBaseUri(), this.uriInfo.getAbsolutePath(), doc, false, |
50 |
|
withPrettyNames, false, false, false); |
51 |
|
} catch (XWikiException e) { |
52 |
0 |
throw new XWikiRestException(e); |
53 |
|
} |
54 |
|
} |
55 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
56 |
2 |
@Override... |
57 |
|
public Response putPageTranslation(String wikiName, String spaceName, String pageName, String language, Page page) |
58 |
|
throws XWikiRestException |
59 |
|
{ |
60 |
2 |
try { |
61 |
2 |
DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, language, null, false, true); |
62 |
|
|
63 |
2 |
return putPage(documentInfo, page); |
64 |
|
} catch (XWikiException e) { |
65 |
0 |
throw new XWikiRestException(e); |
66 |
|
} |
67 |
|
} |
68 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
69 |
4 |
@Override... |
70 |
|
public void deletePageTranslation(String wikiName, String spaceName, String pageName, String language) |
71 |
|
throws XWikiRestException |
72 |
|
{ |
73 |
4 |
try { |
74 |
4 |
DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, language, null, true, false); |
75 |
|
|
76 |
1 |
deletePage(documentInfo); |
77 |
|
} catch (XWikiException e) { |
78 |
0 |
throw new XWikiRestException(e); |
79 |
|
} |
80 |
|
} |
81 |
|
} |