Coverage Report - org.jtheque.primary.utils.web.analyzers.generic.field.AbstractFieldGetterFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractFieldGetterFactory
0 %
0/13
0 %
0/8
3
 
 1  
 package org.jtheque.primary.utils.web.analyzers.generic.field;
 2  
 
 3  
 import org.jdom.Element;
 4  
 import org.jtheque.core.utils.file.XMLException;
 5  
 import org.jtheque.core.utils.file.XMLReader;
 6  
 import org.jtheque.primary.utils.web.analyzers.generic.Factory;
 7  
 import org.jtheque.primary.utils.web.analyzers.generic.field.SimpleFieldGetterFactory.SimpleFieldGetter;
 8  
 import org.jtheque.primary.utils.web.analyzers.generic.operation.Operation;
 9  
 import org.jtheque.primary.utils.web.analyzers.generic.operation.OperationFactory;
 10  
 import org.jtheque.primary.utils.web.analyzers.generic.transform.Transformer;
 11  
 import org.jtheque.primary.utils.web.analyzers.generic.transform.TransformerFactory;
 12  
 
 13  
 /*
 14  
  * This file is part of JTheque.
 15  
  *            
 16  
  * JTheque is free software: you can redistribute it and/or modify
 17  
  * it under the terms of the GNU General Public License as published by
 18  
  * the Free Software Foundation, either version 3 of the License. 
 19  
  *
 20  
  * JTheque is distributed in the hope that it will be useful,
 21  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 22  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 23  
  * GNU General Public License for more details.
 24  
  *
 25  
  * You should have received a copy of the GNU General Public License
 26  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 27  
  */
 28  
 
 29  
 /**
 30  
  * @author Baptiste Wicht
 31  
  */
 32  0
 public abstract class AbstractFieldGetterFactory implements Factory<FieldGetter> {
 33  
         /**
 34  
          * Init the operations of a Field Getter.
 35  
          *
 36  
          * @param getter The field getter.
 37  
          * @param node The node in which we search for operations.
 38  
          * @param reader The XML Reader
 39  
          *
 40  
          * @throws XMLException If an errors occurs during the parse of the XML Elements.
 41  
          */
 42  
         static void initOperations(SimpleFieldGetter getter, Object node, XMLReader reader) throws XMLException{
 43  0
                 for (Element n : reader.getNodes("operations/*", node)){
 44  0
                         Operation operation = OperationFactory.getValueGetter(n, reader);
 45  
 
 46  0
                         if (operation != null){
 47  0
                                 getter.addOperation(operation);
 48  
                         }
 49  0
                 }
 50  0
         }
 51  
 
 52  
         /**
 53  
          * Init the transformers of a field getter.
 54  
          *
 55  
          * @param getter The getter to fill.
 56  
          * @param currentNode The node of the getter.
 57  
          * @param reader The XML Reader
 58  
          *
 59  
          * @throws XMLException Thrown if an errors occurs during the xml reading process.
 60  
          */
 61  
         static void initTransformers(SimpleFieldGetter getter, Object currentNode, XMLReader reader) throws XMLException{
 62  0
                 for (Element n : reader.getNodes("transformers/*", currentNode)){
 63  0
                         Transformer transformer = TransformerFactory.getTransformer(n, reader);
 64  
 
 65  0
                         if (transformer != null){
 66  0
                                 getter.addTransformer(transformer);
 67  
                         }
 68  0
                 }
 69  0
         }
 70  
 }