Removing commented code regarding Overwrite facility
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@171879 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9fc9888335
commit
b4adb4d065
|
@ -115,9 +115,6 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
put("gtar","application/x-gtar");
|
||||
}};
|
||||
|
||||
// public static final String D4ST = Extensions.REPORT_TEMPLATE.getName(); //extension of Report Template type
|
||||
// public static final String D4SR = Extensions.REPORT.getName(); //extension of Report type
|
||||
|
||||
public static Logger logger = LoggerFactory.getLogger(WorkspaceUploadServletStream.class);
|
||||
|
||||
private static boolean appEngine = false;
|
||||
|
@ -370,16 +367,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
logger.debug("key :"+key+", value: "+value);
|
||||
keyFiles.put(key, value);
|
||||
}
|
||||
/*
|
||||
JSONObject object = jsonArray.getJSONObject(0);
|
||||
Iterator it = object.keys();
|
||||
while(it.hasNext()){
|
||||
String key = (String) it.next();
|
||||
String value = object.getString(key);
|
||||
logger.debug("key :"+key+", value: "+value);
|
||||
keyFiles.put((String) key, value);
|
||||
}
|
||||
*/
|
||||
|
||||
} catch (JSONException e) {
|
||||
logger.error("An error occurred during parsing file names: "+keyFiles, e);
|
||||
throw new FileUploadException("An error occurred during parsing file names");
|
||||
|
@ -497,44 +485,10 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
Long size = getContentLength(request);
|
||||
logger.debug("size: " + size + " bytes");
|
||||
|
||||
/*if(!isOverwrite){
|
||||
itemName = WorkspaceUtil.getUniqueName(fileName, destinationFolder);
|
||||
}
|
||||
else{
|
||||
logger.debug("Validating overwrite checking if file with name: "+fileName+" exists into folder ID: "+destinationFolder.getId());
|
||||
boolean isReallyExisting = wa.exists(fileName, destinationFolder.getId());
|
||||
logger.debug("Existing it? "+isReallyExisting);
|
||||
if(isReallyExisting){
|
||||
logger.info("forcing overwrite at 'true' in order to create new version of file: "+fileName);
|
||||
isOverwrite = true;
|
||||
itemName = fileName;
|
||||
}else{
|
||||
itemName = WorkspaceUtil.getUniqueName(fileName, destinationFolder);
|
||||
logger.debug("File with name: "+fileName+" does not exist creating new one: "+fileName);
|
||||
logger.info("forcing overwrite at 'false' in order to create the new file: "+fileName);
|
||||
isOverwrite = false;
|
||||
itemName = fileName;
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
String contentType = uploadItem.getContentType();
|
||||
logger.debug("Content type (mime type): "+contentType + " unique name: "+itemName);
|
||||
|
||||
if(contentType==null || contentType.compareTo(UNKNOWN_UNKNOWN)==0){
|
||||
logger.warn("Content Type not detected forcing to null");
|
||||
contentType = null;
|
||||
}
|
||||
*/
|
||||
|
||||
//CONFIRM DESTINATION FOLDER
|
||||
workspaceUploader.getFile().setParentId(destinationFolder.getId());
|
||||
|
||||
// tmpFile = coyStreamToFile(uploadItem.openStream(), extension);
|
||||
// fis = new FileInputStream(tmpFile);
|
||||
// bis = new BufferedInputStream(fis);
|
||||
|
||||
//instanciate the progress listener
|
||||
//Instancing the progress listener
|
||||
final AbstractUploadProgressListener uploadProgressListener = createNewListener(request.getSession(), clientUploadKey);
|
||||
final UploadProgressInputStream inputStream = new UploadProgressInputStream(uploadItem.openStream(), size);
|
||||
inputStream.addListener(uploadProgressListener);
|
||||
|
@ -791,47 +745,6 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
}.start();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Overwrite item.
|
||||
// *
|
||||
// * @param wa the wa
|
||||
// * @param itemName the item name
|
||||
// * @param fileData the file data
|
||||
// * @param destinationFolder the destination folder
|
||||
// * @return the folder item
|
||||
// */
|
||||
// private FileItem overwriteItem(Workspace wa, String itemName, InputStream fileData, WorkspaceFolder destinationFolder){
|
||||
//
|
||||
// FileItem overwriteItem = null;
|
||||
//
|
||||
// try {
|
||||
// logger.debug("case overwriting item.. "+itemName);
|
||||
// overwriteItem = (FileItem) wa.find(itemName, destinationFolder.getId());
|
||||
// logger.debug("overwriteItem item was found, id is: "+overwriteItem.getId());
|
||||
// wa.upl(overwriteItem.getId(), fileData);
|
||||
// logger.debug("updateItem with id: "+overwriteItem.getId()+ ", is completed");
|
||||
// } catch (ItemNotFoundException e) {
|
||||
// logger.error("Error in createExternalFile, ItemNotFoundException", e);
|
||||
// } catch (WrongItemTypeException e) {
|
||||
// logger.error("Error in createExternalFile, WrongItemTypeException", e);
|
||||
// } catch (WorkspaceFolderNotFoundException e) {
|
||||
// logger.error("Error in createExternalFile, WorkspaceFolderNotFoundException", e);
|
||||
// } catch (WrongDestinationException e) {
|
||||
// logger.error("Error in createExternalFile, WrongDestinationException", e);
|
||||
// } catch (InsufficientPrivilegesException e) {
|
||||
// logger.error("Error in createExternalFile, InsufficientPrivilegesException", e);
|
||||
// } catch (ItemAlreadyExistException e) {
|
||||
// logger.error("Error in createExternalFile, ItemAlreadyExistException", e);
|
||||
// } catch (InternalErrorException e) {
|
||||
// logger.error("Error in createExternalFile, InternalErrorException", e);
|
||||
// }catch (Exception e) {
|
||||
// logger.error("Error in createExternalFile, Exception", e);
|
||||
// }
|
||||
//
|
||||
// return overwriteItem;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Send error.
|
||||
*
|
||||
|
@ -857,7 +770,6 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Send session expired.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue