Changeset 384 for tapas/web/src/com/ether/Controller.java
- Timestamp:
- 03/01/12 15:39:49 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/web/src/com/ether/Controller.java
r382 r384 2 2 3 3 import com.ether.annotation.ControllerMethod; 4 import com.ether.annotation.Mandatory;5 import com.ether.annotation.ParamName;6 import net.sf.json.JSONObject;7 4 import org.apache.commons.logging.Log; 8 5 import org.apache.commons.logging.LogFactory; … … 11 8 12 9 import java.util.HashMap; 13 import java.util.List;14 10 import java.util.Map; 15 11 … … 23 19 /** *********************************************************** **/ 24 20 /** *********************** VIEWS ***************************** **/ 25 /** 26 * ********************************************************** * 27 */ 28 // Default view if url's methodName is unknown 29 @ControllerMethod(view = "init") 21 /** *********************************************************** **/ 22 @ControllerMethod(view = VIEW_INIT) 30 23 public Map<String, Object> home() 31 24 throws WebException … … 34 27 } 35 28 36 @ControllerMethod(view = VIEW_VISUALIZATION)37 public Map<String, Object> view()38 throws WebException39 {40 return new HashMap<String, Object>();41 }42 43 @ControllerMethod(view = VIEW_VISUALIZATION_PLATEFORM)44 public Map<String, Object> viewAllPlateforms()45 throws WebException46 {47 try48 {49 final List<Plateform> plateforms = _etherService.getAllPlateforms();50 51 final Map<String, Object> model = new HashMap<String, Object>();52 model.put( "plateforms", getJsonHelper().toJSON( plateforms ) );53 return model;54 }55 catch( ServiceException e )56 {57 throw new WebException( WebException.WebCode.PLATEFORM_NOT_FOUND, e );58 }59 }60 61 29 /** *********************************************************** **/ 62 30 /** *********************** CALLS ***************************** **/ 63 /** 64 * ********************************************************** * 65 */ 66 @ControllerMethod(jsonResult = true) 67 public JSONObject searchParametersByPlateform( @Mandatory @ParamName(ParameterConstants.PARAMETER_ID) final Integer plateformId ) 68 throws WebException 69 { 70 try 71 { 31 /** *********************************************************** **/ 72 32 73 // final List<Parameter> parameters = new ArrayList<Parameter>( 3 );74 // parameters.add( new Parameter( Long.valueOf( 1 ), "parameter1" ) );75 // parameters.add( new Parameter( Long.valueOf( 2 ), "parameter2" ) );76 // parameters.add( new Parameter( Long.valueOf( 3 ), "parameter3" ) );77 33 78 final List<Parameter> parameters = _etherService.getAllParametersByPlateformId( plateformId );79 final JSONObject result = new JSONObject();80 result.put( "parameters", getJsonHelper().toJSON( parameters ) );81 return result;82 }83 catch( ServiceException e )84 {85 throw new WebException( WebException.WebCode.PARAMETER_NOT_FOUND, e );86 }87 }88 34 89 35 @Required 90 public void set EtherService( @NotNull final EtherService etherService )36 public void setTapasService( @NotNull final TapasService tapasService ) 91 37 { 92 _ etherService = etherService;38 _tapasService = tapasService; 93 39 } 94 40 95 41 private static final Log LOGGER = LogFactory.getLog( Controller.class ); 96 42 97 private static final String VIEW_VISUALIZATION = "visualization/visu"; 98 private static final String VIEW_VISUALIZATION_PLATEFORM = "visualization/visu_plateform"; 43 private static final String VIEW_INIT = "init"; 99 44 100 private EtherService _etherService;45 private TapasService _tapasService; 101 46 }
Note: See TracChangeset
for help on using the changeset viewer.