1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package com.xpn.xwiki.internal.objects.classes

File DefaultDBListQueryBuilder.java

 

Coverage histogram

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

Code metrics

2
3
1
1
61
30
2
0.67
3
1
2

Classes

Class Line # Actions
DefaultDBListQueryBuilder 42 3 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 1 test. .

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 com.xpn.xwiki.internal.objects.classes;
21   
22    import javax.inject.Inject;
23    import javax.inject.Named;
24    import javax.inject.Singleton;
25   
26    import org.xwiki.component.annotation.Component;
27    import org.xwiki.query.Query;
28    import org.xwiki.query.QueryBuilder;
29    import org.xwiki.query.QueryException;
30    import org.xwiki.text.StringUtils;
31   
32    import com.xpn.xwiki.objects.classes.DBListClass;
33   
34    /**
35    * Builds a query that returns the values allowed for a Database List property.
36    *
37    * @version $Id: da2d6e775f991dc6af3fd205e6b34c9c44c30b4c $
38    * @since 9.8RC1
39    */
40    @Component
41    @Singleton
 
42    public class DefaultDBListQueryBuilder implements QueryBuilder<DBListClass>
43    {
44    @Inject
45    @Named("explicitlyAllowedValues")
46    private QueryBuilder<DBListClass> explicitlyAllowedValuesQueryBuilder;
47   
48    @Inject
49    @Named("implicitlyAllowedValues")
50    private QueryBuilder<DBListClass> implicitlyAllowedValuesQueryBuilder;
51   
 
52  144 toggle @Override
53    public Query build(DBListClass dbListClass) throws QueryException
54    {
55  144 if (StringUtils.isEmpty(dbListClass.getSql())) {
56  59 return this.implicitlyAllowedValuesQueryBuilder.build(dbListClass);
57    } else {
58  85 return this.explicitlyAllowedValuesQueryBuilder.build(dbListClass);
59    }
60    }
61    }