1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.platform.wiki.creationjob.internal.steps; |
21 |
|
|
22 |
|
import javax.inject.Inject; |
23 |
|
import javax.inject.Named; |
24 |
|
|
25 |
|
import org.xwiki.component.annotation.Component; |
26 |
|
import org.xwiki.component.annotation.InstantiationStrategy; |
27 |
|
import org.xwiki.component.descriptor.ComponentInstantiationStrategy; |
28 |
|
import org.xwiki.platform.wiki.creationjob.WikiCreationRequest; |
29 |
|
import org.xwiki.platform.wiki.creationjob.WikiCreationStep; |
30 |
|
import org.xwiki.platform.wiki.creationjob.WikiCreationException; |
31 |
|
import org.xwiki.wiki.user.WikiUserManager; |
32 |
|
import org.xwiki.wiki.user.WikiUserManagerException; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
40 |
|
@Component |
41 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
42 |
|
@Named("adduser") |
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
43 |
|
public class AddUsersStep implements WikiCreationStep |
44 |
|
{ |
45 |
|
@Inject |
46 |
|
private WikiUserManager wikiUserManager; |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
48 |
5 |
@Override... |
49 |
|
public void execute(WikiCreationRequest request) throws WikiCreationException |
50 |
|
{ |
51 |
5 |
try { |
52 |
5 |
String wikId = request.getWikiId(); |
53 |
5 |
if (request.getMembers() != null) { |
54 |
2 |
wikiUserManager.addMembers(request.getMembers(), wikId); |
55 |
|
} |
56 |
|
} catch (WikiUserManagerException e) { |
57 |
1 |
throw new WikiCreationException( |
58 |
|
String.format("Failed to add members to the wiki [%s].", request.getWikiId()), e); |
59 |
|
} |
60 |
|
} |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
62 |
10 |
@Override... |
63 |
|
public int getOrder() |
64 |
|
{ |
65 |
10 |
return 4000; |
66 |
|
} |
67 |
|
} |