}
m_artifactsPanel.setValue(selection);
// Notify the user what the overall status was...
Notification notification = createNotification(failedMsg, successMsg);
getMainWindow().showNotification(notification);
m_progress.setStyleName("invisible");
m_statusLine.setStatus(notification.getCaption() + "...");
}
@Override
protected void uploadStarted(UploadHandle upload) {
m_progress.setStyleName("visible");
m_progress.setValue(new Float(0.0f));
m_statusLine.setStatus("Upload of '%s' started...", upload.getFilename());
}
private void appendFailure(StringBuilder sb, UploadHandle handle) {
appendFailure(sb, handle, handle.getFailureReason());
}
private void appendFailure(StringBuilder sb, UploadHandle handle, Exception cause) {
sb.append("<li>'").append(handle.getFile().getName()).append("': failed");
if (cause != null) {
sb.append(", possible reason:<br/>").append(cause.getMessage());
}
sb.append("</li>");
}
private void appendFailureExists(StringBuilder sb, UploadHandle handle) {
sb.append("<li>'").append(handle.getFile().getName()).append("': already exists in repository</li>");
}
private void appendSuccess(StringBuilder sb, UploadHandle handle) {
sb.append("<li>'").append(handle.getFile().getName()).append("': added to repository</li>");
}
private Notification createNotification(StringBuilder failedMsg, StringBuilder successMsg) {
String caption = "Upload completed";
int delay = 500; // msec.
StringBuilder notification = new StringBuilder();
if (failedMsg.length() > 0) {
caption = "Upload completed with failures";
delay = -1;
notification.append("<ul>").append(failedMsg).append("</ul>");
}
if (successMsg.length() > 0) {
notification.append("<ul>").append(successMsg).append("</ul>");
}
if (delay < 0) {
notification.append("<p>(click to dismiss this notification).</p>");
}
Notification summary = new Notification(caption, notification.toString(), Notification.TYPE_TRAY_NOTIFICATION);
summary.setDelayMsec(delay);
return summary;
}
private ArtifactObject uploadToOBR(UploadHandle handle) throws IOException {
return UploadHelper.importRemoteBundle(m_artifactRepository, handle.getFile());