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