Changeset 440 for tapas/web/src


Ignore:
Timestamp:
03/26/12 17:00:15 (12 years ago)
Author:
rboipsl
Message:

ajout anotations
usermandatory

Location:
tapas/web/src/com/ether
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tapas/web/src/com/ether/Controller.java

    r420 r440  
    77import com.ether.tapas.Observatory; 
    88import com.ether.tapas.Tapas; 
     9import com.ether.user.User; 
    910import com.ether.user.UserRole; 
    1011import net.sf.json.JSONObject; 
    1112import org.apache.commons.logging.Log; 
    1213import org.apache.commons.logging.LogFactory; 
     14import org.jetbrains.annotations.NotNull; 
    1315 
    1416import java.util.ArrayList; 
     
    3335            throws WebException 
    3436    { 
    35  
    3637        try 
    3738        { 
     
    5859    /** *********************** CALLS ***************************** **/ 
    5960    /** *********************************************************** **/ 
    60     @ControllerMethod(jsonResult = true) 
    61     public JSONObject createUserRequest( @ParamName("jsonTapas") @Mandatory @UseJSON final Tapas javaTapas ) 
     61    @ControllerMethod(jsonResult = true, userMandatory = true) 
     62    public JSONObject createUserRequest( @ParamName("jsonTapas") @Mandatory @UseJSON final Tapas javaTapas, @NotNull final User user ) // TODO rajouter parametre USER 
    6263            throws WebException 
    6364    { 
     
    6566            throw new WebException( WebException.WebCode.ERROR_JSON_TAPAS_IS_NULL, "Serialization error : jsonTapas is null", WebException.getExceptionThrowable() ); 
    6667 
     68        //TODO recuperer le USER via ControllerEther 
     69 
    6770        //appel a createxml 
    68         getTapasService().createXMLRequest( javaTapas ); 
     71        getTapasService().createXMLRequest( javaTapas ); // en 2ieme parametre 
     72 
     73        //appel a runtime 
     74        //mettre une methode dans tapas service pour appel au shell system 
     75 
    6976 
    7077        final JSONObject result = new JSONObject(); 
  • tapas/web/src/com/ether/ControllerEther.java

    r423 r440  
    120120            final String defaultView = ( null != methodDescription.getDefaultView() && !"".equals( methodDescription.getDefaultView() ) ) ? methodDescription.getDefaultView() : methodDescription.getView(); 
    121121 
     122 
    122123            if( methodDescription.isRequestMandatory() ) 
    123                 params[params.length - 1] = request; 
     124                params[params.length - 1] = request; //params = parametre de la methode du Controller 
     125 
    124126 
    125127            if( methodDescription.isLoginMandatory() ) 
     
    128130                if( null == user ) 
    129131                    return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 
     132            } 
     133 
     134            if (methodDescription.isUserMandatory()) { 
     135                final User user = (User) request.getSession().getAttribute( "SES_USER" ); 
     136 
     137                if( null == user ) 
     138                    return new ModelAndView( defaultView, "errors", "login.error.unknown" ); 
     139                else 
     140                    params[params.length - 1] = user; 
     141 
    130142            } 
    131143 
Note: See TracChangeset for help on using the changeset viewer.