1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.annotation.rest.internal.representations

File FormUrlEncodedAnnotationUpdateRequestReader.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart3.png
80% of files have more coverage

Code metrics

0
6
2
1
68
35
2
0.33
3
2
1

Classes

Class Line # Actions
FormUrlEncodedAnnotationUpdateRequestReader 47 6 0% 2 6
0.2525%
 

Contributing tests

No tests hitting this source file were found.

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.annotation.rest.internal.representations;
21   
22    import java.lang.annotation.Annotation;
23    import java.lang.reflect.Type;
24   
25    import javax.inject.Named;
26    import javax.inject.Singleton;
27    import javax.ws.rs.Consumes;
28    import javax.ws.rs.core.MediaType;
29    import javax.ws.rs.ext.Provider;
30   
31    import org.xwiki.annotation.rest.model.jaxb.AnnotationRequest;
32    import org.xwiki.annotation.rest.model.jaxb.AnnotationUpdateRequest;
33    import org.xwiki.annotation.rest.model.jaxb.ObjectFactory;
34    import org.xwiki.component.annotation.Component;
35   
36    /**
37    * Implementation of the form url encoded reader for the annotation update requests.
38    *
39    * @version $Id: 28f1035f2f0e28737bbba18d6cf2bb804255a8f1 $
40    * @since 2.3M1
41    */
42    @Component
43    @Named("org.xwiki.annotation.rest.internal.representations.FormUrlEncodedAnnotationUpdateRequestReader")
44    @Provider
45    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
46    @Singleton
 
47    public class FormUrlEncodedAnnotationUpdateRequestReader extends
48    AbstractFormUrlEncodedAnnotationUpdateRequestReader<AnnotationUpdateRequest>
49    {
 
50  0 toggle @Override
51    protected AnnotationUpdateRequest getReadObjectInstance(ObjectFactory factory)
52    {
53  0 AnnotationUpdateRequest updateRequest = factory.createAnnotationUpdateRequest();
54  0 updateRequest.setRequest(new AnnotationRequest.Request());
55  0 updateRequest.setFilter(factory.createAnnotationFieldCollection());
56  0 updateRequest.setAnnotation(factory.createAnnotationFieldCollection());
57   
58  0 return updateRequest;
59    }
60   
 
61  8 toggle @Override
62    public boolean isReadable(Class< ? > type, Type genericType, Annotation[] annotations, MediaType mediaType)
63    {
64    // this reader will only read annotationAddRequests, and none of the superclasses. Superclasses will read
65    // themselves
66  8 return type.equals(AnnotationUpdateRequest.class);
67    }
68    }