From cd48539db729d0036501c88c965a1daf381a504f Mon Sep 17 00:00:00 2001
From: Gonzalo Fabian Cameto Hernandez <gonzalo.cameto@fing.edu.uy>
Date: Thu, 9 Nov 2017 21:08:12 -0300
Subject: [PATCH] Eliminacion de comando copy utilizado en versiones anteriores

---
 .../src/app/shared/services/ghci.service.ts   |  7 ----
 .../java/edu/proygrado/ejb/CommandsBean.java  | 40 -------------------
 .../servicios/ghci/WebSocketEndpoint.java     |  4 +-
 3 files changed, 2 insertions(+), 49 deletions(-)

diff --git a/Frontend Angular 4/src/app/shared/services/ghci.service.ts b/Frontend Angular 4/src/app/shared/services/ghci.service.ts
index 79d7bcf..cdee02e 100644
--- a/Frontend Angular 4/src/app/shared/services/ghci.service.ts	
+++ b/Frontend Angular 4/src/app/shared/services/ghci.service.ts	
@@ -64,13 +64,6 @@ export class GHCIService {
 		};
 		this.connection.send(JSON.stringify(message));
 	}
-	copyFile(fileId){
-		var message = {
-			'token': this.authService.getToken(),
-			'copy': fileId
-		};
-		this.connection.send(JSON.stringify(message));
-	}
 	reiniciarInterprete(){
 		var message = {
 			'token': this.authService.getToken(),
diff --git a/Servidor JEE/src/main/java/edu/proygrado/ejb/CommandsBean.java b/Servidor JEE/src/main/java/edu/proygrado/ejb/CommandsBean.java
index 2a36840..ec59172 100644
--- a/Servidor JEE/src/main/java/edu/proygrado/ejb/CommandsBean.java	
+++ b/Servidor JEE/src/main/java/edu/proygrado/ejb/CommandsBean.java	
@@ -152,41 +152,6 @@ public class CommandsBean {
 				}
 			} else if (comandoJson.containsKey("restart")) {
 				restartProcess(this.cedula, token, session);
-			} else if (comandoJson.containsKey("copy")) {
-				int fileId = comandoJson.getInt("copy");
-				try {
-					ArchivoDTO archivo;
-					Usuario usuario = invitadoEJB.getUsuario(token);
-					if (usuario != null && usuario.getCedula().toLowerCase().equals("invitado")) {
-						archivo = invitadoEJB.getArchivo(token, fileId);
-					} else {
-						archivo = archivos.getArchivo(fileId);
-					}
-					String contenido = archivo.getContenido();
-					String fullPathMatefunTmp = context
-							.getRealPath("/WEB-INF/classes/edu/proygrado/binarios/MateFunTmp")+"/";
-					try {
-
-						File file;
-						if (usuario != null && usuario.getCedula().toLowerCase().equals("invitado")) {
-							file = new File(fullPathMatefunTmp + this.cedula + "_" + token + "/"
-									+ corregirNombreArchivo(archivo.getNombre()) + ".mf");
-						} else {
-							file = new File(fullPathMatefunTmp + this.cedula + "/"
-									+ corregirNombreArchivo(archivo.getNombre()) + ".mf");
-						}
-						file.getParentFile().mkdirs();
-						FileWriter writer = new FileWriter(file);
-						writer.write(contenido);
-						writer.close();
-						writer.flush();
-					} catch (IOException e) {
-						// do something
-						System.out.println(e.getMessage());
-					}
-				} catch (Exception ex) {
-					Logger.getLogger(CommandsBean.class.getName()).log(Level.SEVERE, null, ex);
-				}
 			}
 
 		} catch (Exception e) {
@@ -205,11 +170,6 @@ public class CommandsBean {
 		return nombreCorregido;
 	}
 
-	private ServletContext getContext() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
 	public void restartProcess(String cedula, String token, Session session) throws InterruptedException {
 		try {
 			this.callback = session;
diff --git a/Servidor JEE/src/main/java/edu/proygrado/servicios/ghci/WebSocketEndpoint.java b/Servidor JEE/src/main/java/edu/proygrado/servicios/ghci/WebSocketEndpoint.java
index 6da0d50..b8055ef 100644
--- a/Servidor JEE/src/main/java/edu/proygrado/servicios/ghci/WebSocketEndpoint.java	
+++ b/Servidor JEE/src/main/java/edu/proygrado/servicios/ghci/WebSocketEndpoint.java	
@@ -5,10 +5,8 @@
  */
 package edu.proygrado.servicios.ghci;
 
-import edu.proygrado.ejb.CommandsBean;
 import javax.ejb.EJB;
 import javax.ejb.Stateful;
-import javax.ejb.Stateless;
 import javax.json.Json;
 import javax.json.JsonObject;
 import javax.websocket.CloseReason;
@@ -20,6 +18,8 @@ import javax.websocket.Session;
 import javax.websocket.server.PathParam;
 import javax.websocket.server.ServerEndpoint;
 
+import edu.proygrado.ejb.CommandsBean;
+
 /**
  *
  * @author gonzalo
-- 
GitLab