1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.platform.wiki.creationjob.internal.steps

File AddUsersStep.java

 

Coverage histogram

../../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
6
2
1
67
37
4
0.67
3
2
2

Classes

Class Line # Actions
AddUsersStep 43 6 0% 4 0
1.0100%
 

Contributing tests

This file is covered by 3 tests. .

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.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    * Steps that add members to the wiki.
36    *
37    * @version $Id: 2ec95b66ec4dc41493c448c024732caca86d3d74 $
38    * @since 7.0M2
39    */
40    @Component
41    @InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP)
42    @Named("adduser")
 
43    public class AddUsersStep implements WikiCreationStep
44    {
45    @Inject
46    private WikiUserManager wikiUserManager;
47   
 
48  5 toggle @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   
 
62  10 toggle @Override
63    public int getOrder()
64    {
65  10 return 4000;
66    }
67    }