Bug fixed
Signed-off-by: asharani-murugesh <asharani.murugesh@in.bosch.com>
This commit is contained in:
@@ -89,7 +89,6 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
@Override
|
||||
public final OutputStream getOutputStream() {
|
||||
try {
|
||||
view.getDuplicateFileNamesList().clear();
|
||||
return view.saveUploadedFileDetails(fileName, fileSize, mimeType);
|
||||
} catch (final ArtifactUploadFailedException e) {
|
||||
LOG.error("Atifact upload failed {} ", e);
|
||||
@@ -109,7 +108,6 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
public OutputStream receiveUpload(final String fileName, final String mimeType) {
|
||||
this.fileName = fileName;
|
||||
this.mimeType = mimeType;
|
||||
view.getDuplicateFileNamesList().clear();
|
||||
try {
|
||||
if (view.validate()) {
|
||||
if (view.checkForDuplicate(fileName)) {
|
||||
@@ -169,7 +167,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
view.updateActionCount();
|
||||
|
||||
// display the duplicate message after streaming all files
|
||||
view.displayValidationMessage();
|
||||
view.displayDuplicateValidationMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,7 +292,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
if (view.enableProcessBtn()) {
|
||||
infoWindow.uploadSessionFinished();
|
||||
}
|
||||
view.displayValidationMessage();
|
||||
view.displayDuplicateValidationMessage();
|
||||
|
||||
LOG.info("Streaming failed due to :{}", event.getException());
|
||||
}
|
||||
@@ -318,7 +316,6 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
||||
}
|
||||
view.updateActionCount();
|
||||
infoWindow.uploadFailed(event.getFilename(), failureReason);
|
||||
|
||||
LOG.info("Upload failed for file :{}", event.getReason());
|
||||
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ import com.vaadin.ui.VerticalLayout;
|
||||
/**
|
||||
* Upload files layout.
|
||||
*
|
||||
* @author G Venkata Narayana (RBEI/BSO3)
|
||||
*
|
||||
*/
|
||||
@ViewScope
|
||||
@SpringComponent
|
||||
@@ -207,7 +207,7 @@ public class UploadLayout extends VerticalLayout {
|
||||
uploadInfoWindow.uploadSessionStarted();
|
||||
} else {
|
||||
//If the upload is not started, it signifies all dropped files as either duplicate or directory.So display message accordingly
|
||||
displayCompositeMessage(hasDirectory);
|
||||
displayCompositeMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,12 +221,10 @@ public class UploadLayout extends VerticalLayout {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void displayCompositeMessage(final Boolean hasDirectory) {
|
||||
final String duplicateMessage = showDuplicateMessage();
|
||||
private void displayCompositeMessage() {
|
||||
final String duplicateMessage = getDuplicateFileValidationMessage();
|
||||
final StringBuilder compositeMessage = new StringBuilder();
|
||||
if (null != duplicateMessage) {
|
||||
// in case if all selected files are duplicate ,then display
|
||||
// messag
|
||||
if (!Strings.isNullOrEmpty(duplicateMessage)) {
|
||||
compositeMessage.append(duplicateMessage);
|
||||
}
|
||||
if (hasDirectory) {
|
||||
@@ -351,6 +349,7 @@ public class UploadLayout extends VerticalLayout {
|
||||
Boolean validate() {
|
||||
if (!isSoftwareModuleSelected()) {
|
||||
uiNotification.displayValidationError(i18n.get("message.error.noSwModuleSelected"));
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -415,30 +414,31 @@ public class UploadLayout extends VerticalLayout {
|
||||
}
|
||||
}
|
||||
|
||||
void displayValidationMessage() {
|
||||
void displayDuplicateValidationMessage() {
|
||||
// check if streaming of all dropped files are completed
|
||||
if (numberOfFilesActuallyUpload.intValue() == numberOfFileUploadsExpected.intValue()) {
|
||||
displayCompositeMessage(hasDirectory);
|
||||
displayCompositeMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show duplicate file selected message.
|
||||
*
|
||||
* @return duplicate file names
|
||||
*/
|
||||
public String showDuplicateMessage() {
|
||||
|
||||
private String getDuplicateFileValidationMessage() {
|
||||
StringBuilder message = new StringBuilder();
|
||||
if (!duplicateFileNamesList.isEmpty()) {
|
||||
final String fileNames = StringUtils.collectionToCommaDelimitedString(duplicateFileNamesList);
|
||||
if (duplicateFileNamesList.size() == 1) {
|
||||
return i18n.get("message.no.duplicateFile") + fileNames;
|
||||
message.append(i18n.get("message.no.duplicateFile") + fileNames);
|
||||
|
||||
} else if (duplicateFileNamesList.size() > 1) {
|
||||
return i18n.get("message.no.duplicateFiles");
|
||||
message.append(i18n.get("message.no.duplicateFiles"));
|
||||
}
|
||||
duplicateFileNamesList.clear();
|
||||
}
|
||||
return null;
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
public void showDuplicateMessage() {
|
||||
uiNotification.displayValidationError(getDuplicateFileValidationMessage());
|
||||
}
|
||||
|
||||
void increaseNumberOfFileUploadsExpected() {
|
||||
|
||||
Reference in New Issue
Block a user