source: tapas/web/src/com/ether/Controller.java @ 411

Last change on this file since 411 was 411, checked in by rboipsl, 12 years ago

creation 1 form xml

File size: 2.1 KB
Line 
1package com.ether;
2
3import com.ether.annotation.ControllerMethod;
4import com.ether.annotation.Mandatory;
5import com.ether.annotation.ParamName;
6import com.ether.annotation.UseJSON;
7import com.ether.tapas.Tapas;
8import net.sf.json.JSONObject;
9import org.apache.commons.logging.Log;
10import org.apache.commons.logging.LogFactory;
11import org.jetbrains.annotations.NotNull;
12import org.springframework.beans.factory.annotation.Required;
13
14import java.util.HashMap;
15import java.util.Map;
16
17/**
18 * @author vmipsl
19 * @date 02 march 2012
20 */
21public class Controller
22        extends ControllerEther
23{
24
25    /** *********************************************************** **/
26    /** *********************** VIEWS ***************************** **/
27    /** *********************************************************** **/
28    @ControllerMethod(view = VIEW_INIT)public Map<String, Object> home()
29            throws WebException
30    {
31        return new HashMap<String, Object>();
32    }
33
34    @ControllerMethod(view = VIEW_FORM_TAPAS)
35    public Map<String, Object> viewForm()
36            throws WebException{
37        return new HashMap<String, Object>();
38    }
39
40    /** *********************************************************** **/
41    /** *********************** CALLS ***************************** **/
42    /** *********************************************************** **/
43    @ControllerMethod(jsonResult = true)
44    public JSONObject createUserRequest( @ParamName("jsonTapas") @Mandatory @UseJSON final Tapas javaTapas )
45            throws WebException
46    {
47        if( null == javaTapas )
48            throw new WebException( WebException.WebCode.ERROR_JSON_TAPAS_IS_NULL, "Serialization error : jsonTapas is null", WebException.getExceptionThrowable() );
49
50        //appel a createxml
51        getTapasService().createXMLRequest( javaTapas );
52
53        final JSONObject result = new JSONObject();
54        result.put( "result", "SUCCESS" );
55        return result;
56    }
57
58    private static final Log LOGGER = LogFactory.getLog( Controller.class );
59
60    private static final String VIEW_INIT = "init";
61    private static final String VIEW_FORM_TAPAS = "project/formTapas";
62}
Note: See TracBrowser for help on using the repository browser.