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.objects; |
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.DomainObjectFactory; |
29 |
|
import org.xwiki.rest.internal.RangeIterable; |
30 |
|
import org.xwiki.rest.internal.Utils; |
31 |
|
import org.xwiki.rest.model.jaxb.Objects; |
32 |
|
import org.xwiki.rest.resources.objects.ObjectsForClassNameResource; |
33 |
|
|
34 |
|
import com.xpn.xwiki.XWikiException; |
35 |
|
import com.xpn.xwiki.api.Document; |
36 |
|
|
37 |
|
|
38 |
|
@version |
39 |
|
|
40 |
|
@Component |
41 |
|
@Named("org.xwiki.rest.internal.resources.objects.ObjectsForClassNameResourceImpl") |
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.27 |
|
42 |
|
public class ObjectsForClassNameResourceImpl extends BaseObjectsResource implements ObjectsForClassNameResource |
43 |
|
{ |
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.27 |
|
44 |
0 |
@Override... |
45 |
|
public Objects getObjects(String wikiName, String spaceName, String pageName, String className, Integer start, |
46 |
|
Integer number, Boolean withPrettyNames) throws XWikiRestException |
47 |
|
{ |
48 |
0 |
try { |
49 |
0 |
DocumentInfo documentInfo = getDocumentInfo(wikiName, spaceName, pageName, null, null, true, false); |
50 |
|
|
51 |
0 |
Document doc = documentInfo.getDocument(); |
52 |
|
|
53 |
0 |
Objects objects = objectFactory.createObjects(); |
54 |
|
|
55 |
0 |
List<com.xpn.xwiki.objects.BaseObject> objectList = getBaseObjects(doc, className); |
56 |
|
|
57 |
0 |
RangeIterable<com.xpn.xwiki.objects.BaseObject> ri = |
58 |
|
new RangeIterable<com.xpn.xwiki.objects.BaseObject>(objectList, start, number); |
59 |
|
|
60 |
0 |
for (com.xpn.xwiki.objects.BaseObject object : ri) { |
61 |
|
|
62 |
0 |
if (object != null) { |
63 |
0 |
objects.getObjectSummaries() |
64 |
|
.add(DomainObjectFactory.createObjectSummary(objectFactory, uriInfo.getBaseUri(), |
65 |
|
Utils.getXWikiContext(componentManager), doc, object, false, |
66 |
|
Utils.getXWikiApi(componentManager), withPrettyNames)); |
67 |
|
} |
68 |
|
} |
69 |
|
|
70 |
0 |
return objects; |
71 |
|
} catch (XWikiException e) { |
72 |
0 |
throw new XWikiRestException(e); |
73 |
|
} |
74 |
|
} |
75 |
|
} |