Sha256: 6553a2fbaf8f584e1abe92e17b6302a25959a81bef84701228e830beb1017e12

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

package <%= controllers_base_package %>;

<% if action_map.values.member? :get_all -%>
import java.util.List;
<% end -%>

import javax.ws.rs.*;

import org.fusesource.restygwt.client.*;

<% if name -%>
import <%= models_base_package %>.*;
<% end -%>

@Path("/<%= table_name %><%= options[:singleton] ? '.json' : '' %>")
public interface <%= controller_class_name %>Controller extends RestService {

<% actions.each do |action| 
     case action_map[action]
     when :get_all -%>
  @GET @Path("/<%= table_name %>.json")
  void <%= action %>(MethodCallback<List<<%= class_name %>>> callback);

//  @GET @Path("/<%= table_name %>.json")
//  void <%= action %>(MethodCallback<List<<%= class_name %>>> callback, @QueryParam("limit") int limit, @QueryParam("offset") int offset);
//
<%   when :get_single -%>
  @GET<% unless options[:singleton] -%> @Path("/<%= table_name %>/{id}.json")<% end %>
  void <%= action %>(<% unless options[:singleton] -%>@PathParam("id") int id, <% end -%>MethodCallback<<%= class_name %>> callback);

<%   when :post -%>
  @POST @Path("/<%= table_name %>.json")
  void <%= action %>(<%= class_name %> value, MethodCallback<<%= class_name %>> callback);

<%   when :put -%>
  @PUT<% unless options[:singleton] -%> @Path("/<%= table_name %>/{id}.json")<% end %>
  void <%= action %>(<% unless options[:singleton] -%>@PathParam("id") @Attribute("id") <% end -%><%= class_name %> value, MethodCallback<<%= class_name %>> callback);

<%   when :delete -%>
  @DELETE @Path("/<%= table_name %>/{id}.json")
  void <%= action %>(@PathParam("id") @Attribute("id") <%= class_name %> value, MethodCallback<Void> callback);

<%   else -%>
  @GET @Path("/<%= table_name %>/<%= action %>.json")
  void <%= action %>(MethodCallback<Void> callback);

<% end
end -%>
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resty-generators-0.2.0 lib/generators/resty/templates/Controller.java