Clover Coverage Report - ARESTC 0.1.7-SNAPSHOT
Coverage timestamp: Fri Aug 27 2010 19:12:04 CEST
../../../../img/srcFileCovDistChart7.png 67% of files have more coverage
8   81   4   2.67
2   31   0.5   3
3     1.33  
1    
 
  TransformToServiceCall       Line # 28 8 0% 4 5 61.5% 0.61538464
 
  (15)
 
1    /*
2    *
3    * (C)opyright 2010, Nikolaos Georgosopoulos
4    *
5    * This file is part of ARESTC.
6    *
7    * ARESTC is free software: you can redistribute it and/or modify it under the
8    * terms of the Lesser General Public License as published by the Free Software
9    * Foundation, either version 3 of the License, or (at your option) any later
10    * version.
11    *
12    * ARESTC is distributed in the hope that it will be useful, but WITHOUT ANY
13    * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14    * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15    *
16    * You should have received a copy of the Lesser General Public License along
17    * with ARESTC. If not, see <http://www.gnu.org/licenses/>.
18    */
19    package net.sf.arestc.core;
20   
21    import net.sf.arestc.core.services.HTTPMethods;
22    import net.sf.arestc.core.validations.RequestValidator;
23   
24    // TODO: Auto-generated Javadoc
25    /**
26    * The Class TransformToServiceCall.
27    */
 
28    public class TransformToServiceCall extends BaseCommand {
29    /** The validator. */
30    protected final RequestValidator validator;
31   
32    /** The transformer. */
33    protected final RequestTransformer transformer;
34   
35    /**
36    * Instantiates a new transform to service call.
37    *
38    * @param method
39    * the method
40    */
 
41  17 toggle public TransformToServiceCall(final HTTPMethods method) {
42  17 validator = new RequestValidator();
43  17 transformer = RequestTransformerFactory.instance.getTransformer(method,
44    this);
45    }
46   
47    /**
48    * Gets the validator.
49    *
50    * @return the validator
51    */
 
52  0 toggle public RequestValidator getValidator() {
53  0 return validator;
54    }
55   
56    /*
57    * (non-Javadoc)
58    *
59    * @see
60    * net.sf.arestc.core.BaseCommand#process(net.sf.arestc.core.ConnectorRequest
61    * , net.sf.arestc.core.ConnectorContext)
62    */
 
63  10 toggle @Override
64    public ConnectorContext process(final ConnectorRequest request,
65    final ConnectorContext context) throws CommandException {
66   
67  10 if (validator.isValidRequest(request.getParameters(),
68    request.getCredentials(), context.getService())) {
69  10 transformer.transform(request, context);
70    } else {
71  0 context.add(new BaseError(
72    -1,
73    this,
74    "Validation failed, look for configuration discrepancies with the actual runtime feeds",
75    null));
76  0 return context;
77    }
78   
79  10 return super.process(request, context);
80    }
81    }