1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.component.wiki.internal

File AbstractAsyncBaseObjectWikiComponent.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
41% of files have more coverage

Code metrics

2
5
1
1
72
23
2
0.4
5
1
2

Classes

Class Line # Actions
AbstractAsyncBaseObjectWikiComponent 35 5 0% 2 1
0.87587.5%
 

Contributing tests

This file is covered by 16 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.component.wiki.internal;
21   
22    import java.lang.reflect.Type;
23    import java.util.HashSet;
24    import java.util.List;
25    import java.util.Set;
26   
27    import com.xpn.xwiki.objects.BaseObject;
28   
29    /**
30    * Base class helper to implement xobject based asynchronous wiki component.
31    *
32    * @version $Id: f4b319181c2cab04f029fb671f0a82e1fe12660a $
33    * @since 10.10RC1
34    */
 
35    public abstract class AbstractAsyncBaseObjectWikiComponent extends AbstractBaseObjectWikiComponent
36    {
37    /**
38    * Indicate if the asynchronous execution is allowed for this extension.
39    */
40    public static final String XPROPERTY_ASYNC_ENABLED = "async_enabled";
41   
42    /**
43    * Indicate if caching is allowed for this UI extension.
44    */
45    public static final String XPROPERTY_ASYNC_CACHED = "async_cached";
46   
47    /**
48    * Indicate the list of context elements required by the UI extension execution.
49    */
50    public static final String XPROPERTY_ASYNC_CONTEXT = "async_context";
51   
52    protected final boolean async;
53   
54    protected final boolean cached;
55   
56    protected final Set<String> contextEntries;
57   
58    /**
59    * @param baseObject the object containing the component definition
60    * @param roleType the role Type implemented
61    * @param roleHint the role hint for this role implementation
62    */
 
63  6330 toggle public AbstractAsyncBaseObjectWikiComponent(BaseObject baseObject, Type roleType, String roleHint)
64    {
65  6330 super(baseObject, roleType, roleHint);
66   
67  6330 this.async = baseObject.getIntValue(XPROPERTY_ASYNC_ENABLED, 0) == 1;
68  6330 this.cached = baseObject.getIntValue(XPROPERTY_ASYNC_CACHED, 0) == 1;
69  6330 List<String> contextEntriesList = baseObject.getListValue(XPROPERTY_ASYNC_CONTEXT);
70  6330 this.contextEntries = contextEntriesList != null ? new HashSet<>(contextEntriesList) : null;
71    }
72    }