package innovimax.mixthem.rest;

import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.POST;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

@Path("/text")
@Consumes({MediaType.APPLICATION_FORM_URLENCODED})
@Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
public class TextApi  {

    @POST
    @Path("/add")
    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    public Response addFromText(
            @FormParam("text1") String text1, 
            @FormParam("text2") String text2) {
        //TODO
        return Response.status(Status.NOT_IMPLEMENTED).build();
    }

    @POST
    @Path("/alt-{type}")
    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    public Response altFromText(
            @PathParam("type") String type,
            @FormParam("text1") String text1,
            @FormParam("text2") String text2) {
        //TODO
        return Response.status(Status.NOT_IMPLEMENTED).build();
    }

    @POST
    @Path("/join")
    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    public Response joinFromText(
            @FormParam("text1") String text1, 
            @FormParam("text2") String text2, 
            @QueryParam("col1") Integer col1, 
            @QueryParam("col2") Integer col2) {
        //TODO
        return Response.status(Status.NOT_IMPLEMENTED).build();
    }

    @POST
    @Path("/random-alt")
    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    public Response randomAltFromText(
        @FormParam("text1") String text1,
        @FormParam("text2") String text2,
        @QueryParam("seed") Integer seed) {
        //TODO
        return Response.status(Status.NOT_IMPLEMENTED).build();
    }

    @POST
    @Path("/zip-{type}")
    @Consumes({MediaType.APPLICATION_FORM_URLENCODED})
    @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON})
    public Response zipFromText(
        @PathParam("type") String type,
        @FormParam("text1") String text1,
        @FormParam("text2") String text2,
        @QueryParam("sep") String sep) {
        //TODO
        return Response.status(Status.NOT_IMPLEMENTED).build();
    }
}

@@ -26,16 +26,124 @@
 .rest;%0A%0A
+import innovimax.mixthem.rest.services.ServiceFactory;%0Aimport innovimax.mixthem.rest.services.TextService;%0A%0A
 import j
@@ -597,16 +597,90 @@
 Api  %7B%0A%0A
+    private final TextService service = ServiceFactory.getTextService();%0A%0A
     @POS
@@ -948,38 +948,32 @@
 ext2) %7B%0A        
-//TODO
 %0A        return 
@@ -976,54 +976,40 @@
 urn 
-Response.status(Status.NOT_IMPLEMENTED).build(
+service.addFromText(text1, text2
 );%0A 
@@ -1342,33 +1342,24 @@
 xt2) %7B%0A     
-   //TODO
 %0A        ret
@@ -1366,54 +1366,46 @@
 urn 
-Response.status(Status.NOT_IMPLEMENTED).build(
+service.altFromText(type, text1, text2
 );%0A 
@@ -1432,20 +1432,26 @@
 @Path(%22/
-join
+random-alt
 %22)%0A    @
@@ -1590,12 +1590,17 @@
 nse 
-join
+randomAlt
 From
@@ -1597,36 +1597,32 @@
 domAltFromText(%0A
-    
         @FormPar
@@ -1642,35 +1642,33 @@
 tring text1,
- %0A 
+%0A
         
    @FormPara
@@ -1647,35 +1647,32 @@
  text1,%0A        
-   
 @FormParam(%22text
@@ -1688,29 +1688,25 @@
 g text2,
- %0A   
+%0A
         
  @QueryP
@@ -1689,33 +1689,32 @@
  text2,%0A        
- 
 @QueryParam(%22col
@@ -1714,59 +1714,12 @@
 am(%22
-col1%22) Integer col1, %0A            @QueryParam(%22col2
+seed
 %22) I
@@ -1729,12 +1729,12 @@
 ger 
-col2
+seed
 ) %7B%0A
@@ -1733,38 +1733,32 @@
 seed) %7B%0A        
-//TODO
 %0A        return 
@@ -1761,54 +1761,52 @@
 urn 
-Response.status(Status.NOT_IMPLEMENTED).build(
+service.randomAltFromText(text1, text2, seed
 );%0A 
@@ -1829,34 +1829,28 @@
     @Path(%22/
-random-alt
+join
 %22)%0A    @Cons
@@ -1977,33 +1977,28 @@
 ic Response 
-randomAlt
+join
 FromText(%0A  
@@ -1987,32 +1987,36 @@
 e joinFromText(%0A
+    
         @FormPar
@@ -2036,33 +2036,36 @@
 tring text1,
-%0A
+ %0A  
         
 @FormParam(%22
@@ -2044,32 +2044,34 @@
 xt1, %0A          
+  
 @FormParam(%22text
@@ -2079,33 +2079,38 @@
 %22) String text2,
-%0A
+ %0A    
         @QueryPa
@@ -2106,36 +2106,36 @@
    @QueryParam(%22
-seed
+col1
 %22) Integer seed)
@@ -2121,36 +2121,83 @@
 %22col1%22) Integer 
-seed
+col1, %0A            @QueryParam(%22col2%22) Integer col2
 ) %7B%0A        //TO
@@ -2184,38 +2184,32 @@
 col2) %7B%0A        
-//TODO
 %0A        return 
@@ -2212,54 +2212,53 @@
 urn 
-Response.status(Status.NOT_IMPLEMENTED).build(
+service.joinFromText(text1, text2, col1, col2
 );%0A 
@@ -2625,18 +2625,8 @@
     
-    //TODO
 %0A   
@@ -2641,54 +2641,51 @@
 urn 
-Response.status(Status.NOT_IMPLEMENTED).build(
+service.zipFromText(type, text1, text2, sep
 );%0A 

Update TextApi.java