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