Ejemplo n.º 1
0
 @POST
 @Path("/saveFileContent")
 @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
 public Response saveFileContent(
     @FormParam("fileID") long fileID, @FormParam("fileContent") String fileContent) {
   fileService.saveTextFileContent(fileID, fileContent);
   return Response.ok().build();
 }
Ejemplo n.º 2
0
 @POST
 @Path("/renameFile")
 @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
 public Response renameFile(
     @FormParam("fileID") long fileID, @FormParam("newName") String newName) {
   fileService.renameFile(fileID, newName);
   return Response.ok().build();
 }
Ejemplo n.º 3
0
 @GET
 @Path("/getFileContent/{fileID}")
 public Response getFileContent(@PathParam("fileID") long textFileID) {
   TextFileDTO textFile = fileService.getFullTextFile(textFileID);
   Object respObj =
       new FileResponseBuilderImpl(1L)
           .setStatus(ResponseBuilder.SUCCESS)
           .setDataObject(textFile)
           .buildResponse();
   return Response.ok(respObj).build();
 }
Ejemplo n.º 4
0
 @GET
 @Path("/getFile/{fileID}")
 public Response getFile(@PathParam("fileID") long fileID) {
   AbstractFileDTO file = fileService.getFileByID(fileID);
   Object respObj =
       new FileResponseBuilderImpl(1L)
           .setStatus(ResponseBuilder.SUCCESS)
           .setDataObject(file)
           .buildResponse();
   return Response.ok(respObj).build();
 }
Ejemplo n.º 5
0
  @POST
  @Path("/createFolder")
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  public Response createFolder(
      @FormParam("name") String name, @FormParam("parentID") long parentID) {
    FolderDTO newFolder = new FolderDTO();
    newFolder.setName(name);
    newFolder.setParentId(parentID);
    fileService.saveFile(newFolder);

    return Response.ok().build();
  }
Ejemplo n.º 6
0
 @GET
 @Path("/getFolderChildren/{folderID}/{start}/{end}")
 public Response getFolderChildren(
     @PathParam("folderID") long folderID,
     @PathParam("start") int start,
     @PathParam("end") int end) {
   List<AbstractFileDTO> children = fileService.getChildren(folderID, start, end);
   Object respObj =
       new FileResponseBuilderImpl(1L)
           .setStatus(ResponseBuilder.SUCCESS)
           .setDataObject(children)
           .buildResponse();
   return Response.ok(respObj).build();
 }
Ejemplo n.º 7
0
  @POST
  @Path("/createFile")
  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
  public Response createFile(
      @FormParam("fileName") String fileName,
      @FormParam("type") String type,
      @FormParam("parentID") long parentID) {
    TextFileDTO newFile = new TextFileDTO();
    newFile.setType(FileType.valueOf(type));
    newFile.setName(fileName);
    newFile.setParentId(parentID);

    fileService.saveFile(newFile);
    return Response.ok().build();
  }
Ejemplo n.º 8
0
 @GET
 @Path("/deleteFile/{fileID}")
 public Response deleteFile(@PathParam("fileID") long fileID) {
   fileService.deleteFile(fileID, false);
   return Response.ok().build();
 }