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 | import org.jetbrains.annotations.NotNull; |
---|
12 | import org.springframework.beans.factory.annotation.Required; |
---|
13 | |
---|
14 | import java.util.HashMap; |
---|
15 | import java.util.Map; |
---|
16 | |
---|
17 | /** |
---|
18 | * @author vmipsl |
---|
19 | * @date 02 march 2012 |
---|
20 | */ |
---|
21 | public 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 | } |
---|