forked from uPortal-Project/esup-filemanager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue uPortal-Project#19 : Enhancement to upload an existing file
This PR add the possibility to configure the portlet behaviour when uploading an existing file by adding a portlet preference property. It's a first step before developping an UI to let the choice of the user when the problem appear. This PR is more a first step but let the possibility to define a default behaviour for this problem, as the default configuration override all existing files (expect in sardine implementation). So next steps are/could be : - The method putFile for the cmisService must be modified to work with this enhancement. - Give the possibility to a user to change his default behaviour by editing portlet preferences. - wait or implements the UI evolution, referenced here : Valums-File-Uploader/file-uploader#40
- Loading branch information
1 parent
b33be54
commit d118b89
Showing
14 changed files
with
1,958 additions
and
1,771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/org/esupportail/portlet/filemanager/beans/UploadActionType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Licensed to EsupPortail under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
* | ||
* EsupPortail licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.esupportail.portlet.filemanager.beans; | ||
|
||
public enum UploadActionType { | ||
|
||
/** To override the same filename. */ | ||
OVERRIDE(0), | ||
/** To automatically rename the file uploaded. */ | ||
RENAME_NEW(1), | ||
/** To rautomatically ename the file already on the server before upload. */ | ||
RENAME_OLD(2), | ||
/** To throw an "existingFileException" and return success=false with a specific message and to manage in the UI with user action. */ | ||
ERROR(3); | ||
|
||
/** Int value of the action type*/ | ||
private int code; | ||
|
||
/** | ||
* Contructor of the object UploadActionType.java. | ||
* @param code an int | ||
*/ | ||
private UploadActionType(final int code) { | ||
this.code = code; | ||
} | ||
|
||
/** | ||
* Contructor of the object UploadActionType.java. | ||
* @param code a String | ||
*/ | ||
private UploadActionType(final String code) { | ||
this.code = Integer.parseInt(code); | ||
} | ||
|
||
/** | ||
* Getter of member code. | ||
* @return <code>int</code> the attribute code | ||
*/ | ||
public int getCode() { | ||
return code; | ||
} | ||
|
||
/** | ||
* Setter of attribute code. | ||
* @param code the attribute code to set | ||
*/ | ||
public void setCode(final int code) { | ||
this.code = code; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...main/java/org/esupportail/portlet/filemanager/exceptions/EsupStockFileExistException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Licensed to EsupPortail under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
* | ||
* EsupPortail licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.esupportail.portlet.filemanager.exceptions; | ||
|
||
public class EsupStockFileExistException extends EsupStockException { | ||
|
||
private static final long serialVersionUID = 1709146807320625731L; | ||
|
||
public EsupStockFileExistException() { | ||
super("File already exist and overriding file is forbidden !"); | ||
} | ||
|
||
} |
Oops, something went wrong.