1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.security.authorization.testwikis.internal.entities

File DefaultTestDocument.java

 

Coverage histogram

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

Code metrics

2
7
5
1
88
42
6
0.86
1.4
5
1.2

Classes

Class Line # Actions
DefaultTestDocument 37 7 0% 6 0
1.0100%
 

Contributing tests

This file is covered by 13 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   
21    package org.xwiki.security.authorization.testwikis.internal.entities;
22   
23    import org.xwiki.model.EntityType;
24    import org.xwiki.model.reference.DocumentReference;
25    import org.xwiki.model.reference.EntityReference;
26    import org.xwiki.model.reference.SpaceReference;
27    import org.xwiki.security.authorization.testwikis.TestDocument;
28    import org.xwiki.security.authorization.testwikis.TestEntity;
29    import org.xwiki.security.authorization.testwikis.internal.parser.XWikiConstants;
30   
31    /**
32    * Entity representing documents.
33    *
34    * @version $Id: 8ac335eb50c23db36263108a34480b5895c1b9ac $
35    * @since 5.0M2
36    */
 
37    public class DefaultTestDocument extends AbstractSecureTestEntity implements TestDocument
38    {
39    /** The type of reference used by this class. */
40    public static final EntityType TYPE = EntityType.DOCUMENT;
41   
42    /** The alternate description of this entity. */
43    private final String description;
44   
45    /** The creator of this document. */
46    private final DocumentReference creator;
47   
48    /**
49    * Create a new document entity.
50    * @param reference reference of document represented by this entity.
51    * @param creator creator of this document.
52    * @param description alternate description of this entity.
53    * @param parent parent entity of this entity.
54    */
 
55  155 toggle public DefaultTestDocument(EntityReference reference, EntityReference creator, String description,
56    TestEntity parent) {
57  155 super(reference, parent);
58   
59  155 this.creator = (creator != null) ? new DocumentReference(creator) :
60    new DocumentReference(XWikiConstants.SUPERADMIN, new SpaceReference(XWikiConstants.XWIKI_SPACE,
61    getDocumentReference().getWikiReference()));
62  155 this.description = description;
63    }
64   
 
65  96 toggle @Override
66    public EntityType getType()
67    {
68  96 return TYPE;
69    }
70   
 
71  86 toggle @Override
72    public DocumentReference getDocumentReference()
73    {
74  86 return new DocumentReference(getReference());
75    }
76   
 
77  300 toggle @Override
78    public DocumentReference getCreator()
79    {
80  300 return creator;
81    }
82   
 
83  1 toggle @Override
84    public String getDescription()
85    {
86  1 return description;
87    }
88    }